matrix-dimension/web/app/shared/services/legacy/irc-api.service.ts
Travis Ralston 4965b61f2d Re-wire the UI to support the new backend
This still doesn't allow editing, but it supports showing the widgets at least.
2017-12-20 21:28:43 -07:00

28 lines
1.1 KiB
TypeScript

import { Injectable } from "@angular/core";
import { Http } from "@angular/http";
@Injectable()
export class IrcApiService {
constructor(private http: Http) {
}
getChannelOps(roomId: string, networkId: string, channel: string, scalarToken: string): Promise<string[]> {
return this.http.get("/api/v1/irc/" + roomId + "/ops/" + networkId + "/" + channel, {params: {scalar_token: scalarToken}})
.map(res => res.json()).toPromise();
}
linkChannel(roomId: string, networkId: string, channel: string, op: string, scalarToken: string): Promise<any> {
return this.http.put("/api/v1/irc/" + roomId + "/channels/" + networkId + "/" + channel, {}, {
params: {
scalar_token: scalarToken,
op: op
}
}).map(res => res.json()).toPromise();
}
unlinkChannel(roomId: string, networkId: string, channel: string, scalarToken: string): Promise<any> {
return this.http.delete("/api/v1/irc/" + roomId + "/channels/" + networkId + "/" + channel, {params: {scalar_token: scalarToken}})
.map(res => res.json()).toPromise();
}
}