mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
009b510779
This is so the different needs of each can be accounted for. For example, widgets are fairly unrestricted, so nothing really needs to prevent them. Bots on the other hand require an upstream token otherwise we can't get the bot IDs from Modular.
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
import { Injectable } from "@angular/core";
|
|
import { Http } from "@angular/http";
|
|
import { AuthedApi } from "../authed-api";
|
|
import { FE_IntegrationsResponse } from "../../models/dimension-responses";
|
|
|
|
@Injectable()
|
|
export class AdminIntegrationsApiService extends AuthedApi {
|
|
constructor(http: Http) {
|
|
super(http);
|
|
}
|
|
|
|
public getAllWidgets(): Promise<FE_IntegrationsResponse> {
|
|
return this.authedGet("/api/v1/dimension/admin/integrations/widget/all").map(r => r.json()).toPromise();
|
|
}
|
|
|
|
public toggleIntegration(category: string, type: string, enabled: boolean): Promise<any> {
|
|
return this.authedPost("/api/v1/dimension/admin/integrations/" + category + "/" + type + "/enabled", {enabled: enabled}).map(r => r.json()).toPromise();
|
|
}
|
|
|
|
public setIntegrationOptions(category: string, type: string, options: any): Promise<any> {
|
|
return this.authedPost("/api/v1/dimension/admin/integrations/" + category + "/" + type + "/options", {options: options}).map(r => r.json()).toPromise();
|
|
}
|
|
}
|