2017-05-27 03:27:36 -04:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { Http } from "@angular/http";
|
2017-05-28 02:35:40 -04:00
|
|
|
import { Integration } from "./models/integration";
|
2017-05-27 03:27:36 -04:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class ApiService {
|
|
|
|
constructor(private http: Http) {
|
|
|
|
}
|
|
|
|
|
|
|
|
checkScalarToken(token): Promise<boolean> {
|
|
|
|
return this.http.get("/api/v1/scalar/checkToken", {params: {scalar_token: token}})
|
|
|
|
.map(res => res.status === 200).toPromise();
|
|
|
|
}
|
|
|
|
|
2017-05-28 02:35:40 -04:00
|
|
|
getIntegrations(): Promise<Integration[]> {
|
|
|
|
return this.http.get("/api/v1/dimension/integrations")
|
2017-05-27 03:27:36 -04:00
|
|
|
.map(res => res.json()).toPromise();
|
|
|
|
}
|
2017-05-27 19:45:07 -04:00
|
|
|
|
2017-05-28 02:35:40 -04:00
|
|
|
removeIntegration(roomId: string, userId: string, scalarToken: string): Promise<any> {
|
|
|
|
return this.http.post("/api/v1/dimension/removeIntegration", {roomId: roomId, userId: userId, scalarToken: scalarToken})
|
2017-05-27 19:45:07 -04:00
|
|
|
.map(res => res.json()).toPromise();
|
|
|
|
}
|
2017-05-27 03:27:36 -04:00
|
|
|
}
|