2017-12-24 04:02:57 -05:00
|
|
|
import { Injectable } from "@angular/core";
|
2018-03-24 19:16:52 -04:00
|
|
|
import { AuthedApi } from "../authed-api";
|
2018-03-30 21:22:15 -04:00
|
|
|
import { FE_Bridge, FE_Widget } from "../../models/integration";
|
2019-06-29 02:21:56 -04:00
|
|
|
import { HttpClient } from "@angular/common/http";
|
2017-12-24 04:02:57 -05:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class AdminIntegrationsApiService extends AuthedApi {
|
2019-06-29 02:21:56 -04:00
|
|
|
constructor(http: HttpClient) {
|
2017-12-24 04:02:57 -05:00
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
2018-03-30 21:22:15 -04:00
|
|
|
public getAllWidgets(): Promise<FE_Widget[]> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet<FE_Widget[]>("/api/v1/dimension/admin/integrations/widget/all").toPromise();
|
2017-12-24 04:02:57 -05:00
|
|
|
}
|
|
|
|
|
2018-03-30 21:22:15 -04:00
|
|
|
public getAllBridges(): Promise<FE_Bridge<any>[]> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet<FE_Bridge<any>[]>("/api/v1/dimension/admin/integrations/bridge/all").toPromise();
|
2018-03-30 21:22:15 -04:00
|
|
|
}
|
|
|
|
|
2017-12-24 04:02:57 -05:00
|
|
|
public toggleIntegration(category: string, type: string, enabled: boolean): Promise<any> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost("/api/v1/dimension/admin/integrations/" + category + "/" + type + "/enabled", {enabled: enabled}).toPromise();
|
2017-12-24 04:02:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public setIntegrationOptions(category: string, type: string, options: any): Promise<any> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost("/api/v1/dimension/admin/integrations/" + category + "/" + type + "/options", {options: options}).toPromise();
|
2017-12-24 04:02:57 -05:00
|
|
|
}
|
|
|
|
}
|