Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetozalp authored Jun 10, 2021
1 parent 7ed9601 commit 2166f30
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
46 changes: 45 additions & 1 deletion packages/clubhouse-client/src/clubhouse-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {
ClubhouseAPIResponse,
GetTopicAPIResponse,
GetChannelsAPIResponse,
JoinChannelAPIResponse
JoinChannelAPIResponse,
UpdateUsernameAPIResponse,
UpdateNameAPIResponse,
UpdateBioAPIResponse
} from './types'

const MAX_PAGE_SIZE = 400
Expand Down Expand Up @@ -271,6 +274,17 @@ export class ClubhouseClient {
})
}

async leaveChannel(channel): Promise<JoinChannelAPIResponse> {
return this._fetch({
endpoint: `/leave_channel`,
method: 'POST',
body: {
channel,
channel_id: null
}
})
}

async searchUsers(query: string): Promise<PagedUserAPIResponse> {
return this._fetch({
endpoint: `/search_users`,
Expand All @@ -297,6 +311,36 @@ export class ClubhouseClient {
})
}

async updateUsername(username: string): Promise<UpdateUsernameAPIResponse> {
return this._fetch({
endpoint: `/update_username`,
method: 'POST',
body: {
username
}
})
}

async updateName(name: string): Promise<UpdateNameAPIResponse> {
return this._fetch({
endpoint: `/update_name`,
method: 'POST',
body: {
name
}
})
}

async updateBio(bio: string): Promise<UpdateBioAPIResponse> {
return this._fetch({
endpoint: `/update_name`,
method: 'POST',
body: {
bio
}
})
}

async getFollowers(
userId: UserId,
{
Expand Down
12 changes: 12 additions & 0 deletions packages/clubhouse-client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 2166f30

Please sign in to comment.