import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs' ; import { map } from 'rxjs/operators' ; import { ApiCallService , ApiService } from '../../services/api-call.service' ; import { CmdbStatus } from '../models/cmdb-status' ; @ Injectable ( { providedIn : 'root' } ) export class StatusService < T = CmdbStatus > implements ApiService { public servicePrefix : string = 'status' ; constructor ( private api ) { } public getStatusList ( ) { return this . api . callGet < T [ ] > ( `${ this . servicePrefix }/` ) . pipe ( map ( ( apiResponse ) => { return apiResponse . body ; } ) ) ; } public getStatus ( publicID ) { return this . api . callGet < CmdbStatus > ( `${ this . servicePrefix }/${ publicID }` ) . pipe ( map ( ( apiResponse ) => { return apiResponse . body ; } ) ) ; } public postStatus ( data ) { return this . api . callPost < CmdbStatus > ( `${ this . servicePrefix }/` , data ) . pipe ( map ( ( apiResponse ) => { return apiResponse . body ; } ) ) ; } public putStatus ( data ) { return this . api . callPut < CmdbStatus > ( `${ this . servicePrefix }/` , data ) . pipe ( map ( ( apiResponse ) => { return apiResponse . body ; } ) ) ; } }