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_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 AdminUpstreamApiService extends AuthedApi {
|
2019-06-29 02:21:56 -04:00
|
|
|
constructor(http: HttpClient) {
|
2017-12-28 20:22:50 -05:00
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getUpstreams(): Promise<FE_Upstream[]> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet<FE_Upstream[]>("/api/v1/dimension/admin/upstreams/all").toPromise();
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public newUpstream(name: string, type: string, scalarUrl: string, apiUrl: string): Promise<FE_Upstream> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost<FE_Upstream>("/api/v1/dimension/admin/upstreams/new", {
|
2017-12-28 20:22:50 -05:00
|
|
|
name: name,
|
|
|
|
type: type,
|
|
|
|
scalarUrl: scalarUrl,
|
|
|
|
apiUrl: apiUrl,
|
2019-06-29 02:21:56 -04:00
|
|
|
}).toPromise();
|
2017-12-28 20:22:50 -05:00
|
|
|
}
|
|
|
|
}
|