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