matrix-dimension/web/app/shared/services/admin/admin-integrations-api.service.ts

28 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Injectable } from "@angular/core";
import { AuthedApi } from "../authed-api";
import { FE_Bridge, FE_Widget } from "../../models/integration";
2019-06-29 02:21:56 -04:00
import { HttpClient } from "@angular/common/http";
@Injectable()
export class AdminIntegrationsApiService extends AuthedApi {
2019-06-29 02:21:56 -04:00
constructor(http: HttpClient) {
super(http);
}
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();
}
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();
}
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();
}
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();
}
}