@ -20,7 +20,7 @@ import {
HttpHeaders ,
HttpParams
} from '@angular/common/http' ;
import { Component , DestroyRef , OnInit } from '@angular/core' ;
import { Component , DestroyRef , inject , OnInit } from '@angular/core' ;
import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
import { MatCardModule } from '@angular/material/card' ;
import { format , startOfYear } from 'date-fns' ;
@ -38,28 +38,29 @@ import { FetchFailure, FetchResult } from './interfaces/interfaces';
templateUrl : './api-page.html'
} )
export class GfApiPageComponent implements OnInit {
public aiServiceHealth$ : Observable < FetchResult < AiServiceHealthResponse > > ;
public assetProfile$ : Observable <
protected aiServiceHealth$ : Observable < FetchResult < AiServiceHealthResponse > > ;
protected assetProfile$ : Observable <
FetchResult < DataProviderGhostfolioAssetProfileResponse >
> ;
public dividends$ : Observable < FetchResult < DividendsResponse [ ' dividends ' ] > > ;
public historicalData$ : Observable <
protected dividends$ : Observable < FetchResult < DividendsResponse [ ' dividends ' ] > > ;
protected historicalData$ : Observable <
FetchResult < HistoricalResponse [ ' historicalData ' ] >
> ;
public isinLookupItems$ : Observable < FetchResult < LookupResponse [ ' items ' ] > > ;
public lookupItems$ : Observable < FetchResult < LookupResponse [ ' items ' ] > > ;
public quotes$ : Observable < FetchResult < QuotesResponse [ ' quotes ' ] > > ;
public status$ : Observable < FetchResult < DataProviderGhostfolioStatusResponse > > ;
protected isinLookupItems$ : Observable < FetchResult < LookupResponse [ ' items ' ] > > ;
protected lookupItems$ : Observable < FetchResult < LookupResponse [ ' items ' ] > > ;
protected quotes$ : Observable < FetchResult < QuotesResponse [ ' quotes ' ] > > ;
protected status$ : Observable <
FetchResult < DataProviderGhostfolioStatusResponse >
> ;
private apiKey : string ;
public constructor (
private destroyRef : DestroyRef ,
private http : HttpClient
) { }
private readonly destroyRef = inject ( DestroyRef ) ;
private readonly http = inject ( HttpClient ) ;
public ngOnInit() {
this . apiKey = prompt ( $localize ` Please enter your Ghostfolio API key: ` ) ;
this . apiKey =
prompt ( $localize ` Please enter your Ghostfolio API key: ` ) ? ? '' ;
this . aiServiceHealth $ = this . fetchAiServiceHealth ( ) ;
this . assetProfile $ = this . fetchAssetProfile ( { symbol : 'AAPL' } ) ;
@ -71,7 +72,7 @@ export class GfApiPageComponent implements OnInit {
this . status $ = this . fetchStatus ( ) ;
}
public isFetchFailure ( value : unknown ) : value is FetchFailure {
protected isFetchFailure ( value : unknown ) : value is FetchFailure {
return isObject ( value ) && value !== null && 'fetchError' in value ;
}