matrix-dimension/web/app/shared/services/admin/admin-appservice-api.service.ts
Travis Ralston 62d81ed842 Show the appservice configuration after saving; Make the show config button work
Includes the ability to 'test' the appservice. This doesn't bother checking if the URL is set up correctly because we don't actually care about the transactions.
2018-03-24 12:18:38 -06:00

27 lines
1.1 KiB
TypeScript

import { Injectable } from "@angular/core";
import { Http } from "@angular/http";
import { AuthedApi } from "../AuthedApi";
import { FE_Appservice } from "../../models/admin_responses";
@Injectable()
export class AdminAppserviceApiService extends AuthedApi {
constructor(http: Http) {
super(http);
}
public getAppservices(): Promise<FE_Appservice[]> {
return this.authedGet("/api/v1/dimension/admin/appservices/all").map(r => r.json()).toPromise();
}
public getAppservice(appserviceId: string): Promise<FE_Appservice> {
return this.authedGet("/api/v1/dimension/admin/appservices/" + appserviceId).map(r => r.json()).toPromise();
}
public createAppservice(userPrefix: string): Promise<FE_Appservice> {
return this.authedPost("/api/v1/dimension/admin/appservices/new", {userPrefix: userPrefix}).map(r => r.json()).toPromise();
}
public test(appserviceId: string): Promise<any> {
return this.authedPost("/api/v1/dimension/admin/appservices/" + appserviceId + "/test").map(r => r.json()).toPromise();
}
}