From 7a228ddf9407d69a716b1d78fb54eb3989c44fe8 Mon Sep 17 00:00:00 2001 From: Muhamad Ridwan Date: Mon, 14 Apr 2025 08:19:33 +0700 Subject: [PATCH 1/7] feat: second phase of v2 platform api --- .openapi-generator/FILES | 2 -- GroupChannelApi.md | 4 ++-- apis/GroupChannelApi.ts | 15 +++++++-------- models/ObjectSerializer.ts | 6 ------ models/SendBirdMember.ts | 2 +- models/SendBirdUser.ts | 2 +- models/SendbirdBasicUserInfo.ts | 2 +- models/SendbirdGroupChannelDetail.ts | 2 +- models/SendbirdGroupChannelDetailChannel.ts | 2 +- models/all.ts | 2 -- tests/integration/groupChannel.test.ts | 4 +--- types/ObjectParamAPI.ts | 4 +--- types/ObservableAPI.ts | 4 +--- types/PromiseAPI.ts | 4 +--- 14 files changed, 18 insertions(+), 37 deletions(-) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index d5b3c92..f025d9f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -13,8 +13,6 @@ index.ts middleware.ts models/AcceptAnInvitationRequest.ts models/CreateAGroupChannelRequest.ts -models/CreateAGroupChannelResponse.ts -models/CreateAGroupChannelResponseChannel.ts models/GroupChatListChannelsResponse.ts models/HideAChannelRequest.ts models/InviteAsMembersRequest.ts diff --git a/GroupChannelApi.md b/GroupChannelApi.md index 7565e53..97d441c 100644 --- a/GroupChannelApi.md +++ b/GroupChannelApi.md @@ -82,7 +82,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) # **createAGroupChannel** -> CreateAGroupChannelResponse createAGroupChannel() +> SendbirdGroupChannelDetail createAGroupChannel() ## Create a group channel You can create a group channel for 1-to-1 and 1-to-N conversations. By default, group channels are used for conversations between up to 100 members. This number can stretch up to tens of thousands in Supergroup channels. Group channels can either be private and invite only, or public. They support typing indicators, unread count and read receipts, allowing for an interactive chat experience. A user can join up to 2000 group channels, and higher numbers would negatively impact the performance for the end user. The Chat history is turned off by default and its settings can be changed on Sendbird Dashboard by going to Settings > Chat > Channels > Group channels > Chat history. To learn more about group channels, see Channel Overview. > If you are seeing the error message Maximum \"channel join\" count reached., then consider deleting channels that are no longer used. For situations where an agent connects with many customers such as support, delivery logistics or sales, we recommend using Sendbird Desk. https://sendbird.com/docs/chat/platform-api/v3/channel/creating-a-channel/create-a-group-channel#1-create-a-group-channel @@ -167,7 +167,7 @@ Name | Type | Description | Notes ### Return type -**CreateAGroupChannelResponse** +**SendbirdGroupChannelDetail** ### Authorization diff --git a/apis/GroupChannelApi.ts b/apis/GroupChannelApi.ts index a6bc10d..1a90b13 100644 --- a/apis/GroupChannelApi.ts +++ b/apis/GroupChannelApi.ts @@ -12,7 +12,6 @@ import {SecurityAuthentication} from '../auth/auth'; import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; -import { CreateAGroupChannelResponse } from '../models/CreateAGroupChannelResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; @@ -941,22 +940,22 @@ export class GroupChannelApiResponseProcessor { * @params response Response returned by the server for a request to createAGroupChannel * @throws ApiException if the response code was not in [200, 299] */ - public async createAGroupChannel(response: ResponseContext): Promise { + public async createAGroupChannel(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: CreateAGroupChannelResponse = ObjectSerializer.deserialize( + const body: SendbirdGroupChannelDetail = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CreateAGroupChannelResponse", "" - ) as CreateAGroupChannelResponse; + "SendbirdGroupChannelDetail", "" + ) as SendbirdGroupChannelDetail; return body; } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: CreateAGroupChannelResponse = ObjectSerializer.deserialize( + const body: SendbirdGroupChannelDetail = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "CreateAGroupChannelResponse", "" - ) as CreateAGroupChannelResponse; + "SendbirdGroupChannelDetail", "" + ) as SendbirdGroupChannelDetail; return body; } diff --git a/models/ObjectSerializer.ts b/models/ObjectSerializer.ts index 7e06e39..06e40c8 100644 --- a/models/ObjectSerializer.ts +++ b/models/ObjectSerializer.ts @@ -1,7 +1,5 @@ export * from './AcceptAnInvitationRequest'; export * from './CreateAGroupChannelRequest'; -export * from './CreateAGroupChannelResponse'; -export * from './CreateAGroupChannelResponseChannel'; export * from './GroupChatListChannelsResponse'; export * from './HideAChannelRequest'; export * from './InviteAsMembersRequest'; @@ -29,8 +27,6 @@ export * from './UpdateAGroupChannelRequest'; import { AcceptAnInvitationRequest } from './AcceptAnInvitationRequest'; import { CreateAGroupChannelRequest } from './CreateAGroupChannelRequest'; -import { CreateAGroupChannelResponse } from './CreateAGroupChannelResponse'; -import { CreateAGroupChannelResponseChannel } from './CreateAGroupChannelResponseChannel'; import { GroupChatListChannelsResponse } from './GroupChatListChannelsResponse'; import { HideAChannelRequest } from './HideAChannelRequest'; import { InviteAsMembersRequest } from './InviteAsMembersRequest'; @@ -94,8 +90,6 @@ let enumsMap: Set = new Set([ let typeMap: {[index: string]: any} = { "AcceptAnInvitationRequest": AcceptAnInvitationRequest, "CreateAGroupChannelRequest": CreateAGroupChannelRequest, - "CreateAGroupChannelResponse": CreateAGroupChannelResponse, - "CreateAGroupChannelResponseChannel": CreateAGroupChannelResponseChannel, "GroupChatListChannelsResponse": GroupChatListChannelsResponse, "HideAChannelRequest": HideAChannelRequest, "InviteAsMembersRequest": InviteAsMembersRequest, diff --git a/models/SendBirdMember.ts b/models/SendBirdMember.ts index 3c384d4..bdba837 100644 --- a/models/SendBirdMember.ts +++ b/models/SendBirdMember.ts @@ -34,7 +34,7 @@ export class SendbirdMember { 'readTs'?: number; 'role'?: SendbirdMemberRoleEnum; 'state'?: SendbirdMemberStateEnum; - 'userId'?: string; + 'userId': string; static readonly discriminator: string | undefined = undefined; diff --git a/models/SendBirdUser.ts b/models/SendBirdUser.ts index ce7336e..bf8a5c4 100644 --- a/models/SendBirdUser.ts +++ b/models/SendBirdUser.ts @@ -31,7 +31,7 @@ export class SendbirdUser { 'preferredLanguages'?: Array; 'profileUrl'?: string; 'requireAuthForProfileImage'?: boolean; - 'userId'?: string; + 'userId': string; 'state'?: SendbirdUserStateEnum; static readonly discriminator: string | undefined = undefined; diff --git a/models/SendbirdBasicUserInfo.ts b/models/SendbirdBasicUserInfo.ts index 6da92a5..d982547 100644 --- a/models/SendbirdBasicUserInfo.ts +++ b/models/SendbirdBasicUserInfo.ts @@ -15,7 +15,7 @@ import { HttpFile } from '../http/http'; export class SendbirdBasicUserInfo { 'requireAuthForProfileImage'?: boolean; 'nickname'?: string; - 'userId'?: string; + 'userId': string; 'profileUrl'?: string; 'metadata'?: any; diff --git a/models/SendbirdGroupChannelDetail.ts b/models/SendbirdGroupChannelDetail.ts index 678b9cd..7b1cda8 100644 --- a/models/SendbirdGroupChannelDetail.ts +++ b/models/SendbirdGroupChannelDetail.ts @@ -21,7 +21,7 @@ import { HttpFile } from '../http/http'; export class SendbirdGroupChannelDetail { 'channel'?: SendbirdGroupChannelDetailChannel; - 'channelUrl'?: string; + 'channelUrl': string; 'coverUrl'?: string; 'createdAt'?: number; 'createdBy'?: SendbirdBasicUserInfo; diff --git a/models/SendbirdGroupChannelDetailChannel.ts b/models/SendbirdGroupChannelDetailChannel.ts index 57acdf0..00a9077 100644 --- a/models/SendbirdGroupChannelDetailChannel.ts +++ b/models/SendbirdGroupChannelDetailChannel.ts @@ -13,7 +13,7 @@ import { HttpFile } from '../http/http'; export class SendbirdGroupChannelDetailChannel { - 'channelUrl': string; + 'channelUrl'?: string; 'coverUrl'?: string; 'createdAt'?: number; 'customType'?: string; diff --git a/models/all.ts b/models/all.ts index d426cb2..0736977 100644 --- a/models/all.ts +++ b/models/all.ts @@ -1,7 +1,5 @@ export * from './AcceptAnInvitationRequest' export * from './CreateAGroupChannelRequest' -export * from './CreateAGroupChannelResponse' -export * from './CreateAGroupChannelResponseChannel' export * from './GroupChatListChannelsResponse' export * from './HideAChannelRequest' export * from './InviteAsMembersRequest' diff --git a/tests/integration/groupChannel.test.ts b/tests/integration/groupChannel.test.ts index 504ee11..e76fbc8 100644 --- a/tests/integration/groupChannel.test.ts +++ b/tests/integration/groupChannel.test.ts @@ -390,8 +390,6 @@ describe("Group Channel API", () => { expect(response.customType).toBe('data'); expect(typeof response.customType).toBe('string'); - if (response.channelUrl) { - await groupChannelApi.deleteAGroupChannel(response.channelUrl, API_TOKEN); - } + await groupChannelApi.deleteAGroupChannel(response.channelUrl, API_TOKEN); }); }); diff --git a/types/ObjectParamAPI.ts b/types/ObjectParamAPI.ts index fcd96ea..e959b59 100644 --- a/types/ObjectParamAPI.ts +++ b/types/ObjectParamAPI.ts @@ -4,8 +4,6 @@ import { Configuration} from '../configuration' import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; -import { CreateAGroupChannelResponse } from '../models/CreateAGroupChannelResponse'; -import { CreateAGroupChannelResponseChannel } from '../models/CreateAGroupChannelResponseChannel'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; @@ -559,7 +557,7 @@ export class ObjectGroupChannelApi { * Create a group channel * @param param the request object */ - public createAGroupChannel(param: GroupChannelApiCreateAGroupChannelRequest = {}, options?: Configuration): Promise { + public createAGroupChannel(param: GroupChannelApiCreateAGroupChannelRequest = {}, options?: Configuration): Promise { return this.api.createAGroupChannel(param.apiToken, param.createAGroupChannelRequest, options).toPromise(); } diff --git a/types/ObservableAPI.ts b/types/ObservableAPI.ts index 5af799a..b7eb934 100644 --- a/types/ObservableAPI.ts +++ b/types/ObservableAPI.ts @@ -5,8 +5,6 @@ import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; -import { CreateAGroupChannelResponse } from '../models/CreateAGroupChannelResponse'; -import { CreateAGroupChannelResponseChannel } from '../models/CreateAGroupChannelResponseChannel'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; @@ -80,7 +78,7 @@ export class ObservableGroupChannelApi { * @param apiToken * @param createAGroupChannelRequest */ - public createAGroupChannel(apiToken?: string, createAGroupChannelRequest?: CreateAGroupChannelRequest, _options?: Configuration): Observable { + public createAGroupChannel(apiToken?: string, createAGroupChannelRequest?: CreateAGroupChannelRequest, _options?: Configuration): Observable { const requestContextPromise = this.requestFactory.createAGroupChannel(apiToken, createAGroupChannelRequest, _options); // build promise chain diff --git a/types/PromiseAPI.ts b/types/PromiseAPI.ts index e3a197c..f37aff1 100644 --- a/types/PromiseAPI.ts +++ b/types/PromiseAPI.ts @@ -4,8 +4,6 @@ import { Configuration} from '../configuration' import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; -import { CreateAGroupChannelResponse } from '../models/CreateAGroupChannelResponse'; -import { CreateAGroupChannelResponseChannel } from '../models/CreateAGroupChannelResponseChannel'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; @@ -62,7 +60,7 @@ export class PromiseGroupChannelApi { * @param apiToken * @param createAGroupChannelRequest */ - public createAGroupChannel(apiToken?: string, createAGroupChannelRequest?: CreateAGroupChannelRequest, _options?: Configuration): Promise { + public createAGroupChannel(apiToken?: string, createAGroupChannelRequest?: CreateAGroupChannelRequest, _options?: Configuration): Promise { const result = this.api.createAGroupChannel(apiToken, createAGroupChannelRequest, _options); return result.toPromise(); } From 5c7bb02c2a91c86180f23aa89e35313a686758f7 Mon Sep 17 00:00:00 2001 From: Muhamad Ridwan Date: Mon, 14 Apr 2025 13:29:07 +0700 Subject: [PATCH 2/7] feat: test code platform api v2 --- .openapi-generator/FILES | 17 + GroupChannelApi.md | 481 ++++ ModerationApi.md | 1698 +------------- StatisticsApi.md | 337 +-- UserApi.md | 2005 +---------------- apis/GroupChannelApi.ts | 794 ++++++- apis/ModerationApi.ts | 104 + apis/StatisticsApi.ts | 155 ++ apis/UserApi.ts | 103 + index.ts | 2 +- models/CheckIfMemberResponse.ts | 45 + models/FreezeAGroupChannelRequest.ts | 35 + models/GroupChannelListMembersResponse.ts | 43 + models/LeaveAChannelRequest.ts | 48 + models/ListOperatorsResponse.ts | 43 + models/MarkAllMessagesAsReadRequest.ts | 38 + models/ObjectSerializer.ts | 34 + ...RegisterOperatorsToAGroupChannelRequest.ts | 35 + models/ResetChatHistoryRequest.ts | 42 + models/ResetChatHistoryResponse.ts | 38 + .../ViewNumberOfDailyActiveUsersResponse.ts | 35 + .../ViewNumberOfMonthlyActiveUsersResponse.ts | 35 + models/all.ts | 11 + types/ObjectParamAPI.ts | 449 ++++ types/ObservableAPI.ts | 363 +++ types/PromiseAPI.ts | 212 ++ 26 files changed, 3116 insertions(+), 4086 deletions(-) create mode 100644 apis/ModerationApi.ts create mode 100644 apis/StatisticsApi.ts create mode 100644 apis/UserApi.ts create mode 100644 models/CheckIfMemberResponse.ts create mode 100644 models/FreezeAGroupChannelRequest.ts create mode 100644 models/GroupChannelListMembersResponse.ts create mode 100644 models/LeaveAChannelRequest.ts create mode 100644 models/ListOperatorsResponse.ts create mode 100644 models/MarkAllMessagesAsReadRequest.ts create mode 100644 models/RegisterOperatorsToAGroupChannelRequest.ts create mode 100644 models/ResetChatHistoryRequest.ts create mode 100644 models/ResetChatHistoryResponse.ts create mode 100644 models/ViewNumberOfDailyActiveUsersResponse.ts create mode 100644 models/ViewNumberOfMonthlyActiveUsersResponse.ts diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index f025d9f..3f72187 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,7 +1,13 @@ .gitignore GroupChannelApi.md +ModerationApi.md README.md +StatisticsApi.md +UserApi.md apis/GroupChannelApi.ts +apis/ModerationApi.ts +apis/StatisticsApi.ts +apis/UserApi.ts apis/baseapi.ts apis/exception.ts auth/auth.ts @@ -12,14 +18,23 @@ http/isomorphic-fetch.ts index.ts middleware.ts models/AcceptAnInvitationRequest.ts +models/CheckIfMemberResponse.ts models/CreateAGroupChannelRequest.ts +models/FreezeAGroupChannelRequest.ts +models/GroupChannelListMembersResponse.ts models/GroupChatListChannelsResponse.ts models/HideAChannelRequest.ts models/InviteAsMembersRequest.ts models/InviteAsMembersResponse.ts models/InviteAsMembersResponseAllOf.ts models/JoinAChannelRequest.ts +models/LeaveAChannelRequest.ts +models/ListOperatorsResponse.ts +models/MarkAllMessagesAsReadRequest.ts models/ObjectSerializer.ts +models/RegisterOperatorsToAGroupChannelRequest.ts +models/ResetChatHistoryRequest.ts +models/ResetChatHistoryResponse.ts models/SendbirdBasicUserInfo.ts models/SendbirdDisappearingMessage.ts models/SendbirdFile.ts @@ -38,6 +53,8 @@ models/SendbirdUser.ts models/StartTypingIndicatorsRequest.ts models/StopTypingIndicatorsRequest.ts models/UpdateAGroupChannelRequest.ts +models/ViewNumberOfDailyActiveUsersResponse.ts +models/ViewNumberOfMonthlyActiveUsersResponse.ts models/all.ts package.json rxjsStub.ts diff --git a/GroupChannelApi.md b/GroupChannelApi.md index 97d441c..7984480 100644 --- a/GroupChannelApi.md +++ b/GroupChannelApi.md @@ -5,13 +5,20 @@ All URIs are relative to *https://api-APP_ID.sendbird.com* Method | HTTP request | Description ------------- | ------------- | ------------- [**acceptAnInvitation**](GroupChannelApi.md#acceptAnInvitation) | **PUT** /v3/group_channels/{channel_url}/accept | Accept an invitation +[**cancelTheRegistrationOfOperators**](GroupChannelApi.md#cancelTheRegistrationOfOperators) | **DELETE** /v3/group_channels/{channel_url}/operators | Cancel the registration of operators +[**checkIfMember**](GroupChannelApi.md#checkIfMember) | **GET** /v3/group_channels/{channel_url}/members/{user_id} | Check if member [**createAGroupChannel**](GroupChannelApi.md#createAGroupChannel) | **POST** /v3/group_channels | Create a group channel [**deleteAGroupChannel**](GroupChannelApi.md#deleteAGroupChannel) | **DELETE** /v3/group_channels/{channel_url} | Delete a group channel [**getAGroupChannel**](GroupChannelApi.md#getAGroupChannel) | **GET** /v3/group_channels/{channel_url} | Get a group channel [**hideAChannel**](GroupChannelApi.md#hideAChannel) | **PUT** /v3/group_channels/{channel_url}/hide | Hide a channel [**inviteAsMembers**](GroupChannelApi.md#inviteAsMembers) | **POST** /v3/group_channels/{channel_url}/invite | Invite as members [**joinAChannel**](GroupChannelApi.md#joinAChannel) | **PUT** /v3/group_channels/{channel_url}/join | Join a channel +[**leaveAChannel**](GroupChannelApi.md#leaveAChannel) | **PUT** /v3/group_channels/{channel_url}/leave | Leave a channel [**listChannels**](GroupChannelApi.md#listChannels) | **GET** /v3/group_channels | List channels +[**listMembers**](GroupChannelApi.md#listMembers) | **GET** /v3/group_channels/{channel_url}/members | List members +[**listOperators**](GroupChannelApi.md#listOperators) | **GET** /v3/group_channels/{channel_url}/operators | List operators +[**registerOperatorsToAGroupChannel**](GroupChannelApi.md#registerOperatorsToAGroupChannel) | **POST** /v3/group_channels/{channel_url}/operators | Register operators to a group channel +[**resetChatHistory**](GroupChannelApi.md#resetChatHistory) | **PUT** /v3/group_channels/{channel_url}/reset_user_history | Reset chat history [**startTypingIndicators**](GroupChannelApi.md#startTypingIndicators) | **POST** /v3/group_channels/{channel_url}/typing | Start typing indicators [**stopTypingIndicators**](GroupChannelApi.md#stopTypingIndicators) | **DELETE** /v3/group_channels/{channel_url}/typing | Stop typing indicators [**unhideAChannel**](GroupChannelApi.md#unhideAChannel) | **DELETE** /v3/group_channels/{channel_url}/hide | Unhide a channel @@ -74,6 +81,129 @@ No authorization required - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **cancelTheRegistrationOfOperators** +> any cancelTheRegistrationOfOperators() + +## Unregister operators from a group channel You can unregister operators in a group channel but keep them in the channel as members using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/unregister-operators-from-a-group-channel#1-unregister-operators-from-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to cancel the registration of operators. + +### Example + + +```typescript +import { Sendbird } from 'sendbird-platform-sdk'; +import * as fs from 'fs'; + +const configuration = Sendbird.createConfiguration(); +const apiInstance = new Sendbird.GroupChannelApi(configuration); + +let body:Sendbird.GroupChannelApiCancelTheRegistrationOfOperatorsRequest = { + // string | (Required) + channelUrl: "channel_url_example", + // string | Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. + operatorIds: "operator_ids_example", + // string (optional) + deleteAll: "delete_all_example", + // string (optional) + apiToken: "{{API_TOKEN}}", +}; + +apiInstance.cancelTheRegistrationOfOperators(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **channelUrl** | [**string**] | (Required) | defaults to undefined + **operatorIds** | [**string**] | Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. | defaults to undefined + **deleteAll** | [**string**] | | (optional) defaults to undefined + **apiToken** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**any** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **checkIfMember** +> CheckIfMemberResponse checkIfMember() + +## Check if user is a member Checks if a user is a member of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member) + +### Example + + +```typescript +import { Sendbird } from 'sendbird-platform-sdk'; +import * as fs from 'fs'; + +const configuration = Sendbird.createConfiguration(); +const apiInstance = new Sendbird.GroupChannelApi(configuration); + +let body:Sendbird.GroupChannelApiCheckIfMemberRequest = { + // string | (Required) + channelUrl: "channel_url_example", + // string | (Required) + userId: "user_id_example", + // string (optional) + apiToken: "{{API_TOKEN}}", +}; + +apiInstance.checkIfMember(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **channelUrl** | [**string**] | (Required) | defaults to undefined + **userId** | [**string**] | (Required) | defaults to undefined + **apiToken** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**CheckIfMemberResponse** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| @@ -507,6 +637,71 @@ No authorization required [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) +# **leaveAChannel** +> any leaveAChannel() + +## Leave a channel Makes one or more members leave a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-leave-a-channel ---------------------------- + +### Example + + +```typescript +import { Sendbird } from 'sendbird-platform-sdk'; +import * as fs from 'fs'; + +const configuration = Sendbird.createConfiguration(); +const apiInstance = new Sendbird.GroupChannelApi(configuration); + +let body:Sendbird.GroupChannelApiLeaveAChannelRequest = { + // string + channelUrl: "channel_url_example", + // string (optional) + apiToken: "{{API_TOKEN}}", + // LeaveAChannelRequest (optional) + leaveAChannelRequest: { + userIds: [ + "userIds_example", + ], + shouldLeaveAll: true, + }, +}; + +apiInstance.leaveAChannel(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **leaveAChannelRequest** | **LeaveAChannelRequest**| | + **channelUrl** | [**string**] | | defaults to undefined + **apiToken** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**any** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + # **listChannels** > GroupChatListChannelsResponse listChannels() @@ -680,6 +875,292 @@ No authorization required - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **listMembers** +> GroupChannelListMembersResponse listMembers() + +## List members Retrieves a list of members of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel) `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of members of. + +### Example + + +```typescript +import { Sendbird } from 'sendbird-platform-sdk'; +import * as fs from 'fs'; + +const configuration = Sendbird.createConfiguration(); +const apiInstance = new Sendbird.GroupChannelApi(configuration); + +let body:Sendbird.GroupChannelApiListMembersRequest = { + // string | (Required) + channelUrl: "channel_url_example", + // string (optional) + token: "token_example", + // number | Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) (optional) + limit: 1, + // string | Specifies the unique ID of a user. If `user_id` is provided, the response will include two additional boolean properties about each user in the members list. - `is_blocking_me`: Indicates whether the listed user is blocking the user specified in the user_id parameter. - `is_blocked_by_me`: Indicates whether the listed user is blocked by the user specified in the user_id parameter. (optional) + userId: "user_id_example", + // boolean (optional) + showDeliveryReceipt: true, + // boolean (optional) + showReadReceipt: true, + // boolean (optional) + showMemberIsMuted: true, + // 'member_nickname_alphabetical' | 'operator_then_member_alphabetical' | Specifies the method to sort a list of results. Acceptable values are the following: - `member_nickname_alphabetical` (default): sorts by the member nicknames in alphabetical order. - `operator_then_member_alphabetical`: sorts by the operational role and member nickname in alphabetical order where channel operators are listed before channel members. (optional) + order: "member_nickname_alphabetical", + // 'all' | 'operator' | 'nonoperator' | Restricts the search scope to only retrieve operators or non-operator members of the channel. Acceptable values are the following: - `all` (default): no filter is applied to the list. - `operator`: only channel operators are retrieved. - `nonoperator`: all channel members, except channel operators, are retrieved. (optional) + operatorFilter: "all", + // 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend' | Restricts the search scope to retrieve members based on if they have accepted an invitation or if they were invited by a friend. Acceptable values are `invited_only`, `joined_only`, `invited_by_friend`, `invited_by_non_friend`, and `all`. (Default: `all`) (optional) + memberStateFilter: "all", + // 'all' | 'muted' | 'unmuted' | Restricts the search scope to retrieve members who are muted or unmuted in the channel. Acceptable values are `all`, `muted`, and `unmuted`. (Default: `all`) (optional) + mutedMemberFilter: "all", + // 'activated' | 'deactivated' | Restricts the search scope to retrieve members who are activated or deactivated in the channel. Acceptable values are `all`, `activated`, and `deactivated`. (default: `activated`) (optional) + memberActiveModeFilter: "activated", + // string | Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. (optional) + nicknameStartswith: "nickname_startswith_example", + // 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false' | Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) (optional) + includePushPreference: "push_enabled", + // string (optional) + apiToken: "{{API_TOKEN}}", +}; + +apiInstance.listMembers(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **channelUrl** | [**string**] | (Required) | defaults to undefined + **token** | [**string**] | | (optional) defaults to undefined + **limit** | [**number**] | Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) | (optional) defaults to undefined + **userId** | [**string**] | Specifies the unique ID of a user. If `user_id` is provided, the response will include two additional boolean properties about each user in the members list. - `is_blocking_me`: Indicates whether the listed user is blocking the user specified in the user_id parameter. - `is_blocked_by_me`: Indicates whether the listed user is blocked by the user specified in the user_id parameter. | (optional) defaults to undefined + **showDeliveryReceipt** | [**boolean**] | | (optional) defaults to undefined + **showReadReceipt** | [**boolean**] | | (optional) defaults to undefined + **showMemberIsMuted** | [**boolean**] | | (optional) defaults to undefined + **order** | [**'member_nickname_alphabetical' | 'operator_then_member_alphabetical'**]**Array<'member_nickname_alphabetical' | 'operator_then_member_alphabetical'>** | Specifies the method to sort a list of results. Acceptable values are the following: - `member_nickname_alphabetical` (default): sorts by the member nicknames in alphabetical order. - `operator_then_member_alphabetical`: sorts by the operational role and member nickname in alphabetical order where channel operators are listed before channel members. | (optional) defaults to undefined + **operatorFilter** | [**'all' | 'operator' | 'nonoperator'**]**Array<'all' | 'operator' | 'nonoperator'>** | Restricts the search scope to only retrieve operators or non-operator members of the channel. Acceptable values are the following: - `all` (default): no filter is applied to the list. - `operator`: only channel operators are retrieved. - `nonoperator`: all channel members, except channel operators, are retrieved. | (optional) defaults to undefined + **memberStateFilter** | [**'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend'**]**Array<'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend'>** | Restricts the search scope to retrieve members based on if they have accepted an invitation or if they were invited by a friend. Acceptable values are `invited_only`, `joined_only`, `invited_by_friend`, `invited_by_non_friend`, and `all`. (Default: `all`) | (optional) defaults to undefined + **mutedMemberFilter** | [**'all' | 'muted' | 'unmuted'**]**Array<'all' | 'muted' | 'unmuted'>** | Restricts the search scope to retrieve members who are muted or unmuted in the channel. Acceptable values are `all`, `muted`, and `unmuted`. (Default: `all`) | (optional) defaults to undefined + **memberActiveModeFilter** | [**'activated' | 'deactivated'**]**Array<'activated' | 'deactivated'>** | Restricts the search scope to retrieve members who are activated or deactivated in the channel. Acceptable values are `all`, `activated`, and `deactivated`. (default: `activated`) | (optional) defaults to undefined + **nicknameStartswith** | [**string**] | Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. | (optional) defaults to undefined + **includePushPreference** | [**'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false'**]**Array<'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false'>** | Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) | (optional) defaults to undefined + **apiToken** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**GroupChannelListMembersResponse** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **listOperators** +> ListOperatorsResponse listOperators() + +## List operators You can retrieve a list of operators of a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/list-operators-of-a-group-channel#1-list-operators-of-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of operators. + +### Example + + +```typescript +import { Sendbird } from 'sendbird-platform-sdk'; +import * as fs from 'fs'; + +const configuration = Sendbird.createConfiguration(); +const apiInstance = new Sendbird.GroupChannelApi(configuration); + +let body:Sendbird.GroupChannelApiListOperatorsRequest = { + // string | (Required) + channelUrl: "channel_url_example", + // string (optional) + token: "token_example", + // number | Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) (optional) + limit: 1, + // string (optional) + apiToken: "{{API_TOKEN}}", +}; + +apiInstance.listOperators(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **channelUrl** | [**string**] | (Required) | defaults to undefined + **token** | [**string**] | | (optional) defaults to undefined + **limit** | [**number**] | Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) | (optional) defaults to undefined + **apiToken** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**ListOperatorsResponse** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **registerOperatorsToAGroupChannel** +> any registerOperatorsToAGroupChannel() + +## Register operators to a group channel You can register one or more operators to a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/register-operators-to-a-group-channel#1-register-operators-to-a-group-channel + +### Example + + +```typescript +import { Sendbird } from 'sendbird-platform-sdk'; +import * as fs from 'fs'; + +const configuration = Sendbird.createConfiguration(); +const apiInstance = new Sendbird.GroupChannelApi(configuration); + +let body:Sendbird.GroupChannelApiRegisterOperatorsToAGroupChannelRequest = { + // string | (Required) + channelUrl: "channel_url_example", + // string (optional) + apiToken: "{{API_TOKEN}}", + // RegisterOperatorsToAGroupChannelRequest (optional) + registerOperatorsToAGroupChannelRequest: { + operatorIds: [ + "operatorIds_example", + ], + }, +}; + +apiInstance.registerOperatorsToAGroupChannel(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **registerOperatorsToAGroupChannelRequest** | **RegisterOperatorsToAGroupChannelRequest**| | + **channelUrl** | [**string**] | (Required) | defaults to undefined + **apiToken** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**any** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **resetChatHistory** +> ResetChatHistoryResponse resetChatHistory() + +## Reset chat history This action resets the properties related to a specific user's chat history in a [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel), clearing existing messages in a channel from only the specified user's end. Because this action doesn't delete messages from the Sendbird database, other members in the channel can still retrieve and see the messages. This action clears the messages for the specified user by updating the `last_message` and `read_receipt` properties of the [group channel resource](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#4-list-of-properties-for-group-channels) in addition to other internally managed data such as the count of a user's unread messages. Using the `reset_all` property, you can also reset the properties related to the chat history of all members in a group channel. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/reset-chat-history#1-reset-chat-history + +### Example + + +```typescript +import { Sendbird } from 'sendbird-platform-sdk'; +import * as fs from 'fs'; + +const configuration = Sendbird.createConfiguration(); +const apiInstance = new Sendbird.GroupChannelApi(configuration); + +let body:Sendbird.GroupChannelApiResetChatHistoryRequest = { + // string | (Required) + channelUrl: "channel_url_example", + // string (optional) + apiToken: "{{API_TOKEN}}", + // ResetChatHistoryRequest (optional) + resetChatHistoryRequest: { + resetAll: true, + userId: "userId_example", + }, +}; + +apiInstance.resetChatHistory(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **resetChatHistoryRequest** | **ResetChatHistoryRequest**| | + **channelUrl** | [**string**] | (Required) | defaults to undefined + **apiToken** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**ResetChatHistoryResponse** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| diff --git a/ModerationApi.md b/ModerationApi.md index 1441ef1..40a5f33 100644 --- a/ModerationApi.md +++ b/ModerationApi.md @@ -4,39 +4,13 @@ All URIs are relative to *https://api-APP_ID.sendbird.com* Method | HTTP request | Description ------------- | ------------- | ------------- -[**banFromChannelsWithCustomChannelTypes**](ModerationApi.md#banFromChannelsWithCustomChannelTypes) | **POST** /v3/users/{user_id}/banned_channel_custom_types | Ban from channels with custom channel types -[**blockUser**](ModerationApi.md#blockUser) | **POST** /v3/users/{user_id}/block | Block a user -[**gcBanUser**](ModerationApi.md#gcBanUser) | **POST** /v3/group_channels/{channel_url}/ban | Ban a user -[**gcFreezeChannel**](ModerationApi.md#gcFreezeChannel) | **PUT** /v3/group_channels/{channel_url}/freeze | Freeze a channel -[**gcListBannedUsers**](ModerationApi.md#gcListBannedUsers) | **GET** /v3/group_channels/{channel_url}/ban | List banned users -[**gcListMutedUsers**](ModerationApi.md#gcListMutedUsers) | **GET** /v3/group_channels/{channel_url}/mute | List muted users -[**gcMuteUser**](ModerationApi.md#gcMuteUser) | **POST** /v3/group_channels/{channel_url}/mute | Mute a user -[**gcUnbanUserById**](ModerationApi.md#gcUnbanUserById) | **DELETE** /v3/group_channels/{channel_url}/ban/{banned_user_id} | Unban a user -[**gcUnmuteUserById**](ModerationApi.md#gcUnmuteUserById) | **DELETE** /v3/group_channels/{channel_url}/mute/{muted_user_id} | Unmute a user -[**gcUpdateBanById**](ModerationApi.md#gcUpdateBanById) | **PUT** /v3/group_channels/{channel_url}/ban/{banned_user_id} | Update a ban -[**gcViewBanById**](ModerationApi.md#gcViewBanById) | **GET** /v3/group_channels/{channel_url}/ban/{banned_user_id} | View a ban -[**gcViewMuteById**](ModerationApi.md#gcViewMuteById) | **GET** /v3/group_channels/{channel_url}/mute/{muted_user_id} | View a mute -[**listBannedChannels**](ModerationApi.md#listBannedChannels) | **GET** /v3/users/{user_id}/ban | List banned channels -[**listBlockedUsers**](ModerationApi.md#listBlockedUsers) | **GET** /v3/users/{user_id}/block | List blocked users -[**listMutedChannels**](ModerationApi.md#listMutedChannels) | **GET** /v3/users/{user_id}/mute | List muted channels -[**muteInChannelsWithCustomChannelTypes**](ModerationApi.md#muteInChannelsWithCustomChannelTypes) | **POST** /v3/users/{user_id}/muted_channel_custom_types | Mute in channels with custom channel types -[**ocBanUser**](ModerationApi.md#ocBanUser) | **POST** /v3/open_channels/{channel_url}/ban | Ban a user -[**ocFreezeChannel**](ModerationApi.md#ocFreezeChannel) | **PUT** /v3/open_channels/{channel_url}/freeze | Freeze a channel -[**ocListBannedUsers**](ModerationApi.md#ocListBannedUsers) | **GET** /v3/open_channels/{channel_url}/ban | List banned users -[**ocListMutedUsers**](ModerationApi.md#ocListMutedUsers) | **GET** /v3/open_channels/{channel_url}/mute | List muted users -[**ocMuteUser**](ModerationApi.md#ocMuteUser) | **POST** /v3/open_channels/{channel_url}/mute | Mute a user -[**ocUnbanUserById**](ModerationApi.md#ocUnbanUserById) | **DELETE** /v3/open_channels/{channel_url}/ban/{banned_user_id} | Unban a user -[**ocUnmuteUserById**](ModerationApi.md#ocUnmuteUserById) | **DELETE** /v3/open_channels/{channel_url}/mute/{muted_user_id} | Unmute a user -[**ocUpdateBanById**](ModerationApi.md#ocUpdateBanById) | **PUT** /v3/open_channels/{channel_url}/ban/{banned_user_id} | Update a ban -[**ocViewBanById**](ModerationApi.md#ocViewBanById) | **GET** /v3/open_channels/{channel_url}/ban/{banned_user_id} | View a ban -[**ocViewMuteById**](ModerationApi.md#ocViewMuteById) | **GET** /v3/open_channels/{channel_url}/mute/{muted_user_id} | View a mute -[**unblockUserById**](ModerationApi.md#unblockUserById) | **DELETE** /v3/users/{user_id}/block/{target_id} | Unblock a user +[**freezeAGroupChannel**](ModerationApi.md#freezeAGroupChannel) | **PUT** /v3/group_channels/{channel_url}/freeze | Freeze a group channel -# **banFromChannelsWithCustomChannelTypes** -> any banFromChannelsWithCustomChannelTypes() +# **freezeAGroupChannel** +> SendbirdGroupChannelDetail freezeAGroupChannel() -## Ban from channels with custom channel types Bans a user from channels with particular custom channel types. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-ban-from-channels-with-custom-channel-types ---------------------------- +## Freeze a group channel Freezes or unfreezes a group channel. > **Note**: To learn more about other available moderation tools, see [Moderation Overview](https://sendbird.com/docs/chat/platform-api/v3/moderation/moderation-overview#2-actions). [https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel) ### Example @@ -48,218 +22,18 @@ import * as fs from 'fs'; const configuration = Sendbird.createConfiguration(); const apiInstance = new Sendbird.ModerationApi(configuration); -let body:Sendbird.ModerationApiBanFromChannelsWithCustomChannelTypesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // BanFromChannelsWithCustomChannelTypesData (optional) - banFromChannelsWithCustomChannelTypesData: { - channelCustomTypes: [ - "channelCustomTypes_example", - ], - }, -}; - -apiInstance.banFromChannelsWithCustomChannelTypes(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **banFromChannelsWithCustomChannelTypesData** | **BanFromChannelsWithCustomChannelTypesData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**any** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **blockUser** -> BlockUserResponse blockUser() - -## Block a user Allows a user to block another user. A user doesn't receive messages from someone they have blocked anymore. Also, blocking someone doesn't alert them that they have been blocked. Blocked users still can send messages as normal in the channel: however, they can't receive any messages from the users who have blocked them. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-block-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiBlockUserRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // BlockUserData (optional) - blockUserData: { - userId: "userId_example", - targetId: "targetId_example", - userIds: [ - "userIds_example", - ], - users: [ - "users_example", - ], - }, -}; - -apiInstance.blockUser(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **blockUserData** | **BlockUserData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**BlockUserResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcBanUser** -> GcBanUserResponse gcBanUser() - -## Ban a user Bans a user from a group channel. A banned user is immediately expelled from a channel and allowed to join the channel again after a set time period. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-ban-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcBanUserRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // GcBanUserData (optional) - gcBanUserData: { - channelUrl: "channelUrl_example", - userId: "userId_example", - agentId: "agentId_example", - seconds: 1, - description: "description_example", - }, -}; - -apiInstance.gcBanUser(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **gcBanUserData** | **GcBanUserData**| | - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**GcBanUserResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcFreezeChannel** -> SendBirdGroupChannel gcFreezeChannel() - -## Freeze a channel Freezes or unfreezes a group channel. > __Note__: Only users designated as channel operators are allowed to talk when a channel is frozen. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-freeze-a-channel ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcFreezeChannelRequest = { - // string +let body:Sendbird.ModerationApiFreezeAGroupChannelRequest = { + // string | (Required) channelUrl: "channel_url_example", // string (optional) apiToken: "{{API_TOKEN}}", - // GcFreezeChannelData (optional) - gcFreezeChannelData: { - channelUrl: "channelUrl_example", + // FreezeAGroupChannelRequest (optional) + freezeAGroupChannelRequest: { freeze: true, }, }; -apiInstance.gcFreezeChannel(body).then((data:any) => { +apiInstance.freezeAGroupChannel(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -269,14 +43,14 @@ apiInstance.gcFreezeChannel(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **gcFreezeChannelData** | **GcFreezeChannelData**| | - **channelUrl** | [**string**] | | defaults to undefined + **freezeAGroupChannelRequest** | **FreezeAGroupChannelRequest**| | + **channelUrl** | [**string**] | (Required) | defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined ### Return type -**SendBirdGroupChannel** +**SendbirdGroupChannelDetail** ### Authorization @@ -295,1452 +69,4 @@ No authorization required [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **gcListBannedUsers** -> GcListBannedUsersResponse gcListBannedUsers() - -## List banned users Retrieves a list of the banned users from a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-list-banned-users ---------------------------- `channel_url` Type: string Description: Specifies the URL of the channel where to retrieve a list of banned users. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcListBannedUsersRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, -}; - -apiInstance.gcListBannedUsers(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - - -### Return type - -**GcListBannedUsersResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcListMutedUsers** -> GcListMutedUsersResponse gcListMutedUsers() - -## List muted users Retrieves a list of the muted users in a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-list-muted-users ---------------------------- `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of muted users. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcListMutedUsersRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, -}; - -apiInstance.gcListMutedUsers(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - - -### Return type - -**GcListMutedUsersResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcMuteUser** -> SendBirdGroupChannel gcMuteUser() - -## Mute a user Mutes a user in a group channel. A muted user remains in the channel and is allowed to view the messages, but can't send any messages until unmuted. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-mute-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcMuteUserRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // GcMuteUserData (optional) - gcMuteUserData: { - channelUrl: "channelUrl_example", - userId: "userId_example", - seconds: 1, - description: "description_example", - }, -}; - -apiInstance.gcMuteUser(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **gcMuteUserData** | **GcMuteUserData**| | - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**SendBirdGroupChannel** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcUnbanUserById** -> OcDeleteChannelByUrl200Response gcUnbanUserById() - -## Unban a user Unbans a user from a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-unban-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcUnbanUserByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - bannedUserId: "banned_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.gcUnbanUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **bannedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcDeleteChannelByUrl200Response** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcUnmuteUserById** -> OcDeleteChannelByUrl200Response gcUnmuteUserById() - -## Unmute a user Unmutes a user within a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-unmute-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcUnmuteUserByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - mutedUserId: "muted_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.gcUnmuteUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **mutedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcDeleteChannelByUrl200Response** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcUpdateBanById** -> GcUpdateBanByIdResponse gcUpdateBanById() - -## Update a ban Updates details of a ban imposed on a user. You can change the length of the ban with this action, and also provide an updated description. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-update-a-ban ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcUpdateBanByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - bannedUserId: "banned_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // GcUpdateBanByIdData (optional) - gcUpdateBanByIdData: { - channelUrl: "channelUrl_example", - bannedUserId: "bannedUserId_example", - seconds: 1, - description: "description_example", - }, -}; - -apiInstance.gcUpdateBanById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **gcUpdateBanByIdData** | **GcUpdateBanByIdData**| | - **channelUrl** | [**string**] | | defaults to undefined - **bannedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**GcUpdateBanByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcViewBanById** -> GcViewBanByIdResponse gcViewBanById() - -## View a ban Retrieves details of a ban imposed on a user. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-view-a-ban ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcViewBanByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - bannedUserId: "banned_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.gcViewBanById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **bannedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**GcViewBanByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **gcViewMuteById** -> GcViewMuteByIdResponse gcViewMuteById() - -## View a mute Checks if a user is muted in a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-view-a-mute ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiGcViewMuteByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - mutedUserId: "muted_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.gcViewMuteById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **mutedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**GcViewMuteByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **listBannedChannels** -> ListBannedChannelsResponse listBannedChannels() - -## List banned channels Retrieves a list of open and group channels with additional information where a user is banned. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-list-banned-channels ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the target user. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiListBannedChannelsRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, -}; - -apiInstance.listBannedChannels(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - - -### Return type - -**ListBannedChannelsResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **listBlockedUsers** -> ListBlockedUsersResponse listBlockedUsers() - -## List blocked users Retrieves a list of other users that a user has blocked. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-list-blocked-users ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the target user. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiListBlockedUsersRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, - // string (optional) - userIds: "user_ids_example", - // string (optional) - metadatakey: "metadatakey_example", - // string (optional) - metadatavaluesIn: "metadatavalues_in_example", -}; - -apiInstance.listBlockedUsers(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - **userIds** | [**string**] | | (optional) defaults to undefined - **metadatakey** | [**string**] | | (optional) defaults to undefined - **metadatavaluesIn** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ListBlockedUsersResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **listMutedChannels** -> ListMutedChannelsResponse listMutedChannels() - -## List muted channels Retrieves a list of open and group channels with additional information where a user is muted. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-list-muted-channels ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the target user. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiListMutedChannelsRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, -}; - -apiInstance.listMutedChannels(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - - -### Return type - -**ListMutedChannelsResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **muteInChannelsWithCustomChannelTypes** -> any muteInChannelsWithCustomChannelTypes() - -## Mute in channels with custom channel types Mutes a user in channels with particular custom channel types. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-mute-in-channels-with-custom-channel-types ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiMuteInChannelsWithCustomChannelTypesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // MuteInChannelsWithCustomChannelTypesData (optional) - muteInChannelsWithCustomChannelTypesData: { - channelCustomTypes: [ - "channelCustomTypes_example", - ], - }, -}; - -apiInstance.muteInChannelsWithCustomChannelTypes(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **muteInChannelsWithCustomChannelTypesData** | **MuteInChannelsWithCustomChannelTypesData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**any** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocBanUser** -> OcBanUserResponse ocBanUser() - -## Ban a user Bans a user from an open channel. A banned user is immediately expelled from a channel and allowed to participate in the channel again after a set time period. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-ban-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcBanUserRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // OcBanUserData (optional) - ocBanUserData: { - channelUrl: "channelUrl_example", - userId: "userId_example", - agentId: "agentId_example", - seconds: 1, - description: "description_example", - }, -}; - -apiInstance.ocBanUser(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ocBanUserData** | **OcBanUserData**| | - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcBanUserResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocFreezeChannel** -> SendBirdOpenChannel ocFreezeChannel() - -## Freeze a channel Freezes or unfreezes an open channel. > __Note__: Only users designated as channel operators are allowed to talk when a channel is frozen. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-freeze-a-channel ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcFreezeChannelRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // OcFreezeChannelData (optional) - ocFreezeChannelData: { - channelUrl: "channelUrl_example", - freeze: true, - }, -}; - -apiInstance.ocFreezeChannel(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ocFreezeChannelData** | **OcFreezeChannelData**| | - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**SendBirdOpenChannel** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocListBannedUsers** -> OcListBannedUsersResponse ocListBannedUsers() - -## List banned users Retrieves a list of banned users from a specific open channel. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-list-banned-users ---------------------------- `channel_url` Type: string Description: Specifies the URL of the channel where to retrieve a list of banned users. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcListBannedUsersRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, -}; - -apiInstance.ocListBannedUsers(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - - -### Return type - -**OcListBannedUsersResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocListMutedUsers** -> OcListMutedUsersResponse ocListMutedUsers() - -## List muted users Retrieves a list of muted users in the channel. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-list-muted-users ---------------------------- `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of muted users. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcListMutedUsersRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, -}; - -apiInstance.ocListMutedUsers(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - - -### Return type - -**OcListMutedUsersResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocMuteUser** -> SendBirdOpenChannel ocMuteUser() - -## Mute a user Mutes a user in the channel. A muted user remains in the channel and is allowed to view the messages, but can't send any messages until unmuted. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-mute-a-user - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcMuteUserRequest = { - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // OcMuteUserData (optional) - ocMuteUserData: { - userId: "userId_example", - seconds: 1, - description: "description_example", - }, -}; - -apiInstance.ocMuteUser(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ocMuteUserData** | **OcMuteUserData**| | - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**SendBirdOpenChannel** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocUnbanUserById** -> OcDeleteChannelByUrl200Response ocUnbanUserById() - -## Unban a user Unbans a user from an open channel. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-unban-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcUnbanUserByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - bannedUserId: "banned_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.ocUnbanUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **bannedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcDeleteChannelByUrl200Response** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocUnmuteUserById** -> OcDeleteChannelByUrl200Response ocUnmuteUserById() - -## Unmute a user Unmutes a user from an open channel. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-unmute-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcUnmuteUserByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - mutedUserId: "muted_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.ocUnmuteUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **mutedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcDeleteChannelByUrl200Response** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocUpdateBanById** -> OcUpdateBanByIdResponse ocUpdateBanById() - -## Update a ban Updates details of a ban imposed on a user. You can change the length of a ban with this action, and also provide an updated description. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-update-a-ban ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcUpdateBanByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - bannedUserId: "banned_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // OcUpdateBanByIdData (optional) - ocUpdateBanByIdData: { - channelUrl: "channelUrl_example", - bannedUserId: "bannedUserId_example", - seconds: 1, - description: "description_example", - }, -}; - -apiInstance.ocUpdateBanById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ocUpdateBanByIdData** | **OcUpdateBanByIdData**| | - **channelUrl** | [**string**] | | defaults to undefined - **bannedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcUpdateBanByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocViewBanById** -> OcViewBanByIdResponse ocViewBanById() - -## View a ban Retrieves details of a ban imposed on a user. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-view-a-ban ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcViewBanByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - bannedUserId: "banned_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.ocViewBanById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **bannedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcViewBanByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **ocViewMuteById** -> OcViewMuteByIdResponse ocViewMuteById() - -## View a mute Checks if a user is muted in an open channel. https://sendbird.com/docs/chat/v3/platform-api/guides/open-channel#2-view-a-mute ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiOcViewMuteByIdRequest = { - // string - channelUrl: "channel_url_example", - // string - mutedUserId: "muted_user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.ocViewMuteById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **channelUrl** | [**string**] | | defaults to undefined - **mutedUserId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**OcViewMuteByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **unblockUserById** -> any unblockUserById() - -## Unblock a user Unblocks the user. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-unblock-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.ModerationApi(configuration); - -let body:Sendbird.ModerationApiUnblockUserByIdRequest = { - // string - userId: "user_id_example", - // string - targetId: "target_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.unblockUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **targetId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**any** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - diff --git a/StatisticsApi.md b/StatisticsApi.md index 047a9b3..2816dae 100644 --- a/StatisticsApi.md +++ b/StatisticsApi.md @@ -4,260 +4,14 @@ All URIs are relative to *https://api-APP_ID.sendbird.com* Method | HTTP request | Description ------------- | ------------- | ------------- -[**getDetailedOpenRateOfAnnouncementById**](StatisticsApi.md#getDetailedOpenRateOfAnnouncementById) | **GET** /v3/announcement_open_rate/{unique_id} | Get detailed open rate of an announcement -[**getDetailedOpenStatusOfAnnouncementById**](StatisticsApi.md#getDetailedOpenStatusOfAnnouncementById) | **GET** /v3/announcement_open_status/{unique_id} | Get detailed open status of an announcement -[**retrieveAdvancedAnalyticsMetrics**](StatisticsApi.md#retrieveAdvancedAnalyticsMetrics) | **GET** /v3/statistics/metric | Retrieve Advanced analytics metrics -[**viewNumberOfConcurrentConnections**](StatisticsApi.md#viewNumberOfConcurrentConnections) | **GET** /v3/applications/ccu | View number of concurrent connections [**viewNumberOfDailyActiveUsers**](StatisticsApi.md#viewNumberOfDailyActiveUsers) | **GET** /v3/applications/dau | View number of daily active users [**viewNumberOfMonthlyActiveUsers**](StatisticsApi.md#viewNumberOfMonthlyActiveUsers) | **GET** /v3/applications/mau | View number of monthly active users -[**viewNumberOfPeakConnections**](StatisticsApi.md#viewNumberOfPeakConnections) | **GET** /v3/applications/peak_connections | View number of peak connections -# **getDetailedOpenRateOfAnnouncementById** -> GetDetailedOpenRateOfAnnouncementByIdResponse getDetailedOpenRateOfAnnouncementById() - -## Get detailed open rate of an announcement Retrieves the detailed open rate information of an announcement. https://sendbird.com/docs/chat/v3/platform-api/guides/announcements#2-get-detailed-open-rate-of-an-announcement ---------------------------- `unique_id` Type: string Description: Specifies the unique ID of the announcement to get its open rate. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.StatisticsApi(configuration); - -let body:Sendbird.StatisticsApiGetDetailedOpenRateOfAnnouncementByIdRequest = { - // string - uniqueId: "unique_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.getDetailedOpenRateOfAnnouncementById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uniqueId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**GetDetailedOpenRateOfAnnouncementByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **getDetailedOpenStatusOfAnnouncementById** -> GetDetailedOpenStatusOfAnnouncementByIdResponse getDetailedOpenStatusOfAnnouncementById() - -## Get detailed open status of an announcement Retrieves the detailed open status information of a specific announcement. https://sendbird.com/docs/chat/v3/platform-api/guides/announcements#2-get-detailed-open-status-of-an-announcement ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.StatisticsApi(configuration); - -let body:Sendbird.StatisticsApiGetDetailedOpenStatusOfAnnouncementByIdRequest = { - // string - uniqueId: "unique_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // number (optional) - limit: 1, - // string (optional) - next: "next_example", - // Array (optional) - uniqueIds: [ - "unique_ids_example", - ], - // Array (optional) - channelUrls: [ - "channel_urls_example", - ], - // boolean (optional) - hasOpened: true, -}; - -apiInstance.getDetailedOpenStatusOfAnnouncementById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uniqueId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - **next** | [**string**] | | (optional) defaults to undefined - **uniqueIds** | **Array<string>** | | (optional) defaults to undefined - **channelUrls** | **Array<string>** | | (optional) defaults to undefined - **hasOpened** | [**boolean**] | | (optional) defaults to undefined - - -### Return type - -**GetDetailedOpenStatusOfAnnouncementByIdResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **retrieveAdvancedAnalyticsMetrics** -> RetrieveAdvancedAnalyticsMetricsResponse retrieveAdvancedAnalyticsMetrics() - -## Retrieve Advanced analytics metrics Retrieves Advanced analytics metrics based on the specified parameters. You can retrieve either daily or monthly metrics using the time_dimension parameter. >__Note__: Daily metrics are calculated and updated every three hours, starting at 1 a.m. in UTC. Meanwhile, monthly metrics are calculated after the last day of the month. https://sendbird.com/docs/chat/v3/platform-api/guides/advanced-analytics#2-retrieve-advanced-analytics-metrics ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.StatisticsApi(configuration); - -let body:Sendbird.StatisticsApiRetrieveAdvancedAnalyticsMetricsRequest = { - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.retrieveAdvancedAnalyticsMetrics(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**RetrieveAdvancedAnalyticsMetricsResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewNumberOfConcurrentConnections** -> ViewNumberOfConcurrentConnectionsResponse viewNumberOfConcurrentConnections() - -## View number of concurrent connections Retrieves the number of devices and opened browser tabs which are currently connected to Sendbird server. https://sendbird.com/docs/chat/v3/platform-api/guides/application#2-view-number-of-concurrent-connections - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.StatisticsApi(configuration); - -let body:Sendbird.StatisticsApiViewNumberOfConcurrentConnectionsRequest = { - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.viewNumberOfConcurrentConnections(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewNumberOfConcurrentConnectionsResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - # **viewNumberOfDailyActiveUsers** > ViewNumberOfDailyActiveUsersResponse viewNumberOfDailyActiveUsers() -## View number of daily active users Retrieves the number of daily active users of the application (DAU). https://sendbird.com/docs/chat/v3/platform-api/guides/application#2-view-number-of-daily-active-users ---------------------------- +## View number of daily active users Retrieves the number of daily active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users) ### Example @@ -270,10 +24,10 @@ const configuration = Sendbird.createConfiguration(); const apiInstance = new Sendbird.StatisticsApi(configuration); let body:Sendbird.StatisticsApiViewNumberOfDailyActiveUsersRequest = { + // string | YYYY-MM-DD (optional) + date: "date_example", // string (optional) apiToken: "{{API_TOKEN}}", - // string (optional) - date: "date_example", }; apiInstance.viewNumberOfDailyActiveUsers(body).then((data:any) => { @@ -286,8 +40,8 @@ apiInstance.viewNumberOfDailyActiveUsers(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **date** | [**string**] | YYYY-MM-DD | (optional) defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined - **date** | [**string**] | | (optional) defaults to undefined ### Return type @@ -314,7 +68,7 @@ No authorization required # **viewNumberOfMonthlyActiveUsers** > ViewNumberOfMonthlyActiveUsersResponse viewNumberOfMonthlyActiveUsers() -## View number of monthly active users Retrieves the number of monthly active users of the application (MAU). https://sendbird.com/docs/chat/v3/platform-api/guides/application#2-view-number-of-monthly-active-users ---------------------------- +## View number of monthly active users Retrieves the number of monthly active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users) ### Example @@ -327,10 +81,10 @@ const configuration = Sendbird.createConfiguration(); const apiInstance = new Sendbird.StatisticsApi(configuration); let body:Sendbird.StatisticsApiViewNumberOfMonthlyActiveUsersRequest = { + // string | YYYY-MM-DD (optional) + date: "date_example", // string (optional) apiToken: "{{API_TOKEN}}", - // string (optional) - date: "date_example", }; apiInstance.viewNumberOfMonthlyActiveUsers(body).then((data:any) => { @@ -343,8 +97,8 @@ apiInstance.viewNumberOfMonthlyActiveUsers(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **date** | [**string**] | YYYY-MM-DD | (optional) defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined - **date** | [**string**] | | (optional) defaults to undefined ### Return type @@ -368,79 +122,4 @@ No authorization required [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **viewNumberOfPeakConnections** -> ViewNumberOfPeakConnectionsResponse viewNumberOfPeakConnections() - -## View number of peak connections Retrieves the number of concurrently connected devices to Sendbird server during the requested time period. https://sendbird.com/docs/chat/v3/platform-api/guides/application#2-view-number-of-peak-connections ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.StatisticsApi(configuration); - -let body:Sendbird.StatisticsApiViewNumberOfPeakConnectionsRequest = { - // string - timeDimension: "time_dimension_example", - // number - startYear: 1, - // number - startMonth: 1, - // number - endYear: 1, - // number - endMonth: 1, - // string (optional) - apiToken: "{{API_TOKEN}}", - // number (optional) - startDay: 1, - // number (optional) - endDay: 1, -}; - -apiInstance.viewNumberOfPeakConnections(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **timeDimension** | [**string**] | | defaults to undefined - **startYear** | [**number**] | | defaults to undefined - **startMonth** | [**number**] | | defaults to undefined - **endYear** | [**number**] | | defaults to undefined - **endMonth** | [**number**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **startDay** | [**number**] | | (optional) defaults to undefined - **endDay** | [**number**] | | (optional) defaults to undefined - - -### Return type - -**ViewNumberOfPeakConnectionsResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - diff --git a/UserApi.md b/UserApi.md index 8b530cf..e052446 100644 --- a/UserApi.md +++ b/UserApi.md @@ -4,109 +4,13 @@ All URIs are relative to *https://api-APP_ID.sendbird.com* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addRegistrationOrDeviceToken**](UserApi.md#addRegistrationOrDeviceToken) | **POST** /v3/users/{user_id}/push/{token_type} | Add a registration or device token -[**choosePushNotificationContentTemplate**](UserApi.md#choosePushNotificationContentTemplate) | **PUT** /v3/users/{user_id}/push/template | Choose a push notification content template -[**createUser**](UserApi.md#createUser) | **POST** /v3/users | Create a user -[**createUserToken**](UserApi.md#createUserToken) | **POST** /v3/users/{user_id}/token | Create user token -[**deleteUserById**](UserApi.md#deleteUserById) | **DELETE** /v3/users/{user_id} | Delete a user -[**leaveMyGroupChannels**](UserApi.md#leaveMyGroupChannels) | **PUT** /v3/users/{user_id}/my_group_channels/leave | Leave my group channels -[**listMyGroupChannels**](UserApi.md#listMyGroupChannels) | **GET** /v3/users/{user_id}/my_group_channels | List my group channels -[**listRegistrationOrDeviceTokens**](UserApi.md#listRegistrationOrDeviceTokens) | **GET** /v3/users/{user_id}/push/{token_type} | List registration or device tokens -[**listUsers**](UserApi.md#listUsers) | **GET** /v3/users | List users [**markAllMessagesAsRead**](UserApi.md#markAllMessagesAsRead) | **PUT** /v3/users/{user_id}/mark_as_read_all | Mark all messages as read -[**registerAsOperatorToChannelsWithCustomChannelTypes**](UserApi.md#registerAsOperatorToChannelsWithCustomChannelTypes) | **POST** /v3/users/{user_id}/operating_channel_custom_types | Register as an operator to channels with custom channel types -[**removeRegistrationOrDeviceToken**](UserApi.md#removeRegistrationOrDeviceToken) | **DELETE** /v3/users/{user_id}/push | Remove a registration or device token - When unregistering all device tokens -[**removeRegistrationOrDeviceTokenByToken**](UserApi.md#removeRegistrationOrDeviceTokenByToken) | **DELETE** /v3/users/{user_id}/push/{token_type}/{token} | Remove a registration or device token - When unregistering a specific token -[**removeRegistrationOrDeviceTokenFromOwnerByToken**](UserApi.md#removeRegistrationOrDeviceTokenFromOwnerByToken) | **DELETE** /v3/push/device_tokens/{token_type}/{token} | Remove a registration or device token from an owner -[**resetPushPreferences**](UserApi.md#resetPushPreferences) | **DELETE** /v3/users/{user_id}/push_preference | Reset push preferences -[**updateChannelInvitationPreference**](UserApi.md#updateChannelInvitationPreference) | **PUT** /v3/users/{user_id}/channel_invitation_preference | Update channel invitation preference -[**updateCountPreferenceOfChannelByUrl**](UserApi.md#updateCountPreferenceOfChannelByUrl) | **PUT** /v3/users/{user_id}/count_preference/{channel_url} | Update count preference of a channel -[**updatePushPreferences**](UserApi.md#updatePushPreferences) | **PUT** /v3/users/{user_id}/push_preference | Update push preferences -[**updatePushPreferencesForChannelByUrl**](UserApi.md#updatePushPreferencesForChannelByUrl) | **PUT** /v3/users/{user_id}/push_preference/{channel_url} | Update push preferences for a channel -[**updateUserById**](UserApi.md#updateUserById) | **PUT** /v3/users/{user_id} | Update a user -[**viewChannelInvitationPreference**](UserApi.md#viewChannelInvitationPreference) | **GET** /v3/users/{user_id}/channel_invitation_preference | View channel invitation preference -[**viewCountPreferenceOfChannelByUrl**](UserApi.md#viewCountPreferenceOfChannelByUrl) | **GET** /v3/users/{user_id}/count_preference/{channel_url} | View count preference of a channel -[**viewNumberOfChannelsByJoinStatus**](UserApi.md#viewNumberOfChannelsByJoinStatus) | **GET** /v3/users/{user_id}/group_channel_count | View number of channels by join status -[**viewNumberOfChannelsWithUnreadMessages**](UserApi.md#viewNumberOfChannelsWithUnreadMessages) | **GET** /v3/users/{user_id}/unread_channel_count | View number of channels with unread messages -[**viewNumberOfUnreadItems**](UserApi.md#viewNumberOfUnreadItems) | **GET** /v3/users/{user_id}/unread_item_count | View number of unread items -[**viewNumberOfUnreadMessages**](UserApi.md#viewNumberOfUnreadMessages) | **GET** /v3/users/{user_id}/unread_message_count | View number of unread messages -[**viewPushPreferences**](UserApi.md#viewPushPreferences) | **GET** /v3/users/{user_id}/push_preference | View push preferences -[**viewPushPreferencesForChannelByUrl**](UserApi.md#viewPushPreferencesForChannelByUrl) | **GET** /v3/users/{user_id}/push_preference/{channel_url} | View push preferences for a channel -[**viewUserById**](UserApi.md#viewUserById) | **GET** /v3/users/{user_id} | View a user -[**viewWhoOwnsRegistrationOrDeviceTokenByToken**](UserApi.md#viewWhoOwnsRegistrationOrDeviceTokenByToken) | **GET** /v3/push/device_tokens/{token_type}/{token} | View who owns a registration or device token -# **addRegistrationOrDeviceToken** -> AddRegistrationOrDeviceTokenResponse addRegistrationOrDeviceToken() - -## Add a registration or device token > __Note__: A user can have up to 20 FCM registration tokens, 20 HMS device tokens, and 20 APNs device tokens each. The oldest token will be deleted before a new token is added for a user who already has 20 registration or device tokens. Only the 20 newest tokens will be maintained for users who already have more than 20 of each token type. To send notification requests to push notification services on behalf of your server, adds a specific user's FCM registration token, HMS device token, or APNs device token to Sendbird server. Depending on which push service you are using, you can pass one of two values in `token_type`: `gcm`, `huawei`, or `apns`. A FCM registration token and an APNs device token allow identification of each client app instance on each device, and are generated and registered by Android and iOS apps through the corresponding SDKs. Use this method if you need to register a token via your own server. > __Note__: For more information on the registration token and device token, visit the Google's [FCM](https://firebase.google.com/docs/auth/admin/verify-id-tokens) page, Huawei's [Push kit](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/service-introduction-0000001050040060) and Apple's [APNs](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html) page. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-add-a-registration-or-device-token ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiAddRegistrationOrDeviceTokenRequest = { - // string - userId: "user_id_example", - // string - tokenType: "token_type_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // AddRegistrationOrDeviceTokenData (optional) - addRegistrationOrDeviceTokenData: { - gcmRegToken: "gcmRegToken_example", - huaweiDeviceToken: "huaweiDeviceToken_example", - apnsDeviceToken: "apnsDeviceToken_example", - }, -}; - -apiInstance.addRegistrationOrDeviceToken(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **addRegistrationOrDeviceTokenData** | **AddRegistrationOrDeviceTokenData**| | - **userId** | [**string**] | | defaults to undefined - **tokenType** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**AddRegistrationOrDeviceTokenResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **choosePushNotificationContentTemplate** -> ChoosePushNotificationContentTemplateResponse choosePushNotificationContentTemplate() +# **markAllMessagesAsRead** +> any markAllMessagesAsRead() -## Choose a push notification content template Chooses a push notification content template of a user's own. The push notifications feature is only available for group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-choose-a-push-notification-content-template ---------------------------- +## Mark all messages as read This action marks all of a user's unread messages as read in certain group channels. If channels aren't specified, the user's unread messages in all group channels are marked as read. https://sendbird.com/docs/chat/platform-api/v3/user/marking-messages-as-read/mark-all-of-a-users-messages-as-read#1-mark-all-of-a-user-s-messages-as-read ### Example @@ -118,264 +22,20 @@ import * as fs from 'fs'; const configuration = Sendbird.createConfiguration(); const apiInstance = new Sendbird.UserApi(configuration); -let body:Sendbird.UserApiChoosePushNotificationContentTemplateRequest = { - // string +let body:Sendbird.UserApiMarkAllMessagesAsReadRequest = { + // string | (Required) userId: "user_id_example", // string (optional) apiToken: "{{API_TOKEN}}", - // any (optional) - body: {}, -}; - -apiInstance.choosePushNotificationContentTemplate(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **any**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ChoosePushNotificationContentTemplateResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **createUser** -> SendBirdUser createUser() - -## Create a user Creates a new user in the application. A user is identified by its unique user ID, and additionally have a changeable nickname, profile image, and so on. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-create-a-user - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiCreateUserRequest = { - // string (optional) - apiToken: "{{API_TOKEN}}", - // CreateUserData (optional) - createUserData: { - userId: "userId_example", - nickname: "nickname_example", - profileUrl: "profileUrl_example", - profileFile: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, - issueAccessToken: true, - discoveryKeys: [ - "discoveryKeys_example", + // MarkAllMessagesAsReadRequest (optional) + markAllMessagesAsReadRequest: { + channelUrls: [ + "channelUrls_example", ], - metadata: {}, - }, -}; - -apiInstance.createUser(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createUserData** | **CreateUserData**| | - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**SendBirdUser** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **createUserToken** -> CreateUserTokenResponse createUserToken() - -## Create user token - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiCreateUserTokenRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // CreateUserTokenData (optional) - createUserTokenData: { - expiresAt: 3.14, - }, -}; - -apiInstance.createUserToken(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **createUserTokenData** | **CreateUserTokenData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**CreateUserTokenResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **deleteUserById** -> any deleteUserById() - -## Delete a user Deletes a user. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-delete-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiDeleteUserByIdRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.deleteUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**any** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **leaveMyGroupChannels** -> any leaveMyGroupChannels() - -## Leave my group channels Makes a user leave all joined group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-leave-my-group-channels ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the user to leave all joined group channels. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiLeaveMyGroupChannelsRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // LeaveMyGroupChannelsData (optional) - leaveMyGroupChannelsData: { - customType: "customType_example", }, }; -apiInstance.leaveMyGroupChannels(body).then((data:any) => { +apiInstance.markAllMessagesAsRead(body).then((data:any) => { console.log('API called successfully. Returned data: ' + data); }).catch((error:any) => console.error(error)); ``` @@ -385,8 +45,8 @@ apiInstance.leaveMyGroupChannels(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **leaveMyGroupChannelsData** | **LeaveMyGroupChannelsData**| | - **userId** | [**string**] | | defaults to undefined + **markAllMessagesAsReadRequest** | **MarkAllMessagesAsReadRequest**| | + **userId** | [**string**] | (Required) | defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined @@ -411,1645 +71,4 @@ No authorization required [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) -# **listMyGroupChannels** -> ListMyGroupChannelsResponse listMyGroupChannels() - -## List my group channels Retrieves all group channels that the user has joined. You can create a request based on various query parameters. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-list-my-group-channels ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the target user. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiListMyGroupChannelsRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, - // string (optional) - distinctMode: "distinct_mode_example", - // string (optional) - publicMode: "public_mode_example", - // string (optional) - superMode: "super_mode_example", - // string (optional) - hiddenMode: "hidden_mode_example", - // string (optional) - memberStateFilter: "member_state_filter_example", - // string (optional) - unreadFilter: "unread_filter_example", - // number (optional) - createdAfter: 1, - // number (optional) - createdBefore: 1, - // boolean (optional) - showEmpty: true, - // boolean (optional) - showFrozen: true, - // boolean (optional) - showMember: true, - // boolean (optional) - showDeliveryReceipt: true, - // boolean (optional) - showReadReceipt: true, - // string (optional) - order: "order_example", - // string (optional) - metadataOrderKey: "metadata_order_key_example", - // string (optional) - customTypes: "custom_types_example", - // string (optional) - customTypeStartswith: "custom_type_startswith_example", - // string (optional) - channelUrls: "channel_urls_example", - // string (optional) - name: "name_example", - // string (optional) - nameContains: "name_contains_example", - // string (optional) - nameStartswith: "name_startswith_example", - // string (optional) - membersExactlyIn: "members_exactly_in_example", - // string (optional) - membersIncludeIn: "members_include_in_example", - // string (optional) - queryType: "query_type_example", - // string (optional) - membersNickname: "members_nickname_example", - // string (optional) - membersNicknameContains: "members_nickname_contains_example", - // string (optional) - searchQuery: "search_query_example", - // string (optional) - searchFields: "search_fields_example", - // string (optional) - metadataKey: "metadata_key_example", - // string (optional) - metadataValues: "metadata_values_example", - // string (optional) - metadataValueStartswith: "metadata_value_startswith_example", - // string (optional) - metacounterKey: "metacounter_key_example", - // string (optional) - metacounterValues: "metacounter_values_example", - // string (optional) - metacounterValueGt: "metacounter_value_gt_example", - // string (optional) - metacounterValueGte: "metacounter_value_gte_example", - // string (optional) - metacounterValueLt: "metacounter_value_lt_example", - // string (optional) - metacounterValueLte: "metacounter_value_lte_example", - // string (optional) - customType: "custom_type_example", -}; - -apiInstance.listMyGroupChannels(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - **distinctMode** | [**string**] | | (optional) defaults to undefined - **publicMode** | [**string**] | | (optional) defaults to undefined - **superMode** | [**string**] | | (optional) defaults to undefined - **hiddenMode** | [**string**] | | (optional) defaults to undefined - **memberStateFilter** | [**string**] | | (optional) defaults to undefined - **unreadFilter** | [**string**] | | (optional) defaults to undefined - **createdAfter** | [**number**] | | (optional) defaults to undefined - **createdBefore** | [**number**] | | (optional) defaults to undefined - **showEmpty** | [**boolean**] | | (optional) defaults to undefined - **showFrozen** | [**boolean**] | | (optional) defaults to undefined - **showMember** | [**boolean**] | | (optional) defaults to undefined - **showDeliveryReceipt** | [**boolean**] | | (optional) defaults to undefined - **showReadReceipt** | [**boolean**] | | (optional) defaults to undefined - **order** | [**string**] | | (optional) defaults to undefined - **metadataOrderKey** | [**string**] | | (optional) defaults to undefined - **customTypes** | [**string**] | | (optional) defaults to undefined - **customTypeStartswith** | [**string**] | | (optional) defaults to undefined - **channelUrls** | [**string**] | | (optional) defaults to undefined - **name** | [**string**] | | (optional) defaults to undefined - **nameContains** | [**string**] | | (optional) defaults to undefined - **nameStartswith** | [**string**] | | (optional) defaults to undefined - **membersExactlyIn** | [**string**] | | (optional) defaults to undefined - **membersIncludeIn** | [**string**] | | (optional) defaults to undefined - **queryType** | [**string**] | | (optional) defaults to undefined - **membersNickname** | [**string**] | | (optional) defaults to undefined - **membersNicknameContains** | [**string**] | | (optional) defaults to undefined - **searchQuery** | [**string**] | | (optional) defaults to undefined - **searchFields** | [**string**] | | (optional) defaults to undefined - **metadataKey** | [**string**] | | (optional) defaults to undefined - **metadataValues** | [**string**] | | (optional) defaults to undefined - **metadataValueStartswith** | [**string**] | | (optional) defaults to undefined - **metacounterKey** | [**string**] | | (optional) defaults to undefined - **metacounterValues** | [**string**] | | (optional) defaults to undefined - **metacounterValueGt** | [**string**] | | (optional) defaults to undefined - **metacounterValueGte** | [**string**] | | (optional) defaults to undefined - **metacounterValueLt** | [**string**] | | (optional) defaults to undefined - **metacounterValueLte** | [**string**] | | (optional) defaults to undefined - **customType** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ListMyGroupChannelsResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **listRegistrationOrDeviceTokens** -> ListRegistrationOrDeviceTokensResponse listRegistrationOrDeviceTokens() - -## List registration or device tokens Retrieves a list of a specific user's FCM registration tokens, HMS device tokens, or APNs device tokens. You can specify either `gcm`, `huawei`, or `apns` in the `token_type` parameter, depending on which push notification service you are using. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-list-registration-or-device-tokens ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiListRegistrationOrDeviceTokensRequest = { - // string - userId: "user_id_example", - // string - tokenType: "token_type_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.listRegistrationOrDeviceTokens(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **tokenType** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ListRegistrationOrDeviceTokensResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **listUsers** -> ListUsersResponse listUsers() - -## List users Retrieves a list of users in your application. You can query the list using various parameters. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-list-users ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiListUsersRequest = { - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - token: "token_example", - // number (optional) - limit: 1, - // string (optional) - activeMode: "active_mode_example", - // boolean (optional) - showBot: true, - // string (optional) - userIds: "user_ids_example", - // string (optional) - nickname: "nickname_example", - // string (optional) - nicknameStartswith: "nickname_startswith_example", - // string (optional) - metadatakey: "metadatakey_example", - // string (optional) - metadatavaluesIn: "metadatavalues_in_example", -}; - -apiInstance.listUsers(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **apiToken** | [**string**] | | (optional) defaults to undefined - **token** | [**string**] | | (optional) defaults to undefined - **limit** | [**number**] | | (optional) defaults to undefined - **activeMode** | [**string**] | | (optional) defaults to undefined - **showBot** | [**boolean**] | | (optional) defaults to undefined - **userIds** | [**string**] | | (optional) defaults to undefined - **nickname** | [**string**] | | (optional) defaults to undefined - **nicknameStartswith** | [**string**] | | (optional) defaults to undefined - **metadatakey** | [**string**] | | (optional) defaults to undefined - **metadatavaluesIn** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ListUsersResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **markAllMessagesAsRead** -> any markAllMessagesAsRead() - -## Mark all messages as read Marks all of a user's unread messages as read in the joined group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-mark-all-messages-as-read ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiMarkAllMessagesAsReadRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // MarkAllMessagesAsReadData (optional) - markAllMessagesAsReadData: { - channelUrls: [ - "channelUrls_example", - ], - }, -}; - -apiInstance.markAllMessagesAsRead(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **markAllMessagesAsReadData** | **MarkAllMessagesAsReadData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**any** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **registerAsOperatorToChannelsWithCustomChannelTypes** -> any registerAsOperatorToChannelsWithCustomChannelTypes() - -## Register as an operator to channels with custom channel types Registers a user as an operator to channels with particular custom channel types. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-register-as-an-operator-to-channels-with-custom-channel-types ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiRegisterAsOperatorToChannelsWithCustomChannelTypesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // RegisterAsOperatorToChannelsWithCustomChannelTypesData (optional) - registerAsOperatorToChannelsWithCustomChannelTypesData: { - channelCustomTypes: [ - "channelCustomTypes_example", - ], - }, -}; - -apiInstance.registerAsOperatorToChannelsWithCustomChannelTypes(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **registerAsOperatorToChannelsWithCustomChannelTypesData** | **RegisterAsOperatorToChannelsWithCustomChannelTypesData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**any** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **removeRegistrationOrDeviceToken** -> RemoveRegistrationOrDeviceTokenResponse removeRegistrationOrDeviceToken() - -## Remove a registration or device token Removes a specific user's one or more FCM registration tokens, HMS device tokens, or APNs device tokens. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-remove-a-registration-or-device-token ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiRemoveRegistrationOrDeviceTokenRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.removeRegistrationOrDeviceToken(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**RemoveRegistrationOrDeviceTokenResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **removeRegistrationOrDeviceTokenByToken** -> RemoveRegistrationOrDeviceTokenByTokenResponse removeRegistrationOrDeviceTokenByToken() - -## Remove a registration or device token Removes a specific user's one or more FCM registration tokens, HMS device tokens, or APNs device tokens. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-remove-a-registration-or-device-token ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiRemoveRegistrationOrDeviceTokenByTokenRequest = { - // string - userId: "user_id_example", - // string - tokenType: "token_type_example", - // string - token: "token_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.removeRegistrationOrDeviceTokenByToken(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **tokenType** | [**string**] | | defaults to undefined - **token** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**RemoveRegistrationOrDeviceTokenByTokenResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **removeRegistrationOrDeviceTokenFromOwnerByToken** -> RemoveRegistrationOrDeviceTokenFromOwnerByTokenResponse removeRegistrationOrDeviceTokenFromOwnerByToken() - -## Remove a registration or device token from an owner Removes a registration or device token from a user who owns it. You can pass one of two values in `token_type`: `gcm`, `huawei`, or `apns`, depending on which push service you are using. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-remove-a-registration-or-device-token-from-an-owner ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiRemoveRegistrationOrDeviceTokenFromOwnerByTokenRequest = { - // string - tokenType: "token_type_example", - // string - token: "token_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.removeRegistrationOrDeviceTokenFromOwnerByToken(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tokenType** | [**string**] | | defaults to undefined - **token** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**RemoveRegistrationOrDeviceTokenFromOwnerByTokenResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **resetPushPreferences** -> ResetPushPreferencesResponse resetPushPreferences() - -## Reset push preferences Resets a user's push preferences. After performing this action, `do_not_disturb` and `snooze_enabled` are set to false. The values of the parameters associated with the time frame are all set to 0. `timezone` is reset to `UTC`. `push_sound` is reset to `default`. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-reset-push-preferences ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiResetPushPreferencesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.resetPushPreferences(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ResetPushPreferencesResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **updateChannelInvitationPreference** -> UpdateChannelInvitationPreferenceResponse updateChannelInvitationPreference() - -## Update channel invitation preference Updates the channel invitation preference for a user's [private](https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#-3-private-vs-public) group channels. > __Note__: Using the [update default channel invitation preference](https://sendbird.com/docs/chat/v3/platform-api/guides/application#2-update-default-channel-invitation-preference) action, you can update the value of channel invitation preference which is globally applied to all users within the application. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-update-channel-invitation-preference - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiUpdateChannelInvitationPreferenceRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // UpdateChannelInvitationPreferenceData (optional) - updateChannelInvitationPreferenceData: { - autoAccept: true, - }, -}; - -apiInstance.updateChannelInvitationPreference(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updateChannelInvitationPreferenceData** | **UpdateChannelInvitationPreferenceData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**UpdateChannelInvitationPreferenceResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **updateCountPreferenceOfChannelByUrl** -> UpdateCountPreferenceOfChannelByUrlResponse updateCountPreferenceOfChannelByUrl() - -## Update count preference of a channel Updates count preference of a specific group channel of a user. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-update-count-preference-of-a-channel ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiUpdateCountPreferenceOfChannelByUrlRequest = { - // string - userId: "user_id_example", - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // UpdateCountPreferenceOfChannelByUrlData (optional) - updateCountPreferenceOfChannelByUrlData: { - countPreference: "countPreference_example", - }, -}; - -apiInstance.updateCountPreferenceOfChannelByUrl(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updateCountPreferenceOfChannelByUrlData** | **UpdateCountPreferenceOfChannelByUrlData**| | - **userId** | [**string**] | | defaults to undefined - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**UpdateCountPreferenceOfChannelByUrlResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **updatePushPreferences** -> UpdatePushPreferencesResponse updatePushPreferences() - -## Update push preferences Updates a user's push preferences. Through this action, you can set `do_not_disturb` for a user, and update the time frame in which the setting applies. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-update-push-preferences ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiUpdatePushPreferencesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // UpdatePushPreferencesData (optional) - updatePushPreferencesData: { - pushTriggerOption: "pushTriggerOption_example", - doNotDisturb: true, - startHour: 1, - startMin: 1, - endHour: 1, - endMin: 1, - snoozeEnabled: true, - snoozeStartTs: 1, - snoozeEndTs: 1, - blockPushFromBots: true, - pushBlockedBotIds: [ - "pushBlockedBotIds_example", - ], - timezone: "timezone_example", - pushSound: "pushSound_example", - }, -}; - -apiInstance.updatePushPreferences(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updatePushPreferencesData** | **UpdatePushPreferencesData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**UpdatePushPreferencesResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **updatePushPreferencesForChannelByUrl** -> UpdatePushPreferencesForChannelByUrlResponse updatePushPreferencesForChannelByUrl() - -## Update push preferences for a channel Updates push preferences for a user's specific group channel. The push notifications feature is only available for group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-update-push-preferences-for-a-channel ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiUpdatePushPreferencesForChannelByUrlRequest = { - // string - userId: "user_id_example", - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // UpdatePushPreferencesForChannelByUrlData (optional) - updatePushPreferencesForChannelByUrlData: { - pushTriggerOption: "pushTriggerOption_example", - enable: true, - pushSound: "pushSound_example", - }, -}; - -apiInstance.updatePushPreferencesForChannelByUrl(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updatePushPreferencesForChannelByUrlData** | **UpdatePushPreferencesForChannelByUrlData**| | - **userId** | [**string**] | | defaults to undefined - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**UpdatePushPreferencesForChannelByUrlResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **updateUserById** -> SendBirdUser updateUserById() - -## Update a user Updates information on a user. In addition to changing a user's nickname or profile image, you can issue a new access token for the user. The new access token replaces the previous one as the necessary token for authentication. You can also deactivate or reactivate a user. If the `leave_all_when_deactivated` is true (which it is by default), a user leaves all joined group channels when deactivated. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-update-a-user ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiUpdateUserByIdRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // UpdateUserByIdData (optional) - updateUserByIdData: { - userId: "userId_example", - nickname: "nickname_example", - profileUrl: "profileUrl_example", - profileFile: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, - issueAccessToken: true, - issueSessionToken: true, - sessionTokenExpiresAt: 1, - isActive: true, - lastSeenAt: 1, - discoveryKeys: [ - "discoveryKeys_example", - ], - preferredLanguages: [ - "preferredLanguages_example", - ], - leaveAllWhenDeactivated: true, - }, -}; - -apiInstance.updateUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **updateUserByIdData** | **UpdateUserByIdData**| | - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**SendBirdUser** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewChannelInvitationPreference** -> ViewChannelInvitationPreferenceResponse viewChannelInvitationPreference() - -## View channel invitation preference Retrieves channel invitation preference for a user's [private](https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#-3-private-vs-public) group channels. > __Note__: Using the [view default channel invitation preference](https://sendbird.com/docs/chat/v3/platform-api/guides/application#2-view-default-channel-invitation-preference) action, you can retrieve the value of channel invitation preference which is globally applied to all users within the application. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-channel-invitation-preference - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewChannelInvitationPreferenceRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.viewChannelInvitationPreference(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewChannelInvitationPreferenceResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewCountPreferenceOfChannelByUrl** -> ViewCountPreferenceOfChannelByUrlResponse viewCountPreferenceOfChannelByUrl() - -## View count preference of a channel Retrieves count preference of a specific group channel of a user. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-count-preference-of-a-channel ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewCountPreferenceOfChannelByUrlRequest = { - // string - userId: "user_id_example", - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.viewCountPreferenceOfChannelByUrl(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewCountPreferenceOfChannelByUrlResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewNumberOfChannelsByJoinStatus** -> ViewNumberOfChannelsByJoinStatusResponse viewNumberOfChannelsByJoinStatus() - -## View number of channels by join status Retrieves the number of a user's group channels by their join status. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-number-of-channels-by-join-status ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the user to retrieve the number. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewNumberOfChannelsByJoinStatusRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - state: "state_example", -}; - -apiInstance.viewNumberOfChannelsByJoinStatus(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **state** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewNumberOfChannelsByJoinStatusResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewNumberOfChannelsWithUnreadMessages** -> ViewNumberOfChannelsWithUnreadMessagesResponse viewNumberOfChannelsWithUnreadMessages() - -## View number of channels with unread messages Retrieves the total number of a user's group channels with unread messages. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-number-of-channels-with-unread-messages ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewNumberOfChannelsWithUnreadMessagesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // Array (optional) - customTypes: [ - "custom_types_example", - ], - // string (optional) - superMode: "super_mode_example", -}; - -apiInstance.viewNumberOfChannelsWithUnreadMessages(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **customTypes** | **Array<string>** | | (optional) defaults to undefined - **superMode** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewNumberOfChannelsWithUnreadMessagesResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewNumberOfUnreadItems** -> ViewNumberOfUnreadItemsResponse viewNumberOfUnreadItems() - -## View number of unread items Retrieves a set of total numbers of a user's unread messages, unread mentioned messages, or received invitations in either super or non-super group channels. This action is only available for the group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-number-of-unread-items ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewNumberOfUnreadItemsRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - customType: "custom_type_example", - // string (optional) - itemKeys: "item_keys_example", -}; - -apiInstance.viewNumberOfUnreadItems(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **customType** | [**string**] | | (optional) defaults to undefined - **itemKeys** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewNumberOfUnreadItemsResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewNumberOfUnreadMessages** -> ViewNumberOfUnreadMessagesResponse viewNumberOfUnreadMessages() - -## View number of unread messages Retrieves the total number of a user's currently unread messages in the group channels. The unread counts feature is only available for the group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-number-of-unread-messages ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the user to retrieve the number. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewNumberOfUnreadMessagesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // string (optional) - customTypes: "custom_types_example", - // string (optional) - superMode: "super_mode_example", -}; - -apiInstance.viewNumberOfUnreadMessages(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **customTypes** | [**string**] | | (optional) defaults to undefined - **superMode** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewNumberOfUnreadMessagesResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewPushPreferences** -> ViewPushPreferencesResponse viewPushPreferences() - -## View push preferences Retrieves a user's push preferences about whether the user has set `do_not_disturb` to pause notifications for a certain period of time, and the time frame in which the user has applied the setting. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-push-preferences ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewPushPreferencesRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.viewPushPreferences(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewPushPreferencesResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewPushPreferencesForChannelByUrl** -> ViewPushPreferencesForChannelByUrlResponse viewPushPreferencesForChannelByUrl() - -## View push preferences for a channel Retrieves whether a user has turned on notification messages for a specific channel. The push notifications feature is only available for group channels. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-push-preferences-for-a-channel ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewPushPreferencesForChannelByUrlRequest = { - // string - userId: "user_id_example", - // string - channelUrl: "channel_url_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.viewPushPreferencesForChannelByUrl(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **channelUrl** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**ViewPushPreferencesForChannelByUrlResponse** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewUserById** -> SendBirdUser viewUserById() - -## View a user Retrieves information on a user. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-a-user ---------------------------- `user_id` Type: string Description: Specifies the unique ID of the user to retrieve. - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewUserByIdRequest = { - // string - userId: "user_id_example", - // string (optional) - apiToken: "{{API_TOKEN}}", - // boolean (optional) - includeUnreadCount: true, - // string (optional) - customTypes: "custom_types_example", - // string (optional) - superMode: "super_mode_example", -}; - -apiInstance.viewUserById(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **userId** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - **includeUnreadCount** | [**boolean**] | | (optional) defaults to undefined - **customTypes** | [**string**] | | (optional) defaults to undefined - **superMode** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**SendBirdUser** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - -# **viewWhoOwnsRegistrationOrDeviceTokenByToken** -> Array viewWhoOwnsRegistrationOrDeviceTokenByToken() - -## View who owns a registration or device token Retrieves a user who owns a FCM registration token, HMS device token, or APNs device token. You can pass one of two values in `token_type`: `gcm`, `huawei`, or `apns`, depending on which push service you are using. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-who-owns-a-registration-or-device-token ---------------------------- - -### Example - - -```typescript -import { Sendbird } from 'sendbird-platform-sdk'; -import * as fs from 'fs'; - -const configuration = Sendbird.createConfiguration(); -const apiInstance = new Sendbird.UserApi(configuration); - -let body:Sendbird.UserApiViewWhoOwnsRegistrationOrDeviceTokenByTokenRequest = { - // string - tokenType: "token_type_example", - // string - token: "token_example", - // string (optional) - apiToken: "{{API_TOKEN}}", -}; - -apiInstance.viewWhoOwnsRegistrationOrDeviceTokenByToken(body).then((data:any) => { - console.log('API called successfully. Returned data: ' + data); -}).catch((error:any) => console.error(error)); -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tokenType** | [**string**] | | defaults to undefined - **token** | [**string**] | | defaults to undefined - **apiToken** | [**string**] | | (optional) defaults to undefined - - -### Return type - -**Array** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful response | - | - -[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) - diff --git a/apis/GroupChannelApi.ts b/apis/GroupChannelApi.ts index 1a90b13..9fa7489 100644 --- a/apis/GroupChannelApi.ts +++ b/apis/GroupChannelApi.ts @@ -11,12 +11,19 @@ import {SecurityAuthentication} from '../auth/auth'; import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; +import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; +import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; import { InviteAsMembersResponse } from '../models/InviteAsMembersResponse'; import { JoinAChannelRequest } from '../models/JoinAChannelRequest'; +import { LeaveAChannelRequest } from '../models/LeaveAChannelRequest'; +import { ListOperatorsResponse } from '../models/ListOperatorsResponse'; +import { RegisterOperatorsToAGroupChannelRequest } from '../models/RegisterOperatorsToAGroupChannelRequest'; +import { ResetChatHistoryRequest } from '../models/ResetChatHistoryRequest'; +import { ResetChatHistoryResponse } from '../models/ResetChatHistoryResponse'; import { SendbirdGroupChannelDetail } from '../models/SendbirdGroupChannelDetail'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; @@ -69,6 +76,107 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { requestContext.setBody(serializedBody); + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * ## Unregister operators from a group channel You can unregister operators in a group channel but keep them in the channel as members using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/unregister-operators-from-a-group-channel#1-unregister-operators-from-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to cancel the registration of operators. + * Cancel the registration of operators + * @param channelUrl (Required) + * @param operatorIds Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. + * @param deleteAll + * @param apiToken + */ + public async cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: string, apiToken?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "cancelTheRegistrationOfOperators", "channelUrl"); + } + + + // verify required parameter 'operatorIds' is not null or undefined + if (operatorIds === null || operatorIds === undefined) { + throw new RequiredError("GroupChannelApi", "cancelTheRegistrationOfOperators", "operatorIds"); + } + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/operators' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (operatorIds !== undefined) { + requestContext.setQueryParam("operator_ids", ObjectSerializer.serialize(operatorIds, "string", "")); + } + + // Query Params + if (deleteAll !== undefined) { + requestContext.setQueryParam("delete_all", ObjectSerializer.serialize(deleteAll, "string", "")); + } + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * ## Check if user is a member Checks if a user is a member of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member) + * Check if member + * @param channelUrl (Required) + * @param userId (Required) + * @param apiToken + */ + public async checkIfMember(channelUrl: string, userId: string, apiToken?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "checkIfMember", "channelUrl"); + } + + + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("GroupChannelApi", "checkIfMember", "userId"); + } + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/members/{user_id}' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))) + .replace('{' + 'user_id' + '}', encodeURIComponent(String(userId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); @@ -371,6 +479,56 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + /** + * ## Leave a channel Makes one or more members leave a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-leave-a-channel ---------------------------- + * Leave a channel + * @param channelUrl + * @param apiToken + * @param leaveAChannelRequest + */ + public async leaveAChannel(channelUrl: string, apiToken?: string, leaveAChannelRequest?: LeaveAChannelRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "leaveAChannel", "channelUrl"); + } + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/leave' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("Api-Token", ObjectSerializer.serialize(apiToken, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(leaveAChannelRequest, "LeaveAChannelRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + /** * ## List group channels This action retrieves a list of [group channels](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel). You can use various query parameters to determine the search scope and select what kind of information you want to receive about the queried channels. If you want to retrieve a list of group channels that a specific user has joined, use the [list group channels by user](https://sendbird.com/docs/chat/platform-api/v3/user/managing-joined-group-channels/list-group-channels-by-user) action under the User section. https://sendbird.com/docs/chat/platform-api/v3/channel/listing-channels-in-an-application/list-group-channels#1-list-group-channels * List channels @@ -700,96 +858,124 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { } /** - * ## Start typing indicators You can start showing a typing indicator using this API. Seeing whether other users are typing can help a more interactive conversation environment by showing real-time engagement of other users. If you're looking for an easy way to show typing indicators on your app, check out Sendbird UIKit for a ready-to-use UI feature that can be customized to fit your needs. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-typing-indicators/start-typing-indicators#1-start-typing-indicators `channel_url` Type: string Description: Specifies the URL of the channel to set typing indicators. - * Start typing indicators + * ## List members Retrieves a list of members of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel) `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of members of. + * List members * @param channelUrl (Required) + * @param token + * @param limit Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) + * @param userId Specifies the unique ID of a user. If `user_id` is provided, the response will include two additional boolean properties about each user in the members list. - `is_blocking_me`: Indicates whether the listed user is blocking the user specified in the user_id parameter. - `is_blocked_by_me`: Indicates whether the listed user is blocked by the user specified in the user_id parameter. + * @param showDeliveryReceipt + * @param showReadReceipt + * @param showMemberIsMuted + * @param order Specifies the method to sort a list of results. Acceptable values are the following: - `member_nickname_alphabetical` (default): sorts by the member nicknames in alphabetical order. - `operator_then_member_alphabetical`: sorts by the operational role and member nickname in alphabetical order where channel operators are listed before channel members. + * @param operatorFilter Restricts the search scope to only retrieve operators or non-operator members of the channel. Acceptable values are the following: - `all` (default): no filter is applied to the list. - `operator`: only channel operators are retrieved. - `nonoperator`: all channel members, except channel operators, are retrieved. + * @param memberStateFilter Restricts the search scope to retrieve members based on if they have accepted an invitation or if they were invited by a friend. Acceptable values are `invited_only`, `joined_only`, `invited_by_friend`, `invited_by_non_friend`, and `all`. (Default: `all`) + * @param mutedMemberFilter Restricts the search scope to retrieve members who are muted or unmuted in the channel. Acceptable values are `all`, `muted`, and `unmuted`. (Default: `all`) + * @param memberActiveModeFilter Restricts the search scope to retrieve members who are activated or deactivated in the channel. Acceptable values are `all`, `activated`, and `deactivated`. (default: `activated`) + * @param nicknameStartswith Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. + * @param includePushPreference Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) * @param apiToken - * @param startTypingIndicatorsRequest */ - public async startTypingIndicators(channelUrl: string, apiToken?: string, startTypingIndicatorsRequest?: StartTypingIndicatorsRequest, _options?: Configuration): Promise { + public async listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false', apiToken?: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined if (channelUrl === null || channelUrl === undefined) { - throw new RequiredError("GroupChannelApi", "startTypingIndicators", "channelUrl"); + throw new RequiredError("GroupChannelApi", "listMembers", "channelUrl"); } + + + + + + + + + + + + // Path Params - const localVarPath = '/v3/group_channels/{channel_url}/typing' + const localVarPath = '/v3/group_channels/{channel_url}/members' .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") - // Header Params - requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + // Query Params + if (token !== undefined) { + requestContext.setQueryParam("token", ObjectSerializer.serialize(token, "string", "")); + } + // Query Params + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "")); + } - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(startTypingIndicatorsRequest, "StartTypingIndicatorsRequest", ""), - contentType - ); - requestContext.setBody(serializedBody); + // Query Params + if (userId !== undefined) { + requestContext.setQueryParam("user_id", ObjectSerializer.serialize(userId, "string", "")); + } - - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default - if (defaultAuth?.applySecurityAuthentication) { - await defaultAuth?.applySecurityAuthentication(requestContext); + // Query Params + if (showDeliveryReceipt !== undefined) { + requestContext.setQueryParam("show_delivery_receipt", ObjectSerializer.serialize(showDeliveryReceipt, "boolean", "")); } - return requestContext; - } + // Query Params + if (showReadReceipt !== undefined) { + requestContext.setQueryParam("show_read_receipt", ObjectSerializer.serialize(showReadReceipt, "boolean", "")); + } - /** - * ## Stop typing indicators You can stop showing a typing indicator using this API. To signal that a user is no longer typing, you can let the indicator disappear when the user sends a message or completely deletes the message text. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-typing-indicators/stop-typing-indicators#1-stop-typing-indicators `channel_url` Type: string Description: Specifies the URL of the channel to set typing indicators. - * Stop typing indicators - * @param channelUrl (Required) - * @param apiToken - * @param stopTypingIndicatorsRequest - */ - public async stopTypingIndicators(channelUrl: string, apiToken?: string, stopTypingIndicatorsRequest?: StopTypingIndicatorsRequest, _options?: Configuration): Promise { - let _config = _options || this.configuration; + // Query Params + if (showMemberIsMuted !== undefined) { + requestContext.setQueryParam("show_member_is_muted", ObjectSerializer.serialize(showMemberIsMuted, "boolean", "")); + } - // verify required parameter 'channelUrl' is not null or undefined - if (channelUrl === null || channelUrl === undefined) { - throw new RequiredError("GroupChannelApi", "stopTypingIndicators", "channelUrl"); + // Query Params + if (order !== undefined) { + requestContext.setQueryParam("order", ObjectSerializer.serialize(order, "'member_nickname_alphabetical' | 'operator_then_member_alphabetical'", "")); } + // Query Params + if (operatorFilter !== undefined) { + requestContext.setQueryParam("operator_filter", ObjectSerializer.serialize(operatorFilter, "'all' | 'operator' | 'nonoperator'", "")); + } + // Query Params + if (memberStateFilter !== undefined) { + requestContext.setQueryParam("member_state_filter", ObjectSerializer.serialize(memberStateFilter, "'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend'", "")); + } + // Query Params + if (mutedMemberFilter !== undefined) { + requestContext.setQueryParam("muted_member_filter", ObjectSerializer.serialize(mutedMemberFilter, "'all' | 'muted' | 'unmuted'", "")); + } - // Path Params - const localVarPath = '/v3/group_channels/{channel_url}/typing' - .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + // Query Params + if (memberActiveModeFilter !== undefined) { + requestContext.setQueryParam("member_active_mode_filter", ObjectSerializer.serialize(memberActiveModeFilter, "'activated' | 'deactivated'", "")); + } - // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); - requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + // Query Params + if (nicknameStartswith !== undefined) { + requestContext.setQueryParam("nickname_startswith", ObjectSerializer.serialize(nicknameStartswith, "string", "")); + } + + // Query Params + if (includePushPreference !== undefined) { + requestContext.setQueryParam("include_push_preference", ObjectSerializer.serialize(includePushPreference, "'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false'", "")); + } // Header Params requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); - // Body Params - const contentType = ObjectSerializer.getPreferredMediaType([ - "application/json" - ]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(stopTypingIndicatorsRequest, "StopTypingIndicatorsRequest", ""), - contentType - ); - requestContext.setBody(serializedBody); - const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { @@ -800,19 +986,19 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { } /** - * ## Unhide a channel This action lets a hidden [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel) reappear on the channel list of a specific user or every member in the group channel. Hiding or unhiding a channel lets users organize their channel list based on those that require the most attention. Note that only group channels can be hidden or unhidden. [https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/unhide-a-channel#1-unhide-a-channel](https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/unhide-a-channel#1-unhide-a-channel) `channel_url` Type: string Description: Specifies the URL of the channel to unhide or unarchive. - * Unhide a channel + * ## List operators You can retrieve a list of operators of a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/list-operators-of-a-group-channel#1-list-operators-of-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of operators. + * List operators * @param channelUrl (Required) - * @param userId (Required) - * @param shouldUnhideAll + * @param token + * @param limit Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) * @param apiToken */ - public async unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { + public async listOperators(channelUrl: string, token?: string, limit?: number, apiToken?: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined if (channelUrl === null || channelUrl === undefined) { - throw new RequiredError("GroupChannelApi", "unhideAChannel", "channelUrl"); + throw new RequiredError("GroupChannelApi", "listOperators", "channelUrl"); } @@ -820,21 +1006,21 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { // Path Params - const localVarPath = '/v3/group_channels/{channel_url}/hide' + const localVarPath = '/v3/group_channels/{channel_url}/operators' .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") // Query Params - if (userId !== undefined) { - requestContext.setQueryParam("user_id", ObjectSerializer.serialize(userId, "string", "")); + if (token !== undefined) { + requestContext.setQueryParam("token", ObjectSerializer.serialize(token, "string", "")); } // Query Params - if (shouldUnhideAll !== undefined) { - requestContext.setQueryParam("should_unhide_all", ObjectSerializer.serialize(shouldUnhideAll, "boolean", "")); + if (limit !== undefined) { + requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", "")); } // Header Params @@ -851,29 +1037,29 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { } /** - * ## Update a group channel You can update information about a group channel or a Supergroup channel using this API. You can't make any changes to the members of a channel with this API. To change members, see [invite as members](https://sendbird.com/docs/chat/platform-api/v3/channel/inviting-a-user/invite-as-members-channel) instead. See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/update-a-group-channel#1-update-a-group-channel - * Update a group channel - * @param channelUrl + * ## Register operators to a group channel You can register one or more operators to a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/register-operators-to-a-group-channel#1-register-operators-to-a-group-channel + * Register operators to a group channel + * @param channelUrl (Required) * @param apiToken - * @param updateAGroupChannelRequest + * @param registerOperatorsToAGroupChannelRequest */ - public async updateAGroupChannel(channelUrl: string, apiToken?: string, updateAGroupChannelRequest?: UpdateAGroupChannelRequest, _options?: Configuration): Promise { + public async registerOperatorsToAGroupChannel(channelUrl: string, apiToken?: string, registerOperatorsToAGroupChannelRequest?: RegisterOperatorsToAGroupChannelRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined if (channelUrl === null || channelUrl === undefined) { - throw new RequiredError("GroupChannelApi", "updateAGroupChannel", "channelUrl"); + throw new RequiredError("GroupChannelApi", "registerOperatorsToAGroupChannel", "channelUrl"); } // Path Params - const localVarPath = '/v3/group_channels/{channel_url}' + const localVarPath = '/v3/group_channels/{channel_url}/operators' .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); // Make Request Context - const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") // Header Params @@ -886,7 +1072,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(updateAGroupChannelRequest, "UpdateAGroupChannelRequest", ""), + ObjectSerializer.serialize(registerOperatorsToAGroupChannelRequest, "RegisterOperatorsToAGroupChannelRequest", ""), contentType ); requestContext.setBody(serializedBody); @@ -900,8 +1086,259 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } -} - + /** + * ## Reset chat history This action resets the properties related to a specific user's chat history in a [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel), clearing existing messages in a channel from only the specified user's end. Because this action doesn't delete messages from the Sendbird database, other members in the channel can still retrieve and see the messages. This action clears the messages for the specified user by updating the `last_message` and `read_receipt` properties of the [group channel resource](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#4-list-of-properties-for-group-channels) in addition to other internally managed data such as the count of a user's unread messages. Using the `reset_all` property, you can also reset the properties related to the chat history of all members in a group channel. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/reset-chat-history#1-reset-chat-history + * Reset chat history + * @param channelUrl (Required) + * @param apiToken + * @param resetChatHistoryRequest + */ + public async resetChatHistory(channelUrl: string, apiToken?: string, resetChatHistoryRequest?: ResetChatHistoryRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "resetChatHistory", "channelUrl"); + } + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/reset_user_history' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(resetChatHistoryRequest, "ResetChatHistoryRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * ## Start typing indicators You can start showing a typing indicator using this API. Seeing whether other users are typing can help a more interactive conversation environment by showing real-time engagement of other users. If you're looking for an easy way to show typing indicators on your app, check out Sendbird UIKit for a ready-to-use UI feature that can be customized to fit your needs. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-typing-indicators/start-typing-indicators#1-start-typing-indicators `channel_url` Type: string Description: Specifies the URL of the channel to set typing indicators. + * Start typing indicators + * @param channelUrl (Required) + * @param apiToken + * @param startTypingIndicatorsRequest + */ + public async startTypingIndicators(channelUrl: string, apiToken?: string, startTypingIndicatorsRequest?: StartTypingIndicatorsRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "startTypingIndicators", "channelUrl"); + } + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/typing' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(startTypingIndicatorsRequest, "StartTypingIndicatorsRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * ## Stop typing indicators You can stop showing a typing indicator using this API. To signal that a user is no longer typing, you can let the indicator disappear when the user sends a message or completely deletes the message text. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-typing-indicators/stop-typing-indicators#1-stop-typing-indicators `channel_url` Type: string Description: Specifies the URL of the channel to set typing indicators. + * Stop typing indicators + * @param channelUrl (Required) + * @param apiToken + * @param stopTypingIndicatorsRequest + */ + public async stopTypingIndicators(channelUrl: string, apiToken?: string, stopTypingIndicatorsRequest?: StopTypingIndicatorsRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "stopTypingIndicators", "channelUrl"); + } + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/typing' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(stopTypingIndicatorsRequest, "StopTypingIndicatorsRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * ## Unhide a channel This action lets a hidden [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel) reappear on the channel list of a specific user or every member in the group channel. Hiding or unhiding a channel lets users organize their channel list based on those that require the most attention. Note that only group channels can be hidden or unhidden. [https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/unhide-a-channel#1-unhide-a-channel](https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/unhide-a-channel#1-unhide-a-channel) `channel_url` Type: string Description: Specifies the URL of the channel to unhide or unarchive. + * Unhide a channel + * @param channelUrl (Required) + * @param userId (Required) + * @param shouldUnhideAll + * @param apiToken + */ + public async unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "unhideAChannel", "channelUrl"); + } + + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/hide' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (userId !== undefined) { + requestContext.setQueryParam("user_id", ObjectSerializer.serialize(userId, "string", "")); + } + + // Query Params + if (shouldUnhideAll !== undefined) { + requestContext.setQueryParam("should_unhide_all", ObjectSerializer.serialize(shouldUnhideAll, "boolean", "")); + } + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * ## Update a group channel You can update information about a group channel or a Supergroup channel using this API. You can't make any changes to the members of a channel with this API. To change members, see [invite as members](https://sendbird.com/docs/chat/platform-api/v3/channel/inviting-a-user/invite-as-members-channel) instead. See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/update-a-group-channel#1-update-a-group-channel + * Update a group channel + * @param channelUrl + * @param apiToken + * @param updateAGroupChannelRequest + */ + public async updateAGroupChannel(channelUrl: string, apiToken?: string, updateAGroupChannelRequest?: UpdateAGroupChannelRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("GroupChannelApi", "updateAGroupChannel", "channelUrl"); + } + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(updateAGroupChannelRequest, "UpdateAGroupChannelRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + export class GroupChannelApiResponseProcessor { /** @@ -933,6 +1370,64 @@ export class GroupChannelApiResponseProcessor { throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to cancelTheRegistrationOfOperators + * @throws ApiException if the response code was not in [200, 299] + */ + public async cancelTheRegistrationOfOperators(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to checkIfMember + * @throws ApiException if the response code was not in [200, 299] + */ + public async checkIfMember(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: CheckIfMemberResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CheckIfMemberResponse", "" + ) as CheckIfMemberResponse; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: CheckIfMemberResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CheckIfMemberResponse", "" + ) as CheckIfMemberResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1107,6 +1602,35 @@ export class GroupChannelApiResponseProcessor { throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to leaveAChannel + * @throws ApiException if the response code was not in [200, 299] + */ + public async leaveAChannel(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1136,6 +1660,122 @@ export class GroupChannelApiResponseProcessor { throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listMembers + * @throws ApiException if the response code was not in [200, 299] + */ + public async listMembers(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: GroupChannelListMembersResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GroupChannelListMembersResponse", "" + ) as GroupChannelListMembersResponse; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: GroupChannelListMembersResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "GroupChannelListMembersResponse", "" + ) as GroupChannelListMembersResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listOperators + * @throws ApiException if the response code was not in [200, 299] + */ + public async listOperators(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ListOperatorsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListOperatorsResponse", "" + ) as ListOperatorsResponse; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListOperatorsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListOperatorsResponse", "" + ) as ListOperatorsResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to registerOperatorsToAGroupChannel + * @throws ApiException if the response code was not in [200, 299] + */ + public async registerOperatorsToAGroupChannel(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to resetChatHistory + * @throws ApiException if the response code was not in [200, 299] + */ + public async resetChatHistory(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ResetChatHistoryResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ResetChatHistoryResponse", "" + ) as ResetChatHistoryResponse; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ResetChatHistoryResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ResetChatHistoryResponse", "" + ) as ResetChatHistoryResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects diff --git a/apis/ModerationApi.ts b/apis/ModerationApi.ts new file mode 100644 index 0000000..25af9a8 --- /dev/null +++ b/apis/ModerationApi.ts @@ -0,0 +1,104 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest'; +import { SendbirdGroupChannelDetail } from '../models/SendbirdGroupChannelDetail'; + +/** + * no description + */ +export class ModerationApiRequestFactory extends BaseAPIRequestFactory { + + /** + * ## Freeze a group channel Freezes or unfreezes a group channel. > **Note**: To learn more about other available moderation tools, see [Moderation Overview](https://sendbird.com/docs/chat/platform-api/v3/moderation/moderation-overview#2-actions). [https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel) + * Freeze a group channel + * @param channelUrl (Required) + * @param apiToken + * @param freezeAGroupChannelRequest + */ + public async freezeAGroupChannel(channelUrl: string, apiToken?: string, freezeAGroupChannelRequest?: FreezeAGroupChannelRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'channelUrl' is not null or undefined + if (channelUrl === null || channelUrl === undefined) { + throw new RequiredError("ModerationApi", "freezeAGroupChannel", "channelUrl"); + } + + + + + // Path Params + const localVarPath = '/v3/group_channels/{channel_url}/freeze' + .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(freezeAGroupChannelRequest, "FreezeAGroupChannelRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class ModerationApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to freezeAGroupChannel + * @throws ApiException if the response code was not in [200, 299] + */ + public async freezeAGroupChannel(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: SendbirdGroupChannelDetail = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "SendbirdGroupChannelDetail", "" + ) as SendbirdGroupChannelDetail; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: SendbirdGroupChannelDetail = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "SendbirdGroupChannelDetail", "" + ) as SendbirdGroupChannelDetail; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/apis/StatisticsApi.ts b/apis/StatisticsApi.ts new file mode 100644 index 0000000..6d27516 --- /dev/null +++ b/apis/StatisticsApi.ts @@ -0,0 +1,155 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { ViewNumberOfDailyActiveUsersResponse } from '../models/ViewNumberOfDailyActiveUsersResponse'; +import { ViewNumberOfMonthlyActiveUsersResponse } from '../models/ViewNumberOfMonthlyActiveUsersResponse'; + +/** + * no description + */ +export class StatisticsApiRequestFactory extends BaseAPIRequestFactory { + + /** + * ## View number of daily active users Retrieves the number of daily active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users) + * View number of daily active users + * @param date YYYY-MM-DD + * @param apiToken + */ + public async viewNumberOfDailyActiveUsers(date?: string, apiToken?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + // Path Params + const localVarPath = '/v3/applications/dau'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (date !== undefined) { + requestContext.setQueryParam("date", ObjectSerializer.serialize(date, "string", "")); + } + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * ## View number of monthly active users Retrieves the number of monthly active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users) + * View number of monthly active users + * @param date YYYY-MM-DD + * @param apiToken + */ + public async viewNumberOfMonthlyActiveUsers(date?: string, apiToken?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + // Path Params + const localVarPath = '/v3/applications/mau'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (date !== undefined) { + requestContext.setQueryParam("date", ObjectSerializer.serialize(date, "string", "")); + } + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class StatisticsApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to viewNumberOfDailyActiveUsers + * @throws ApiException if the response code was not in [200, 299] + */ + public async viewNumberOfDailyActiveUsers(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ViewNumberOfDailyActiveUsersResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ViewNumberOfDailyActiveUsersResponse", "" + ) as ViewNumberOfDailyActiveUsersResponse; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ViewNumberOfDailyActiveUsersResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ViewNumberOfDailyActiveUsersResponse", "" + ) as ViewNumberOfDailyActiveUsersResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to viewNumberOfMonthlyActiveUsers + * @throws ApiException if the response code was not in [200, 299] + */ + public async viewNumberOfMonthlyActiveUsers(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ViewNumberOfMonthlyActiveUsersResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ViewNumberOfMonthlyActiveUsersResponse", "" + ) as ViewNumberOfMonthlyActiveUsersResponse; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ViewNumberOfMonthlyActiveUsersResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ViewNumberOfMonthlyActiveUsersResponse", "" + ) as ViewNumberOfMonthlyActiveUsersResponse; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/apis/UserApi.ts b/apis/UserApi.ts new file mode 100644 index 0000000..01f71a3 --- /dev/null +++ b/apis/UserApi.ts @@ -0,0 +1,103 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { MarkAllMessagesAsReadRequest } from '../models/MarkAllMessagesAsReadRequest'; + +/** + * no description + */ +export class UserApiRequestFactory extends BaseAPIRequestFactory { + + /** + * ## Mark all messages as read This action marks all of a user's unread messages as read in certain group channels. If channels aren't specified, the user's unread messages in all group channels are marked as read. https://sendbird.com/docs/chat/platform-api/v3/user/marking-messages-as-read/mark-all-of-a-users-messages-as-read#1-mark-all-of-a-user-s-messages-as-read + * Mark all messages as read + * @param userId (Required) + * @param apiToken + * @param markAllMessagesAsReadRequest + */ + public async markAllMessagesAsRead(userId: string, apiToken?: string, markAllMessagesAsReadRequest?: MarkAllMessagesAsReadRequest, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("UserApi", "markAllMessagesAsRead", "userId"); + } + + + + + // Path Params + const localVarPath = '/v3/users/{user_id}/mark_as_read_all' + .replace('{' + 'user_id' + '}', encodeURIComponent(String(userId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(markAllMessagesAsReadRequest, "MarkAllMessagesAsReadRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class UserApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to markAllMessagesAsRead + * @throws ApiException if the response code was not in [200, 299] + */ + public async markAllMessagesAsRead(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: any = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "any", "" + ) as any; + return body; + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/index.ts b/index.ts index e5a415c..80a9f39 100644 --- a/index.ts +++ b/index.ts @@ -8,5 +8,5 @@ export * from "./servers"; export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; -export { PromiseGroupChannelApi as GroupChannelApi } from './types/PromiseAPI'; +export { PromiseGroupChannelApi as GroupChannelApi, PromiseModerationApi as ModerationApi, PromiseStatisticsApi as StatisticsApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; diff --git a/models/CheckIfMemberResponse.ts b/models/CheckIfMemberResponse.ts new file mode 100644 index 0000000..c5e6024 --- /dev/null +++ b/models/CheckIfMemberResponse.ts @@ -0,0 +1,45 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class CheckIfMemberResponse { + 'isMember'?: boolean; + 'state'?: CheckIfMemberResponseStateEnum; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "isMember", + "baseName": "is_member", + "type": "boolean", + "format": "" + }, + { + "name": "state", + "baseName": "state", + "type": "CheckIfMemberResponseStateEnum", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CheckIfMemberResponse.attributeTypeMap; + } + + public constructor() { + } +} + + +export type CheckIfMemberResponseStateEnum = "invited" | "joined" | "none" ; + diff --git a/models/FreezeAGroupChannelRequest.ts b/models/FreezeAGroupChannelRequest.ts new file mode 100644 index 0000000..acaf1f7 --- /dev/null +++ b/models/FreezeAGroupChannelRequest.ts @@ -0,0 +1,35 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class FreezeAGroupChannelRequest { + 'freeze': boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "freeze", + "baseName": "freeze", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FreezeAGroupChannelRequest.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/GroupChannelListMembersResponse.ts b/models/GroupChannelListMembersResponse.ts new file mode 100644 index 0000000..34dde46 --- /dev/null +++ b/models/GroupChannelListMembersResponse.ts @@ -0,0 +1,43 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { SendbirdMember } from './SendbirdMember'; +import { HttpFile } from '../http/http'; + +export class GroupChannelListMembersResponse { + 'members': Array; + 'next'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "members", + "baseName": "members", + "type": "Array", + "format": "" + }, + { + "name": "next", + "baseName": "next", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return GroupChannelListMembersResponse.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/LeaveAChannelRequest.ts b/models/LeaveAChannelRequest.ts new file mode 100644 index 0000000..59d6103 --- /dev/null +++ b/models/LeaveAChannelRequest.ts @@ -0,0 +1,48 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class LeaveAChannelRequest { + /** + * Specifies an array of one or more IDs of the users to leave the channel. + */ + 'userIds': Array; + /** + * Determines whether to make all members leave the channel. (Default: false) + */ + 'shouldLeaveAll': boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "userIds", + "baseName": "user_ids", + "type": "Array", + "format": "" + }, + { + "name": "shouldLeaveAll", + "baseName": "should_leave_all", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return LeaveAChannelRequest.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/ListOperatorsResponse.ts b/models/ListOperatorsResponse.ts new file mode 100644 index 0000000..f972a60 --- /dev/null +++ b/models/ListOperatorsResponse.ts @@ -0,0 +1,43 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { SendbirdUser } from './SendbirdUser'; +import { HttpFile } from '../http/http'; + +export class ListOperatorsResponse { + 'next'?: string; + 'operators'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "next", + "baseName": "next", + "type": "string", + "format": "" + }, + { + "name": "operators", + "baseName": "operators", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ListOperatorsResponse.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/MarkAllMessagesAsReadRequest.ts b/models/MarkAllMessagesAsReadRequest.ts new file mode 100644 index 0000000..c3a8add --- /dev/null +++ b/models/MarkAllMessagesAsReadRequest.ts @@ -0,0 +1,38 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class MarkAllMessagesAsReadRequest { + /** + * Specifies an array of one or more group channel URLs where unread messages need to be marked as read. If not specified, unread messages in all group channels a user joined are marked as read. + */ + 'channelUrls'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "channelUrls", + "baseName": "channel_urls", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarkAllMessagesAsReadRequest.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/ObjectSerializer.ts b/models/ObjectSerializer.ts index 06e40c8..c7a2229 100644 --- a/models/ObjectSerializer.ts +++ b/models/ObjectSerializer.ts @@ -1,11 +1,20 @@ export * from './AcceptAnInvitationRequest'; +export * from './CheckIfMemberResponse'; export * from './CreateAGroupChannelRequest'; +export * from './FreezeAGroupChannelRequest'; +export * from './GroupChannelListMembersResponse'; export * from './GroupChatListChannelsResponse'; export * from './HideAChannelRequest'; export * from './InviteAsMembersRequest'; export * from './InviteAsMembersResponse'; export * from './InviteAsMembersResponseAllOf'; export * from './JoinAChannelRequest'; +export * from './LeaveAChannelRequest'; +export * from './ListOperatorsResponse'; +export * from './MarkAllMessagesAsReadRequest'; +export * from './RegisterOperatorsToAGroupChannelRequest'; +export * from './ResetChatHistoryRequest'; +export * from './ResetChatHistoryResponse'; export * from './SendbirdBasicUserInfo'; export * from './SendbirdDisappearingMessage'; export * from './SendbirdFile'; @@ -24,15 +33,26 @@ export * from './SendbirdUser'; export * from './StartTypingIndicatorsRequest'; export * from './StopTypingIndicatorsRequest'; export * from './UpdateAGroupChannelRequest'; +export * from './ViewNumberOfDailyActiveUsersResponse'; +export * from './ViewNumberOfMonthlyActiveUsersResponse'; import { AcceptAnInvitationRequest } from './AcceptAnInvitationRequest'; +import { CheckIfMemberResponse , CheckIfMemberResponseStateEnum } from './CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from './CreateAGroupChannelRequest'; +import { FreezeAGroupChannelRequest } from './FreezeAGroupChannelRequest'; +import { GroupChannelListMembersResponse } from './GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from './GroupChatListChannelsResponse'; import { HideAChannelRequest } from './HideAChannelRequest'; import { InviteAsMembersRequest } from './InviteAsMembersRequest'; import { InviteAsMembersResponse , InviteAsMembersResponseCountPreferenceEnum , InviteAsMembersResponseHiddenStateEnum , InviteAsMembersResponseMemberStateEnum , InviteAsMembersResponseMyRoleEnum , InviteAsMembersResponsePushTriggerOptionEnum } from './InviteAsMembersResponse'; import { InviteAsMembersResponseAllOf } from './InviteAsMembersResponseAllOf'; import { JoinAChannelRequest } from './JoinAChannelRequest'; +import { LeaveAChannelRequest } from './LeaveAChannelRequest'; +import { ListOperatorsResponse } from './ListOperatorsResponse'; +import { MarkAllMessagesAsReadRequest } from './MarkAllMessagesAsReadRequest'; +import { RegisterOperatorsToAGroupChannelRequest } from './RegisterOperatorsToAGroupChannelRequest'; +import { ResetChatHistoryRequest } from './ResetChatHistoryRequest'; +import { ResetChatHistoryResponse } from './ResetChatHistoryResponse'; import { SendbirdBasicUserInfo } from './SendbirdBasicUserInfo'; import { SendbirdDisappearingMessage } from './SendbirdDisappearingMessage'; import { SendbirdFile } from './SendbirdFile'; @@ -51,6 +71,8 @@ import { SendbirdUser , SendbirdUserStateEnum } from './Sendbir import { StartTypingIndicatorsRequest } from './StartTypingIndicatorsRequest'; import { StopTypingIndicatorsRequest } from './StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from './UpdateAGroupChannelRequest'; +import { ViewNumberOfDailyActiveUsersResponse } from './ViewNumberOfDailyActiveUsersResponse'; +import { ViewNumberOfMonthlyActiveUsersResponse } from './ViewNumberOfMonthlyActiveUsersResponse'; /* tslint:disable:no-unused-variable */ let primitives = [ @@ -72,6 +94,7 @@ const supportedMediaTypes: { [mediaType: string]: number } = { let enumsMap: Set = new Set([ + "CheckIfMemberResponseStateEnum", "InviteAsMembersResponseCountPreferenceEnum", "InviteAsMembersResponseHiddenStateEnum", "InviteAsMembersResponseMemberStateEnum", @@ -89,13 +112,22 @@ let enumsMap: Set = new Set([ let typeMap: {[index: string]: any} = { "AcceptAnInvitationRequest": AcceptAnInvitationRequest, + "CheckIfMemberResponse": CheckIfMemberResponse, "CreateAGroupChannelRequest": CreateAGroupChannelRequest, + "FreezeAGroupChannelRequest": FreezeAGroupChannelRequest, + "GroupChannelListMembersResponse": GroupChannelListMembersResponse, "GroupChatListChannelsResponse": GroupChatListChannelsResponse, "HideAChannelRequest": HideAChannelRequest, "InviteAsMembersRequest": InviteAsMembersRequest, "InviteAsMembersResponse": InviteAsMembersResponse, "InviteAsMembersResponseAllOf": InviteAsMembersResponseAllOf, "JoinAChannelRequest": JoinAChannelRequest, + "LeaveAChannelRequest": LeaveAChannelRequest, + "ListOperatorsResponse": ListOperatorsResponse, + "MarkAllMessagesAsReadRequest": MarkAllMessagesAsReadRequest, + "RegisterOperatorsToAGroupChannelRequest": RegisterOperatorsToAGroupChannelRequest, + "ResetChatHistoryRequest": ResetChatHistoryRequest, + "ResetChatHistoryResponse": ResetChatHistoryResponse, "SendbirdBasicUserInfo": SendbirdBasicUserInfo, "SendbirdDisappearingMessage": SendbirdDisappearingMessage, "SendbirdFile": SendbirdFile, @@ -114,6 +146,8 @@ let typeMap: {[index: string]: any} = { "StartTypingIndicatorsRequest": StartTypingIndicatorsRequest, "StopTypingIndicatorsRequest": StopTypingIndicatorsRequest, "UpdateAGroupChannelRequest": UpdateAGroupChannelRequest, + "ViewNumberOfDailyActiveUsersResponse": ViewNumberOfDailyActiveUsersResponse, + "ViewNumberOfMonthlyActiveUsersResponse": ViewNumberOfMonthlyActiveUsersResponse, } export class ObjectSerializer { diff --git a/models/RegisterOperatorsToAGroupChannelRequest.ts b/models/RegisterOperatorsToAGroupChannelRequest.ts new file mode 100644 index 0000000..b95a10b --- /dev/null +++ b/models/RegisterOperatorsToAGroupChannelRequest.ts @@ -0,0 +1,35 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class RegisterOperatorsToAGroupChannelRequest { + 'operatorIds': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "operatorIds", + "baseName": "operator_ids", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return RegisterOperatorsToAGroupChannelRequest.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/ResetChatHistoryRequest.ts b/models/ResetChatHistoryRequest.ts new file mode 100644 index 0000000..f9e753c --- /dev/null +++ b/models/ResetChatHistoryRequest.ts @@ -0,0 +1,42 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ResetChatHistoryRequest { + 'resetAll'?: boolean; + 'userId'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "resetAll", + "baseName": "reset_all", + "type": "boolean", + "format": "" + }, + { + "name": "userId", + "baseName": "user_id", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ResetChatHistoryRequest.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/ResetChatHistoryResponse.ts b/models/ResetChatHistoryResponse.ts new file mode 100644 index 0000000..a05c746 --- /dev/null +++ b/models/ResetChatHistoryResponse.ts @@ -0,0 +1,38 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ResetChatHistoryResponse { + /** + * The timestamp in Unix milliseconds indicating the point in time that determines when the user can view messages in a specific channel. Messages sent on or before this timestamp can't be viewed by the user. + */ + 'tsMessageOffset'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "tsMessageOffset", + "baseName": "ts_message_offset", + "type": "number", + "format": "int64" + } ]; + + static getAttributeTypeMap() { + return ResetChatHistoryResponse.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/ViewNumberOfDailyActiveUsersResponse.ts b/models/ViewNumberOfDailyActiveUsersResponse.ts new file mode 100644 index 0000000..2705846 --- /dev/null +++ b/models/ViewNumberOfDailyActiveUsersResponse.ts @@ -0,0 +1,35 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ViewNumberOfDailyActiveUsersResponse { + 'dau'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "dau", + "baseName": "dau", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ViewNumberOfDailyActiveUsersResponse.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/ViewNumberOfMonthlyActiveUsersResponse.ts b/models/ViewNumberOfMonthlyActiveUsersResponse.ts new file mode 100644 index 0000000..f99170d --- /dev/null +++ b/models/ViewNumberOfMonthlyActiveUsersResponse.ts @@ -0,0 +1,35 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ViewNumberOfMonthlyActiveUsersResponse { + 'mau'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "mau", + "baseName": "mau", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ViewNumberOfMonthlyActiveUsersResponse.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/all.ts b/models/all.ts index 0736977..55ba0e7 100644 --- a/models/all.ts +++ b/models/all.ts @@ -1,11 +1,20 @@ export * from './AcceptAnInvitationRequest' +export * from './CheckIfMemberResponse' export * from './CreateAGroupChannelRequest' +export * from './FreezeAGroupChannelRequest' +export * from './GroupChannelListMembersResponse' export * from './GroupChatListChannelsResponse' export * from './HideAChannelRequest' export * from './InviteAsMembersRequest' export * from './InviteAsMembersResponse' export * from './InviteAsMembersResponseAllOf' export * from './JoinAChannelRequest' +export * from './LeaveAChannelRequest' +export * from './ListOperatorsResponse' +export * from './MarkAllMessagesAsReadRequest' +export * from './RegisterOperatorsToAGroupChannelRequest' +export * from './ResetChatHistoryRequest' +export * from './ResetChatHistoryResponse' export * from './SendbirdBasicUserInfo' export * from './SendbirdDisappearingMessage' export * from './SendbirdFile' @@ -24,3 +33,5 @@ export * from './SendbirdUser' export * from './StartTypingIndicatorsRequest' export * from './StopTypingIndicatorsRequest' export * from './UpdateAGroupChannelRequest' +export * from './ViewNumberOfDailyActiveUsersResponse' +export * from './ViewNumberOfMonthlyActiveUsersResponse' diff --git a/types/ObjectParamAPI.ts b/types/ObjectParamAPI.ts index e959b59..808f4c8 100644 --- a/types/ObjectParamAPI.ts +++ b/types/ObjectParamAPI.ts @@ -3,13 +3,22 @@ import * as models from '../models/all'; import { Configuration} from '../configuration' import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; +import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; +import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest'; +import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; import { InviteAsMembersResponse } from '../models/InviteAsMembersResponse'; import { InviteAsMembersResponseAllOf } from '../models/InviteAsMembersResponseAllOf'; import { JoinAChannelRequest } from '../models/JoinAChannelRequest'; +import { LeaveAChannelRequest } from '../models/LeaveAChannelRequest'; +import { ListOperatorsResponse } from '../models/ListOperatorsResponse'; +import { MarkAllMessagesAsReadRequest } from '../models/MarkAllMessagesAsReadRequest'; +import { RegisterOperatorsToAGroupChannelRequest } from '../models/RegisterOperatorsToAGroupChannelRequest'; +import { ResetChatHistoryRequest } from '../models/ResetChatHistoryRequest'; +import { ResetChatHistoryResponse } from '../models/ResetChatHistoryResponse'; import { SendbirdBasicUserInfo } from '../models/SendbirdBasicUserInfo'; import { SendbirdDisappearingMessage } from '../models/SendbirdDisappearingMessage'; import { SendbirdFile } from '../models/SendbirdFile'; @@ -28,6 +37,8 @@ import { SendbirdUser } from '../models/SendbirdUser'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from '../models/UpdateAGroupChannelRequest'; +import { ViewNumberOfDailyActiveUsersResponse } from '../models/ViewNumberOfDailyActiveUsersResponse'; +import { ViewNumberOfMonthlyActiveUsersResponse } from '../models/ViewNumberOfMonthlyActiveUsersResponse'; import { ObservableGroupChannelApi } from "./ObservableAPI"; import { GroupChannelApiRequestFactory, GroupChannelApiResponseProcessor} from "../apis/GroupChannelApi"; @@ -53,6 +64,54 @@ export interface GroupChannelApiAcceptAnInvitationRequest { acceptAnInvitationRequest?: AcceptAnInvitationRequest } +export interface GroupChannelApiCancelTheRegistrationOfOperatorsRequest { + /** + * (Required) + * @type string + * @memberof GroupChannelApicancelTheRegistrationOfOperators + */ + channelUrl: string + /** + * Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. + * @type string + * @memberof GroupChannelApicancelTheRegistrationOfOperators + */ + operatorIds: string + /** + * + * @type string + * @memberof GroupChannelApicancelTheRegistrationOfOperators + */ + deleteAll?: string + /** + * + * @type string + * @memberof GroupChannelApicancelTheRegistrationOfOperators + */ + apiToken?: string +} + +export interface GroupChannelApiCheckIfMemberRequest { + /** + * (Required) + * @type string + * @memberof GroupChannelApicheckIfMember + */ + channelUrl: string + /** + * (Required) + * @type string + * @memberof GroupChannelApicheckIfMember + */ + userId: string + /** + * + * @type string + * @memberof GroupChannelApicheckIfMember + */ + apiToken?: string +} + export interface GroupChannelApiCreateAGroupChannelRequest { /** * @@ -185,6 +244,27 @@ export interface GroupChannelApiJoinAChannelRequest { joinAChannelRequest?: JoinAChannelRequest } +export interface GroupChannelApiLeaveAChannelRequest { + /** + * + * @type string + * @memberof GroupChannelApileaveAChannel + */ + channelUrl: string + /** + * + * @type string + * @memberof GroupChannelApileaveAChannel + */ + apiToken?: string + /** + * + * @type LeaveAChannelRequest + * @memberof GroupChannelApileaveAChannel + */ + leaveAChannelRequest?: LeaveAChannelRequest +} + export interface GroupChannelApiListChannelsRequest { /** * @@ -446,6 +526,168 @@ export interface GroupChannelApiListChannelsRequest { userId?: string } +export interface GroupChannelApiListMembersRequest { + /** + * (Required) + * @type string + * @memberof GroupChannelApilistMembers + */ + channelUrl: string + /** + * + * @type string + * @memberof GroupChannelApilistMembers + */ + token?: string + /** + * Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) + * @type number + * @memberof GroupChannelApilistMembers + */ + limit?: number + /** + * Specifies the unique ID of a user. If `user_id` is provided, the response will include two additional boolean properties about each user in the members list. - `is_blocking_me`: Indicates whether the listed user is blocking the user specified in the user_id parameter. - `is_blocked_by_me`: Indicates whether the listed user is blocked by the user specified in the user_id parameter. + * @type string + * @memberof GroupChannelApilistMembers + */ + userId?: string + /** + * + * @type boolean + * @memberof GroupChannelApilistMembers + */ + showDeliveryReceipt?: boolean + /** + * + * @type boolean + * @memberof GroupChannelApilistMembers + */ + showReadReceipt?: boolean + /** + * + * @type boolean + * @memberof GroupChannelApilistMembers + */ + showMemberIsMuted?: boolean + /** + * Specifies the method to sort a list of results. Acceptable values are the following: - `member_nickname_alphabetical` (default): sorts by the member nicknames in alphabetical order. - `operator_then_member_alphabetical`: sorts by the operational role and member nickname in alphabetical order where channel operators are listed before channel members. + * @type 'member_nickname_alphabetical' | 'operator_then_member_alphabetical' + * @memberof GroupChannelApilistMembers + */ + order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical' + /** + * Restricts the search scope to only retrieve operators or non-operator members of the channel. Acceptable values are the following: - `all` (default): no filter is applied to the list. - `operator`: only channel operators are retrieved. - `nonoperator`: all channel members, except channel operators, are retrieved. + * @type 'all' | 'operator' | 'nonoperator' + * @memberof GroupChannelApilistMembers + */ + operatorFilter?: 'all' | 'operator' | 'nonoperator' + /** + * Restricts the search scope to retrieve members based on if they have accepted an invitation or if they were invited by a friend. Acceptable values are `invited_only`, `joined_only`, `invited_by_friend`, `invited_by_non_friend`, and `all`. (Default: `all`) + * @type 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend' + * @memberof GroupChannelApilistMembers + */ + memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend' + /** + * Restricts the search scope to retrieve members who are muted or unmuted in the channel. Acceptable values are `all`, `muted`, and `unmuted`. (Default: `all`) + * @type 'all' | 'muted' | 'unmuted' + * @memberof GroupChannelApilistMembers + */ + mutedMemberFilter?: 'all' | 'muted' | 'unmuted' + /** + * Restricts the search scope to retrieve members who are activated or deactivated in the channel. Acceptable values are `all`, `activated`, and `deactivated`. (default: `activated`) + * @type 'activated' | 'deactivated' + * @memberof GroupChannelApilistMembers + */ + memberActiveModeFilter?: 'activated' | 'deactivated' + /** + * Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. + * @type string + * @memberof GroupChannelApilistMembers + */ + nicknameStartswith?: string + /** + * Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) + * @type 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false' + * @memberof GroupChannelApilistMembers + */ + includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false' + /** + * + * @type string + * @memberof GroupChannelApilistMembers + */ + apiToken?: string +} + +export interface GroupChannelApiListOperatorsRequest { + /** + * (Required) + * @type string + * @memberof GroupChannelApilistOperators + */ + channelUrl: string + /** + * + * @type string + * @memberof GroupChannelApilistOperators + */ + token?: string + /** + * Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) + * @type number + * @memberof GroupChannelApilistOperators + */ + limit?: number + /** + * + * @type string + * @memberof GroupChannelApilistOperators + */ + apiToken?: string +} + +export interface GroupChannelApiRegisterOperatorsToAGroupChannelRequest { + /** + * (Required) + * @type string + * @memberof GroupChannelApiregisterOperatorsToAGroupChannel + */ + channelUrl: string + /** + * + * @type string + * @memberof GroupChannelApiregisterOperatorsToAGroupChannel + */ + apiToken?: string + /** + * + * @type RegisterOperatorsToAGroupChannelRequest + * @memberof GroupChannelApiregisterOperatorsToAGroupChannel + */ + registerOperatorsToAGroupChannelRequest?: RegisterOperatorsToAGroupChannelRequest +} + +export interface GroupChannelApiResetChatHistoryRequest { + /** + * (Required) + * @type string + * @memberof GroupChannelApiresetChatHistory + */ + channelUrl: string + /** + * + * @type string + * @memberof GroupChannelApiresetChatHistory + */ + apiToken?: string + /** + * + * @type ResetChatHistoryRequest + * @memberof GroupChannelApiresetChatHistory + */ + resetChatHistoryRequest?: ResetChatHistoryRequest +} + export interface GroupChannelApiStartTypingIndicatorsRequest { /** * (Required) @@ -552,6 +794,24 @@ export class ObjectGroupChannelApi { return this.api.acceptAnInvitation(param.channelUrl, param.apiToken, param.acceptAnInvitationRequest, options).toPromise(); } + /** + * ## Unregister operators from a group channel You can unregister operators in a group channel but keep them in the channel as members using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/unregister-operators-from-a-group-channel#1-unregister-operators-from-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to cancel the registration of operators. + * Cancel the registration of operators + * @param param the request object + */ + public cancelTheRegistrationOfOperators(param: GroupChannelApiCancelTheRegistrationOfOperatorsRequest, options?: Configuration): Promise { + return this.api.cancelTheRegistrationOfOperators(param.channelUrl, param.operatorIds, param.deleteAll, param.apiToken, options).toPromise(); + } + + /** + * ## Check if user is a member Checks if a user is a member of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member) + * Check if member + * @param param the request object + */ + public checkIfMember(param: GroupChannelApiCheckIfMemberRequest, options?: Configuration): Promise { + return this.api.checkIfMember(param.channelUrl, param.userId, param.apiToken, options).toPromise(); + } + /** * ## Create a group channel You can create a group channel for 1-to-1 and 1-to-N conversations. By default, group channels are used for conversations between up to 100 members. This number can stretch up to tens of thousands in Supergroup channels. Group channels can either be private and invite only, or public. They support typing indicators, unread count and read receipts, allowing for an interactive chat experience. A user can join up to 2000 group channels, and higher numbers would negatively impact the performance for the end user. The Chat history is turned off by default and its settings can be changed on Sendbird Dashboard by going to Settings > Chat > Channels > Group channels > Chat history. To learn more about group channels, see Channel Overview. > If you are seeing the error message Maximum \"channel join\" count reached., then consider deleting channels that are no longer used. For situations where an agent connects with many customers such as support, delivery logistics or sales, we recommend using Sendbird Desk. https://sendbird.com/docs/chat/platform-api/v3/channel/creating-a-channel/create-a-group-channel#1-create-a-group-channel * Create a group channel @@ -606,6 +866,15 @@ export class ObjectGroupChannelApi { return this.api.joinAChannel(param.channelUrl, param.apiToken, param.joinAChannelRequest, options).toPromise(); } + /** + * ## Leave a channel Makes one or more members leave a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-leave-a-channel ---------------------------- + * Leave a channel + * @param param the request object + */ + public leaveAChannel(param: GroupChannelApiLeaveAChannelRequest, options?: Configuration): Promise { + return this.api.leaveAChannel(param.channelUrl, param.apiToken, param.leaveAChannelRequest, options).toPromise(); + } + /** * ## List group channels This action retrieves a list of [group channels](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel). You can use various query parameters to determine the search scope and select what kind of information you want to receive about the queried channels. If you want to retrieve a list of group channels that a specific user has joined, use the [list group channels by user](https://sendbird.com/docs/chat/platform-api/v3/user/managing-joined-group-channels/list-group-channels-by-user) action under the User section. https://sendbird.com/docs/chat/platform-api/v3/channel/listing-channels-in-an-application/list-group-channels#1-list-group-channels * List channels @@ -615,6 +884,42 @@ export class ObjectGroupChannelApi { return this.api.listChannels(param.apiToken, param.token, param.limit, param.distinctMode, param.publicMode, param.superMode, param.createdAfter, param.createdBefore, param.showEmpty, param.showMember, param.showDeliveryReceipt, param.showReadReceipt, param.showMetadata, param.showFrozen, param.order, param.metadataOrderKey, param.customTypes, param.customTypeStartswith, param.channelUrls, param.name, param.nameContains, param.nameStartswith, param.membersExactlyIn, param.membersIncludeIn, param.queryType, param.membersNickname, param.membersNicknameContains, param.metadataKey, param.metadataValues, param.metadataValueStartswith, param.metacounterKey, param.metacounterValues, param.metacounterValueGt, param.metacounterValueGte, param.metacounterValueLt, param.metacounterValueLte, param.includeSortedMetaarrayInLastMessage, param.customType, param.readReceipt, param.member, param.isDistinct, param.membersIn, param.userId, options).toPromise(); } + /** + * ## List members Retrieves a list of members of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel) `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of members of. + * List members + * @param param the request object + */ + public listMembers(param: GroupChannelApiListMembersRequest, options?: Configuration): Promise { + return this.api.listMembers(param.channelUrl, param.token, param.limit, param.userId, param.showDeliveryReceipt, param.showReadReceipt, param.showMemberIsMuted, param.order, param.operatorFilter, param.memberStateFilter, param.mutedMemberFilter, param.memberActiveModeFilter, param.nicknameStartswith, param.includePushPreference, param.apiToken, options).toPromise(); + } + + /** + * ## List operators You can retrieve a list of operators of a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/list-operators-of-a-group-channel#1-list-operators-of-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of operators. + * List operators + * @param param the request object + */ + public listOperators(param: GroupChannelApiListOperatorsRequest, options?: Configuration): Promise { + return this.api.listOperators(param.channelUrl, param.token, param.limit, param.apiToken, options).toPromise(); + } + + /** + * ## Register operators to a group channel You can register one or more operators to a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/register-operators-to-a-group-channel#1-register-operators-to-a-group-channel + * Register operators to a group channel + * @param param the request object + */ + public registerOperatorsToAGroupChannel(param: GroupChannelApiRegisterOperatorsToAGroupChannelRequest, options?: Configuration): Promise { + return this.api.registerOperatorsToAGroupChannel(param.channelUrl, param.apiToken, param.registerOperatorsToAGroupChannelRequest, options).toPromise(); + } + + /** + * ## Reset chat history This action resets the properties related to a specific user's chat history in a [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel), clearing existing messages in a channel from only the specified user's end. Because this action doesn't delete messages from the Sendbird database, other members in the channel can still retrieve and see the messages. This action clears the messages for the specified user by updating the `last_message` and `read_receipt` properties of the [group channel resource](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#4-list-of-properties-for-group-channels) in addition to other internally managed data such as the count of a user's unread messages. Using the `reset_all` property, you can also reset the properties related to the chat history of all members in a group channel. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/reset-chat-history#1-reset-chat-history + * Reset chat history + * @param param the request object + */ + public resetChatHistory(param: GroupChannelApiResetChatHistoryRequest, options?: Configuration): Promise { + return this.api.resetChatHistory(param.channelUrl, param.apiToken, param.resetChatHistoryRequest, options).toPromise(); + } + /** * ## Start typing indicators You can start showing a typing indicator using this API. Seeing whether other users are typing can help a more interactive conversation environment by showing real-time engagement of other users. If you're looking for an easy way to show typing indicators on your app, check out Sendbird UIKit for a ready-to-use UI feature that can be customized to fit your needs. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-typing-indicators/start-typing-indicators#1-start-typing-indicators `channel_url` Type: string Description: Specifies the URL of the channel to set typing indicators. * Start typing indicators @@ -652,3 +957,147 @@ export class ObjectGroupChannelApi { } } + +import { ObservableModerationApi } from "./ObservableAPI"; +import { ModerationApiRequestFactory, ModerationApiResponseProcessor} from "../apis/ModerationApi"; + +export interface ModerationApiFreezeAGroupChannelRequest { + /** + * (Required) + * @type string + * @memberof ModerationApifreezeAGroupChannel + */ + channelUrl: string + /** + * + * @type string + * @memberof ModerationApifreezeAGroupChannel + */ + apiToken?: string + /** + * + * @type FreezeAGroupChannelRequest + * @memberof ModerationApifreezeAGroupChannel + */ + freezeAGroupChannelRequest?: FreezeAGroupChannelRequest +} + +export class ObjectModerationApi { + private api: ObservableModerationApi + + public constructor(configuration: Configuration, requestFactory?: ModerationApiRequestFactory, responseProcessor?: ModerationApiResponseProcessor) { + this.api = new ObservableModerationApi(configuration, requestFactory, responseProcessor); + } + + /** + * ## Freeze a group channel Freezes or unfreezes a group channel. > **Note**: To learn more about other available moderation tools, see [Moderation Overview](https://sendbird.com/docs/chat/platform-api/v3/moderation/moderation-overview#2-actions). [https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel) + * Freeze a group channel + * @param param the request object + */ + public freezeAGroupChannel(param: ModerationApiFreezeAGroupChannelRequest, options?: Configuration): Promise { + return this.api.freezeAGroupChannel(param.channelUrl, param.apiToken, param.freezeAGroupChannelRequest, options).toPromise(); + } + +} + +import { ObservableStatisticsApi } from "./ObservableAPI"; +import { StatisticsApiRequestFactory, StatisticsApiResponseProcessor} from "../apis/StatisticsApi"; + +export interface StatisticsApiViewNumberOfDailyActiveUsersRequest { + /** + * YYYY-MM-DD + * @type string + * @memberof StatisticsApiviewNumberOfDailyActiveUsers + */ + date?: string + /** + * + * @type string + * @memberof StatisticsApiviewNumberOfDailyActiveUsers + */ + apiToken?: string +} + +export interface StatisticsApiViewNumberOfMonthlyActiveUsersRequest { + /** + * YYYY-MM-DD + * @type string + * @memberof StatisticsApiviewNumberOfMonthlyActiveUsers + */ + date?: string + /** + * + * @type string + * @memberof StatisticsApiviewNumberOfMonthlyActiveUsers + */ + apiToken?: string +} + +export class ObjectStatisticsApi { + private api: ObservableStatisticsApi + + public constructor(configuration: Configuration, requestFactory?: StatisticsApiRequestFactory, responseProcessor?: StatisticsApiResponseProcessor) { + this.api = new ObservableStatisticsApi(configuration, requestFactory, responseProcessor); + } + + /** + * ## View number of daily active users Retrieves the number of daily active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users) + * View number of daily active users + * @param param the request object + */ + public viewNumberOfDailyActiveUsers(param: StatisticsApiViewNumberOfDailyActiveUsersRequest = {}, options?: Configuration): Promise { + return this.api.viewNumberOfDailyActiveUsers(param.date, param.apiToken, options).toPromise(); + } + + /** + * ## View number of monthly active users Retrieves the number of monthly active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users) + * View number of monthly active users + * @param param the request object + */ + public viewNumberOfMonthlyActiveUsers(param: StatisticsApiViewNumberOfMonthlyActiveUsersRequest = {}, options?: Configuration): Promise { + return this.api.viewNumberOfMonthlyActiveUsers(param.date, param.apiToken, options).toPromise(); + } + +} + +import { ObservableUserApi } from "./ObservableAPI"; +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; + +export interface UserApiMarkAllMessagesAsReadRequest { + /** + * (Required) + * @type string + * @memberof UserApimarkAllMessagesAsRead + */ + userId: string + /** + * + * @type string + * @memberof UserApimarkAllMessagesAsRead + */ + apiToken?: string + /** + * + * @type MarkAllMessagesAsReadRequest + * @memberof UserApimarkAllMessagesAsRead + */ + markAllMessagesAsReadRequest?: MarkAllMessagesAsReadRequest +} + +export class ObjectUserApi { + private api: ObservableUserApi + + public constructor(configuration: Configuration, requestFactory?: UserApiRequestFactory, responseProcessor?: UserApiResponseProcessor) { + this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); + } + + /** + * ## Mark all messages as read This action marks all of a user's unread messages as read in certain group channels. If channels aren't specified, the user's unread messages in all group channels are marked as read. https://sendbird.com/docs/chat/platform-api/v3/user/marking-messages-as-read/mark-all-of-a-users-messages-as-read#1-mark-all-of-a-user-s-messages-as-read + * Mark all messages as read + * @param param the request object + */ + public markAllMessagesAsRead(param: UserApiMarkAllMessagesAsReadRequest, options?: Configuration): Promise { + return this.api.markAllMessagesAsRead(param.userId, param.apiToken, param.markAllMessagesAsReadRequest, options).toPromise(); + } + +} diff --git a/types/ObservableAPI.ts b/types/ObservableAPI.ts index b7eb934..10bc472 100644 --- a/types/ObservableAPI.ts +++ b/types/ObservableAPI.ts @@ -4,13 +4,22 @@ import { Configuration} from '../configuration' import { Observable, of, from } from '../rxjsStub'; import {mergeMap, map} from '../rxjsStub'; import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; +import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; +import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest'; +import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; import { InviteAsMembersResponse } from '../models/InviteAsMembersResponse'; import { InviteAsMembersResponseAllOf } from '../models/InviteAsMembersResponseAllOf'; import { JoinAChannelRequest } from '../models/JoinAChannelRequest'; +import { LeaveAChannelRequest } from '../models/LeaveAChannelRequest'; +import { ListOperatorsResponse } from '../models/ListOperatorsResponse'; +import { MarkAllMessagesAsReadRequest } from '../models/MarkAllMessagesAsReadRequest'; +import { RegisterOperatorsToAGroupChannelRequest } from '../models/RegisterOperatorsToAGroupChannelRequest'; +import { ResetChatHistoryRequest } from '../models/ResetChatHistoryRequest'; +import { ResetChatHistoryResponse } from '../models/ResetChatHistoryResponse'; import { SendbirdBasicUserInfo } from '../models/SendbirdBasicUserInfo'; import { SendbirdDisappearingMessage } from '../models/SendbirdDisappearingMessage'; import { SendbirdFile } from '../models/SendbirdFile'; @@ -29,6 +38,8 @@ import { SendbirdUser } from '../models/SendbirdUser'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from '../models/UpdateAGroupChannelRequest'; +import { ViewNumberOfDailyActiveUsersResponse } from '../models/ViewNumberOfDailyActiveUsersResponse'; +import { ViewNumberOfMonthlyActiveUsersResponse } from '../models/ViewNumberOfMonthlyActiveUsersResponse'; import { GroupChannelApiRequestFactory, GroupChannelApiResponseProcessor} from "../apis/GroupChannelApi"; export class ObservableGroupChannelApi { @@ -72,6 +83,59 @@ export class ObservableGroupChannelApi { })); } + /** + * ## Unregister operators from a group channel You can unregister operators in a group channel but keep them in the channel as members using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/unregister-operators-from-a-group-channel#1-unregister-operators-from-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to cancel the registration of operators. + * Cancel the registration of operators + * @param channelUrl (Required) + * @param operatorIds Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. + * @param deleteAll + * @param apiToken + */ + public cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: string, apiToken?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.cancelTheRegistrationOfOperators(channelUrl, operatorIds, deleteAll, apiToken, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.cancelTheRegistrationOfOperators(rsp))); + })); + } + + /** + * ## Check if user is a member Checks if a user is a member of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member) + * Check if member + * @param channelUrl (Required) + * @param userId (Required) + * @param apiToken + */ + public checkIfMember(channelUrl: string, userId: string, apiToken?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.checkIfMember(channelUrl, userId, apiToken, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.checkIfMember(rsp))); + })); + } + /** * ## Create a group channel You can create a group channel for 1-to-1 and 1-to-N conversations. By default, group channels are used for conversations between up to 100 members. This number can stretch up to tens of thousands in Supergroup channels. Group channels can either be private and invite only, or public. They support typing indicators, unread count and read receipts, allowing for an interactive chat experience. A user can join up to 2000 group channels, and higher numbers would negatively impact the performance for the end user. The Chat history is turned off by default and its settings can be changed on Sendbird Dashboard by going to Settings > Chat > Channels > Group channels > Chat history. To learn more about group channels, see Channel Overview. > If you are seeing the error message Maximum \"channel join\" count reached., then consider deleting channels that are no longer used. For situations where an agent connects with many customers such as support, delivery logistics or sales, we recommend using Sendbird Desk. https://sendbird.com/docs/chat/platform-api/v3/channel/creating-a-channel/create-a-group-channel#1-create-a-group-channel * Create a group channel @@ -229,6 +293,32 @@ export class ObservableGroupChannelApi { })); } + /** + * ## Leave a channel Makes one or more members leave a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-leave-a-channel ---------------------------- + * Leave a channel + * @param channelUrl + * @param apiToken + * @param leaveAChannelRequest + */ + public leaveAChannel(channelUrl: string, apiToken?: string, leaveAChannelRequest?: LeaveAChannelRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.leaveAChannel(channelUrl, apiToken, leaveAChannelRequest, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.leaveAChannel(rsp))); + })); + } + /** * ## List group channels This action retrieves a list of [group channels](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel). You can use various query parameters to determine the search scope and select what kind of information you want to receive about the queried channels. If you want to retrieve a list of group channels that a specific user has joined, use the [list group channels by user](https://sendbird.com/docs/chat/platform-api/v3/user/managing-joined-group-channels/list-group-channels-by-user) action under the User section. https://sendbird.com/docs/chat/platform-api/v3/channel/listing-channels-in-an-application/list-group-channels#1-list-group-channels * List channels @@ -295,6 +385,123 @@ export class ObservableGroupChannelApi { })); } + /** + * ## List members Retrieves a list of members of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel) `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of members of. + * List members + * @param channelUrl (Required) + * @param token + * @param limit Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) + * @param userId Specifies the unique ID of a user. If `user_id` is provided, the response will include two additional boolean properties about each user in the members list. - `is_blocking_me`: Indicates whether the listed user is blocking the user specified in the user_id parameter. - `is_blocked_by_me`: Indicates whether the listed user is blocked by the user specified in the user_id parameter. + * @param showDeliveryReceipt + * @param showReadReceipt + * @param showMemberIsMuted + * @param order Specifies the method to sort a list of results. Acceptable values are the following: - `member_nickname_alphabetical` (default): sorts by the member nicknames in alphabetical order. - `operator_then_member_alphabetical`: sorts by the operational role and member nickname in alphabetical order where channel operators are listed before channel members. + * @param operatorFilter Restricts the search scope to only retrieve operators or non-operator members of the channel. Acceptable values are the following: - `all` (default): no filter is applied to the list. - `operator`: only channel operators are retrieved. - `nonoperator`: all channel members, except channel operators, are retrieved. + * @param memberStateFilter Restricts the search scope to retrieve members based on if they have accepted an invitation or if they were invited by a friend. Acceptable values are `invited_only`, `joined_only`, `invited_by_friend`, `invited_by_non_friend`, and `all`. (Default: `all`) + * @param mutedMemberFilter Restricts the search scope to retrieve members who are muted or unmuted in the channel. Acceptable values are `all`, `muted`, and `unmuted`. (Default: `all`) + * @param memberActiveModeFilter Restricts the search scope to retrieve members who are activated or deactivated in the channel. Acceptable values are `all`, `activated`, and `deactivated`. (default: `activated`) + * @param nicknameStartswith Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. + * @param includePushPreference Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) + * @param apiToken + */ + public listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false', apiToken?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.listMembers(channelUrl, token, limit, userId, showDeliveryReceipt, showReadReceipt, showMemberIsMuted, order, operatorFilter, memberStateFilter, mutedMemberFilter, memberActiveModeFilter, nicknameStartswith, includePushPreference, apiToken, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.listMembers(rsp))); + })); + } + + /** + * ## List operators You can retrieve a list of operators of a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/list-operators-of-a-group-channel#1-list-operators-of-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of operators. + * List operators + * @param channelUrl (Required) + * @param token + * @param limit Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) + * @param apiToken + */ + public listOperators(channelUrl: string, token?: string, limit?: number, apiToken?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.listOperators(channelUrl, token, limit, apiToken, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.listOperators(rsp))); + })); + } + + /** + * ## Register operators to a group channel You can register one or more operators to a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/register-operators-to-a-group-channel#1-register-operators-to-a-group-channel + * Register operators to a group channel + * @param channelUrl (Required) + * @param apiToken + * @param registerOperatorsToAGroupChannelRequest + */ + public registerOperatorsToAGroupChannel(channelUrl: string, apiToken?: string, registerOperatorsToAGroupChannelRequest?: RegisterOperatorsToAGroupChannelRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.registerOperatorsToAGroupChannel(channelUrl, apiToken, registerOperatorsToAGroupChannelRequest, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.registerOperatorsToAGroupChannel(rsp))); + })); + } + + /** + * ## Reset chat history This action resets the properties related to a specific user's chat history in a [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel), clearing existing messages in a channel from only the specified user's end. Because this action doesn't delete messages from the Sendbird database, other members in the channel can still retrieve and see the messages. This action clears the messages for the specified user by updating the `last_message` and `read_receipt` properties of the [group channel resource](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#4-list-of-properties-for-group-channels) in addition to other internally managed data such as the count of a user's unread messages. Using the `reset_all` property, you can also reset the properties related to the chat history of all members in a group channel. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/reset-chat-history#1-reset-chat-history + * Reset chat history + * @param channelUrl (Required) + * @param apiToken + * @param resetChatHistoryRequest + */ + public resetChatHistory(channelUrl: string, apiToken?: string, resetChatHistoryRequest?: ResetChatHistoryRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.resetChatHistory(channelUrl, apiToken, resetChatHistoryRequest, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.resetChatHistory(rsp))); + })); + } + /** * ## Start typing indicators You can start showing a typing indicator using this API. Seeing whether other users are typing can help a more interactive conversation environment by showing real-time engagement of other users. If you're looking for an easy way to show typing indicators on your app, check out Sendbird UIKit for a ready-to-use UI feature that can be customized to fit your needs. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-typing-indicators/start-typing-indicators#1-start-typing-indicators `channel_url` Type: string Description: Specifies the URL of the channel to set typing indicators. * Start typing indicators @@ -401,3 +608,159 @@ export class ObservableGroupChannelApi { } } + +import { ModerationApiRequestFactory, ModerationApiResponseProcessor} from "../apis/ModerationApi"; +export class ObservableModerationApi { + private requestFactory: ModerationApiRequestFactory; + private responseProcessor: ModerationApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: ModerationApiRequestFactory, + responseProcessor?: ModerationApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new ModerationApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new ModerationApiResponseProcessor(); + } + + /** + * ## Freeze a group channel Freezes or unfreezes a group channel. > **Note**: To learn more about other available moderation tools, see [Moderation Overview](https://sendbird.com/docs/chat/platform-api/v3/moderation/moderation-overview#2-actions). [https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel) + * Freeze a group channel + * @param channelUrl (Required) + * @param apiToken + * @param freezeAGroupChannelRequest + */ + public freezeAGroupChannel(channelUrl: string, apiToken?: string, freezeAGroupChannelRequest?: FreezeAGroupChannelRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.freezeAGroupChannel(channelUrl, apiToken, freezeAGroupChannelRequest, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.freezeAGroupChannel(rsp))); + })); + } + +} + +import { StatisticsApiRequestFactory, StatisticsApiResponseProcessor} from "../apis/StatisticsApi"; +export class ObservableStatisticsApi { + private requestFactory: StatisticsApiRequestFactory; + private responseProcessor: StatisticsApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: StatisticsApiRequestFactory, + responseProcessor?: StatisticsApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new StatisticsApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new StatisticsApiResponseProcessor(); + } + + /** + * ## View number of daily active users Retrieves the number of daily active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users) + * View number of daily active users + * @param date YYYY-MM-DD + * @param apiToken + */ + public viewNumberOfDailyActiveUsers(date?: string, apiToken?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.viewNumberOfDailyActiveUsers(date, apiToken, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.viewNumberOfDailyActiveUsers(rsp))); + })); + } + + /** + * ## View number of monthly active users Retrieves the number of monthly active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users) + * View number of monthly active users + * @param date YYYY-MM-DD + * @param apiToken + */ + public viewNumberOfMonthlyActiveUsers(date?: string, apiToken?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.viewNumberOfMonthlyActiveUsers(date, apiToken, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.viewNumberOfMonthlyActiveUsers(rsp))); + })); + } + +} + +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +export class ObservableUserApi { + private requestFactory: UserApiRequestFactory; + private responseProcessor: UserApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: UserApiRequestFactory, + responseProcessor?: UserApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new UserApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new UserApiResponseProcessor(); + } + + /** + * ## Mark all messages as read This action marks all of a user's unread messages as read in certain group channels. If channels aren't specified, the user's unread messages in all group channels are marked as read. https://sendbird.com/docs/chat/platform-api/v3/user/marking-messages-as-read/mark-all-of-a-users-messages-as-read#1-mark-all-of-a-user-s-messages-as-read + * Mark all messages as read + * @param userId (Required) + * @param apiToken + * @param markAllMessagesAsReadRequest + */ + public markAllMessagesAsRead(userId: string, apiToken?: string, markAllMessagesAsReadRequest?: MarkAllMessagesAsReadRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.markAllMessagesAsRead(userId, apiToken, markAllMessagesAsReadRequest, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (let middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (let middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.markAllMessagesAsRead(rsp))); + })); + } + +} diff --git a/types/PromiseAPI.ts b/types/PromiseAPI.ts index f37aff1..2d35dee 100644 --- a/types/PromiseAPI.ts +++ b/types/PromiseAPI.ts @@ -3,13 +3,22 @@ import * as models from '../models/all'; import { Configuration} from '../configuration' import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; +import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; +import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest'; +import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; import { InviteAsMembersRequest } from '../models/InviteAsMembersRequest'; import { InviteAsMembersResponse } from '../models/InviteAsMembersResponse'; import { InviteAsMembersResponseAllOf } from '../models/InviteAsMembersResponseAllOf'; import { JoinAChannelRequest } from '../models/JoinAChannelRequest'; +import { LeaveAChannelRequest } from '../models/LeaveAChannelRequest'; +import { ListOperatorsResponse } from '../models/ListOperatorsResponse'; +import { MarkAllMessagesAsReadRequest } from '../models/MarkAllMessagesAsReadRequest'; +import { RegisterOperatorsToAGroupChannelRequest } from '../models/RegisterOperatorsToAGroupChannelRequest'; +import { ResetChatHistoryRequest } from '../models/ResetChatHistoryRequest'; +import { ResetChatHistoryResponse } from '../models/ResetChatHistoryResponse'; import { SendbirdBasicUserInfo } from '../models/SendbirdBasicUserInfo'; import { SendbirdDisappearingMessage } from '../models/SendbirdDisappearingMessage'; import { SendbirdFile } from '../models/SendbirdFile'; @@ -28,6 +37,8 @@ import { SendbirdUser } from '../models/SendbirdUser'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from '../models/UpdateAGroupChannelRequest'; +import { ViewNumberOfDailyActiveUsersResponse } from '../models/ViewNumberOfDailyActiveUsersResponse'; +import { ViewNumberOfMonthlyActiveUsersResponse } from '../models/ViewNumberOfMonthlyActiveUsersResponse'; import { ObservableGroupChannelApi } from './ObservableAPI'; import { GroupChannelApiRequestFactory, GroupChannelApiResponseProcessor} from "../apis/GroupChannelApi"; @@ -54,6 +65,31 @@ export class PromiseGroupChannelApi { return result.toPromise(); } + /** + * ## Unregister operators from a group channel You can unregister operators in a group channel but keep them in the channel as members using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/unregister-operators-from-a-group-channel#1-unregister-operators-from-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to cancel the registration of operators. + * Cancel the registration of operators + * @param channelUrl (Required) + * @param operatorIds Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. + * @param deleteAll + * @param apiToken + */ + public cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: string, apiToken?: string, _options?: Configuration): Promise { + const result = this.api.cancelTheRegistrationOfOperators(channelUrl, operatorIds, deleteAll, apiToken, _options); + return result.toPromise(); + } + + /** + * ## Check if user is a member Checks if a user is a member of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/check-if-user-is-a-member#1-check-if-user-is-a-member) + * Check if member + * @param channelUrl (Required) + * @param userId (Required) + * @param apiToken + */ + public checkIfMember(channelUrl: string, userId: string, apiToken?: string, _options?: Configuration): Promise { + const result = this.api.checkIfMember(channelUrl, userId, apiToken, _options); + return result.toPromise(); + } + /** * ## Create a group channel You can create a group channel for 1-to-1 and 1-to-N conversations. By default, group channels are used for conversations between up to 100 members. This number can stretch up to tens of thousands in Supergroup channels. Group channels can either be private and invite only, or public. They support typing indicators, unread count and read receipts, allowing for an interactive chat experience. A user can join up to 2000 group channels, and higher numbers would negatively impact the performance for the end user. The Chat history is turned off by default and its settings can be changed on Sendbird Dashboard by going to Settings > Chat > Channels > Group channels > Chat history. To learn more about group channels, see Channel Overview. > If you are seeing the error message Maximum \"channel join\" count reached., then consider deleting channels that are no longer used. For situations where an agent connects with many customers such as support, delivery logistics or sales, we recommend using Sendbird Desk. https://sendbird.com/docs/chat/platform-api/v3/channel/creating-a-channel/create-a-group-channel#1-create-a-group-channel * Create a group channel @@ -127,6 +163,18 @@ export class PromiseGroupChannelApi { return result.toPromise(); } + /** + * ## Leave a channel Makes one or more members leave a group channel. https://sendbird.com/docs/chat/v3/platform-api/guides/group-channel#2-leave-a-channel ---------------------------- + * Leave a channel + * @param channelUrl + * @param apiToken + * @param leaveAChannelRequest + */ + public leaveAChannel(channelUrl: string, apiToken?: string, leaveAChannelRequest?: LeaveAChannelRequest, _options?: Configuration): Promise { + const result = this.api.leaveAChannel(channelUrl, apiToken, leaveAChannelRequest, _options); + return result.toPromise(); + } + /** * ## List group channels This action retrieves a list of [group channels](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel). You can use various query parameters to determine the search scope and select what kind of information you want to receive about the queried channels. If you want to retrieve a list of group channels that a specific user has joined, use the [list group channels by user](https://sendbird.com/docs/chat/platform-api/v3/user/managing-joined-group-channels/list-group-channels-by-user) action under the User section. https://sendbird.com/docs/chat/platform-api/v3/channel/listing-channels-in-an-application/list-group-channels#1-list-group-channels * List channels @@ -179,6 +227,67 @@ export class PromiseGroupChannelApi { return result.toPromise(); } + /** + * ## List members Retrieves a list of members of a group channel. > **Note**: See [this page](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-open-channel-vs-group-channel-vs-supergroup-channel) to learn more about channel types. [https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/channel/listing-users/list-members-of-a-group-channel#1-list-members-of-a-group-channel) `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of members of. + * List members + * @param channelUrl (Required) + * @param token + * @param limit Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) + * @param userId Specifies the unique ID of a user. If `user_id` is provided, the response will include two additional boolean properties about each user in the members list. - `is_blocking_me`: Indicates whether the listed user is blocking the user specified in the user_id parameter. - `is_blocked_by_me`: Indicates whether the listed user is blocked by the user specified in the user_id parameter. + * @param showDeliveryReceipt + * @param showReadReceipt + * @param showMemberIsMuted + * @param order Specifies the method to sort a list of results. Acceptable values are the following: - `member_nickname_alphabetical` (default): sorts by the member nicknames in alphabetical order. - `operator_then_member_alphabetical`: sorts by the operational role and member nickname in alphabetical order where channel operators are listed before channel members. + * @param operatorFilter Restricts the search scope to only retrieve operators or non-operator members of the channel. Acceptable values are the following: - `all` (default): no filter is applied to the list. - `operator`: only channel operators are retrieved. - `nonoperator`: all channel members, except channel operators, are retrieved. + * @param memberStateFilter Restricts the search scope to retrieve members based on if they have accepted an invitation or if they were invited by a friend. Acceptable values are `invited_only`, `joined_only`, `invited_by_friend`, `invited_by_non_friend`, and `all`. (Default: `all`) + * @param mutedMemberFilter Restricts the search scope to retrieve members who are muted or unmuted in the channel. Acceptable values are `all`, `muted`, and `unmuted`. (Default: `all`) + * @param memberActiveModeFilter Restricts the search scope to retrieve members who are activated or deactivated in the channel. Acceptable values are `all`, `activated`, and `deactivated`. (default: `activated`) + * @param nicknameStartswith Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. + * @param includePushPreference Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) + * @param apiToken + */ + public listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false', apiToken?: string, _options?: Configuration): Promise { + const result = this.api.listMembers(channelUrl, token, limit, userId, showDeliveryReceipt, showReadReceipt, showMemberIsMuted, order, operatorFilter, memberStateFilter, mutedMemberFilter, memberActiveModeFilter, nicknameStartswith, includePushPreference, apiToken, _options); + return result.toPromise(); + } + + /** + * ## List operators You can retrieve a list of operators of a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/list-operators-of-a-group-channel#1-list-operators-of-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to retrieve a list of operators. + * List operators + * @param channelUrl (Required) + * @param token + * @param limit Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10) + * @param apiToken + */ + public listOperators(channelUrl: string, token?: string, limit?: number, apiToken?: string, _options?: Configuration): Promise { + const result = this.api.listOperators(channelUrl, token, limit, apiToken, _options); + return result.toPromise(); + } + + /** + * ## Register operators to a group channel You can register one or more operators to a group channel using this API. https://sendbird.com/docs/chat/platform-api/v3/user/assigning-a-user-role/register-operators-to-a-group-channel#1-register-operators-to-a-group-channel + * Register operators to a group channel + * @param channelUrl (Required) + * @param apiToken + * @param registerOperatorsToAGroupChannelRequest + */ + public registerOperatorsToAGroupChannel(channelUrl: string, apiToken?: string, registerOperatorsToAGroupChannelRequest?: RegisterOperatorsToAGroupChannelRequest, _options?: Configuration): Promise { + const result = this.api.registerOperatorsToAGroupChannel(channelUrl, apiToken, registerOperatorsToAGroupChannelRequest, _options); + return result.toPromise(); + } + + /** + * ## Reset chat history This action resets the properties related to a specific user's chat history in a [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel), clearing existing messages in a channel from only the specified user's end. Because this action doesn't delete messages from the Sendbird database, other members in the channel can still retrieve and see the messages. This action clears the messages for the specified user by updating the `last_message` and `read_receipt` properties of the [group channel resource](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#4-list-of-properties-for-group-channels) in addition to other internally managed data such as the count of a user's unread messages. Using the `reset_all` property, you can also reset the properties related to the chat history of all members in a group channel. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/reset-chat-history#1-reset-chat-history + * Reset chat history + * @param channelUrl (Required) + * @param apiToken + * @param resetChatHistoryRequest + */ + public resetChatHistory(channelUrl: string, apiToken?: string, resetChatHistoryRequest?: ResetChatHistoryRequest, _options?: Configuration): Promise { + const result = this.api.resetChatHistory(channelUrl, apiToken, resetChatHistoryRequest, _options); + return result.toPromise(); + } + /** * ## Start typing indicators You can start showing a typing indicator using this API. Seeing whether other users are typing can help a more interactive conversation environment by showing real-time engagement of other users. If you're looking for an easy way to show typing indicators on your app, check out Sendbird UIKit for a ready-to-use UI feature that can be customized to fit your needs. https://sendbird.com/docs/chat/platform-api/v3/channel/managing-typing-indicators/start-typing-indicators#1-start-typing-indicators `channel_url` Type: string Description: Specifies the URL of the channel to set typing indicators. * Start typing indicators @@ -233,3 +342,106 @@ export class PromiseGroupChannelApi { +import { ObservableModerationApi } from './ObservableAPI'; + +import { ModerationApiRequestFactory, ModerationApiResponseProcessor} from "../apis/ModerationApi"; +export class PromiseModerationApi { + private api: ObservableModerationApi + + public constructor( + configuration: Configuration, + requestFactory?: ModerationApiRequestFactory, + responseProcessor?: ModerationApiResponseProcessor + ) { + this.api = new ObservableModerationApi(configuration, requestFactory, responseProcessor); + } + + /** + * ## Freeze a group channel Freezes or unfreezes a group channel. > **Note**: To learn more about other available moderation tools, see [Moderation Overview](https://sendbird.com/docs/chat/platform-api/v3/moderation/moderation-overview#2-actions). [https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel](https://sendbird.com/docs/chat/platform-api/v3/moderation/freezing-a-channel/freeze-a-group-channel#1-freeze-a-group-channel) + * Freeze a group channel + * @param channelUrl (Required) + * @param apiToken + * @param freezeAGroupChannelRequest + */ + public freezeAGroupChannel(channelUrl: string, apiToken?: string, freezeAGroupChannelRequest?: FreezeAGroupChannelRequest, _options?: Configuration): Promise { + const result = this.api.freezeAGroupChannel(channelUrl, apiToken, freezeAGroupChannelRequest, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableStatisticsApi } from './ObservableAPI'; + +import { StatisticsApiRequestFactory, StatisticsApiResponseProcessor} from "../apis/StatisticsApi"; +export class PromiseStatisticsApi { + private api: ObservableStatisticsApi + + public constructor( + configuration: Configuration, + requestFactory?: StatisticsApiRequestFactory, + responseProcessor?: StatisticsApiResponseProcessor + ) { + this.api = new ObservableStatisticsApi(configuration, requestFactory, responseProcessor); + } + + /** + * ## View number of daily active users Retrieves the number of daily active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-daily-active-users#1-get-number-of-daily-active-users) + * View number of daily active users + * @param date YYYY-MM-DD + * @param apiToken + */ + public viewNumberOfDailyActiveUsers(date?: string, apiToken?: string, _options?: Configuration): Promise { + const result = this.api.viewNumberOfDailyActiveUsers(date, apiToken, _options); + return result.toPromise(); + } + + /** + * ## View number of monthly active users Retrieves the number of monthly active users of an application. > **Note**: This metric is scheduled to be calculated every 30 minutes, starting at 00:00 UTC, with the first update at 00:30 UTC. [https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users](https://sendbird.com/docs/chat/platform-api/v3/statistics/daus-and-maus/get-number-of-monthly-active-users#1-get-number-of-monthly-active-users) + * View number of monthly active users + * @param date YYYY-MM-DD + * @param apiToken + */ + public viewNumberOfMonthlyActiveUsers(date?: string, apiToken?: string, _options?: Configuration): Promise { + const result = this.api.viewNumberOfMonthlyActiveUsers(date, apiToken, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableUserApi } from './ObservableAPI'; + +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +export class PromiseUserApi { + private api: ObservableUserApi + + public constructor( + configuration: Configuration, + requestFactory?: UserApiRequestFactory, + responseProcessor?: UserApiResponseProcessor + ) { + this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); + } + + /** + * ## Mark all messages as read This action marks all of a user's unread messages as read in certain group channels. If channels aren't specified, the user's unread messages in all group channels are marked as read. https://sendbird.com/docs/chat/platform-api/v3/user/marking-messages-as-read/mark-all-of-a-users-messages-as-read#1-mark-all-of-a-user-s-messages-as-read + * Mark all messages as read + * @param userId (Required) + * @param apiToken + * @param markAllMessagesAsReadRequest + */ + public markAllMessagesAsRead(userId: string, apiToken?: string, markAllMessagesAsReadRequest?: MarkAllMessagesAsReadRequest, _options?: Configuration): Promise { + const result = this.api.markAllMessagesAsRead(userId, apiToken, markAllMessagesAsReadRequest, _options); + return result.toPromise(); + } + + +} + + + From f1a2ba3eef07426d41cef91a61a84068ab29ce5a Mon Sep 17 00:00:00 2001 From: Muhamad Ridwan Date: Tue, 15 Apr 2025 08:06:38 +0700 Subject: [PATCH 3/7] feat: test code for second phase --- index.ts | 2 +- tests/integration/constants.ts | 0 tests/integration/groupChannel.test.ts | 116 ++++++++++++------------- tests/integration/moderation.test.ts | 72 +++++++++++++++ tests/integration/statistics.test.ts | 0 tests/integration/user.test.ts | 0 6 files changed, 129 insertions(+), 61 deletions(-) create mode 100644 tests/integration/constants.ts create mode 100644 tests/integration/moderation.test.ts create mode 100644 tests/integration/statistics.test.ts create mode 100644 tests/integration/user.test.ts diff --git a/index.ts b/index.ts index 80a9f39..9242068 100644 --- a/index.ts +++ b/index.ts @@ -8,5 +8,5 @@ export * from "./servers"; export { RequiredError } from "./apis/baseapi"; export { PromiseMiddleware as Middleware } from './middleware'; -export { PromiseGroupChannelApi as GroupChannelApi, PromiseModerationApi as ModerationApi, PromiseStatisticsApi as StatisticsApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; +export { GroupChannelApiAcceptAnInvitationRequest, GroupChannelApiCancelTheRegistrationOfOperatorsRequest, GroupChannelApiCheckIfMemberRequest, GroupChannelApiCreateAGroupChannelRequest, GroupChannelApiDeleteAGroupChannelRequest, GroupChannelApiGetAGroupChannelRequest, GroupChannelApiHideAChannelRequest, GroupChannelApiInviteAsMembersRequest, GroupChannelApiJoinAChannelRequest, GroupChannelApiLeaveAChannelRequest, GroupChannelApiListChannelsRequest, GroupChannelApiListMembersRequest, GroupChannelApiListOperatorsRequest, GroupChannelApiRegisterOperatorsToAGroupChannelRequest, GroupChannelApiResetChatHistoryRequest, GroupChannelApiStartTypingIndicatorsRequest, GroupChannelApiStopTypingIndicatorsRequest, GroupChannelApiUnhideAChannelRequest, GroupChannelApiUpdateAGroupChannelRequest, ObjectGroupChannelApi as GroupChannelApi, ModerationApiFreezeAGroupChannelRequest, ObjectModerationApi as ModerationApi, StatisticsApiViewNumberOfDailyActiveUsersRequest, StatisticsApiViewNumberOfMonthlyActiveUsersRequest, ObjectStatisticsApi as StatisticsApi, UserApiMarkAllMessagesAsReadRequest, ObjectUserApi as UserApi } from './types/ObjectParamAPI'; diff --git a/tests/integration/constants.ts b/tests/integration/constants.ts new file mode 100644 index 0000000..e69de29 diff --git a/tests/integration/groupChannel.test.ts b/tests/integration/groupChannel.test.ts index 6705aeb..3ac4bb2 100644 --- a/tests/integration/groupChannel.test.ts +++ b/tests/integration/groupChannel.test.ts @@ -17,8 +17,8 @@ import { createConfiguration } from "../../configuration"; import { GroupChannelApi } from "../../index"; describe("Group Channel API", () => { - const APP_ID = process.env.APP_ID || ''; - const API_TOKEN = process.env.API_TOKEN || ''; + const APP_ID = process.env.APP_ID || ""; + const API_TOKEN = process.env.API_TOKEN || ""; let groupChannelApi: GroupChannelApi; const validSendbirdGroupChannelCountPreferenceEnum: ( | SendbirdGroupChannelCountPreferenceEnum @@ -61,22 +61,19 @@ describe("Group Channel API", () => { }); it("call listChannels with positive query params", async () => { - const response = await groupChannelApi.listChannels( - API_TOKEN, - undefined, - 10, - "all", - "all", - "all", - undefined, - undefined, - true, - true, - true, - true, - true, - true - ); + const response = await groupChannelApi.listChannels({ + apiToken: API_TOKEN, + limit: 10, + distinctMode: "all", + publicMode: "all", + superMode: "all", + showEmpty: true, + showMember: true, + showDeliveryReceipt: true, + showReadReceipt: true, + showMetadata: true, + showFrozen: true, + }); expect(response).toHaveProperty("channels"); expect(Array.isArray(response.channels)).toBe(true); @@ -259,22 +256,19 @@ describe("Group Channel API", () => { }); it("call listChannels with negative query params", async () => { - const response = await groupChannelApi.listChannels( - API_TOKEN, - undefined, - 10, - "all", - "all", - "all", - undefined, - undefined, - false, - false, - false, - false, - false, - false - ); + const response = await groupChannelApi.listChannels({ + apiToken: API_TOKEN, + limit: 10, + distinctMode: "all", + publicMode: "all", + superMode: "all", + showEmpty: false, + showMember: false, + showDeliveryReceipt: false, + showReadReceipt: false, + showMetadata: false, + showFrozen: false, + }); expect(response).toHaveProperty("channels"); expect(Array.isArray(response.channels)).toBe(true); @@ -313,8 +307,8 @@ describe("Group Channel API", () => { * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) */ invitationStatus: { - "ttsYcp4M5USFbhDxPqM2ETwM1vB2": 'joined', - 'lK7U9lvxcZWVNa5SgZnLv81DG2R2': 'joined' + ttsYcp4M5USFbhDxPqM2ETwM1vB2: "joined", + lK7U9lvxcZWVNa5SgZnLv81DG2R2: "joined", }, inviterId: "ttsYcp4M5USFbhDxPqM2ETwM1vB2", isDistinct: true, @@ -333,16 +327,15 @@ describe("Group Channel API", () => { }; try { - await groupChannelApi.createAGroupChannel( - API_TOKEN, - request - ); - } catch(error) { - expect(JSON.parse(((error as any).body)).code).toBe(400111) + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + } catch (error) { + expect(JSON.parse((error as any).body).code).toBe(400111); } }); - it("call createAGroupChannel and deleteAGroupChannel", async () => { const request: CreateAGroupChannelRequest = { accessCode: "integration", @@ -355,8 +348,8 @@ describe("Group Channel API", () => { * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) */ invitationStatus: { - "ttsYcp4M5USFbhDxPqM2ETwM1vB2": 'joined', - 'lK7U9lvxcZWVNa5SgZnLv81DG2R2': 'joined' + ttsYcp4M5USFbhDxPqM2ETwM1vB2: "joined", + lK7U9lvxcZWVNa5SgZnLv81DG2R2: "joined", }, inviterId: "ttsYcp4M5USFbhDxPqM2ETwM1vB2", isDistinct: false, @@ -373,24 +366,27 @@ describe("Group Channel API", () => { { userId: "lK7U9lvxcZWVNa5SgZnLv81DG2R2" }, ], }; - - const response = await groupChannelApi.createAGroupChannel( - API_TOKEN, - request - ); - expect(response).toHaveProperty('channelUrl') - expect(response.channelUrl).toBe('integration-test'); - expect(typeof response.channelUrl).toBe('string'); + const response = await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); - expect(response).toHaveProperty('coverUrl') - expect(response.coverUrl).toBe('empty'); - expect(typeof response.coverUrl).toBe('string'); + expect(response).toHaveProperty("channelUrl"); + expect(response.channelUrl).toBe("integration-test"); + expect(typeof response.channelUrl).toBe("string"); - expect(response).toHaveProperty('customType') - expect(response.customType).toBe('data'); - expect(typeof response.customType).toBe('string'); + expect(response).toHaveProperty("coverUrl"); + expect(response.coverUrl).toBe("empty"); + expect(typeof response.coverUrl).toBe("string"); - await groupChannelApi.deleteAGroupChannel(response.channelUrl, API_TOKEN); + expect(response).toHaveProperty("customType"); + expect(response.customType).toBe("data"); + expect(typeof response.customType).toBe("string"); + + await groupChannelApi.deleteAGroupChannel({ + channelUrl: response.channelUrl, + apiToken: API_TOKEN, + }); }); }); diff --git a/tests/integration/moderation.test.ts b/tests/integration/moderation.test.ts new file mode 100644 index 0000000..ba4eb9e --- /dev/null +++ b/tests/integration/moderation.test.ts @@ -0,0 +1,72 @@ +import { + CreateAGroupChannelRequest, +} from "../../models/ObjectSerializer"; +import { ServerConfiguration } from "../../servers"; +import { createConfiguration } from "../../configuration"; +import { ModerationApi, GroupChannelApi } from "../../index"; + +describe("Group Channel API", () => { + const APP_ID = process.env.APP_ID || ""; + const API_TOKEN = process.env.API_TOKEN || ""; + let moderationApi: ModerationApi; + let groupChannelApi: GroupChannelApi; + + + beforeEach(() => { + const serverConfig = new ServerConfiguration( + `https://api-${APP_ID}.sendbird.com`, + { app_id: APP_ID } + ); + const configuration = createConfiguration({ + baseServer: serverConfig, + }); + groupChannelApi = new GroupChannelApi(configuration); + moderationApi = new ModerationApi(configuration); + }); + + it("call listChannels with positive query params", async () => { + const request: CreateAGroupChannelRequest = { + accessCode: "integration", + blockSdkUserChannelJoin: true, + channelUrl: "integration-test", + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: { + ttsYcp4M5USFbhDxPqM2ETwM1vB2: "joined", + lK7U9lvxcZWVNa5SgZnLv81DG2R2: "joined", + }, + inviterId: "ttsYcp4M5USFbhDxPqM2ETwM1vB2", + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: [ + { + userId: "ttsYcp4M5USFbhDxPqM2ETwM1vB2", + }, + { userId: "lK7U9lvxcZWVNa5SgZnLv81DG2R2" }, + ], + }; + + const response = await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + const freezeResponse = await moderationApi.freezeAGroupChannel({ + channelUrl: response.channelUrl, + apiToken: API_TOKEN, + freezeAGroupChannelRequest: { freeze: true }, + }); + + expect(response).toHaveProperty("channelUrl"); + expect(response.channelUrl).toBe("integration-test"); + expect(typeof response.channelUrl).toBe("string"); + }); +}); diff --git a/tests/integration/statistics.test.ts b/tests/integration/statistics.test.ts new file mode 100644 index 0000000..e69de29 diff --git a/tests/integration/user.test.ts b/tests/integration/user.test.ts new file mode 100644 index 0000000..e69de29 From 603eaa384fba7f1c682abc143ec720b409b9942a Mon Sep 17 00:00:00 2001 From: Muhamad Ridwan Date: Sun, 20 Apr 2025 22:05:27 +0700 Subject: [PATCH 4/7] feat: modify tests integration constants --- tests/integration/constants.ts | 9 + tests/integration/groupChannel.test.ts | 576 ++++++++++++++++++++++++- tests/integration/moderation.test.ts | 53 ++- tests/integration/statistics.test.ts | 44 ++ tests/integration/user.test.ts | 0 5 files changed, 660 insertions(+), 22 deletions(-) delete mode 100644 tests/integration/user.test.ts diff --git a/tests/integration/constants.ts b/tests/integration/constants.ts index e69de29..c81de52 100644 --- a/tests/integration/constants.ts +++ b/tests/integration/constants.ts @@ -0,0 +1,9 @@ +export const GLOBAL_GROUP_CHANNEL_ACCESS_CODE = "integration"; +// Please make sure we have a couple of users +export const USERS = [ + "ttsYcp4M5USFbhDxPqM2ETwM1vB2", + "lK7U9lvxcZWVNa5SgZnLv81DG2R2", +]; + +export const MASTER_USER_ID = USERS[0]; +export const SECOND_USER_ID = USERS[1]; diff --git a/tests/integration/groupChannel.test.ts b/tests/integration/groupChannel.test.ts index 3ac4bb2..835208e 100644 --- a/tests/integration/groupChannel.test.ts +++ b/tests/integration/groupChannel.test.ts @@ -1,3 +1,4 @@ +import { ListOperatorsResponse } from "./../../models/ListOperatorsResponse"; import { CreateAGroupChannelRequest, SendbirdBasicUserInfo, @@ -10,11 +11,20 @@ import { SendbirdMessageResponse, SendbirdSmsFallback, SendbirdUser, + SendbirdMemberRoleEnum, + SendbirdMemberStateEnum, + SendbirdGroupChannelDetailChannel, } from "../../models/ObjectSerializer"; import { hasValidField } from "./helper"; import { ServerConfiguration } from "../../servers"; import { createConfiguration } from "../../configuration"; import { GroupChannelApi } from "../../index"; +import { + GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + MASTER_USER_ID, + SECOND_USER_ID, + USERS, +} from "./constants"; describe("Group Channel API", () => { const APP_ID = process.env.APP_ID || ""; @@ -49,6 +59,15 @@ describe("Group Channel API", () => { | undefined )[] = ["all", "default", "false", "mention_only"]; + const validSendbirdMemberRoleEnum: (SendbirdMemberRoleEnum | undefined)[] = [ + "", + "none", + "operator", + ]; + + const validSendbirdMemberStateEnum: (SendbirdMemberStateEnum | undefined)[] = + ["", "invited", "joined"]; + beforeEach(() => { const serverConfig = new ServerConfiguration( `https://api-${APP_ID}.sendbird.com`, @@ -162,7 +181,7 @@ describe("Group Channel API", () => { expect(typeof channel.isHidden).toBe("boolean"); } - Object(channel).hasProe; + // Object(channel).hasProe; if ("isMuted" in channel) { expect(typeof channel.isMuted).toBe("boolean"); } @@ -389,4 +408,559 @@ describe("Group Channel API", () => { apiToken: API_TOKEN, }); }); + + it("call getAGroupChannel", async () => { + const CHANNEL_URL = "get-group-channel-test-channel-url"; + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: Object.fromEntries(USERS.map((id) => [id, "joined"])), + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; + + const createGroupChannelresponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + expect(typeof createGroupChannelresponse.channelUrl).toBe("string"); + + const groupChannelResponse = await groupChannelApi.getAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + showDeliveryReceipt: true, + showReadReceipt: true, + showMember: true, + memberActiveMode: "all", + }); + await groupChannelApi.deleteAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + + const channel = groupChannelResponse; + expect(channel).toHaveProperty("channelUrl"); + expect(channel.channelUrl).toBe(CHANNEL_URL); + + expect(channel).toHaveProperty("channel"); + expect(channel.channel).toBeInstanceOf(SendbirdGroupChannelDetailChannel); + + expect(channel.channel).toHaveProperty("channelUrl"); + expect(typeof channel.channel?.channelUrl).toBe("string"); + + expect(channel.channel).toHaveProperty("coverUrl"); + expect(typeof channel.channel?.coverUrl).toBe("string"); + + expect(channel.channel).toHaveProperty("createdAt"); + expect(typeof channel.channel?.createdAt).toBe("number"); + + expect(channel.channel).toHaveProperty("customType"); + expect(typeof channel.channel?.customType).toBe("string"); + + expect(channel.channel).toHaveProperty("data"); + expect(typeof channel.channel?.data).toBe("string"); + + expect(channel.channel).toHaveProperty("maxLengthMessage"); + expect(typeof channel.channel?.maxLengthMessage).toBe("number"); + + expect(channel.channel).toHaveProperty("memberCount"); + expect(typeof channel.channel?.memberCount).toBe("number"); + + expect(channel.channel).toHaveProperty("name"); + expect(typeof channel.channel?.name).toBe("string"); + + expect(channel).toHaveProperty("name"); + expect(typeof channel.name).toBe("string"); + + expect(channel).toHaveProperty("coverUrl"); + expect(typeof channel.coverUrl).toBe("string"); + + expect(channel).toHaveProperty("createdAt"); + expect(typeof channel.createdAt).toBe("number"); + + if (hasValidField(channel, "createdBy")) { + expect(channel.createdBy).toBeInstanceOf(SendbirdBasicUserInfo); + } + + expect(channel).toHaveProperty("customType"); + expect(typeof channel.customType).toBe("string"); + + expect(channel).toHaveProperty("data"); + expect(typeof channel.data).toBe("string"); + + expect(channel).toHaveProperty("deliveryReceipt"); + expect(typeof channel.deliveryReceipt).toBe("object"); + + expect(channel).toHaveProperty("disappearingMessage"); + expect(channel.disappearingMessage).toBeInstanceOf( + SendbirdDisappearingMessage + ); + + expect(channel).toHaveProperty("freeze"); + expect(typeof channel.freeze).toBe("boolean"); + + expect(channel).toHaveProperty("hasAiBot"); + expect(typeof channel.hasAiBot).toBe("boolean"); + + expect(channel).toHaveProperty("hasBot"); + expect(typeof channel.hasBot).toBe("boolean"); + + expect(channel).toHaveProperty("ignoreProfanityFilter"); + expect(typeof channel.ignoreProfanityFilter).toBe("boolean"); + + expect(channel).toHaveProperty("isAccessCodeRequired"); + expect(typeof channel.isAccessCodeRequired).toBe("boolean"); + + expect(channel).toHaveProperty("isBroadcast"); + expect(typeof channel.isBroadcast).toBe("boolean"); + + expect(channel).toHaveProperty("isDiscoverable"); + expect(typeof channel.isDiscoverable).toBe("boolean"); + + expect(channel).toHaveProperty("isDistinct"); + expect(typeof channel.isDistinct).toBe("boolean"); + + expect(channel).toHaveProperty("isEphemeral"); + expect(typeof channel.isEphemeral).toBe("boolean"); + + if ("isHidden" in channel) { + expect(typeof channel.isHidden).toBe("boolean"); + } + + if ("isMuted" in channel) { + expect(typeof channel.isMuted).toBe("boolean"); + } + + if ("isPublic" in channel) { + expect(typeof channel.isPublic).toBe("boolean"); + } + + if ("isPushEnabled" in channel) { + expect(typeof channel.isPushEnabled).toBe("boolean"); + } + + expect(channel).toHaveProperty("isSuper"); + expect(typeof channel.isSuper).toBe("boolean"); + + expect(channel).toHaveProperty("joinedMemberCount"); + expect(typeof channel.joinedMemberCount).toBe("number"); + + if (hasValidField(channel, "lastMessage")) { + expect(channel.lastMessage).toBeInstanceOf(SendbirdMessageResponse); + } + + expect(channel).toHaveProperty("maxLengthMessage"); + expect(typeof channel.maxLengthMessage).toBe("number"); + + expect(channel).toHaveProperty("memberCount"); + expect(typeof channel.memberCount).toBe("number"); + + expect(channel).toHaveProperty("members"); + expect(Array.isArray(channel.members)).toBe(true); + + expect(channel).toHaveProperty("messageSurvivalSeconds"); + expect(typeof channel.messageSurvivalSeconds).toBe("number"); + + expect(channel).toHaveProperty("name"); + expect(typeof channel.name).toBe("string"); + + expect(channel).toHaveProperty("readReceipt"); + expect(typeof channel.readReceipt).toBe("object"); + + expect(channel).toHaveProperty("smsFallback"); + expect(channel.smsFallback).toBeInstanceOf(SendbirdSmsFallback); + + expect(channel).toHaveProperty("unreadMentionCount"); + expect(typeof channel.unreadMentionCount).toBe("number"); + + expect(channel).toHaveProperty("unreadMessageCount"); + expect(typeof channel.unreadMessageCount).toBe("number"); + }); + + it("call listMembers", async () => { + const listResponse = await groupChannelApi.listChannels({ + apiToken: API_TOKEN, + limit: 1, + distinctMode: "all", + publicMode: "all", + superMode: "all", + showEmpty: true, + showMember: true, + showDeliveryReceipt: true, + showReadReceipt: true, + showMetadata: true, + showFrozen: true, + }); + expect(listResponse).toHaveProperty("channels"); + expect(Array.isArray(listResponse.channels)).toBe(true); + expect(listResponse.channels?.length).toBe(1); + + const channel = listResponse.channels?.[0]; + expect(channel).toBeDefined(); + + if (channel) { + const listMembersResponse = await groupChannelApi.listMembers({ + apiToken: API_TOKEN, + channelUrl: channel.channelUrl, + }); + + expect(listMembersResponse).toHaveProperty("members"); + expect(Array.isArray(listMembersResponse.members)).toBe(true); + listMembersResponse.members.forEach((member) => { + expect(member).toHaveProperty("userId"); + expect(typeof member.userId).toBe("string"); + + if (hasValidField(member, "deliveredTs")) { + expect(typeof member.deliveredTs).toBe("number"); + } + + if (hasValidField(member, "doNotDisturb")) { + expect(typeof member.doNotDisturb).toBe("boolean"); + } + + if (hasValidField(member, "friendDiscoveryKey")) { + expect(Array.isArray(member.friendDiscoveryKey)).toBe(true); + } + + if (hasValidField(member, "friendName")) { + expect(typeof member.friendName).toBe("string"); + } + + if (hasValidField(member, "isActive")) { + expect(typeof member.isActive).toBe("boolean"); + } + + if (hasValidField(member, "isBlockedByMe")) { + expect(typeof member.isBlockedByMe).toBe("boolean"); + } + + if (hasValidField(member, "isBlockingMe")) { + expect(typeof member.isBlockingMe).toBe("boolean"); + } + + if (hasValidField(member, "isMuted")) { + expect(typeof member.isMuted).toBe("boolean"); + } + + if (hasValidField(member, "isOnline")) { + expect(typeof member.isOnline).toBe("boolean"); + } + + if (hasValidField(member, "lastSeenAt")) { + expect(typeof member.lastSeenAt).toBe("number"); + } + + if (hasValidField(member, "metadata")) { + expect(typeof member.metadata).toBe("object"); + } + + if (hasValidField(member, "mutedDescription")) { + expect(typeof member.mutedDescription).toBe("string"); + } + + if (hasValidField(member, "mutedEndAt")) { + expect(typeof member.mutedEndAt).toBe("number"); + } + + if (hasValidField(member, "nickname")) { + expect(typeof member.nickname).toBe("string"); + } + + if (hasValidField(member, "pushEnabled")) { + expect(typeof member.pushEnabled).toBe("boolean"); + } + + if (hasValidField(member, "pushTriggerOption")) { + expect(typeof member.pushTriggerOption).toBe("string"); + } + + if (hasValidField(member, "profileUrl")) { + expect(typeof member.profileUrl).toBe("string"); + } + + if (hasValidField(member, "requireAuthForProfileImage")) { + expect(typeof member.requireAuthForProfileImage).toBe("boolean"); + } + + if (hasValidField(member, "readTs")) { + expect(typeof member.readTs).toBe("number"); + } + + if (hasValidField(member, "role")) { + expect(typeof member.role).toBe("string"); + expect(validSendbirdMemberRoleEnum.includes(member.role)).toBe(true); + } + + if (hasValidField(member, "state")) { + expect(typeof member.state).toBe("string"); + expect(validSendbirdMemberStateEnum.includes(member.state)).toBe( + true + ); + } + }); + } + }); + + it("call registerOperatorsToAGroupChannel, listOperators then cancelTheRegistrationOfOperators", async () => { + const CHANNEL_URL = "list-operator-test-channel-url"; + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: Object.fromEntries(USERS.map((id) => [id, "joined"])), + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; + + const createGroupChannelresponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + expect(typeof createGroupChannelresponse.channelUrl).toBe("string"); + + expect(createGroupChannelresponse).toHaveProperty("operators"); + expect(createGroupChannelresponse.operators?.length || 0).toBe(0); + + const registerOperatorResponse = + await groupChannelApi.registerOperatorsToAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + registerOperatorsToAGroupChannelRequest: { + operatorIds: [MASTER_USER_ID], + }, + }); + + expect(registerOperatorResponse).toBeDefined(); + + const listOperatorsResponse = await groupChannelApi.listOperators({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + + expect(listOperatorsResponse).toHaveProperty("operators"); + expect(Object.keys(listOperatorsResponse).length).toBe(2); + + expect(listOperatorsResponse.operators?.length || 0).toBe(1); + + listOperatorsResponse.operators?.map((operator) => { + expect(operator.userId).toEqual(MASTER_USER_ID); + expect(operator).toHaveProperty("nickname"); + expect(typeof operator.nickname).toBe("string"); + expect(operator).toHaveProperty("profileUrl"); + expect(typeof operator.profileUrl).toBe("string"); + expect(operator).toHaveProperty("metadata"); + expect(typeof operator.metadata).toBe("object"); + expect(operator).toHaveProperty("requireAuthForProfileImage"); + expect(typeof operator.requireAuthForProfileImage).toBe("boolean"); + }); + + const cancelTheRegistrationOfOperatorsResponse = + await groupChannelApi.cancelTheRegistrationOfOperators({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + operatorIds: MASTER_USER_ID, + }); + + expect(cancelTheRegistrationOfOperatorsResponse).toBeDefined(); + + const listOperatorsAfterCancelRegistrationResponse = + await groupChannelApi.listOperators({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + + expect(listOperatorsAfterCancelRegistrationResponse).toHaveProperty( + "operators" + ); + expect( + Object.keys(listOperatorsAfterCancelRegistrationResponse).length + ).toBe(2); + + expect( + listOperatorsAfterCancelRegistrationResponse.operators?.length || 0 + ).toBe(0); + + await groupChannelApi.deleteAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + }); + + it("call startTypingIndicators and stopTypingIndicators", async () => { + const CHANNEL_URL = "group-channel-typing-indicators-test-channel-url"; + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: Object.fromEntries(USERS.map((id) => [id, "joined"])), + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; + + const createGroupChannelresponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + + const startTypingResponse = await groupChannelApi.startTypingIndicators({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + startTypingIndicatorsRequest: { + userIds: [MASTER_USER_ID], + }, + }); + + const stopTypingResponse = await groupChannelApi.startTypingIndicators({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + startTypingIndicatorsRequest: { + userIds: [MASTER_USER_ID], + }, + }); + + expect(startTypingResponse).toBeDefined(); + expect(stopTypingResponse).toBeDefined(); + + await groupChannelApi.deleteAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + }); + + it("call hideAChannel then unhideAChannel", async () => { + const CHANNEL_URL = "group-channel-hide-test-channel-url"; + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: { + MASTER_USER_ID: 'joined', + }, + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; + + const createGroupChannelresponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + + const hideAChannelResponse = await groupChannelApi.hideAChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + hideAChannelRequest: { + userId: SECOND_USER_ID, + allowAutoUnhide: true, + shouldHideAll: false, + } + }); + const groupChannelAfterHideResponse = await groupChannelApi.getAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + showDeliveryReceipt: true, + showReadReceipt: true, + showMember: true, + memberActiveMode: "all", + }); + + const unhideAChannelResponse = await groupChannelApi.unhideAChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + shouldUnhideAll: false, + userId: SECOND_USER_ID, + }); + + const groupChannelAfterUnHideResponse = await groupChannelApi.getAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + showDeliveryReceipt: true, + showReadReceipt: true, + showMember: true, + memberActiveMode: "all", + }); + await groupChannelApi.deleteAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + + expect(hideAChannelResponse).toBeDefined(); + expect(unhideAChannelResponse).toBeDefined(); + }); + + it.todo("call inviteAsMembers then acceptAnInvitation and checkIfMember"); + + it.todo("call joinAChannel then leaveAChannel"); + + it.todo("call updateAGroupChannel"); + + it.todo("call resetChatHistory"); }); diff --git a/tests/integration/moderation.test.ts b/tests/integration/moderation.test.ts index ba4eb9e..80ba987 100644 --- a/tests/integration/moderation.test.ts +++ b/tests/integration/moderation.test.ts @@ -4,8 +4,9 @@ import { import { ServerConfiguration } from "../../servers"; import { createConfiguration } from "../../configuration"; import { ModerationApi, GroupChannelApi } from "../../index"; +import { GLOBAL_GROUP_CHANNEL_ACCESS_CODE, MASTER_USER_ID, USERS } from "./constants"; -describe("Group Channel API", () => { +describe("Moderation API", () => { const APP_ID = process.env.APP_ID || ""; const API_TOKEN = process.env.API_TOKEN || ""; let moderationApi: ModerationApi; @@ -24,22 +25,20 @@ describe("Group Channel API", () => { moderationApi = new ModerationApi(configuration); }); - it("call listChannels with positive query params", async () => { + it("call freezeAGroupChannel from new created channel", async () => { + const CHANNEL_URL = 'freeze-integration-test-channel-url'; const request: CreateAGroupChannelRequest = { - accessCode: "integration", + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, blockSdkUserChannelJoin: true, - channelUrl: "integration-test", + channelUrl: CHANNEL_URL, coverUrl: "empty", customType: "data", data: "data", /** * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) */ - invitationStatus: { - ttsYcp4M5USFbhDxPqM2ETwM1vB2: "joined", - lK7U9lvxcZWVNa5SgZnLv81DG2R2: "joined", - }, - inviterId: "ttsYcp4M5USFbhDxPqM2ETwM1vB2", + invitationStatus: Object.fromEntries(USERS.map((id) => [id, "joined"])), + inviterId: MASTER_USER_ID, isDistinct: false, isEphemeral: true, isPublic: true, @@ -47,26 +46,38 @@ describe("Group Channel API", () => { name: "test", operatorIds: [], strict: true, - users: [ - { - userId: "ttsYcp4M5USFbhDxPqM2ETwM1vB2", - }, - { userId: "lK7U9lvxcZWVNa5SgZnLv81DG2R2" }, - ], + users: USERS.map((id) => ({userId: id})), }; - const response = await groupChannelApi.createAGroupChannel({ + const createGroupChannelresponse = await groupChannelApi.createAGroupChannel({ apiToken: API_TOKEN, createAGroupChannelRequest: request, }); - const freezeResponse = await moderationApi.freezeAGroupChannel({ - channelUrl: response.channelUrl, + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + expect(typeof createGroupChannelresponse.channelUrl).toBe("string"); + + expect(createGroupChannelresponse).toHaveProperty("freeze"); + expect(createGroupChannelresponse.freeze).toBe(false); + + const freezeChannelResponse = await moderationApi.freezeAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, apiToken: API_TOKEN, freezeAGroupChannelRequest: { freeze: true }, }); - expect(response).toHaveProperty("channelUrl"); - expect(response.channelUrl).toBe("integration-test"); - expect(typeof response.channelUrl).toBe("string"); + expect(freezeChannelResponse).toHaveProperty("channelUrl"); + expect(freezeChannelResponse.channelUrl).toBe(CHANNEL_URL); + expect(typeof freezeChannelResponse.channelUrl).toBe("string"); + + expect(freezeChannelResponse).not.toEqual(createGroupChannelresponse); + expect(freezeChannelResponse).toHaveProperty("freeze"); + expect(freezeChannelResponse.freeze).toBe(true); + + await groupChannelApi.deleteAGroupChannel({ + apiToken: API_TOKEN, + channelUrl: createGroupChannelresponse.channelUrl, + }); }); }); diff --git a/tests/integration/statistics.test.ts b/tests/integration/statistics.test.ts index e69de29..3396f34 100644 --- a/tests/integration/statistics.test.ts +++ b/tests/integration/statistics.test.ts @@ -0,0 +1,44 @@ +import { ServerConfiguration } from "../../servers"; +import { createConfiguration } from "../../configuration"; +import { StatisticsApi } from "../../index"; + +describe("Statistics API", () => { + const APP_ID = process.env.APP_ID || ""; + const API_TOKEN = process.env.API_TOKEN || ""; + let statisticApi: StatisticsApi; + + beforeEach(() => { + const serverConfig = new ServerConfiguration( + `https://api-${APP_ID}.sendbird.com`, + { app_id: APP_ID } + ); + const configuration = createConfiguration({ + baseServer: serverConfig, + }); + statisticApi = new StatisticsApi(configuration); + }); + + it("call viewNumberOfDailyActiveUsers", async () => { + const response = await statisticApi.viewNumberOfDailyActiveUsers({ + apiToken: API_TOKEN, + }); + + expect(Object.keys(response).length).toBe(1); + + expect(response).toHaveProperty("dau"); + expect(response.dau).toBeGreaterThanOrEqual(0); + expect(typeof response.dau).toBe("number"); + }); + + it("call viewNumberOfMonthlyActiveUsers", async () => { + const response = await statisticApi.viewNumberOfMonthlyActiveUsers({ + apiToken: API_TOKEN, + }); + + expect(Object.keys(response).length).toBe(1); + + expect(response).toHaveProperty("mau"); + expect(response.mau).toBeGreaterThanOrEqual(0); + expect(typeof response.mau).toBe("number"); + }); +}); diff --git a/tests/integration/user.test.ts b/tests/integration/user.test.ts deleted file mode 100644 index e69de29..0000000 From eaa74b830af98e60718086c70c9026a1786e218e Mon Sep 17 00:00:00 2001 From: Muhamad Ridwan Date: Mon, 21 Apr 2025 07:04:18 +0700 Subject: [PATCH 5/7] feat: add more test case --- .openapi-generator/FILES | 2 + GroupChannelApi.md | 11 +- apis/GroupChannelApi.ts | 31 +- models/GetAGroupChannelResponse.ts | 365 ++++++++++++++++++++++ models/GetAGroupChannelResponseAllOf.ts | 36 +++ models/ObjectSerializer.ts | 11 + models/all.ts | 2 + tests/integration/groupChannel.test.ts | 383 +++++++++++++++++++++++- types/ObjectParamAPI.ts | 14 +- types/ObservableAPI.ts | 9 +- types/PromiseAPI.ts | 9 +- 11 files changed, 835 insertions(+), 38 deletions(-) create mode 100644 models/GetAGroupChannelResponse.ts create mode 100644 models/GetAGroupChannelResponseAllOf.ts diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3f72187..05adbd7 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -21,6 +21,8 @@ models/AcceptAnInvitationRequest.ts models/CheckIfMemberResponse.ts models/CreateAGroupChannelRequest.ts models/FreezeAGroupChannelRequest.ts +models/GetAGroupChannelResponse.ts +models/GetAGroupChannelResponseAllOf.ts models/GroupChannelListMembersResponse.ts models/GroupChatListChannelsResponse.ts models/HideAChannelRequest.ts diff --git a/GroupChannelApi.md b/GroupChannelApi.md index 7984480..18c9904 100644 --- a/GroupChannelApi.md +++ b/GroupChannelApi.md @@ -374,7 +374,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) # **getAGroupChannel** -> SendbirdGroupChannelDetail getAGroupChannel() +> GetAGroupChannelResponse getAGroupChannel() ## Get a group channel This action retrieves information about a specific [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel). You can use the optional query parameters to determine whether to include delivery receipt, read receipt, or member information in the response. https://sendbird.com/docs/chat/platform-api/v3/channel/listing-channels-in-an-application/get-a-group-channel#1-get-a-group-channel `channel_url` Type: string Description: Specifies the URL of the channel to retrieve. @@ -400,6 +400,8 @@ let body:Sendbird.GroupChannelApiGetAGroupChannelRequest = { // 'all' | 'activated' | 'deactivated' | Restricts the member list to members who are activated or deactivated in the channel. This parameter is only effective if the parameter show_member is true. Acceptable values are all, activated, and deactivated. (default: all) (optional) memberActiveMode: "all", // string (optional) + userId: "user_id_example", + // string (optional) apiToken: "{{API_TOKEN}}", }; @@ -418,12 +420,13 @@ Name | Type | Description | Notes **showReadReceipt** | [**boolean**] | | (optional) defaults to undefined **showMember** | [**boolean**] | | (optional) defaults to undefined **memberActiveMode** | [**'all' | 'activated' | 'deactivated'**]**Array<'all' | 'activated' | 'deactivated'>** | Restricts the member list to members who are activated or deactivated in the channel. This parameter is only effective if the parameter show_member is true. Acceptable values are all, activated, and deactivated. (default: all) | (optional) defaults to undefined + **userId** | [**string**] | | (optional) defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined ### Return type -**SendbirdGroupChannelDetail** +**GetAGroupChannelResponse** ### Authorization @@ -1314,7 +1317,7 @@ const apiInstance = new Sendbird.GroupChannelApi(configuration); let body:Sendbird.GroupChannelApiUnhideAChannelRequest = { // string | (Required) channelUrl: "channel_url_example", - // string | (Required) (optional) + // string | (Required) userId: "user_id_example", // boolean (optional) shouldUnhideAll: true, @@ -1333,7 +1336,7 @@ apiInstance.unhideAChannel(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **channelUrl** | [**string**] | (Required) | defaults to undefined - **userId** | [**string**] | (Required) | (optional) defaults to undefined + **userId** | [**string**] | (Required) | defaults to undefined **shouldUnhideAll** | [**boolean**] | | (optional) defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined diff --git a/apis/GroupChannelApi.ts b/apis/GroupChannelApi.ts index 9fa7489..cc5290c 100644 --- a/apis/GroupChannelApi.ts +++ b/apis/GroupChannelApi.ts @@ -13,6 +13,7 @@ import {SecurityAuthentication} from '../auth/auth'; import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; +import { GetAGroupChannelResponse } from '../models/GetAGroupChannelResponse'; import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; @@ -272,9 +273,10 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { * @param showReadReceipt * @param showMember * @param memberActiveMode Restricts the member list to members who are activated or deactivated in the channel. This parameter is only effective if the parameter show_member is true. Acceptable values are all, activated, and deactivated. (default: all) + * @param userId * @param apiToken */ - public async getAGroupChannel(channelUrl: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMember?: boolean, memberActiveMode?: 'all' | 'activated' | 'deactivated', apiToken?: string, _options?: Configuration): Promise { + public async getAGroupChannel(channelUrl: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMember?: boolean, memberActiveMode?: 'all' | 'activated' | 'deactivated', userId?: string, apiToken?: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined @@ -288,6 +290,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { + // Path Params const localVarPath = '/v3/group_channels/{channel_url}' .replace('{' + 'channel_url' + '}', encodeURIComponent(String(channelUrl))); @@ -316,6 +319,11 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { requestContext.setQueryParam("member_active_mode", ObjectSerializer.serialize(memberActiveMode, "'all' | 'activated' | 'deactivated'", "")); } + // Query Params + if (userId !== undefined) { + requestContext.setQueryParam("user_id", ObjectSerializer.serialize(userId, "string", "")); + } + // Header Params requestContext.setHeaderParam("api-token", ObjectSerializer.serialize(apiToken, "string", "")); @@ -1244,7 +1252,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { * @param shouldUnhideAll * @param apiToken */ - public async unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { + public async unhideAChannel(channelUrl: string, userId: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined @@ -1253,6 +1261,11 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { } + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError("GroupChannelApi", "unhideAChannel", "userId"); + } + @@ -1493,22 +1506,22 @@ export class GroupChannelApiResponseProcessor { * @params response Response returned by the server for a request to getAGroupChannel * @throws ApiException if the response code was not in [200, 299] */ - public async getAGroupChannel(response: ResponseContext): Promise { + public async getAGroupChannel(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { - const body: SendbirdGroupChannelDetail = ObjectSerializer.deserialize( + const body: GetAGroupChannelResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "SendbirdGroupChannelDetail", "" - ) as SendbirdGroupChannelDetail; + "GetAGroupChannelResponse", "" + ) as GetAGroupChannelResponse; return body; } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: SendbirdGroupChannelDetail = ObjectSerializer.deserialize( + const body: GetAGroupChannelResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), - "SendbirdGroupChannelDetail", "" - ) as SendbirdGroupChannelDetail; + "GetAGroupChannelResponse", "" + ) as GetAGroupChannelResponse; return body; } diff --git a/models/GetAGroupChannelResponse.ts b/models/GetAGroupChannelResponse.ts new file mode 100644 index 0000000..217943f --- /dev/null +++ b/models/GetAGroupChannelResponse.ts @@ -0,0 +1,365 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { GetAGroupChannelResponseAllOf } from './GetAGroupChannelResponseAllOf'; +import { SendbirdBasicUserInfo } from './SendbirdBasicUserInfo'; +import { SendbirdDisappearingMessage } from './SendbirdDisappearingMessage'; +import { SendbirdGroupChannel } from './SendbirdGroupChannel'; +import { SendbirdGroupChannelDetailChannel } from './SendbirdGroupChannelDetailChannel'; +import { SendbirdMember } from './SendbirdMember'; +import { SendbirdMessageResponse } from './SendbirdMessageResponse'; +import { SendbirdSmsFallback } from './SendbirdSmsFallback'; +import { HttpFile } from '../http/http'; + +export class GetAGroupChannelResponse { + 'channel'?: SendbirdGroupChannelDetailChannel; + 'channelUrl': string; + 'countPreference'?: GetAGroupChannelResponseCountPreferenceEnum; + 'coverUrl'?: string; + 'createdAt'?: number; + 'createdBy'?: SendbirdBasicUserInfo; + 'customType'?: string; + 'data'?: string; + 'deliveryReceipt'?: any; + 'disappearingMessage'?: SendbirdDisappearingMessage; + 'freeze'?: boolean; + 'hasAiBot'?: boolean; + 'hasBot'?: boolean; + 'hiddenState'?: GetAGroupChannelResponseHiddenStateEnum; + 'ignoreProfanityFilter'?: boolean; + 'invitedAt'?: number; + 'inviter'?: SendbirdBasicUserInfo; + 'isAccessCodeRequired'?: boolean; + 'isBroadcast'?: boolean; + 'isDiscoverable'?: boolean; + 'isDistinct'?: boolean; + 'isEphemeral'?: boolean; + 'isExclusive'?: boolean; + 'isHidden'?: boolean; + 'isMuted'?: boolean; + 'isPublic'?: boolean; + 'isPushEnabled'?: boolean; + 'isSuper'?: boolean; + 'joinedMemberCount'?: number; + 'joinedTs'?: number; + 'lastMessage'?: SendbirdMessageResponse; + 'maxLengthMessage'?: number; + 'memberCount'?: number; + 'memberState'?: GetAGroupChannelResponseMemberStateEnum; + 'members'?: Array; + 'messageSurvivalSeconds'?: number; + 'metadata'?: any; + 'myRole'?: GetAGroupChannelResponseMyRoleEnum; + 'name'?: string; + 'pushTriggerOption'?: GetAGroupChannelResponsePushTriggerOptionEnum; + 'readReceipt'?: { [key: string]: number; }; + 'smsFallback'?: SendbirdSmsFallback; + 'tsMessageOffset'?: number; + 'unreadMentionCount'?: number; + 'unreadMessageCount'?: number; + 'userLastRead'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "channel", + "baseName": "channel", + "type": "SendbirdGroupChannelDetailChannel", + "format": "" + }, + { + "name": "channelUrl", + "baseName": "channel_url", + "type": "string", + "format": "" + }, + { + "name": "countPreference", + "baseName": "count_preference", + "type": "GetAGroupChannelResponseCountPreferenceEnum", + "format": "" + }, + { + "name": "coverUrl", + "baseName": "cover_url", + "type": "string", + "format": "" + }, + { + "name": "createdAt", + "baseName": "created_at", + "type": "number", + "format": "int64" + }, + { + "name": "createdBy", + "baseName": "created_by", + "type": "SendbirdBasicUserInfo", + "format": "" + }, + { + "name": "customType", + "baseName": "custom_type", + "type": "string", + "format": "" + }, + { + "name": "data", + "baseName": "data", + "type": "string", + "format": "" + }, + { + "name": "deliveryReceipt", + "baseName": "delivery_receipt", + "type": "any", + "format": "" + }, + { + "name": "disappearingMessage", + "baseName": "disappearing_message", + "type": "SendbirdDisappearingMessage", + "format": "" + }, + { + "name": "freeze", + "baseName": "freeze", + "type": "boolean", + "format": "" + }, + { + "name": "hasAiBot", + "baseName": "has_ai_bot", + "type": "boolean", + "format": "" + }, + { + "name": "hasBot", + "baseName": "has_bot", + "type": "boolean", + "format": "" + }, + { + "name": "hiddenState", + "baseName": "hidden_state", + "type": "GetAGroupChannelResponseHiddenStateEnum", + "format": "" + }, + { + "name": "ignoreProfanityFilter", + "baseName": "ignore_profanity_filter", + "type": "boolean", + "format": "" + }, + { + "name": "invitedAt", + "baseName": "invited_at", + "type": "number", + "format": "int64" + }, + { + "name": "inviter", + "baseName": "inviter", + "type": "SendbirdBasicUserInfo", + "format": "" + }, + { + "name": "isAccessCodeRequired", + "baseName": "is_access_code_required", + "type": "boolean", + "format": "" + }, + { + "name": "isBroadcast", + "baseName": "is_broadcast", + "type": "boolean", + "format": "" + }, + { + "name": "isDiscoverable", + "baseName": "is_discoverable", + "type": "boolean", + "format": "" + }, + { + "name": "isDistinct", + "baseName": "is_distinct", + "type": "boolean", + "format": "" + }, + { + "name": "isEphemeral", + "baseName": "is_ephemeral", + "type": "boolean", + "format": "" + }, + { + "name": "isExclusive", + "baseName": "is_exclusive", + "type": "boolean", + "format": "" + }, + { + "name": "isHidden", + "baseName": "is_hidden", + "type": "boolean", + "format": "" + }, + { + "name": "isMuted", + "baseName": "is_muted", + "type": "boolean", + "format": "" + }, + { + "name": "isPublic", + "baseName": "is_public", + "type": "boolean", + "format": "" + }, + { + "name": "isPushEnabled", + "baseName": "is_push_enabled", + "type": "boolean", + "format": "" + }, + { + "name": "isSuper", + "baseName": "is_super", + "type": "boolean", + "format": "" + }, + { + "name": "joinedMemberCount", + "baseName": "joined_member_count", + "type": "number", + "format": "" + }, + { + "name": "joinedTs", + "baseName": "joined_ts", + "type": "number", + "format": "int64" + }, + { + "name": "lastMessage", + "baseName": "last_message", + "type": "SendbirdMessageResponse", + "format": "" + }, + { + "name": "maxLengthMessage", + "baseName": "max_length_message", + "type": "number", + "format": "" + }, + { + "name": "memberCount", + "baseName": "member_count", + "type": "number", + "format": "" + }, + { + "name": "memberState", + "baseName": "member_state", + "type": "GetAGroupChannelResponseMemberStateEnum", + "format": "" + }, + { + "name": "members", + "baseName": "members", + "type": "Array", + "format": "" + }, + { + "name": "messageSurvivalSeconds", + "baseName": "message_survival_seconds", + "type": "number", + "format": "" + }, + { + "name": "metadata", + "baseName": "metadata", + "type": "any", + "format": "" + }, + { + "name": "myRole", + "baseName": "my_role", + "type": "GetAGroupChannelResponseMyRoleEnum", + "format": "" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "pushTriggerOption", + "baseName": "push_trigger_option", + "type": "GetAGroupChannelResponsePushTriggerOptionEnum", + "format": "" + }, + { + "name": "readReceipt", + "baseName": "read_receipt", + "type": "{ [key: string]: number; }", + "format": "int64" + }, + { + "name": "smsFallback", + "baseName": "sms_fallback", + "type": "SendbirdSmsFallback", + "format": "" + }, + { + "name": "tsMessageOffset", + "baseName": "ts_message_offset", + "type": "number", + "format": "int64" + }, + { + "name": "unreadMentionCount", + "baseName": "unread_mention_count", + "type": "number", + "format": "" + }, + { + "name": "unreadMessageCount", + "baseName": "unread_message_count", + "type": "number", + "format": "" + }, + { + "name": "userLastRead", + "baseName": "user_last_read", + "type": "number", + "format": "int64" + } ]; + + static getAttributeTypeMap() { + return GetAGroupChannelResponse.attributeTypeMap; + } + + public constructor() { + } +} + + +export type GetAGroupChannelResponseCountPreferenceEnum = "false" | "all" | "unread_message_count_only" | "unread_mentioned_count_only" ; +export type GetAGroupChannelResponseHiddenStateEnum = "hidden_allow_auto_unhide" | "hidden_prevent_auto_unhide" | "unhidden" ; +export type GetAGroupChannelResponseMemberStateEnum = "invited" | "joined" | "none" ; +export type GetAGroupChannelResponseMyRoleEnum = "" | "none" | "operator" ; +export type GetAGroupChannelResponsePushTriggerOptionEnum = "all" | "default" | "mention_only" | "false" ; + diff --git a/models/GetAGroupChannelResponseAllOf.ts b/models/GetAGroupChannelResponseAllOf.ts new file mode 100644 index 0000000..d72ee44 --- /dev/null +++ b/models/GetAGroupChannelResponseAllOf.ts @@ -0,0 +1,36 @@ +/** + * Sendbird Platform SDK + * Sendbird Platform API SDK [https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) Contact Support: Name: Sendbird Email: [support@sendbird.com](https://mailto:support@sendbird.com) + * + * OpenAPI spec version: 1.0.0 + * Contact: support@sendbird.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { SendbirdGroupChannelDetailChannel } from './SendbirdGroupChannelDetailChannel'; +import { HttpFile } from '../http/http'; + +export class GetAGroupChannelResponseAllOf { + 'channel'?: SendbirdGroupChannelDetailChannel; + + static readonly discriminator: string | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "channel", + "baseName": "channel", + "type": "SendbirdGroupChannelDetailChannel", + "format": "" + } ]; + + static getAttributeTypeMap() { + return GetAGroupChannelResponseAllOf.attributeTypeMap; + } + + public constructor() { + } +} + diff --git a/models/ObjectSerializer.ts b/models/ObjectSerializer.ts index c7a2229..9531920 100644 --- a/models/ObjectSerializer.ts +++ b/models/ObjectSerializer.ts @@ -2,6 +2,8 @@ export * from './AcceptAnInvitationRequest'; export * from './CheckIfMemberResponse'; export * from './CreateAGroupChannelRequest'; export * from './FreezeAGroupChannelRequest'; +export * from './GetAGroupChannelResponse'; +export * from './GetAGroupChannelResponseAllOf'; export * from './GroupChannelListMembersResponse'; export * from './GroupChatListChannelsResponse'; export * from './HideAChannelRequest'; @@ -40,6 +42,8 @@ import { AcceptAnInvitationRequest } from './AcceptAnInvitationRequest'; import { CheckIfMemberResponse , CheckIfMemberResponseStateEnum } from './CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from './CreateAGroupChannelRequest'; import { FreezeAGroupChannelRequest } from './FreezeAGroupChannelRequest'; +import { GetAGroupChannelResponse , GetAGroupChannelResponseCountPreferenceEnum , GetAGroupChannelResponseHiddenStateEnum , GetAGroupChannelResponseMemberStateEnum , GetAGroupChannelResponseMyRoleEnum , GetAGroupChannelResponsePushTriggerOptionEnum } from './GetAGroupChannelResponse'; +import { GetAGroupChannelResponseAllOf } from './GetAGroupChannelResponseAllOf'; import { GroupChannelListMembersResponse } from './GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from './GroupChatListChannelsResponse'; import { HideAChannelRequest } from './HideAChannelRequest'; @@ -95,6 +99,11 @@ const supportedMediaTypes: { [mediaType: string]: number } = { let enumsMap: Set = new Set([ "CheckIfMemberResponseStateEnum", + "GetAGroupChannelResponseCountPreferenceEnum", + "GetAGroupChannelResponseHiddenStateEnum", + "GetAGroupChannelResponseMemberStateEnum", + "GetAGroupChannelResponseMyRoleEnum", + "GetAGroupChannelResponsePushTriggerOptionEnum", "InviteAsMembersResponseCountPreferenceEnum", "InviteAsMembersResponseHiddenStateEnum", "InviteAsMembersResponseMemberStateEnum", @@ -115,6 +124,8 @@ let typeMap: {[index: string]: any} = { "CheckIfMemberResponse": CheckIfMemberResponse, "CreateAGroupChannelRequest": CreateAGroupChannelRequest, "FreezeAGroupChannelRequest": FreezeAGroupChannelRequest, + "GetAGroupChannelResponse": GetAGroupChannelResponse, + "GetAGroupChannelResponseAllOf": GetAGroupChannelResponseAllOf, "GroupChannelListMembersResponse": GroupChannelListMembersResponse, "GroupChatListChannelsResponse": GroupChatListChannelsResponse, "HideAChannelRequest": HideAChannelRequest, diff --git a/models/all.ts b/models/all.ts index 55ba0e7..0c7f685 100644 --- a/models/all.ts +++ b/models/all.ts @@ -2,6 +2,8 @@ export * from './AcceptAnInvitationRequest' export * from './CheckIfMemberResponse' export * from './CreateAGroupChannelRequest' export * from './FreezeAGroupChannelRequest' +export * from './GetAGroupChannelResponse' +export * from './GetAGroupChannelResponseAllOf' export * from './GroupChannelListMembersResponse' export * from './GroupChatListChannelsResponse' export * from './HideAChannelRequest' diff --git a/tests/integration/groupChannel.test.ts b/tests/integration/groupChannel.test.ts index 835208e..50edd61 100644 --- a/tests/integration/groupChannel.test.ts +++ b/tests/integration/groupChannel.test.ts @@ -892,7 +892,7 @@ describe("Group Channel API", () => { * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) */ invitationStatus: { - MASTER_USER_ID: 'joined', + MASTER_USER_ID: "joined", }, inviterId: MASTER_USER_ID, isDistinct: false, @@ -921,46 +921,397 @@ describe("Group Channel API", () => { userId: SECOND_USER_ID, allowAutoUnhide: true, shouldHideAll: false, - } + }, }); - const groupChannelAfterHideResponse = await groupChannelApi.getAGroupChannel({ + + const groupChannelAfterHideResponse = + await groupChannelApi.getAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + showDeliveryReceipt: true, + showReadReceipt: true, + showMember: true, + memberActiveMode: "all", + userId: SECOND_USER_ID, + }); + + const unhideAChannelResponse = await groupChannelApi.unhideAChannel({ channelUrl: createGroupChannelresponse.channelUrl, apiToken: API_TOKEN, - showDeliveryReceipt: true, - showReadReceipt: true, - showMember: true, - memberActiveMode: "all", + shouldUnhideAll: false, + userId: SECOND_USER_ID, }); - const unhideAChannelResponse = await groupChannelApi.unhideAChannel({ + const groupChannelAfterUnHideResponse = + await groupChannelApi.getAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + showDeliveryReceipt: true, + showReadReceipt: true, + showMember: true, + memberActiveMode: "all", + userId: SECOND_USER_ID, + }); + await groupChannelApi.deleteAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + expect(groupChannelAfterHideResponse.channelUrl).toBe(CHANNEL_URL); + expect(groupChannelAfterHideResponse).toHaveProperty("hiddenState"); + expect(groupChannelAfterHideResponse.isHidden).toBeTruthy(); + + expect(groupChannelAfterHideResponse).toHaveProperty("hiddenState"); + expect(groupChannelAfterHideResponse.hiddenState).toBe( + "hidden_allow_auto_unhide" + ); + expect( + validSendbirdGroupChannelHiddenStateEnum.includes( + groupChannelAfterHideResponse.hiddenState + ) + ).toBeTruthy(); + + expect(groupChannelAfterUnHideResponse).toHaveProperty("hiddenState"); + expect(groupChannelAfterUnHideResponse.isHidden).toBeFalsy(); + expect(groupChannelAfterUnHideResponse).toHaveProperty("hiddenState"); + expect(groupChannelAfterUnHideResponse.hiddenState).toBe("unhidden"); + expect( + validSendbirdGroupChannelHiddenStateEnum.includes( + groupChannelAfterUnHideResponse.hiddenState + ) + ).toBeTruthy(); + + expect(hideAChannelResponse).toBeDefined(); + expect(unhideAChannelResponse).toBeDefined(); + }); + + it("call inviteAsMembers then acceptAnInvitation and checkIfMember", async () => { + const CHANNEL_URL = "group-channel-member-invitation-test-channel-url"; + // Cleanup first + try { + await groupChannelApi.deleteAGroupChannel({ + channelUrl: CHANNEL_URL, + apiToken: API_TOKEN, + }); + } catch {} + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: { + MASTER_USER_ID: "joined", + }, + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; + + const createGroupChannelresponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + + const inviteAsMembersResponse = await groupChannelApi.inviteAsMembers({ + channelUrl: CHANNEL_URL, + apiToken: API_TOKEN, + inviteAsMembersRequest: { + inviterId: MASTER_USER_ID, + userIds: [SECOND_USER_ID], + }, + }); + + const groupChannelAfterInviteResponse = + await groupChannelApi.getAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + showDeliveryReceipt: true, + showReadReceipt: true, + showMember: true, + memberActiveMode: "all", + userId: SECOND_USER_ID, + }); + + const acceptAnInvitationResponse = await groupChannelApi.acceptAnInvitation( + { + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + acceptAnInvitationRequest: { + userId: SECOND_USER_ID, + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + }, + } + ); + + const checkIfMemberResponse = await groupChannelApi.checkIfMember({ channelUrl: createGroupChannelresponse.channelUrl, apiToken: API_TOKEN, - shouldUnhideAll: false, userId: SECOND_USER_ID, }); - const groupChannelAfterUnHideResponse = await groupChannelApi.getAGroupChannel({ + const groupChannelAfterJoinedResponse = + await groupChannelApi.getAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + showDeliveryReceipt: true, + showReadReceipt: true, + showMember: true, + memberActiveMode: "all", + userId: SECOND_USER_ID, + }); + + await groupChannelApi.deleteAGroupChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + }); + + expect(inviteAsMembersResponse).toHaveProperty("invitedAt"); + expect(inviteAsMembersResponse).toHaveProperty("inviter"); + expect(inviteAsMembersResponse.inviter?.userId).toBe(MASTER_USER_ID); + expect(inviteAsMembersResponse.inviter).toBeInstanceOf( + SendbirdBasicUserInfo + ); + + expect(groupChannelAfterInviteResponse).toHaveProperty("memberState"); + expect(groupChannelAfterInviteResponse.memberState).toBe("invited"); + expect(groupChannelAfterInviteResponse.memberCount).toBe(2); + expect(groupChannelAfterInviteResponse.joinedMemberCount).toBe(1); + + expect(acceptAnInvitationResponse.joinedMemberCount).toBe(2); + expect( + acceptAnInvitationResponse.members?.find( + (member) => (member.state = "joined") + )?.userId + ).toBe(SECOND_USER_ID); + + expect(groupChannelAfterJoinedResponse).toHaveProperty("memberState"); + expect(groupChannelAfterJoinedResponse).toHaveProperty("joinedTs"); + expect(groupChannelAfterJoinedResponse.joinedTs?.toString().length).toBe( + 10 + ); + expect(groupChannelAfterJoinedResponse.memberState).toBe("joined"); + expect(groupChannelAfterJoinedResponse.memberCount).toBe(2); + expect(groupChannelAfterJoinedResponse.joinedMemberCount).toBe(2); + + expect(checkIfMemberResponse).toHaveProperty("isMember"); + expect(checkIfMemberResponse.isMember).toBeTruthy(); + expect(typeof checkIfMemberResponse.isMember).toBe("boolean"); + + expect(checkIfMemberResponse).toHaveProperty("state"); + expect(checkIfMemberResponse.state).toBeTruthy(); + expect(typeof checkIfMemberResponse.state).toBe("string"); + expect( + validSendbirdGroupChannelMemberStateEnum.includes( + checkIfMemberResponse.state + ) + ).toBeTruthy(); + }); + + it("call joinAChannel then leaveAChannel", async () => { + const CHANNEL_URL = "group-channel-join-leave-channel-test-channel-url"; + // Cleanup first + try { + await groupChannelApi.deleteAGroupChannel({ + channelUrl: CHANNEL_URL, + apiToken: API_TOKEN, + }); + } catch {} + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: { + MASTER_USER_ID: "joined", + }, + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; + + const createGroupChannelresponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + + const joinAChannelResponse = await groupChannelApi.joinAChannel({ + channelUrl: CHANNEL_URL, + apiToken: API_TOKEN, + joinAChannelRequest: { + userId: SECOND_USER_ID, + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + }, + }); + + const leaveAChannelResponse = await groupChannelApi.leaveAChannel({ + channelUrl: createGroupChannelresponse.channelUrl, + apiToken: API_TOKEN, + leaveAChannelRequest: { + shouldLeaveAll: false, + userIds: [SECOND_USER_ID], + }, + }); + + const getAGroupChannelResponse = await groupChannelApi.getAGroupChannel({ channelUrl: createGroupChannelresponse.channelUrl, apiToken: API_TOKEN, showDeliveryReceipt: true, showReadReceipt: true, showMember: true, memberActiveMode: "all", + userId: MASTER_USER_ID, }); + await groupChannelApi.deleteAGroupChannel({ channelUrl: createGroupChannelresponse.channelUrl, apiToken: API_TOKEN, }); - expect(hideAChannelResponse).toBeDefined(); - expect(unhideAChannelResponse).toBeDefined(); + expect(joinAChannelResponse.memberCount).toBe(2); + expect(joinAChannelResponse.joinedMemberCount).toBe(2); + + expect(leaveAChannelResponse).toBeDefined(); + + expect(getAGroupChannelResponse.memberCount).toBe(1); + expect(getAGroupChannelResponse.joinedMemberCount).toBe(1); }); - it.todo("call inviteAsMembers then acceptAnInvitation and checkIfMember"); + it("call updateAGroupChannel", async () => { + const CHANNEL_URL = "group-channel-update-channel-test-channel-url"; + // Cleanup first + try { + await groupChannelApi.deleteAGroupChannel({ + channelUrl: CHANNEL_URL, + apiToken: API_TOKEN, + }); + } catch {} + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: { + MASTER_USER_ID: "joined", + }, + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; - it.todo("call joinAChannel then leaveAChannel"); + const createGroupChannelResponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelResponse).toHaveProperty("channelUrl"); + expect(createGroupChannelResponse.channelUrl).toBe(CHANNEL_URL); - it.todo("call updateAGroupChannel"); + const updateAGroupChannelResponse = + await groupChannelApi.updateAGroupChannel({ + channelUrl: CHANNEL_URL, + apiToken: API_TOKEN, + updateAGroupChannelRequest: { + name: "test2", + data: "data2", + }, + }); - it.todo("call resetChatHistory"); + expect(updateAGroupChannelResponse.name).toBe("test2"); + expect(updateAGroupChannelResponse.data).toBe("data2"); + }); + + it("call resetChatHistory", async () => { + const CHANNEL_URL = "group-channel-reset-chat-history-test-channel-url"; + // Cleanup first + try { + await groupChannelApi.deleteAGroupChannel({ + channelUrl: CHANNEL_URL, + apiToken: API_TOKEN, + }); + } catch {} + const request: CreateAGroupChannelRequest = { + accessCode: GLOBAL_GROUP_CHANNEL_ACCESS_CODE, + blockSdkUserChannelJoin: true, + channelUrl: CHANNEL_URL, + coverUrl: "empty", + customType: "data", + data: "data", + /** + * Specifies one or more key-value pair items which set the invitation status of each user invited to the channel. The key should be a user_id and the value should be their joining status. Acceptable values are joined, invited_by_friend, and invited_by_non_friend. (Default: joined) + */ + invitationStatus: Object.fromEntries(USERS.map((id) => [id, "joined"])), + inviterId: MASTER_USER_ID, + isDistinct: false, + isEphemeral: true, + isPublic: true, + isSuper: true, + name: "test", + operatorIds: [], + strict: true, + users: USERS.map((id) => ({ userId: id })), + }; + const createGroupChannelresponse = + await groupChannelApi.createAGroupChannel({ + apiToken: API_TOKEN, + createAGroupChannelRequest: request, + }); + + expect(createGroupChannelresponse).toHaveProperty("channelUrl"); + expect(createGroupChannelresponse.channelUrl).toBe(CHANNEL_URL); + + const resetChatHistoryresponse = await groupChannelApi.resetChatHistory({ + apiToken: API_TOKEN, + channelUrl: createGroupChannelresponse.channelUrl, + resetChatHistoryRequest: { + resetAll: true, + }, + }); + + expect(resetChatHistoryresponse).toHaveProperty("tsMessageOffset"); + expect(typeof resetChatHistoryresponse.tsMessageOffset).toBe("number"); + expect(resetChatHistoryresponse.tsMessageOffset?.toString().length).toBe( + 13 + ); + }); }); diff --git a/types/ObjectParamAPI.ts b/types/ObjectParamAPI.ts index 808f4c8..9ecd371 100644 --- a/types/ObjectParamAPI.ts +++ b/types/ObjectParamAPI.ts @@ -6,6 +6,8 @@ import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest'; +import { GetAGroupChannelResponse } from '../models/GetAGroupChannelResponse'; +import { GetAGroupChannelResponseAllOf } from '../models/GetAGroupChannelResponseAllOf'; import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; @@ -173,6 +175,12 @@ export interface GroupChannelApiGetAGroupChannelRequest { * @memberof GroupChannelApigetAGroupChannel */ memberActiveMode?: 'all' | 'activated' | 'deactivated' + /** + * + * @type string + * @memberof GroupChannelApigetAGroupChannel + */ + userId?: string /** * * @type string @@ -742,7 +750,7 @@ export interface GroupChannelApiUnhideAChannelRequest { * @type string * @memberof GroupChannelApiunhideAChannel */ - userId?: string + userId: string /** * * @type boolean @@ -835,8 +843,8 @@ export class ObjectGroupChannelApi { * Get a group channel * @param param the request object */ - public getAGroupChannel(param: GroupChannelApiGetAGroupChannelRequest, options?: Configuration): Promise { - return this.api.getAGroupChannel(param.channelUrl, param.showDeliveryReceipt, param.showReadReceipt, param.showMember, param.memberActiveMode, param.apiToken, options).toPromise(); + public getAGroupChannel(param: GroupChannelApiGetAGroupChannelRequest, options?: Configuration): Promise { + return this.api.getAGroupChannel(param.channelUrl, param.showDeliveryReceipt, param.showReadReceipt, param.showMember, param.memberActiveMode, param.userId, param.apiToken, options).toPromise(); } /** diff --git a/types/ObservableAPI.ts b/types/ObservableAPI.ts index 10bc472..559fee4 100644 --- a/types/ObservableAPI.ts +++ b/types/ObservableAPI.ts @@ -7,6 +7,8 @@ import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest'; +import { GetAGroupChannelResponse } from '../models/GetAGroupChannelResponse'; +import { GetAGroupChannelResponseAllOf } from '../models/GetAGroupChannelResponseAllOf'; import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; @@ -194,10 +196,11 @@ export class ObservableGroupChannelApi { * @param showReadReceipt * @param showMember * @param memberActiveMode Restricts the member list to members who are activated or deactivated in the channel. This parameter is only effective if the parameter show_member is true. Acceptable values are all, activated, and deactivated. (default: all) + * @param userId * @param apiToken */ - public getAGroupChannel(channelUrl: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMember?: boolean, memberActiveMode?: 'all' | 'activated' | 'deactivated', apiToken?: string, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.getAGroupChannel(channelUrl, showDeliveryReceipt, showReadReceipt, showMember, memberActiveMode, apiToken, _options); + public getAGroupChannel(channelUrl: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMember?: boolean, memberActiveMode?: 'all' | 'activated' | 'deactivated', userId?: string, apiToken?: string, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.getAGroupChannel(channelUrl, showDeliveryReceipt, showReadReceipt, showMember, memberActiveMode, userId, apiToken, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -562,7 +565,7 @@ export class ObservableGroupChannelApi { * @param shouldUnhideAll * @param apiToken */ - public unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Observable { + public unhideAChannel(channelUrl: string, userId: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Observable { const requestContextPromise = this.requestFactory.unhideAChannel(channelUrl, userId, shouldUnhideAll, apiToken, _options); // build promise chain diff --git a/types/PromiseAPI.ts b/types/PromiseAPI.ts index 2d35dee..1740652 100644 --- a/types/PromiseAPI.ts +++ b/types/PromiseAPI.ts @@ -6,6 +6,8 @@ import { AcceptAnInvitationRequest } from '../models/AcceptAnInvitationRequest'; import { CheckIfMemberResponse } from '../models/CheckIfMemberResponse'; import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest'; import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest'; +import { GetAGroupChannelResponse } from '../models/GetAGroupChannelResponse'; +import { GetAGroupChannelResponseAllOf } from '../models/GetAGroupChannelResponseAllOf'; import { GroupChannelListMembersResponse } from '../models/GroupChannelListMembersResponse'; import { GroupChatListChannelsResponse } from '../models/GroupChatListChannelsResponse'; import { HideAChannelRequest } from '../models/HideAChannelRequest'; @@ -120,10 +122,11 @@ export class PromiseGroupChannelApi { * @param showReadReceipt * @param showMember * @param memberActiveMode Restricts the member list to members who are activated or deactivated in the channel. This parameter is only effective if the parameter show_member is true. Acceptable values are all, activated, and deactivated. (default: all) + * @param userId * @param apiToken */ - public getAGroupChannel(channelUrl: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMember?: boolean, memberActiveMode?: 'all' | 'activated' | 'deactivated', apiToken?: string, _options?: Configuration): Promise { - const result = this.api.getAGroupChannel(channelUrl, showDeliveryReceipt, showReadReceipt, showMember, memberActiveMode, apiToken, _options); + public getAGroupChannel(channelUrl: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMember?: boolean, memberActiveMode?: 'all' | 'activated' | 'deactivated', userId?: string, apiToken?: string, _options?: Configuration): Promise { + const result = this.api.getAGroupChannel(channelUrl, showDeliveryReceipt, showReadReceipt, showMember, memberActiveMode, userId, apiToken, _options); return result.toPromise(); } @@ -320,7 +323,7 @@ export class PromiseGroupChannelApi { * @param shouldUnhideAll * @param apiToken */ - public unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { + public unhideAChannel(channelUrl: string, userId: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { const result = this.api.unhideAChannel(channelUrl, userId, shouldUnhideAll, apiToken, _options); return result.toPromise(); } From db849979721d0b2e8c1af82470ae56b17bca1a15 Mon Sep 17 00:00:00 2001 From: Muhamad Ridwan Date: Fri, 25 Apr 2025 14:20:59 +0700 Subject: [PATCH 6/7] feat: sync with feedbacks --- .gitignore | 2 ++ .openapi-generator/FILES | 1 - GroupChannelApi.md | 24 +++++++++++++----------- apis/GroupChannelApi.ts | 22 ++++++++-------------- models/LeaveAChannelRequest.ts | 22 +++++++++++++++++++++- models/ObjectSerializer.ts | 3 --- models/ResetChatHistoryRequest.ts | 2 +- models/all.ts | 1 - package.json | 2 +- tests/integration/groupChannel.test.ts | 1 + tsconfig.json | 2 +- types/ObjectParamAPI.ts | 17 ++++++++--------- types/ObservableAPI.ts | 13 ++++++------- types/PromiseAPI.ts | 13 ++++++------- 14 files changed, 68 insertions(+), 57 deletions(-) diff --git a/.gitignore b/.gitignore index de268ef..05575ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +sendbird-platform-sdk-* + node_modules/ dist/ diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 05adbd7..4916215 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -53,7 +53,6 @@ models/SendbirdSmsFallback.ts models/SendbirdThumbnail.ts models/SendbirdUser.ts models/StartTypingIndicatorsRequest.ts -models/StopTypingIndicatorsRequest.ts models/UpdateAGroupChannelRequest.ts models/ViewNumberOfDailyActiveUsersResponse.ts models/ViewNumberOfMonthlyActiveUsersResponse.ts diff --git a/GroupChannelApi.md b/GroupChannelApi.md index 18c9904..f78fc17 100644 --- a/GroupChannelApi.md +++ b/GroupChannelApi.md @@ -108,8 +108,8 @@ let body:Sendbird.GroupChannelApiCancelTheRegistrationOfOperatorsRequest = { channelUrl: "channel_url_example", // string | Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. operatorIds: "operator_ids_example", - // string (optional) - deleteAll: "delete_all_example", + // boolean (optional) + deleteAll: true, // string (optional) apiToken: "{{API_TOKEN}}", }; @@ -126,7 +126,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **channelUrl** | [**string**] | (Required) | defaults to undefined **operatorIds** | [**string**] | Specifies an array of one or more operator IDs to unregister from the channel. The operators in this array remain as participants of the channel after losing their operational roles. Urlencoding each operator ID is recommended. An example of a Urlencoded array would be ?operator_ids=urlencoded_id_1,urlencoded_id_2. | defaults to undefined - **deleteAll** | [**string**] | | (optional) defaults to undefined + **deleteAll** | [**boolean**] | | (optional) defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined @@ -666,6 +666,8 @@ let body:Sendbird.GroupChannelApiLeaveAChannelRequest = { "userIds_example", ], shouldLeaveAll: true, + shouldRemoveOperatorStatus: true, + reason: "reason_example", }, }; @@ -927,8 +929,8 @@ let body:Sendbird.GroupChannelApiListMembersRequest = { memberActiveModeFilter: "activated", // string | Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. (optional) nicknameStartswith: "nickname_startswith_example", - // 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false' | Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) (optional) - includePushPreference: "push_enabled", + // boolean | Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) (optional) + includePushPreference: true, // string (optional) apiToken: "{{API_TOKEN}}", }; @@ -956,7 +958,7 @@ Name | Type | Description | Notes **mutedMemberFilter** | [**'all' | 'muted' | 'unmuted'**]**Array<'all' | 'muted' | 'unmuted'>** | Restricts the search scope to retrieve members who are muted or unmuted in the channel. Acceptable values are `all`, `muted`, and `unmuted`. (Default: `all`) | (optional) defaults to undefined **memberActiveModeFilter** | [**'activated' | 'deactivated'**]**Array<'activated' | 'deactivated'>** | Restricts the search scope to retrieve members who are activated or deactivated in the channel. Acceptable values are `all`, `activated`, and `deactivated`. (default: `activated`) | (optional) defaults to undefined **nicknameStartswith** | [**string**] | Searches for members whose nicknames start with the specified value. Urlencoding the value is recommended. | (optional) defaults to undefined - **includePushPreference** | [**'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false'**]**Array<'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false'>** | Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) | (optional) defaults to undefined + **includePushPreference** | [**boolean**] | Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) | (optional) defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined @@ -1255,8 +1257,8 @@ let body:Sendbird.GroupChannelApiStopTypingIndicatorsRequest = { channelUrl: "channel_url_example", // string (optional) apiToken: "{{API_TOKEN}}", - // StopTypingIndicatorsRequest (optional) - stopTypingIndicatorsRequest: { + // StartTypingIndicatorsRequest (optional) + startTypingIndicatorsRequest: { userIds: [ "userIds_example", ], @@ -1273,7 +1275,7 @@ apiInstance.stopTypingIndicators(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **stopTypingIndicatorsRequest** | **StopTypingIndicatorsRequest**| | + **startTypingIndicatorsRequest** | **StartTypingIndicatorsRequest**| | **channelUrl** | [**string**] | (Required) | defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined @@ -1317,7 +1319,7 @@ const apiInstance = new Sendbird.GroupChannelApi(configuration); let body:Sendbird.GroupChannelApiUnhideAChannelRequest = { // string | (Required) channelUrl: "channel_url_example", - // string | (Required) + // string | (Required) (optional) userId: "user_id_example", // boolean (optional) shouldUnhideAll: true, @@ -1336,7 +1338,7 @@ apiInstance.unhideAChannel(body).then((data:any) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **channelUrl** | [**string**] | (Required) | defaults to undefined - **userId** | [**string**] | (Required) | defaults to undefined + **userId** | [**string**] | (Required) | (optional) defaults to undefined **shouldUnhideAll** | [**boolean**] | | (optional) defaults to undefined **apiToken** | [**string**] | | (optional) defaults to undefined diff --git a/apis/GroupChannelApi.ts b/apis/GroupChannelApi.ts index cc5290c..c7e0fed 100644 --- a/apis/GroupChannelApi.ts +++ b/apis/GroupChannelApi.ts @@ -27,7 +27,6 @@ import { ResetChatHistoryRequest } from '../models/ResetChatHistoryRequest'; import { ResetChatHistoryResponse } from '../models/ResetChatHistoryResponse'; import { SendbirdGroupChannelDetail } from '../models/SendbirdGroupChannelDetail'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; -import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from '../models/UpdateAGroupChannelRequest'; /** @@ -93,7 +92,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { * @param deleteAll * @param apiToken */ - public async cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: string, apiToken?: string, _options?: Configuration): Promise { + public async cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: boolean, apiToken?: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined @@ -125,7 +124,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { // Query Params if (deleteAll !== undefined) { - requestContext.setQueryParam("delete_all", ObjectSerializer.serialize(deleteAll, "string", "")); + requestContext.setQueryParam("delete_all", ObjectSerializer.serialize(deleteAll, "boolean", "")); } // Header Params @@ -884,7 +883,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { * @param includePushPreference Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) * @param apiToken */ - public async listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false', apiToken?: string, _options?: Configuration): Promise { + public async listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: boolean, apiToken?: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined @@ -977,7 +976,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { // Query Params if (includePushPreference !== undefined) { - requestContext.setQueryParam("include_push_preference", ObjectSerializer.serialize(includePushPreference, "'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false'", "")); + requestContext.setQueryParam("include_push_preference", ObjectSerializer.serialize(includePushPreference, "boolean", "")); } // Header Params @@ -1199,9 +1198,9 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { * Stop typing indicators * @param channelUrl (Required) * @param apiToken - * @param stopTypingIndicatorsRequest + * @param startTypingIndicatorsRequest */ - public async stopTypingIndicators(channelUrl: string, apiToken?: string, stopTypingIndicatorsRequest?: StopTypingIndicatorsRequest, _options?: Configuration): Promise { + public async stopTypingIndicators(channelUrl: string, apiToken?: string, startTypingIndicatorsRequest?: StartTypingIndicatorsRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined @@ -1230,7 +1229,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( - ObjectSerializer.serialize(stopTypingIndicatorsRequest, "StopTypingIndicatorsRequest", ""), + ObjectSerializer.serialize(startTypingIndicatorsRequest, "StartTypingIndicatorsRequest", ""), contentType ); requestContext.setBody(serializedBody); @@ -1252,7 +1251,7 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { * @param shouldUnhideAll * @param apiToken */ - public async unhideAChannel(channelUrl: string, userId: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { + public async unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'channelUrl' is not null or undefined @@ -1261,11 +1260,6 @@ export class GroupChannelApiRequestFactory extends BaseAPIRequestFactory { } - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError("GroupChannelApi", "unhideAChannel", "userId"); - } - diff --git a/models/LeaveAChannelRequest.ts b/models/LeaveAChannelRequest.ts index 59d6103..8f9d4f4 100644 --- a/models/LeaveAChannelRequest.ts +++ b/models/LeaveAChannelRequest.ts @@ -20,7 +20,15 @@ export class LeaveAChannelRequest { /** * Determines whether to make all members leave the channel. (Default: false) */ - 'shouldLeaveAll': boolean; + 'shouldLeaveAll'?: boolean; + /** + * Determines whether to remove a user from the channel's operator list if the user who is leaving the channel is an operator. (Default: false) + */ + 'shouldRemoveOperatorStatus'?: boolean; + /** + * Specifies the reason for leaving a channel. Acceptable values are admin_removed, admin_deleted, admin_deactivated, left_by_own_choice, and channel_operator_removed. + */ + 'reason'?: string; static readonly discriminator: string | undefined = undefined; @@ -36,6 +44,18 @@ export class LeaveAChannelRequest { "baseName": "should_leave_all", "type": "boolean", "format": "" + }, + { + "name": "shouldRemoveOperatorStatus", + "baseName": "should_remove_operator_status", + "type": "boolean", + "format": "" + }, + { + "name": "reason", + "baseName": "reason", + "type": "string", + "format": "" } ]; static getAttributeTypeMap() { diff --git a/models/ObjectSerializer.ts b/models/ObjectSerializer.ts index 9531920..2f6dda5 100644 --- a/models/ObjectSerializer.ts +++ b/models/ObjectSerializer.ts @@ -33,7 +33,6 @@ export * from './SendbirdSmsFallback'; export * from './SendbirdThumbnail'; export * from './SendbirdUser'; export * from './StartTypingIndicatorsRequest'; -export * from './StopTypingIndicatorsRequest'; export * from './UpdateAGroupChannelRequest'; export * from './ViewNumberOfDailyActiveUsersResponse'; export * from './ViewNumberOfMonthlyActiveUsersResponse'; @@ -73,7 +72,6 @@ import { SendbirdSmsFallback } from './SendbirdSmsFallback'; import { SendbirdThumbnail } from './SendbirdThumbnail'; import { SendbirdUser , SendbirdUserStateEnum } from './SendbirdUser'; import { StartTypingIndicatorsRequest } from './StartTypingIndicatorsRequest'; -import { StopTypingIndicatorsRequest } from './StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from './UpdateAGroupChannelRequest'; import { ViewNumberOfDailyActiveUsersResponse } from './ViewNumberOfDailyActiveUsersResponse'; import { ViewNumberOfMonthlyActiveUsersResponse } from './ViewNumberOfMonthlyActiveUsersResponse'; @@ -155,7 +153,6 @@ let typeMap: {[index: string]: any} = { "SendbirdThumbnail": SendbirdThumbnail, "SendbirdUser": SendbirdUser, "StartTypingIndicatorsRequest": StartTypingIndicatorsRequest, - "StopTypingIndicatorsRequest": StopTypingIndicatorsRequest, "UpdateAGroupChannelRequest": UpdateAGroupChannelRequest, "ViewNumberOfDailyActiveUsersResponse": ViewNumberOfDailyActiveUsersResponse, "ViewNumberOfMonthlyActiveUsersResponse": ViewNumberOfMonthlyActiveUsersResponse, diff --git a/models/ResetChatHistoryRequest.ts b/models/ResetChatHistoryRequest.ts index f9e753c..d0aabee 100644 --- a/models/ResetChatHistoryRequest.ts +++ b/models/ResetChatHistoryRequest.ts @@ -14,7 +14,7 @@ import { HttpFile } from '../http/http'; export class ResetChatHistoryRequest { 'resetAll'?: boolean; - 'userId'?: string; + 'userId': string; static readonly discriminator: string | undefined = undefined; diff --git a/models/all.ts b/models/all.ts index 0c7f685..63c8ab3 100644 --- a/models/all.ts +++ b/models/all.ts @@ -33,7 +33,6 @@ export * from './SendbirdSmsFallback' export * from './SendbirdThumbnail' export * from './SendbirdUser' export * from './StartTypingIndicatorsRequest' -export * from './StopTypingIndicatorsRequest' export * from './UpdateAGroupChannelRequest' export * from './ViewNumberOfDailyActiveUsersResponse' export * from './ViewNumberOfMonthlyActiveUsersResponse' diff --git a/package.json b/package.json index 6ca1a92..bca6e24 100644 --- a/package.json +++ b/package.json @@ -44,4 +44,4 @@ "ts-node": "^10.9.2", "typescript": "^4.9.5" } -} +} \ No newline at end of file diff --git a/tests/integration/groupChannel.test.ts b/tests/integration/groupChannel.test.ts index 50edd61..c98dcb8 100644 --- a/tests/integration/groupChannel.test.ts +++ b/tests/integration/groupChannel.test.ts @@ -1305,6 +1305,7 @@ describe("Group Channel API", () => { channelUrl: createGroupChannelresponse.channelUrl, resetChatHistoryRequest: { resetAll: true, + userId: MASTER_USER_ID, }, }); diff --git a/tsconfig.json b/tsconfig.json index b0279a2..ba2b40d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,4 +26,4 @@ "filesGlob": [ "./**/*.ts", ] -} +} \ No newline at end of file diff --git a/types/ObjectParamAPI.ts b/types/ObjectParamAPI.ts index 9ecd371..0550657 100644 --- a/types/ObjectParamAPI.ts +++ b/types/ObjectParamAPI.ts @@ -37,7 +37,6 @@ import { SendbirdSmsFallback } from '../models/SendbirdSmsFallback'; import { SendbirdThumbnail } from '../models/SendbirdThumbnail'; import { SendbirdUser } from '../models/SendbirdUser'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; -import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from '../models/UpdateAGroupChannelRequest'; import { ViewNumberOfDailyActiveUsersResponse } from '../models/ViewNumberOfDailyActiveUsersResponse'; import { ViewNumberOfMonthlyActiveUsersResponse } from '../models/ViewNumberOfMonthlyActiveUsersResponse'; @@ -81,10 +80,10 @@ export interface GroupChannelApiCancelTheRegistrationOfOperatorsRequest { operatorIds: string /** * - * @type string + * @type boolean * @memberof GroupChannelApicancelTheRegistrationOfOperators */ - deleteAll?: string + deleteAll?: boolean /** * * @type string @@ -615,10 +614,10 @@ export interface GroupChannelApiListMembersRequest { nicknameStartswith?: string /** * Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) - * @type 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false' + * @type boolean * @memberof GroupChannelApilistMembers */ - includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false' + includePushPreference?: boolean /** * * @type string @@ -732,10 +731,10 @@ export interface GroupChannelApiStopTypingIndicatorsRequest { apiToken?: string /** * - * @type StopTypingIndicatorsRequest + * @type StartTypingIndicatorsRequest * @memberof GroupChannelApistopTypingIndicators */ - stopTypingIndicatorsRequest?: StopTypingIndicatorsRequest + startTypingIndicatorsRequest?: StartTypingIndicatorsRequest } export interface GroupChannelApiUnhideAChannelRequest { @@ -750,7 +749,7 @@ export interface GroupChannelApiUnhideAChannelRequest { * @type string * @memberof GroupChannelApiunhideAChannel */ - userId: string + userId?: string /** * * @type boolean @@ -943,7 +942,7 @@ export class ObjectGroupChannelApi { * @param param the request object */ public stopTypingIndicators(param: GroupChannelApiStopTypingIndicatorsRequest, options?: Configuration): Promise { - return this.api.stopTypingIndicators(param.channelUrl, param.apiToken, param.stopTypingIndicatorsRequest, options).toPromise(); + return this.api.stopTypingIndicators(param.channelUrl, param.apiToken, param.startTypingIndicatorsRequest, options).toPromise(); } /** diff --git a/types/ObservableAPI.ts b/types/ObservableAPI.ts index 559fee4..16acd81 100644 --- a/types/ObservableAPI.ts +++ b/types/ObservableAPI.ts @@ -38,7 +38,6 @@ import { SendbirdSmsFallback } from '../models/SendbirdSmsFallback'; import { SendbirdThumbnail } from '../models/SendbirdThumbnail'; import { SendbirdUser } from '../models/SendbirdUser'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; -import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from '../models/UpdateAGroupChannelRequest'; import { ViewNumberOfDailyActiveUsersResponse } from '../models/ViewNumberOfDailyActiveUsersResponse'; import { ViewNumberOfMonthlyActiveUsersResponse } from '../models/ViewNumberOfMonthlyActiveUsersResponse'; @@ -93,7 +92,7 @@ export class ObservableGroupChannelApi { * @param deleteAll * @param apiToken */ - public cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: string, apiToken?: string, _options?: Configuration): Observable { + public cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: boolean, apiToken?: string, _options?: Configuration): Observable { const requestContextPromise = this.requestFactory.cancelTheRegistrationOfOperators(channelUrl, operatorIds, deleteAll, apiToken, _options); // build promise chain @@ -407,7 +406,7 @@ export class ObservableGroupChannelApi { * @param includePushPreference Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) * @param apiToken */ - public listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false', apiToken?: string, _options?: Configuration): Observable { + public listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: boolean, apiToken?: string, _options?: Configuration): Observable { const requestContextPromise = this.requestFactory.listMembers(channelUrl, token, limit, userId, showDeliveryReceipt, showReadReceipt, showMemberIsMuted, order, operatorFilter, memberStateFilter, mutedMemberFilter, memberActiveModeFilter, nicknameStartswith, includePushPreference, apiToken, _options); // build promise chain @@ -536,10 +535,10 @@ export class ObservableGroupChannelApi { * Stop typing indicators * @param channelUrl (Required) * @param apiToken - * @param stopTypingIndicatorsRequest + * @param startTypingIndicatorsRequest */ - public stopTypingIndicators(channelUrl: string, apiToken?: string, stopTypingIndicatorsRequest?: StopTypingIndicatorsRequest, _options?: Configuration): Observable { - const requestContextPromise = this.requestFactory.stopTypingIndicators(channelUrl, apiToken, stopTypingIndicatorsRequest, _options); + public stopTypingIndicators(channelUrl: string, apiToken?: string, startTypingIndicatorsRequest?: StartTypingIndicatorsRequest, _options?: Configuration): Observable { + const requestContextPromise = this.requestFactory.stopTypingIndicators(channelUrl, apiToken, startTypingIndicatorsRequest, _options); // build promise chain let middlewarePreObservable = from(requestContextPromise); @@ -565,7 +564,7 @@ export class ObservableGroupChannelApi { * @param shouldUnhideAll * @param apiToken */ - public unhideAChannel(channelUrl: string, userId: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Observable { + public unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Observable { const requestContextPromise = this.requestFactory.unhideAChannel(channelUrl, userId, shouldUnhideAll, apiToken, _options); // build promise chain diff --git a/types/PromiseAPI.ts b/types/PromiseAPI.ts index 1740652..8f867e6 100644 --- a/types/PromiseAPI.ts +++ b/types/PromiseAPI.ts @@ -37,7 +37,6 @@ import { SendbirdSmsFallback } from '../models/SendbirdSmsFallback'; import { SendbirdThumbnail } from '../models/SendbirdThumbnail'; import { SendbirdUser } from '../models/SendbirdUser'; import { StartTypingIndicatorsRequest } from '../models/StartTypingIndicatorsRequest'; -import { StopTypingIndicatorsRequest } from '../models/StopTypingIndicatorsRequest'; import { UpdateAGroupChannelRequest } from '../models/UpdateAGroupChannelRequest'; import { ViewNumberOfDailyActiveUsersResponse } from '../models/ViewNumberOfDailyActiveUsersResponse'; import { ViewNumberOfMonthlyActiveUsersResponse } from '../models/ViewNumberOfMonthlyActiveUsersResponse'; @@ -75,7 +74,7 @@ export class PromiseGroupChannelApi { * @param deleteAll * @param apiToken */ - public cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: string, apiToken?: string, _options?: Configuration): Promise { + public cancelTheRegistrationOfOperators(channelUrl: string, operatorIds: string, deleteAll?: boolean, apiToken?: string, _options?: Configuration): Promise { const result = this.api.cancelTheRegistrationOfOperators(channelUrl, operatorIds, deleteAll, apiToken, _options); return result.toPromise(); } @@ -249,7 +248,7 @@ export class PromiseGroupChannelApi { * @param includePushPreference Determines whether to include information about the push preference of each member, such as `push_enabled`, `push_trigger_option`, and `do_not_disturb`. (Default: `false`) * @param apiToken */ - public listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: 'push_enabled' | 'push_trigger_option' | 'do_not_disturb' | 'false', apiToken?: string, _options?: Configuration): Promise { + public listMembers(channelUrl: string, token?: string, limit?: number, userId?: string, showDeliveryReceipt?: boolean, showReadReceipt?: boolean, showMemberIsMuted?: boolean, order?: 'member_nickname_alphabetical' | 'operator_then_member_alphabetical', operatorFilter?: 'all' | 'operator' | 'nonoperator', memberStateFilter?: 'all' | 'invited_only' | 'joined_only' | 'invited_by_friend' | 'invited_by_non_friend', mutedMemberFilter?: 'all' | 'muted' | 'unmuted', memberActiveModeFilter?: 'activated' | 'deactivated', nicknameStartswith?: string, includePushPreference?: boolean, apiToken?: string, _options?: Configuration): Promise { const result = this.api.listMembers(channelUrl, token, limit, userId, showDeliveryReceipt, showReadReceipt, showMemberIsMuted, order, operatorFilter, memberStateFilter, mutedMemberFilter, memberActiveModeFilter, nicknameStartswith, includePushPreference, apiToken, _options); return result.toPromise(); } @@ -308,10 +307,10 @@ export class PromiseGroupChannelApi { * Stop typing indicators * @param channelUrl (Required) * @param apiToken - * @param stopTypingIndicatorsRequest + * @param startTypingIndicatorsRequest */ - public stopTypingIndicators(channelUrl: string, apiToken?: string, stopTypingIndicatorsRequest?: StopTypingIndicatorsRequest, _options?: Configuration): Promise { - const result = this.api.stopTypingIndicators(channelUrl, apiToken, stopTypingIndicatorsRequest, _options); + public stopTypingIndicators(channelUrl: string, apiToken?: string, startTypingIndicatorsRequest?: StartTypingIndicatorsRequest, _options?: Configuration): Promise { + const result = this.api.stopTypingIndicators(channelUrl, apiToken, startTypingIndicatorsRequest, _options); return result.toPromise(); } @@ -323,7 +322,7 @@ export class PromiseGroupChannelApi { * @param shouldUnhideAll * @param apiToken */ - public unhideAChannel(channelUrl: string, userId: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { + public unhideAChannel(channelUrl: string, userId?: string, shouldUnhideAll?: boolean, apiToken?: string, _options?: Configuration): Promise { const result = this.api.unhideAChannel(channelUrl, userId, shouldUnhideAll, apiToken, _options); return result.toPromise(); } From 6e8837743aaad3fae0724788db9237853be4885f Mon Sep 17 00:00:00 2001 From: Muhamad Ridwan Date: Fri, 25 Apr 2025 14:34:58 +0700 Subject: [PATCH 7/7] feat: typing adjustment --- GroupChannelApi.md | 2 +- README.md | 91 +++++--------------------- README.md-e | 91 +++++--------------------- models/LeaveAChannelRequest.ts | 7 +- models/ObjectSerializer.ts | 3 +- tests/integration/groupChannel.test.ts | 8 +++ 6 files changed, 52 insertions(+), 150 deletions(-) diff --git a/GroupChannelApi.md b/GroupChannelApi.md index f78fc17..9c67615 100644 --- a/GroupChannelApi.md +++ b/GroupChannelApi.md @@ -667,7 +667,7 @@ let body:Sendbird.GroupChannelApiLeaveAChannelRequest = { ], shouldLeaveAll: true, shouldRemoveOperatorStatus: true, - reason: "reason_example", + reason: "LEFT_BY_OWN_CHOICE", }, }; diff --git a/README.md b/README.md index b72f826..720438f 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,30 @@ -![Sendbird banner image](http://ww1.prweb.com/prfiles/2021/09/14/18371217/Sendbird_Logo_RGB_lg.png) +## sendbird-platform-sdk-typescript@1.0.27 -# [Sendbird Typescript Platform SDK](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) +This generator creates TypeScript/JavaScript client that utilizes fetch-api. -[![link to docs](https://img.shields.io/badge/SDK-docs-green)](/docs) -This is a Node.js package written in Typescript that makes talking to the [Sendbird Platform API](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) easier. -With this library you can extend your Sendbird integration to include advanced features like message-, and channel automation, user management, create user authentication tokens, and create bots. +### Building -# 🔥 Quick start - -```javascript -import * as sendbird from 'sendbird-platform-sdk-typescript'; -const APP_ID = "YOUR_APP_ID_FROM_DASHBOARD"; -const API_TOKEN = "YOUR_MASTER_API_TOKEN_FROM_DASHBOARD"; -const serverConfig = new sendbird.ServerConfiguration("https://api-{app_id}.sendbird.com", { "app_id": APP_ID }) -const configuration = sendbird.createConfiguration({ baseServer : serverConfig }); -const userAPI = new sendbird.UserApi(configuration); -// List users, use the next token in the response to get the next page of users in subsequent requests -userAPI.listUsers(API_TOKEN, '', 10).then((users) => { - console.log("Listing first 10 users:\n") - console.log(users) -}).catch((error) => { - console.log("Error listing users") - console.log(error) -}) -// How to create a user -const userData: sendbird.CreateUserData = { - userId: "bob_smith", - nickname: "Bob", - profileUrl: "https://cataas.com/c" -} -userAPI.createUser(API_TOKEN, userData).then((user) => { - console.log("User created:\n") - console.log(user) -}).catch((error) => { - console.log("Error creating user:") - console.log(error) -}) +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build ``` -# ⚠️ Warnings - - 1. This package is not currently in npm. Please see the Local development section for installation instructions. - 2. This library is intended for server to server requests. **Do not use in a browser environment**. This SDK uses the Master API Token, which should never be exposed to the outside world like in a webpage or app. - -# ⚒️ Prerequisite - -In order to make requests with this SDK you will need you master API token. This can be found through the [Sendbird dashboard](https://dashboard.sendbird.com/). Each app you create in Sendbird has its own master api token. These tokens can be found in Settings > Application > General. -![how to find you api token](https://i.imgur.com/0YMKtpX.png) - -# 💻 Requirements - -You will need [Node.js](https://nodejs.org/en/download/) installed. This has been developed and tested with NodeJS 17+. - -# ⚙️ Installation - -🚨 Package not yet in npm 🚨 -```npm install sendbird-platform-sdk-typescript``` - -# 🤓 Local Development +### Publishing - 1. Clone the repository - 2. cd to the `sendbird-platform-sdk-typescript` directory - 3. run `npm install` - 4. cd to your project directory - 5. run `npm install /path/to/sendbird-platform-sdk-typescript --save` +First build the package then run ```npm publish``` +### Consuming -# 🗃️ Documentation -All the documentation for this project lives in the /docs directory of this repo. +navigate to the folder of your consuming project and run one of the following commands. -##### Helpful links +_published:_ -| | Documentation | -| ----------- | ----------- | -| Announcement | [docs/AnnouncementApi.md](AnnouncementApi.md)| -| Application | [docs/ApplicationApi.md](ApplicationApi.md) | -| Bot | [docs/BotApi.md](BotApi.md) | -| GroupChannel | [docs/GroupChannelApi.md](GroupChannelApi.md) | -| Message | [docs/MessageApi.md](MessageApi.md) | -| OpenChannel | [docs/OpenChannelApi.md ](OpenChannelApi.md) | -| User | [docs/UserApi.md](UserApi.md) | -| Webhooks | [docs/WebhooksApi.md](WebhooksApi.md) | +``` +npm install sendbird-platform-sdk-typescript@1.0.27 --save +``` +_unPublished (not recommended):_ +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/README.md-e b/README.md-e index b72f826..720438f 100644 --- a/README.md-e +++ b/README.md-e @@ -1,85 +1,30 @@ -![Sendbird banner image](http://ww1.prweb.com/prfiles/2021/09/14/18371217/Sendbird_Logo_RGB_lg.png) +## sendbird-platform-sdk-typescript@1.0.27 -# [Sendbird Typescript Platform SDK](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) +This generator creates TypeScript/JavaScript client that utilizes fetch-api. -[![link to docs](https://img.shields.io/badge/SDK-docs-green)](/docs) -This is a Node.js package written in Typescript that makes talking to the [Sendbird Platform API](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) easier. -With this library you can extend your Sendbird integration to include advanced features like message-, and channel automation, user management, create user authentication tokens, and create bots. +### Building -# 🔥 Quick start - -```javascript -import * as sendbird from 'sendbird-platform-sdk-typescript'; -const APP_ID = "YOUR_APP_ID_FROM_DASHBOARD"; -const API_TOKEN = "YOUR_MASTER_API_TOKEN_FROM_DASHBOARD"; -const serverConfig = new sendbird.ServerConfiguration("https://api-{app_id}.sendbird.com", { "app_id": APP_ID }) -const configuration = sendbird.createConfiguration({ baseServer : serverConfig }); -const userAPI = new sendbird.UserApi(configuration); -// List users, use the next token in the response to get the next page of users in subsequent requests -userAPI.listUsers(API_TOKEN, '', 10).then((users) => { - console.log("Listing first 10 users:\n") - console.log(users) -}).catch((error) => { - console.log("Error listing users") - console.log(error) -}) -// How to create a user -const userData: sendbird.CreateUserData = { - userId: "bob_smith", - nickname: "Bob", - profileUrl: "https://cataas.com/c" -} -userAPI.createUser(API_TOKEN, userData).then((user) => { - console.log("User created:\n") - console.log(user) -}).catch((error) => { - console.log("Error creating user:") - console.log(error) -}) +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build ``` -# ⚠️ Warnings - - 1. This package is not currently in npm. Please see the Local development section for installation instructions. - 2. This library is intended for server to server requests. **Do not use in a browser environment**. This SDK uses the Master API Token, which should never be exposed to the outside world like in a webpage or app. - -# ⚒️ Prerequisite - -In order to make requests with this SDK you will need you master API token. This can be found through the [Sendbird dashboard](https://dashboard.sendbird.com/). Each app you create in Sendbird has its own master api token. These tokens can be found in Settings > Application > General. -![how to find you api token](https://i.imgur.com/0YMKtpX.png) - -# 💻 Requirements - -You will need [Node.js](https://nodejs.org/en/download/) installed. This has been developed and tested with NodeJS 17+. - -# ⚙️ Installation - -🚨 Package not yet in npm 🚨 -```npm install sendbird-platform-sdk-typescript``` - -# 🤓 Local Development +### Publishing - 1. Clone the repository - 2. cd to the `sendbird-platform-sdk-typescript` directory - 3. run `npm install` - 4. cd to your project directory - 5. run `npm install /path/to/sendbird-platform-sdk-typescript --save` +First build the package then run ```npm publish``` +### Consuming -# 🗃️ Documentation -All the documentation for this project lives in the /docs directory of this repo. +navigate to the folder of your consuming project and run one of the following commands. -##### Helpful links +_published:_ -| | Documentation | -| ----------- | ----------- | -| Announcement | [docs/AnnouncementApi.md](AnnouncementApi.md)| -| Application | [docs/ApplicationApi.md](ApplicationApi.md) | -| Bot | [docs/BotApi.md](BotApi.md) | -| GroupChannel | [docs/GroupChannelApi.md](GroupChannelApi.md) | -| Message | [docs/MessageApi.md](MessageApi.md) | -| OpenChannel | [docs/OpenChannelApi.md ](OpenChannelApi.md) | -| User | [docs/UserApi.md](UserApi.md) | -| Webhooks | [docs/WebhooksApi.md](WebhooksApi.md) | +``` +npm install sendbird-platform-sdk-typescript@1.0.27 --save +``` +_unPublished (not recommended):_ +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/models/LeaveAChannelRequest.ts b/models/LeaveAChannelRequest.ts index 8f9d4f4..a2688d4 100644 --- a/models/LeaveAChannelRequest.ts +++ b/models/LeaveAChannelRequest.ts @@ -28,7 +28,7 @@ export class LeaveAChannelRequest { /** * Specifies the reason for leaving a channel. Acceptable values are admin_removed, admin_deleted, admin_deactivated, left_by_own_choice, and channel_operator_removed. */ - 'reason'?: string; + 'reason'?: LeaveAChannelRequestReasonEnum; static readonly discriminator: string | undefined = undefined; @@ -54,7 +54,7 @@ export class LeaveAChannelRequest { { "name": "reason", "baseName": "reason", - "type": "string", + "type": "LeaveAChannelRequestReasonEnum", "format": "" } ]; @@ -66,3 +66,6 @@ export class LeaveAChannelRequest { } } + +export type LeaveAChannelRequestReasonEnum = "LEFT_BY_OWN_CHOICE" | "CHANNEL_OPERATOR_REMOVED" | "ADMIN_REMOVED" | "ADMIN_DELETED" | "ADMIN_DEACTIVATED" ; + diff --git a/models/ObjectSerializer.ts b/models/ObjectSerializer.ts index 2f6dda5..bced3e3 100644 --- a/models/ObjectSerializer.ts +++ b/models/ObjectSerializer.ts @@ -50,7 +50,7 @@ import { InviteAsMembersRequest } from './InviteAsMembersRequest'; import { InviteAsMembersResponse , InviteAsMembersResponseCountPreferenceEnum , InviteAsMembersResponseHiddenStateEnum , InviteAsMembersResponseMemberStateEnum , InviteAsMembersResponseMyRoleEnum , InviteAsMembersResponsePushTriggerOptionEnum } from './InviteAsMembersResponse'; import { InviteAsMembersResponseAllOf } from './InviteAsMembersResponseAllOf'; import { JoinAChannelRequest } from './JoinAChannelRequest'; -import { LeaveAChannelRequest } from './LeaveAChannelRequest'; +import { LeaveAChannelRequest , LeaveAChannelRequestReasonEnum } from './LeaveAChannelRequest'; import { ListOperatorsResponse } from './ListOperatorsResponse'; import { MarkAllMessagesAsReadRequest } from './MarkAllMessagesAsReadRequest'; import { RegisterOperatorsToAGroupChannelRequest } from './RegisterOperatorsToAGroupChannelRequest'; @@ -107,6 +107,7 @@ let enumsMap: Set = new Set([ "InviteAsMembersResponseMemberStateEnum", "InviteAsMembersResponseMyRoleEnum", "InviteAsMembersResponsePushTriggerOptionEnum", + "LeaveAChannelRequestReasonEnum", "SendbirdGroupChannelCountPreferenceEnum", "SendbirdGroupChannelHiddenStateEnum", "SendbirdGroupChannelMemberStateEnum", diff --git a/tests/integration/groupChannel.test.ts b/tests/integration/groupChannel.test.ts index c98dcb8..8fec765 100644 --- a/tests/integration/groupChannel.test.ts +++ b/tests/integration/groupChannel.test.ts @@ -14,6 +14,7 @@ import { SendbirdMemberRoleEnum, SendbirdMemberStateEnum, SendbirdGroupChannelDetailChannel, + LeaveAChannelRequestReasonEnum, } from "../../models/ObjectSerializer"; import { hasValidField } from "./helper"; import { ServerConfiguration } from "../../servers"; @@ -617,14 +618,19 @@ describe("Group Channel API", () => { expect(channel).toBeDefined(); if (channel) { + const LIMIT = 10; const listMembersResponse = await groupChannelApi.listMembers({ apiToken: API_TOKEN, + limit: LIMIT, channelUrl: channel.channelUrl, + includePushPreference: true, }); expect(listMembersResponse).toHaveProperty("members"); expect(Array.isArray(listMembersResponse.members)).toBe(true); + expect((listMembersResponse.members.length)).toBeLessThanOrEqual(LIMIT); listMembersResponse.members.forEach((member) => { + console.log(member); expect(member).toHaveProperty("userId"); expect(typeof member.userId).toBe("string"); @@ -1177,6 +1183,8 @@ describe("Group Channel API", () => { apiToken: API_TOKEN, leaveAChannelRequest: { shouldLeaveAll: false, + shouldRemoveOperatorStatus: true, + reason: 'LEFT_BY_OWN_CHOICE', userIds: [SECOND_USER_ID], }, });