33 lines
869 B
TypeScript

import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {NGXLogger} from 'ngx-logger';
import {environment} from '../../environments/environment';
@Injectable()
export class RestService {
private currentLocation = 'http://' + environment.location + ':' + environment.port + '/api/v1/resources/';
constructor(
private logger: NGXLogger,
private http: HttpClient
) {
}
getTrafficLightEvents(tlid) {
return this.http.get(this.currentLocation + 'traffic_light_events?id=' + tlid, {observe: 'response'});
}
getCarEvents(vin) {
return this.http.get(this.currentLocation + 'car_events?vin=' + vin, {observe: 'response'});
}
getTrafficLights() {
return this.http.get(this.currentLocation + 'traffic_lights');
}
getCars() {
return this.http.get(this.currentLocation + 'cars');
}
}