File

libs/core/src/lib/dataset-api/splitted-data-api-interface.service.ts

Extends

DatasetImplApiInterface

Index

Methods

Constructor

constructor(httpservice: HttpService, internalDatasetId: InternalIdHandler, translate: TranslateService)
Parameters :
Name Type Optional
httpservice HttpService No
internalDatasetId InternalIdHandler No
translate TranslateService No

Methods

Public getData
getData(id: string, apiUrl: string, timespan: Timespan, params: DataParameterFilter, options: HttpRequestOptions)
Type parameters :
  • T
Parameters :
Name Type Optional Default value
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter No {}
options HttpRequestOptions No
Returns : any
Public getTsData
getTsData(id: string, apiUrl: string, timespan: Timespan, params: DataParameterFilter, options: HttpRequestOptions)
Type parameters :
  • T
Parameters :
Name Type Optional Default value
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter No {}
options HttpRequestOptions No
Public getCategories
getCategories(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getCategory
getCategory(id: string, apiUrl: string, params?: ParameterFilter)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
Public getData
getData(id: string, apiUrl: string, timespan: Timespan, params: DataParameterFilter, options: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional Default value
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter No {}
options HttpRequestOptions No
Public getDataset
getDataset(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getDatasetByInternalId
getDatasetByInternalId(internalId: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
internalId string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getDatasets
getDatasets(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getFeature
getFeature(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getFeatures
getFeatures(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getOffering
getOffering(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getOfferings
getOfferings(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getPhenomena
getPhenomena(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getPhenomenon
getPhenomenon(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getPlatform
getPlatform(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getPlatforms
getPlatforms(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getProcedure
getProcedure(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getProcedures
getProcedures(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getService
getService(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getServices
getServices(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getSingleTimeseries
getSingleTimeseries(id: string, apiUrl: string, params?: ParameterFilter)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
Public getSingleTimeseriesByInternalId
getSingleTimeseriesByInternalId(internalId: string, params?: ParameterFilter)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
internalId string No
params ParameterFilter Yes
Public getStation
getStation(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getStations
getStations(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getTimeseries
getTimeseries(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public getTimeseriesData
getTimeseriesData(apiUrl: string, ids: string[], timespan: Timespan, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
ids string[] No
timespan Timespan No
options HttpRequestOptions Yes
Public getTimeseriesExtras
getTimeseriesExtras(id: string, apiUrl: string)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
Public getTsData
getTsData(id: string, apiUrl: string, timespan: Timespan, params: DataParameterFilter, options: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional Default value
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter No {}
options HttpRequestOptions No
Private prepareDataset
prepareDataset(datasetObj: Dataset, apiUrl: string)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
datasetObj Dataset No
apiUrl string No
Returns : any
Private requestApiTexted
requestApiTexted(url: string, params: ParameterFilter, options: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional Default value
url string No
params ParameterFilter No {}
options HttpRequestOptions No {}
Returns : Observable<string>
Private requestApiTextedPost
requestApiTextedPost(url: string, params: ParameterFilter, options: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional Default value
url string No
params ParameterFilter No {}
options HttpRequestOptions No {}
Returns : Observable<Object>
Public Abstract getCategories
getCategories(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getCategory
getCategory(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getData
getData(id: string, apiUrl: string, timespan: Timespan, params?: DataParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getDataset
getDataset(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getDatasetByInternalId
getDatasetByInternalId(internalId: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
internalId string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getDatasets
getDatasets(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getFeature
getFeature(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getFeatures
getFeatures(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getOffering
getOffering(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getOfferings
getOfferings(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPhenomena
getPhenomena(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPhenomenon
getPhenomenon(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPlatform
getPlatform(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPlatforms
getPlatforms(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getProcedure
getProcedure(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getProcedures
getProcedures(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getService
getService(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getServices
getServices(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getSingleTimeseries
getSingleTimeseries(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getSingleTimeseriesByInternalId
getSingleTimeseriesByInternalId(internalId: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
internalId string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getStation
getStation(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getStations
getStations(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getTimeseries
getTimeseries(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getTimeseriesData
getTimeseriesData(apiUrl: string, ids: string[], timespan: Timespan, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
ids string[] No
timespan Timespan No
options HttpRequestOptions Yes
Public Abstract getTimeseriesExtras
getTimeseriesExtras(id: string, apiUrl: string)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
Public Abstract getTsData
getTsData(id: string, apiUrl: string, timespan: Timespan, params?: DataParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter Yes
options HttpRequestOptions Yes
Protected prepareParams
prepareParams(params: ParameterFilter)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
params ParameterFilter No
Returns : HttpParams
Protected requestApi
requestApi(url: string, params: ParameterFilter, options: HttpRequestOptions)
Inherited from DatasetImplApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional Default value
url string No
params ParameterFilter No {}
options HttpRequestOptions No {}
Returns : Observable<T>
Protected createBasicAuthHeader
createBasicAuthHeader(token: string)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
token string No
Returns : HttpHeaders
Protected createRequestTimespan
createRequestTimespan(timespan: Timespan)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
timespan Timespan No
Returns : string
Protected createRequestUrl
createRequestUrl(apiUrl: string, endpoint: string, id?: string)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
endpoint string No
id string Yes
Returns : string
Protected createBasicAuthHeader
createBasicAuthHeader(token: string)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
token string No
Returns : HttpHeaders
Protected createRequestTimespan
createRequestTimespan(timespan: Timespan)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
timespan Timespan No
Returns : string
Protected createRequestUrl
createRequestUrl(apiUrl: string, endpoint: string, id?: string)
Inherited from DatasetImplApiInterface
Parameters :
Name Type Optional
apiUrl string No
endpoint string No
id string Yes
Returns : string
Public Abstract getCategories
getCategories(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getCategory
getCategory(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getData
getData(id: string, apiUrl: string, timespan: Timespan, params?: DataParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getDataset
getDataset(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getDatasetByInternalId
getDatasetByInternalId(internalId: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
internalId string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getDatasets
getDatasets(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getFeature
getFeature(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getFeatures
getFeatures(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getOffering
getOffering(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getOfferings
getOfferings(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPhenomena
getPhenomena(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPhenomenon
getPhenomenon(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPlatform
getPlatform(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getPlatforms
getPlatforms(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getProcedure
getProcedure(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getProcedures
getProcedures(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getService
getService(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getServices
getServices(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getSingleTimeseries
getSingleTimeseries(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getSingleTimeseriesByInternalId
getSingleTimeseriesByInternalId(internalId: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
internalId string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getStation
getStation(id: string, apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getStations
getStations(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getTimeseries
getTimeseries(apiUrl: string, params?: ParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
params ParameterFilter Yes
options HttpRequestOptions Yes
Public Abstract getTimeseriesData
getTimeseriesData(apiUrl: string, ids: string[], timespan: Timespan, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
ids string[] No
timespan Timespan No
options HttpRequestOptions Yes
Public Abstract getTimeseriesExtras
getTimeseriesExtras(id: string, apiUrl: string)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
id string No
apiUrl string No
Public Abstract getTsData
getTsData(id: string, apiUrl: string, timespan: Timespan, params?: DataParameterFilter, options?: HttpRequestOptions)
Inherited from DatasetApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional
id string No
apiUrl string No
timespan Timespan No
params DataParameterFilter Yes
options HttpRequestOptions Yes
Protected prepareParams
prepareParams(params: ParameterFilter)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
params ParameterFilter No
Returns : HttpParams
Protected requestApi
requestApi(url: string, params: ParameterFilter, options: HttpRequestOptions)
Inherited from DatasetApiInterface
Type parameters :
  • T
Parameters :
Name Type Optional Default value
url string No
params ParameterFilter No {}
options HttpRequestOptions No {}
Returns : Observable<T>
Protected createBasicAuthHeader
createBasicAuthHeader(token: string)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
token string No
Returns : HttpHeaders
Protected createRequestTimespan
createRequestTimespan(timespan: Timespan)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
timespan Timespan No
Returns : string
Protected createRequestUrl
createRequestUrl(apiUrl: string, endpoint: string, id?: string)
Inherited from DatasetApiInterface
Parameters :
Name Type Optional
apiUrl string No
endpoint string No
id string Yes
Returns : string
Protected createBasicAuthHeader
createBasicAuthHeader(token: string)
Inherited from ApiInterface
Defined in ApiInterface:19
Parameters :
Name Type Optional
token string No
Returns : HttpHeaders
Protected createRequestTimespan
createRequestTimespan(timespan: Timespan)
Inherited from ApiInterface
Defined in ApiInterface:15
Parameters :
Name Type Optional
timespan Timespan No
Returns : string
Protected createRequestUrl
createRequestUrl(apiUrl: string, endpoint: string, id?: string)
Inherited from ApiInterface
Defined in ApiInterface:8
Parameters :
Name Type Optional
apiUrl string No
endpoint string No
id string Yes
Returns : string
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import moment from 'moment';
import { forkJoin, Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { Data } from '../model/dataset-api/data';
import { DataParameterFilter, HttpRequestOptions } from '../model/internal/http-requests';
import { Timespan } from '../model/internal/timeInterval';
import { DatasetImplApiInterface } from './dataset-impl-api-interface.service';
import { HttpService } from './http.service';
import { InternalIdHandler } from './internal-id-handler.service';

@Injectable()
export class SplittedDataDatasetApiInterface extends DatasetImplApiInterface {

    constructor(
        protected httpservice: HttpService,
        protected internalDatasetId: InternalIdHandler,
        protected translate: TranslateService
    ) {
        super(httpservice, internalDatasetId, translate);
    }

    public getTsData<T>(
        id: string,
        apiUrl: string,
        timespan: Timespan,
        params: DataParameterFilter = {},
        options: HttpRequestOptions
    ): Observable<Data<T>> {
        const maxTimeExtent = moment.duration(1, 'year').asMilliseconds();
        if ((timespan.to - timespan.from) > maxTimeExtent) {
            const requests: Array<Observable<Data<T>>> = [];
            let start = moment(timespan.from).startOf('year');
            let end = moment(timespan.from).endOf('year');
            while (start.isBefore(moment(timespan.to))) {
                const chunkSpan = new Timespan(start.unix() * 1000, end.unix() * 1000);
                requests.push(super.getTsData<T>(id, apiUrl, chunkSpan, params, options));
                start = end.add(1, 'millisecond');
                end = moment(start).endOf('year');
            }
            return forkJoin(requests).pipe(map((e) => {
                const mergedResult = e.reduce((previous, current) => {
                    const next: Data<T> = {
                        referenceValues: {},
                        values: []
                    };

                    if (previous.values && current.values) {
                        next.values = previous.values.concat(current.values);
                    }

                    if (previous.valueBeforeTimespan) {
                        next.valueBeforeTimespan = previous.valueBeforeTimespan;
                    }

                    if (current.valueAfterTimespan) {
                        next.valueAfterTimespan = current.valueAfterTimespan;
                    }

                    for (const key in previous.referenceValues) {
                        if (previous.referenceValues.hasOwnProperty(key) && current.referenceValues.hasOwnProperty(key)) {
                            const refVal = previous.referenceValues[key];
                            if (refVal instanceof Array) {
                                next.referenceValues[key] = refVal.concat(current.referenceValues[key]);
                            } else {
                                const currRefValData = (current.referenceValues[key] as never) as Data<T>;
                                const prevRefValData = (refVal as Data<T>);
                                const nextRefValData: Data<T> = {
                                    referenceValues: {},
                                    values: []
                                };
                                if (prevRefValData.values && currRefValData.values) {
                                    nextRefValData.values = prevRefValData.values.concat(currRefValData.values);
                                }
                                if (prevRefValData.valueBeforeTimespan) {
                                    nextRefValData.valueBeforeTimespan = prevRefValData.valueBeforeTimespan;
                                }
                                if (currRefValData.valueAfterTimespan) {
                                    nextRefValData.valueAfterTimespan = currRefValData.valueAfterTimespan;
                                }
                                next.referenceValues[key] = nextRefValData as never;
                            }
                        }
                    }
                    return next;
                });
                if (mergedResult.values && mergedResult.values.length > 0) {
                    // cut first
                    const fromIdx = mergedResult.values.findIndex(el => el[0] >= timespan.from);
                    mergedResult.values = mergedResult.values.slice(fromIdx);
                    // cut last
                    const toIdx = mergedResult.values.findIndex(el => el[0] >= timespan.to);
                    if (toIdx >= 0) { mergedResult.values = mergedResult.values.slice(0, toIdx + 1); }
                }
                return mergedResult;
            }));
        } else {
            return super.getTsData<T>(id, apiUrl, timespan, params, options);
        }
    }

    public getData<T>(
        id: string,
        apiUrl: string,
        timespan: Timespan,
        params: DataParameterFilter = {},
        options: HttpRequestOptions
    ) {
        const maxTimeExtent = moment.duration(1, 'year').asMilliseconds();
        if ((timespan.to - timespan.from) > maxTimeExtent) {
            const requests: Array<Observable<Data<T>>> = [];
            let start = moment(timespan.from).startOf('year');
            let end = moment(timespan.from).endOf('year');
            while (start.isBefore(moment(timespan.to))) {
                const chunkSpan = new Timespan(start.unix() * 1000, end.unix() * 1000);
                requests.push(super.getData<T>(id, apiUrl, chunkSpan, params, options));
                start = end.add(1, 'millisecond');
                end = moment(start).endOf('year');
            }
            return forkJoin(requests).pipe(map((e) => {
                const mergedResult = e.reduce((previous, current) => {
                    const next: Data<T> = {
                        referenceValues: {},
                        values: []
                    };

                    if (previous.values && current.values) {
                        next.values = previous.values.concat(current.values);
                    }

                    if (previous.valueBeforeTimespan) {
                        next.valueBeforeTimespan = previous.valueBeforeTimespan;
                    }

                    if (current.valueAfterTimespan) {
                        next.valueAfterTimespan = current.valueAfterTimespan;
                    }

                    for (const key in previous.referenceValues) {
                        if (previous.referenceValues.hasOwnProperty(key) && current.referenceValues.hasOwnProperty(key)) {
                            const refVal = previous.referenceValues[key];
                            if (refVal instanceof Array) {
                                next.referenceValues[key] = refVal.concat(current.referenceValues[key]);
                            } else {
                                const currRefValData = (current.referenceValues[key] as never) as Data<T>;
                                const prevRefValData = (refVal as Data<T>);
                                const nextRefValData: Data<T> = {
                                    referenceValues: {},
                                    values: []
                                };
                                if (prevRefValData.values && currRefValData.values) {
                                    nextRefValData.values = prevRefValData.values.concat(currRefValData.values);
                                }
                                if (prevRefValData.valueBeforeTimespan) {
                                    nextRefValData.valueBeforeTimespan = prevRefValData.valueBeforeTimespan;
                                }
                                if (currRefValData.valueAfterTimespan) {
                                    nextRefValData.valueAfterTimespan = currRefValData.valueAfterTimespan;
                                }
                                next.referenceValues[key] = nextRefValData as never;
                            }
                        }
                    }
                    return next;
                });
                if (mergedResult.values && mergedResult.values.length > 0) {
                    // cut first
                    const fromIdx = mergedResult.values.findIndex(el => el[0] >= timespan.from);
                    mergedResult.values = mergedResult.values.slice(fromIdx);
                    // cut last
                    const toIdx = mergedResult.values.findIndex(el => el[0] >= timespan.to);
                    if (toIdx >= 0) { mergedResult.values = mergedResult.values.slice(0, toIdx + 1); }
                }
                return mergedResult;
            }));
        } else {
            return super.getData<T>(id, apiUrl, timespan, params, options);
        }
    }

}

result-matching ""

    No results matching ""