2018-03-31 16:37:36 -04:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { Http } from "@angular/http";
|
|
|
|
import { AuthedApi } from "../authed-api";
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class IrcApiService extends AuthedApi {
|
|
|
|
constructor(http: Http) {
|
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getOperators(networkId: string, channelNoHash: string): Promise<string[]> {
|
|
|
|
return this.authedGet("/api/v1/dimension/irc/" + networkId + "/channel/" + channelNoHash + "/ops").map(r => r.json()).toPromise();
|
|
|
|
}
|
|
|
|
|
|
|
|
public requestLink(roomId: string, networkId: string, channelNoHash: string, op: string): Promise<any> {
|
|
|
|
return this.authedPost("/api/v1/dimension/irc/" + networkId + "/channel/" + channelNoHash + "/link/" + roomId, {op: op}).map(r => r.json()).toPromise();
|
|
|
|
}
|
2018-03-31 17:48:20 -04:00
|
|
|
|
|
|
|
public removeLink(roomId: string, networkId: string, channelNoHash: string): Promise<any> {
|
|
|
|
return this.authedPost("/api/v1/dimension/irc/" + networkId + "/channel/" + channelNoHash + "/unlink/" + roomId).map(r => r.json()).toPromise();
|
|
|
|
}
|
2018-03-31 16:37:36 -04:00
|
|
|
}
|