2017-12-28 20:22:50 -05:00
|
|
|
import { Injectable } from "@angular/core";
|
2018-03-24 19:16:52 -04:00
|
|
|
import { AuthedApi } from "../authed-api";
|
|
|
|
import { FE_Appservice, FE_NebConfiguration, FE_Upstream } from "../../models/admin-responses";
|
2019-06-29 02:21:56 -04:00
|
|
|
import { HttpClient } from "@angular/common/http";
|
2017-12-28 20:22:50 -05:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class AdminNebApiService extends AuthedApi {
|
2019-06-29 02:21:56 -04:00
|
|
|
constructor(http: HttpClient) {
|
2017-12-28 20:22:50 -05:00
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getConfigurations(): Promise<FE_NebConfiguration[]> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet<FE_NebConfiguration[]>("/api/v1/dimension/admin/neb/all").toPromise();
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public getConfiguration(nebId: number): Promise<FE_NebConfiguration> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet<FE_NebConfiguration>("/api/v1/dimension/admin/neb/" + nebId + "/config").toPromise();
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public newUpstreamConfiguration(upstream: FE_Upstream): Promise<FE_NebConfiguration> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost<FE_NebConfiguration>("/api/v1/dimension/admin/neb/new/upstream", {upstreamId: upstream.id}).toPromise();
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public newAppserviceConfiguration(adminUrl: string, appservice: FE_Appservice): Promise<FE_NebConfiguration> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost<FE_NebConfiguration>("/api/v1/dimension/admin/neb/new/appservice", {
|
2017-12-28 20:22:50 -05:00
|
|
|
adminUrl: adminUrl,
|
|
|
|
appserviceId: appservice.id
|
2019-06-29 02:21:56 -04:00
|
|
|
}).toPromise();
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public toggleIntegration(nebId: number, integrationType: string, setEnabled: boolean): Promise<any> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost("/api/v1/dimension/admin/neb/" + nebId + "/integration/" + integrationType + "/enabled", {enabled: setEnabled}).toPromise();
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|
2018-03-24 16:54:12 -04:00
|
|
|
|
|
|
|
public setIntegrationConfiguration(nebId: number, integrationType: string, configuration: any): Promise<any> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost("/api/v1/dimension/admin/neb/" + nebId + "/integration/" + integrationType + "/config", configuration).toPromise();
|
2018-03-24 16:54:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public getIntegrationConfiguration(nebId: number, integrationType: string): Promise<any> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet("/api/v1/dimension/admin/neb/" + nebId + "/integration/" + integrationType + "/config").toPromise();
|
2018-03-24 16:54:12 -04:00
|
|
|
}
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|