2017-12-20 23:28:43 -05:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { Http } from "@angular/http";
|
2019-03-13 02:28:12 -04:00
|
|
|
import {
|
|
|
|
FE_ScalarAccountResponse,
|
|
|
|
FE_ScalarOpenIdRequestBody,
|
|
|
|
FE_ScalarRegisterResponse
|
|
|
|
} from "../../models/scalar-server-responses";
|
2018-03-24 19:16:52 -04:00
|
|
|
import { AuthedApi } from "../authed-api";
|
2017-12-20 23:28:43 -05:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class ScalarServerApiService extends AuthedApi {
|
|
|
|
constructor(http: Http) {
|
|
|
|
super(http)
|
|
|
|
}
|
|
|
|
|
2019-03-24 16:37:51 -04:00
|
|
|
public ping(): Promise<any> {
|
|
|
|
return this.http.get("/api/v1/scalar/ping").map(res => res.json()).toPromise();
|
|
|
|
}
|
|
|
|
|
2017-12-24 04:02:57 -05:00
|
|
|
public getAccount(): Promise<FE_ScalarAccountResponse> {
|
2017-12-20 23:28:43 -05:00
|
|
|
return this.authedGet("/api/v1/scalar/account").map(res => res.json()).toPromise();
|
|
|
|
}
|
2019-03-13 02:28:12 -04:00
|
|
|
|
|
|
|
public register(openId: FE_ScalarOpenIdRequestBody): Promise<FE_ScalarRegisterResponse> {
|
|
|
|
return this.http.post("/api/v1/scalar/register", openId).map(res => res.json()).toPromise();
|
|
|
|
}
|
2017-12-20 23:28:43 -05:00
|
|
|
}
|