libs/core/src/lib/api-communication/connectors/sta-api-v1-connector/delete/sta-delete-interface.service.ts
Methods |
constructor(httpService: HttpService)
|
||||||
Parameters :
|
Protected createRequestUrl |
createRequestUrl(apiUrl: string, endpoint: string, id?: string)
|
Returns :
string
|
deleteDatastream |
deleteDatastream(url: string, id: string)
|
Returns :
Observable<any>
|
deleteFeatureOfInterest |
deleteFeatureOfInterest(url: string, id: string)
|
Returns :
Observable<any>
|
deleteHistoricalLocation |
deleteHistoricalLocation(url: string, id: string)
|
Returns :
Observable<any>
|
deleteLocation |
deleteLocation(url: string, id: string)
|
Returns :
Observable<any>
|
deleteObservation |
deleteObservation(url: string, id: string)
|
Returns :
Observable<any>
|
deleteObservedProperty |
deleteObservedProperty(url: string, id: string)
|
Returns :
Observable<any>
|
deleteSensor |
deleteSensor(url: string, id: string)
|
Returns :
Observable<any>
|
deleteThing |
deleteThing(url: string, id: string)
|
Returns :
Observable<any>
|
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpService } from '../../../../dataset-api/http.service';
import { StaDeleteInterface, StaEndpoint } from '../model/sta-interface';
@Injectable()
export class StaDeleteInterfaceService implements StaDeleteInterface {
constructor(
protected httpService: HttpService
) { }
deleteThing(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.Things, id));
}
deleteObservation(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.Things, id));
}
deleteHistoricalLocation(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.HistoricalLocations, id));
}
deleteLocation(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.Locations, id));
}
deleteSensor(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.Sensors, id));
}
deleteFeatureOfInterest(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.FeaturesOfInterest, id));
}
deleteObservedProperty(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.ObservedProperties, id));
}
deleteDatastream(url: string, id: string): Observable<any> {
return this.httpService.client().delete(this.createRequestUrl(url, StaEndpoint.Datastreams, id));
}
protected createRequestUrl(apiUrl: string, endpoint: string, id?: string) {
// TODO: Check whether apiUrl ends with slash
if (id !== null && id !== undefined) {
return `${apiUrl}${endpoint}('${id}')`;
} else {
return `${apiUrl}${endpoint}`;
}
}
}