From 861de060a58fefa78a185808a1f2896b6504c548 Mon Sep 17 00:00:00 2001 From: yaziine Date: Mon, 13 Sep 2021 14:57:46 +0400 Subject: [PATCH] Add deleteChannels and getTask methods --- src/client.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/client.ts b/src/client.ts index 074f030133..a815300c96 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3279,4 +3279,33 @@ export class StreamChat< ); return campaign; } + + /** + * deleteChannels - Deletes a list of channel + * + * @param {string[]} cids Channel CIDs + * @param {hard_delete?: boolean} hard_delete Defines if the channel is hard deleted or not + * + * @return {APIResponse} A task ID + */ + async deleteChannels( + cids: string[], + hard_delete?: boolean, + ) { + return await this.post(this.baseURL + `/channels/delete`, { + cids, + hard_delete, + }); + } + + /** + * getTask - Gets a task + * + * @param {string} id Task ID + * + * @return {APIResponse} The task status + */ + async getTask(id: string) { + return this.get(`${this.baseURL}/tasks/${id}`); + } }