2017-12-20 23:28:43 -05:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { Http } from "@angular/http";
|
|
|
|
import { AuthedApi } from "./AuthedApi";
|
|
|
|
import { DimensionIntegrationsResponse } from "../models/dimension_responses";
|
2017-12-23 15:15:54 -05:00
|
|
|
import { Widget } from "../models/integration";
|
2017-12-20 23:28:43 -05:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class DimensionApiService extends AuthedApi {
|
|
|
|
constructor(http: Http) {
|
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getIntegrations(roomId: string): Promise<DimensionIntegrationsResponse> {
|
|
|
|
return this.authedGet("/api/v1/dimension/integrations/room/" + roomId).map(r => r.json()).toPromise();
|
|
|
|
}
|
2017-12-23 15:15:54 -05:00
|
|
|
|
|
|
|
public getWidget(type: string): Promise<Widget> {
|
|
|
|
return this.http.get("/api/v1/dimension/widget/" + type).map(r => r.json()).toPromise();
|
|
|
|
}
|
|
|
|
|
|
|
|
public isEmbeddable(url: string): Promise<any> { // 200 = success, anything else = error
|
|
|
|
return this.http.get("/api/v1/dimension/widgets/embeddable", {params: {url: url}})
|
|
|
|
.map(r => r.json()).toPromise();
|
|
|
|
}
|
2017-12-20 23:28:43 -05:00
|
|
|
}
|