import {HttpService, LocalDataService} from "@haventec/common-js/ts"; export class OrganisationService { private listUrl = '/organisation?page=:page&size=:size'; private getUrl = '/organisation/name/:name'; private updateUrl = '/organisation'; private basePath: string; private http: HttpService; constructor( public domainUrl: string, private localDataService: LocalDataService ) { this.http = new HttpService(); this.basePath = domainUrl; } list(page: number, size: number) { let self : any = this; page = page || 0; size = size || 10; var url = self.basePath + this.listUrl.replace(':page', page.toString()).replace(':size', size.toString()); return this.http.get(url, this.localDataService.getAccessToken()); } get(name: string) { let self : any = this; var url = self.basePath + this.getUrl.replace(':name', name); return this.http.get(url, this.localDataService.getAccessToken()); } update(name: string, description: string, uuid: string, apiKey: string) { let self : any = this; var url = self.basePath + this.updateUrl; return this.http.post(url, {name: name, description: description, uuid: uuid, apiKey: apiKey}, this.localDataService.getAccessToken()); } }