2017-12-24 04:02:57 -05:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { Http } from "@angular/http";
|
2018-03-24 19:16:52 -04:00
|
|
|
import { AuthedApi } from "../authed-api";
|
|
|
|
import { FE_IntegrationsResponse } from "../../models/dimension-responses";
|
2017-12-24 04:02:57 -05:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class AdminIntegrationsApiService extends AuthedApi {
|
|
|
|
constructor(http: Http) {
|
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
2018-03-25 15:13:50 -04:00
|
|
|
public getAllWidgets(): Promise<FE_IntegrationsResponse> {
|
|
|
|
return this.authedGet("/api/v1/dimension/admin/integrations/widget/all").map(r => r.json()).toPromise();
|
2017-12-24 04:02:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public toggleIntegration(category: string, type: string, enabled: boolean): Promise<any> {
|
2017-12-28 20:22:50 -05:00
|
|
|
return this.authedPost("/api/v1/dimension/admin/integrations/" + category + "/" + type + "/enabled", {enabled: enabled}).map(r => r.json()).toPromise();
|
2017-12-24 04:02:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public setIntegrationOptions(category: string, type: string, options: any): Promise<any> {
|
2017-12-28 20:22:50 -05:00
|
|
|
return this.authedPost("/api/v1/dimension/admin/integrations/" + category + "/" + type + "/options", {options: options}).map(r => r.json()).toPromise();
|
2017-12-24 04:02:57 -05:00
|
|
|
}
|
|
|
|
}
|