2018-10-21 16:20:37 -04:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { AuthedApi } from "../authed-api";
|
|
|
|
import { FE_GitterLink } from "../../models/gitter";
|
2019-06-29 02:21:56 -04:00
|
|
|
import { HttpClient } from "@angular/common/http";
|
2018-10-21 16:20:37 -04:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class GitterApiService extends AuthedApi {
|
2019-06-29 02:21:56 -04:00
|
|
|
constructor(http: HttpClient) {
|
2018-10-21 16:20:37 -04:00
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bridgeRoom(roomId: string, gitterRoomName: string): Promise<FE_GitterLink> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedPost<FE_GitterLink>("/api/v1/dimension/gitter/room/" + roomId + "/link", {gitterRoomName}).toPromise();
|
2018-10-21 16:20:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public unbridgeRoom(roomId: string): Promise<any> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedDelete("/api/v1/dimension/gitter/room/" + roomId + "/link").toPromise();
|
2018-10-21 16:20:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public getLink(roomId: string): Promise<FE_GitterLink> {
|
2019-06-29 02:21:56 -04:00
|
|
|
return this.authedGet<FE_GitterLink>("/api/v1/dimension/gitter/room/" + roomId + "/link").toPromise();
|
2018-10-21 16:20:37 -04:00
|
|
|
}
|
|
|
|
}
|