From 2166f30e36bf8f2081225b6d82ba9d388687c1cc Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 10 Jun 2021 23:32:26 +0000 Subject: [PATCH] push --- .../clubhouse-client/src/clubhouse-client.ts | 46 ++++++++++++++++++- packages/clubhouse-client/src/types.ts | 12 +++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/packages/clubhouse-client/src/clubhouse-client.ts b/packages/clubhouse-client/src/clubhouse-client.ts index 5e1520c..c99fbab 100644 --- a/packages/clubhouse-client/src/clubhouse-client.ts +++ b/packages/clubhouse-client/src/clubhouse-client.ts @@ -17,7 +17,10 @@ import { ClubhouseAPIResponse, GetTopicAPIResponse, GetChannelsAPIResponse, - JoinChannelAPIResponse + JoinChannelAPIResponse, + UpdateUsernameAPIResponse, + UpdateNameAPIResponse, + UpdateBioAPIResponse } from './types' const MAX_PAGE_SIZE = 400 @@ -271,6 +274,17 @@ export class ClubhouseClient { }) } + async leaveChannel(channel): Promise { + return this._fetch({ + endpoint: `/leave_channel`, + method: 'POST', + body: { + channel, + channel_id: null + } + }) + } + async searchUsers(query: string): Promise { return this._fetch({ endpoint: `/search_users`, @@ -297,6 +311,36 @@ export class ClubhouseClient { }) } + async updateUsername(username: string): Promise { + return this._fetch({ + endpoint: `/update_username`, + method: 'POST', + body: { + username + } + }) + } + + async updateName(name: string): Promise { + return this._fetch({ + endpoint: `/update_name`, + method: 'POST', + body: { + name + } + }) + } + + async updateBio(bio: string): Promise { + return this._fetch({ + endpoint: `/update_name`, + method: 'POST', + body: { + bio + } + }) + } + async getFollowers( userId: UserId, { diff --git a/packages/clubhouse-client/src/types.ts b/packages/clubhouse-client/src/types.ts index 42c48e6..84525ac 100644 --- a/packages/clubhouse-client/src/types.ts +++ b/packages/clubhouse-client/src/types.ts @@ -240,3 +240,15 @@ export interface JoinChannelAPIResponse extends ClubhouseAPIResponse { pubnub_enable: boolean agora_native_mute: boolean } + +export interface UpdateUsernameAPIResponse extends ClubhouseAPIResponse { + username: string +} + +export interface UpdateNameAPIResponse extends ClubhouseAPIResponse { + name: string +} + +export interface UpdateBioAPIResponse extends ClubhouseAPIResponse { + bio: string +} \ No newline at end of file