matrix-dimension/web/app/shared/services/admin/admin-upstream-api.service.ts
2017-12-28 18:22:50 -07:00

25 lines
821 B
TypeScript

import { Injectable } from "@angular/core";
import { Http } from "@angular/http";
import { AuthedApi } from "../AuthedApi";
import { FE_Upstream } from "../../models/admin_responses";
@Injectable()
export class AdminUpstreamApiService extends AuthedApi {
constructor(http: Http) {
super(http);
}
public getUpstreams(): Promise<FE_Upstream[]> {
return this.authedGet("/api/v1/dimension/admin/upstreams/all").map(r => r.json()).toPromise();
}
public newUpstream(name: string, type: string, scalarUrl: string, apiUrl: string): Promise<FE_Upstream> {
return this.authedPost("/api/v1/dimension/admin/upstreams/new", {
name: name,
type: type,
scalarUrl: scalarUrl,
apiUrl: apiUrl,
}).map(r => r.json()).toPromise();
}
}