mezon-js 2.13.26 → 2.13.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.gen.ts CHANGED
@@ -26,6 +26,28 @@ export interface ChannelUserListChannelUser {
26
26
  is_banned?: boolean;
27
27
  }
28
28
 
29
+ /** */
30
+ export interface ApiBannedUser {
31
+ //
32
+ ban_time?: number;
33
+ //
34
+ banned_avatar?: string;
35
+ //The banned user.
36
+ banned_id?: string;
37
+ //
38
+ banned_name?: string;
39
+ //
40
+ channel_id?: string;
41
+ //
42
+ reason?: string;
43
+ }
44
+
45
+ /** */
46
+ export interface ApibannedUserList {
47
+ //
48
+ banned_users?: Array<ApiBannedUser>;
49
+ }
50
+
29
51
  /** A single user-role pair. */
30
52
  export interface ClanUserListClanUser {
31
53
  //from the `avatar_url` field in the `clan_desc_profile` table.
@@ -5763,6 +5785,37 @@ export class MezonApi {
5763
5785
  ]);
5764
5786
  }
5765
5787
 
5788
+ /** List banned user */
5789
+ listBannedUsers(bearerToken: string,
5790
+ options: any = {}): Promise<ApibannedUserList> {
5791
+
5792
+ const urlPath = "/v2/banned";
5793
+ const queryParams = new Map<string, any>();
5794
+
5795
+ let bodyJson : string = "";
5796
+
5797
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5798
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5799
+ if (bearerToken) {
5800
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5801
+ }
5802
+
5803
+ return Promise.race([
5804
+ fetch(fullUrl, fetchOptions).then((response) => {
5805
+ if (response.status == 204) {
5806
+ return response;
5807
+ } else if (response.status >= 200 && response.status < 300) {
5808
+ return response.json();
5809
+ } else {
5810
+ throw response;
5811
+ }
5812
+ }),
5813
+ new Promise((_, reject) =>
5814
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5815
+ ),
5816
+ ]);
5817
+ }
5818
+
5766
5819
  /** Ban a set of users from a channel. */
5767
5820
  unbanClanUsers(bearerToken: string,
5768
5821
  clanId:string,
package/client.ts CHANGED
@@ -179,6 +179,7 @@ import {
179
179
  ApiListClanUnreadMsgIndicatorResponse,
180
180
  ApiAddFriendsResponse,
181
181
  ApiUpdateUsernameRequest,
182
+ ApibannedUserList,
182
183
  } from "./api.gen";
183
184
 
184
185
  import { Session } from "./session";
@@ -1128,6 +1129,26 @@ export class Client {
1128
1129
  });
1129
1130
  }
1130
1131
 
1132
+ async listBannedUsers(
1133
+ session: Session
1134
+ ): Promise<ApibannedUserList> {
1135
+ if (
1136
+ this.autoRefreshSession &&
1137
+ session.refresh_token &&
1138
+ session.isexpired(Date.now() / 1000)
1139
+ ) {
1140
+ await this.sessionRefresh(session);
1141
+ }
1142
+
1143
+ return this.apiClient
1144
+ .listBannedUsers(
1145
+ session.token
1146
+ )
1147
+ .then((response: ApibannedUserList) => {
1148
+ return Promise.resolve(response);
1149
+ });
1150
+ }
1151
+
1131
1152
  /** Ban a set of users from a clan. */
1132
1153
  async unbanClanUsers(
1133
1154
  session: Session,
package/dist/api.gen.d.ts CHANGED
@@ -10,6 +10,19 @@ export interface ChannelUserListChannelUser {
10
10
  added_by?: string;
11
11
  is_banned?: boolean;
12
12
  }
13
+ /** */
14
+ export interface ApiBannedUser {
15
+ ban_time?: number;
16
+ banned_avatar?: string;
17
+ banned_id?: string;
18
+ banned_name?: string;
19
+ channel_id?: string;
20
+ reason?: string;
21
+ }
22
+ /** */
23
+ export interface ApibannedUserList {
24
+ banned_users?: Array<ApiBannedUser>;
25
+ }
13
26
  /** A single user-role pair. */
14
27
  export interface ClanUserListClanUser {
15
28
  clan_avatar?: string;
@@ -2082,6 +2095,8 @@ export declare class MezonApi {
2082
2095
  updateClanDesc(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
2083
2096
  /** Kick a set of users from a clan. */
2084
2097
  removeClanUsers(bearerToken: string, clanId: string, userIds?: Array<string>, options?: any): Promise<any>;
2098
+ /** List banned user */
2099
+ listBannedUsers(bearerToken: string, options?: any): Promise<ApibannedUserList>;
2085
2100
  /** Ban a set of users from a channel. */
2086
2101
  unbanClanUsers(bearerToken: string, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number, options?: any): Promise<any>;
2087
2102
  /** Ban a set of users from a channel. */
package/dist/client.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ApiAccount, ApiAccountMezon, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiUnlockedItemRequest, ApiForSaleItemList, ApiUnlockedItemResponse, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiStoreWalletKeyRequest, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse, ApiUpdateUsernameRequest } from "./api.gen";
16
+ import { ApiAccount, ApiAccountMezon, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiUnlockedItemRequest, ApiForSaleItemList, ApiUnlockedItemResponse, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiStoreWalletKeyRequest, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse, ApiUpdateUsernameRequest, ApibannedUserList } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -300,6 +300,7 @@ export declare class Client {
300
300
  getAccount(session: Session): Promise<ApiAccount>;
301
301
  /** Kick a set of users from a clan. */
302
302
  removeClanUsers(session: Session, clanId: string, ids?: Array<string>): Promise<boolean>;
303
+ listBannedUsers(session: Session): Promise<ApibannedUserList>;
303
304
  /** Ban a set of users from a clan. */
304
305
  unbanClanUsers(session: Session, clanId: string, channelId?: string, userIds?: Array<string>): Promise<boolean>;
305
306
  /** Ban a set of users from a clan. */
@@ -2549,6 +2549,31 @@ var MezonApi = class {
2549
2549
  )
2550
2550
  ]);
2551
2551
  }
2552
+ /** List banned user */
2553
+ listBannedUsers(bearerToken, options = {}) {
2554
+ const urlPath = "/v2/banned";
2555
+ const queryParams = /* @__PURE__ */ new Map();
2556
+ let bodyJson = "";
2557
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2558
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2559
+ if (bearerToken) {
2560
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2561
+ }
2562
+ return Promise.race([
2563
+ fetch(fullUrl, fetchOptions).then((response) => {
2564
+ if (response.status == 204) {
2565
+ return response;
2566
+ } else if (response.status >= 200 && response.status < 300) {
2567
+ return response.json();
2568
+ } else {
2569
+ throw response;
2570
+ }
2571
+ }),
2572
+ new Promise(
2573
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2574
+ )
2575
+ ]);
2576
+ }
2552
2577
  /** Ban a set of users from a channel. */
2553
2578
  unbanClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
2554
2579
  if (clanId === null || clanId === void 0) {
@@ -8878,6 +8903,18 @@ var Client = class {
8878
8903
  });
8879
8904
  });
8880
8905
  }
8906
+ listBannedUsers(session) {
8907
+ return __async(this, null, function* () {
8908
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8909
+ yield this.sessionRefresh(session);
8910
+ }
8911
+ return this.apiClient.listBannedUsers(
8912
+ session.token
8913
+ ).then((response) => {
8914
+ return Promise.resolve(response);
8915
+ });
8916
+ });
8917
+ }
8881
8918
  /** Ban a set of users from a clan. */
8882
8919
  unbanClanUsers(session, clanId, channelId, userIds) {
8883
8920
  return __async(this, null, function* () {
@@ -2515,6 +2515,31 @@ var MezonApi = class {
2515
2515
  )
2516
2516
  ]);
2517
2517
  }
2518
+ /** List banned user */
2519
+ listBannedUsers(bearerToken, options = {}) {
2520
+ const urlPath = "/v2/banned";
2521
+ const queryParams = /* @__PURE__ */ new Map();
2522
+ let bodyJson = "";
2523
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2524
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2525
+ if (bearerToken) {
2526
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2527
+ }
2528
+ return Promise.race([
2529
+ fetch(fullUrl, fetchOptions).then((response) => {
2530
+ if (response.status == 204) {
2531
+ return response;
2532
+ } else if (response.status >= 200 && response.status < 300) {
2533
+ return response.json();
2534
+ } else {
2535
+ throw response;
2536
+ }
2537
+ }),
2538
+ new Promise(
2539
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2540
+ )
2541
+ ]);
2542
+ }
2518
2543
  /** Ban a set of users from a channel. */
2519
2544
  unbanClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
2520
2545
  if (clanId === null || clanId === void 0) {
@@ -8844,6 +8869,18 @@ var Client = class {
8844
8869
  });
8845
8870
  });
8846
8871
  }
8872
+ listBannedUsers(session) {
8873
+ return __async(this, null, function* () {
8874
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8875
+ yield this.sessionRefresh(session);
8876
+ }
8877
+ return this.apiClient.listBannedUsers(
8878
+ session.token
8879
+ ).then((response) => {
8880
+ return Promise.resolve(response);
8881
+ });
8882
+ });
8883
+ }
8847
8884
  /** Ban a set of users from a clan. */
8848
8885
  unbanClanUsers(session, clanId, channelId, userIds) {
8849
8886
  return __async(this, null, function* () {
package/dist/socket.d.ts CHANGED
@@ -139,6 +139,7 @@ export interface UserChannelAddedEvent {
139
139
  caller: UserProfileRedis;
140
140
  create_time_second: number;
141
141
  active: number;
142
+ member_count: number;
142
143
  }
143
144
  export interface UserChannelRemovedEvent {
144
145
  channel_id: string;
@@ -432,6 +433,7 @@ export interface ChannelCreatedEvent {
432
433
  status: number;
433
434
  app_id: string;
434
435
  clan_name: string;
436
+ channel_avatar: string;
435
437
  }
436
438
  export interface CategoryEvent {
437
439
  clan_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.13.26",
3
+ "version": "2.13.28",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -230,6 +230,8 @@ export interface UserChannelAddedEvent {
230
230
  create_time_second: number;
231
231
  //
232
232
  active: number;
233
+ // member count for group channel
234
+ member_count: number;
233
235
  }
234
236
 
235
237
  export interface UserChannelRemovedEvent {
@@ -682,6 +684,8 @@ export interface ChannelCreatedEvent {
682
684
  app_id: string;
683
685
  // clan_name
684
686
  clan_name: string;
687
+ // channel avatar
688
+ channel_avatar: string;
685
689
  }
686
690
 
687
691
  export interface CategoryEvent {