mezon-js 2.12.44 → 2.12.46

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
@@ -2700,6 +2700,8 @@ export interface ApiQuickMenuAccess {
2700
2700
  id?: string;
2701
2701
  //
2702
2702
  menu_name?: string;
2703
+ //
2704
+ menu_type?: number;
2703
2705
  }
2704
2706
 
2705
2707
  /** */
@@ -2724,6 +2726,8 @@ export interface ApiQuickMenuAccessRequest {
2724
2726
  id?: string;
2725
2727
  //
2726
2728
  menu_name?: string;
2729
+ //
2730
+ menu_type?:number;
2727
2731
  }
2728
2732
 
2729
2733
  /** */
@@ -3285,6 +3289,21 @@ export interface ApiClanDiscoverRequest {
3285
3289
  page_number?: number;
3286
3290
  }
3287
3291
 
3292
+ /** */
3293
+ export interface ApiChannelMemberDetail {
3294
+ //
3295
+ added_by?: string;
3296
+ //
3297
+ member_id?: string;
3298
+ }
3299
+
3300
+ /** */
3301
+ export interface ApiChannelMemberList {
3302
+ //
3303
+ channel_members?: Array<ApiChannelMemberDetail>;
3304
+ }
3305
+
3306
+
3288
3307
  export class MezonApi {
3289
3308
  basePath: string;
3290
3309
  constructor(
@@ -10918,12 +10937,14 @@ export class MezonApi {
10918
10937
  listQuickMenuAccess(bearerToken: string,
10919
10938
  botId?:string,
10920
10939
  channelId?:string,
10940
+ menuType?:number,
10921
10941
  options: any = {}): Promise<ApiQuickMenuAccessList> {
10922
10942
 
10923
10943
  const urlPath = "/v2/quickmenuaccess";
10924
10944
  const queryParams = new Map<string, any>();
10925
10945
  queryParams.set("bot_id", botId);
10926
10946
  queryParams.set("channel_id", channelId);
10947
+ queryParams.set("menu_type", menuType);
10927
10948
 
10928
10949
  let bodyJson : string = "";
10929
10950
 
@@ -11089,4 +11110,39 @@ export class MezonApi {
11089
11110
  ),
11090
11111
  ]);
11091
11112
  }
11113
+
11114
+ /** */
11115
+ listChannelMember(bearerToken: string,
11116
+ channelId?:string,
11117
+ clanId?:string,
11118
+ options: any = {}): Promise<ApiChannelMemberList> {
11119
+
11120
+ const urlPath = "/v2/listchannelmember";
11121
+ const queryParams = new Map<string, any>();
11122
+ queryParams.set("channel_id", channelId);
11123
+ queryParams.set("clan_id", clanId);
11124
+
11125
+ let bodyJson : string = "";
11126
+
11127
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
11128
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
11129
+ if (bearerToken) {
11130
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
11131
+ }
11132
+
11133
+ return Promise.race([
11134
+ fetch(fullUrl, fetchOptions).then((response) => {
11135
+ if (response.status == 204) {
11136
+ return response;
11137
+ } else if (response.status >= 200 && response.status < 300) {
11138
+ return response.json();
11139
+ } else {
11140
+ throw response;
11141
+ }
11142
+ }),
11143
+ new Promise((_, reject) =>
11144
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
11145
+ ),
11146
+ ]);
11147
+ }
11092
11148
  }
package/client.ts CHANGED
@@ -169,6 +169,7 @@ import {
169
169
  ApiUnlockedItemRequest,
170
170
  ApiForSaleItemList,
171
171
  ApiUnlockedItemResponse,
172
+ ApiChannelMemberList,
172
173
  } from "./api.gen";
173
174
 
174
175
  import { Session } from "./session";
@@ -4858,4 +4859,24 @@ export class Client {
4858
4859
  return Promise.resolve(response);
4859
4860
  });
4860
4861
  }
4862
+
4863
+ async listChannelMember(
4864
+ session: Session,
4865
+ channelId:string,
4866
+ clanId:string,
4867
+ ): Promise<ApiChannelMemberList> {
4868
+ if (
4869
+ this.autoRefreshSession &&
4870
+ session.refresh_token &&
4871
+ session.isexpired(Date.now() / 1000)
4872
+ ) {
4873
+ await this.sessionRefresh(session);
4874
+ }
4875
+
4876
+ return this.apiClient
4877
+ .listChannelMember(session.token, channelId, clanId)
4878
+ .then((response: ApiChannelMemberList) => {
4879
+ return Promise.resolve(response);
4880
+ });
4881
+ }
4861
4882
  }
package/dist/api.gen.d.ts CHANGED
@@ -1543,6 +1543,7 @@ export interface ApiQuickMenuAccess {
1543
1543
  clan_id?: string;
1544
1544
  id?: string;
1545
1545
  menu_name?: string;
1546
+ menu_type?: number;
1546
1547
  }
1547
1548
  /** */
1548
1549
  export interface ApiQuickMenuAccessList {
@@ -1557,6 +1558,7 @@ export interface ApiQuickMenuAccessRequest {
1557
1558
  clan_id?: string;
1558
1559
  id?: string;
1559
1560
  menu_name?: string;
1561
+ menu_type?: number;
1560
1562
  }
1561
1563
  /** */
1562
1564
  export interface ApiUserPermissionInChannelListResponse {
@@ -1882,6 +1884,15 @@ export interface ApiClanDiscoverRequest {
1882
1884
  item_per_page?: number;
1883
1885
  page_number?: number;
1884
1886
  }
1887
+ /** */
1888
+ export interface ApiChannelMemberDetail {
1889
+ added_by?: string;
1890
+ member_id?: string;
1891
+ }
1892
+ /** */
1893
+ export interface ApiChannelMemberList {
1894
+ channel_members?: Array<ApiChannelMemberDetail>;
1895
+ }
1885
1896
  export declare class MezonApi {
1886
1897
  readonly serverKey: string;
1887
1898
  readonly timeoutMs: number;
@@ -2272,7 +2283,7 @@ export declare class MezonApi {
2272
2283
  /** */
2273
2284
  deleteQuickMenuAccess(bearerToken: string, id?: string, menuName?: string, background?: string, actionMsg?: string, options?: any): Promise<any>;
2274
2285
  /** */
2275
- listQuickMenuAccess(bearerToken: string, botId?: string, channelId?: string, options?: any): Promise<ApiQuickMenuAccessList>;
2286
+ listQuickMenuAccess(bearerToken: string, botId?: string, channelId?: string, menuType?: number, options?: any): Promise<ApiQuickMenuAccessList>;
2276
2287
  /** */
2277
2288
  addQuickMenuAccess(bearerToken: string, body: ApiQuickMenuAccessRequest, options?: any): Promise<any>;
2278
2289
  /** */
@@ -2281,4 +2292,6 @@ export declare class MezonApi {
2281
2292
  unlockItem(bearerToken: string, body: ApiUnlockedItemRequest, options?: any): Promise<ApiUnlockedItemResponse>;
2282
2293
  /** For sale items */
2283
2294
  listForSaleItems(bearerToken: string, page?: number, options?: any): Promise<ApiForSaleItemList>;
2295
+ /** */
2296
+ listChannelMember(bearerToken: string, channelId?: string, clanId?: string, options?: any): Promise<ApiChannelMemberList>;
2284
2297
  }
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, ApiClanDescProfile, 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 } 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, ApiClanDescProfile, 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, ApiChannelMemberList } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -631,4 +631,5 @@ export declare class Client {
631
631
  updateQuickMenuAccess(session: Session, request: ApiQuickMenuAccessRequest): Promise<any>;
632
632
  unlockItem(session: Session, request: ApiUnlockedItemRequest): Promise<ApiUnlockedItemResponse>;
633
633
  listForSaleItems(session: Session, page?: number): Promise<ApiForSaleItemList>;
634
+ listChannelMember(session: Session, channelId: string, clanId: string): Promise<ApiChannelMemberList>;
634
635
  }
@@ -6688,11 +6688,12 @@ var MezonApi = class {
6688
6688
  ]);
6689
6689
  }
6690
6690
  /** */
6691
- listQuickMenuAccess(bearerToken, botId, channelId, options = {}) {
6691
+ listQuickMenuAccess(bearerToken, botId, channelId, menuType, options = {}) {
6692
6692
  const urlPath = "/v2/quickmenuaccess";
6693
6693
  const queryParams = /* @__PURE__ */ new Map();
6694
6694
  queryParams.set("bot_id", botId);
6695
6695
  queryParams.set("channel_id", channelId);
6696
+ queryParams.set("menu_type", menuType);
6696
6697
  let bodyJson = "";
6697
6698
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6698
6699
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -6827,6 +6828,33 @@ var MezonApi = class {
6827
6828
  )
6828
6829
  ]);
6829
6830
  }
6831
+ /** */
6832
+ listChannelMember(bearerToken, channelId, clanId, options = {}) {
6833
+ const urlPath = "/v2/listchannelmember";
6834
+ const queryParams = /* @__PURE__ */ new Map();
6835
+ queryParams.set("channel_id", channelId);
6836
+ queryParams.set("clan_id", clanId);
6837
+ let bodyJson = "";
6838
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6839
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6840
+ if (bearerToken) {
6841
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6842
+ }
6843
+ return Promise.race([
6844
+ fetch(fullUrl, fetchOptions).then((response) => {
6845
+ if (response.status == 204) {
6846
+ return response;
6847
+ } else if (response.status >= 200 && response.status < 300) {
6848
+ return response.json();
6849
+ } else {
6850
+ throw response;
6851
+ }
6852
+ }),
6853
+ new Promise(
6854
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6855
+ )
6856
+ ]);
6857
+ }
6830
6858
  };
6831
6859
 
6832
6860
  // session.ts
@@ -7263,9 +7291,11 @@ var _DefaultSocket = class _DefaultSocket {
7263
7291
  } else if (message.user_status_event) {
7264
7292
  this.onuserstatusevent(message.user_status_event);
7265
7293
  } else if (message.join_channel_app_data) {
7266
- this.onJoinChannelAppEvent(message.join_channel_app_data);
7294
+ this.onjoinchannelappevent(message.join_channel_app_data);
7267
7295
  } else if (message.unpin_message_event) {
7268
- this.onUnpinMessageEvent(message.unpin_message_event);
7296
+ this.onunpinmessageevent(message.unpin_message_event);
7297
+ } else if (message.quick_menu_event) {
7298
+ this.onquickmenuevent(message.quick_menu_event);
7269
7299
  } else {
7270
7300
  if (this.verbose && window && window.console) {
7271
7301
  console.log("Unrecognized message received: %o", message);
@@ -7623,20 +7653,25 @@ var _DefaultSocket = class _DefaultSocket {
7623
7653
  console.log(user_status_event);
7624
7654
  }
7625
7655
  }
7626
- onJoinChannelAppEvent(join_channel_app_data) {
7656
+ onjoinchannelappevent(join_channel_app_data) {
7627
7657
  if (this.verbose && window && window.console) {
7628
7658
  console.log(join_channel_app_data);
7629
7659
  }
7630
7660
  }
7631
- onUnpinMessageEvent(unpin_message_event) {
7661
+ onunpinmessageevent(unpin_message_event) {
7632
7662
  if (this.verbose && window && window.console) {
7633
7663
  console.log(unpin_message_event);
7634
7664
  }
7635
7665
  }
7666
+ onquickmenuevent(event) {
7667
+ if (this.verbose && window && window.console) {
7668
+ console.log(event);
7669
+ }
7670
+ }
7636
7671
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
7637
7672
  const untypedMessage = message;
7638
7673
  return new Promise((resolve, reject) => {
7639
- var _a;
7674
+ var _a, _b;
7640
7675
  if (!this.adapter.isOpen()) {
7641
7676
  reject("Socket connection has not been established yet.");
7642
7677
  } else {
@@ -7652,6 +7687,10 @@ var _DefaultSocket = class _DefaultSocket {
7652
7687
  untypedMessage.ephemeral_message_send.message.content = JSON.stringify(
7653
7688
  (_a = untypedMessage.ephemeral_message_send.message) == null ? void 0 : _a.content
7654
7689
  );
7690
+ } else if (untypedMessage.quick_menu_event) {
7691
+ untypedMessage.quick_menu_event.message.content = JSON.stringify(
7692
+ (_b = untypedMessage.quick_menu_event.message) == null ? void 0 : _b.content
7693
+ );
7655
7694
  }
7656
7695
  const cid = this.generatecid();
7657
7696
  this.cIds[cid] = { resolve, reject };
@@ -7777,6 +7816,31 @@ var _DefaultSocket = class _DefaultSocket {
7777
7816
  updateStatus(status) {
7778
7817
  return this.send({ status_update: { status } });
7779
7818
  }
7819
+ writeQuickMenuEvent(menu_name, clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code, topic_id) {
7820
+ return __async(this, null, function* () {
7821
+ const response = yield this.send({
7822
+ quick_menu_event: {
7823
+ menu_name,
7824
+ message: {
7825
+ clan_id,
7826
+ channel_id,
7827
+ mode,
7828
+ is_public,
7829
+ content,
7830
+ mentions,
7831
+ attachments,
7832
+ references,
7833
+ anonymous_message,
7834
+ mention_everyone,
7835
+ avatar,
7836
+ code,
7837
+ topic_id
7838
+ }
7839
+ }
7840
+ });
7841
+ return response.ephemeral_message_send;
7842
+ });
7843
+ }
7780
7844
  writeEphemeralMessage(receiver_id, clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code, topic_id) {
7781
7845
  return __async(this, null, function* () {
7782
7846
  const response = yield this.send({
@@ -10596,4 +10660,14 @@ var Client = class {
10596
10660
  });
10597
10661
  });
10598
10662
  }
10663
+ listChannelMember(session, channelId, clanId) {
10664
+ return __async(this, null, function* () {
10665
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
10666
+ yield this.sessionRefresh(session);
10667
+ }
10668
+ return this.apiClient.listChannelMember(session.token, channelId, clanId).then((response) => {
10669
+ return Promise.resolve(response);
10670
+ });
10671
+ });
10672
+ }
10599
10673
  };
@@ -6654,11 +6654,12 @@ var MezonApi = class {
6654
6654
  ]);
6655
6655
  }
6656
6656
  /** */
6657
- listQuickMenuAccess(bearerToken, botId, channelId, options = {}) {
6657
+ listQuickMenuAccess(bearerToken, botId, channelId, menuType, options = {}) {
6658
6658
  const urlPath = "/v2/quickmenuaccess";
6659
6659
  const queryParams = /* @__PURE__ */ new Map();
6660
6660
  queryParams.set("bot_id", botId);
6661
6661
  queryParams.set("channel_id", channelId);
6662
+ queryParams.set("menu_type", menuType);
6662
6663
  let bodyJson = "";
6663
6664
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6664
6665
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -6793,6 +6794,33 @@ var MezonApi = class {
6793
6794
  )
6794
6795
  ]);
6795
6796
  }
6797
+ /** */
6798
+ listChannelMember(bearerToken, channelId, clanId, options = {}) {
6799
+ const urlPath = "/v2/listchannelmember";
6800
+ const queryParams = /* @__PURE__ */ new Map();
6801
+ queryParams.set("channel_id", channelId);
6802
+ queryParams.set("clan_id", clanId);
6803
+ let bodyJson = "";
6804
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6805
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6806
+ if (bearerToken) {
6807
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6808
+ }
6809
+ return Promise.race([
6810
+ fetch(fullUrl, fetchOptions).then((response) => {
6811
+ if (response.status == 204) {
6812
+ return response;
6813
+ } else if (response.status >= 200 && response.status < 300) {
6814
+ return response.json();
6815
+ } else {
6816
+ throw response;
6817
+ }
6818
+ }),
6819
+ new Promise(
6820
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6821
+ )
6822
+ ]);
6823
+ }
6796
6824
  };
6797
6825
 
6798
6826
  // session.ts
@@ -7229,9 +7257,11 @@ var _DefaultSocket = class _DefaultSocket {
7229
7257
  } else if (message.user_status_event) {
7230
7258
  this.onuserstatusevent(message.user_status_event);
7231
7259
  } else if (message.join_channel_app_data) {
7232
- this.onJoinChannelAppEvent(message.join_channel_app_data);
7260
+ this.onjoinchannelappevent(message.join_channel_app_data);
7233
7261
  } else if (message.unpin_message_event) {
7234
- this.onUnpinMessageEvent(message.unpin_message_event);
7262
+ this.onunpinmessageevent(message.unpin_message_event);
7263
+ } else if (message.quick_menu_event) {
7264
+ this.onquickmenuevent(message.quick_menu_event);
7235
7265
  } else {
7236
7266
  if (this.verbose && window && window.console) {
7237
7267
  console.log("Unrecognized message received: %o", message);
@@ -7589,20 +7619,25 @@ var _DefaultSocket = class _DefaultSocket {
7589
7619
  console.log(user_status_event);
7590
7620
  }
7591
7621
  }
7592
- onJoinChannelAppEvent(join_channel_app_data) {
7622
+ onjoinchannelappevent(join_channel_app_data) {
7593
7623
  if (this.verbose && window && window.console) {
7594
7624
  console.log(join_channel_app_data);
7595
7625
  }
7596
7626
  }
7597
- onUnpinMessageEvent(unpin_message_event) {
7627
+ onunpinmessageevent(unpin_message_event) {
7598
7628
  if (this.verbose && window && window.console) {
7599
7629
  console.log(unpin_message_event);
7600
7630
  }
7601
7631
  }
7632
+ onquickmenuevent(event) {
7633
+ if (this.verbose && window && window.console) {
7634
+ console.log(event);
7635
+ }
7636
+ }
7602
7637
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
7603
7638
  const untypedMessage = message;
7604
7639
  return new Promise((resolve, reject) => {
7605
- var _a;
7640
+ var _a, _b;
7606
7641
  if (!this.adapter.isOpen()) {
7607
7642
  reject("Socket connection has not been established yet.");
7608
7643
  } else {
@@ -7618,6 +7653,10 @@ var _DefaultSocket = class _DefaultSocket {
7618
7653
  untypedMessage.ephemeral_message_send.message.content = JSON.stringify(
7619
7654
  (_a = untypedMessage.ephemeral_message_send.message) == null ? void 0 : _a.content
7620
7655
  );
7656
+ } else if (untypedMessage.quick_menu_event) {
7657
+ untypedMessage.quick_menu_event.message.content = JSON.stringify(
7658
+ (_b = untypedMessage.quick_menu_event.message) == null ? void 0 : _b.content
7659
+ );
7621
7660
  }
7622
7661
  const cid = this.generatecid();
7623
7662
  this.cIds[cid] = { resolve, reject };
@@ -7743,6 +7782,31 @@ var _DefaultSocket = class _DefaultSocket {
7743
7782
  updateStatus(status) {
7744
7783
  return this.send({ status_update: { status } });
7745
7784
  }
7785
+ writeQuickMenuEvent(menu_name, clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code, topic_id) {
7786
+ return __async(this, null, function* () {
7787
+ const response = yield this.send({
7788
+ quick_menu_event: {
7789
+ menu_name,
7790
+ message: {
7791
+ clan_id,
7792
+ channel_id,
7793
+ mode,
7794
+ is_public,
7795
+ content,
7796
+ mentions,
7797
+ attachments,
7798
+ references,
7799
+ anonymous_message,
7800
+ mention_everyone,
7801
+ avatar,
7802
+ code,
7803
+ topic_id
7804
+ }
7805
+ }
7806
+ });
7807
+ return response.ephemeral_message_send;
7808
+ });
7809
+ }
7746
7810
  writeEphemeralMessage(receiver_id, clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code, topic_id) {
7747
7811
  return __async(this, null, function* () {
7748
7812
  const response = yield this.send({
@@ -10562,6 +10626,16 @@ var Client = class {
10562
10626
  });
10563
10627
  });
10564
10628
  }
10629
+ listChannelMember(session, channelId, clanId) {
10630
+ return __async(this, null, function* () {
10631
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
10632
+ yield this.sessionRefresh(session);
10633
+ }
10634
+ return this.apiClient.listChannelMember(session.token, channelId, clanId).then((response) => {
10635
+ return Promise.resolve(response);
10636
+ });
10637
+ });
10638
+ }
10565
10639
  };
10566
10640
  export {
10567
10641
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -242,6 +242,29 @@ interface ChannelMessageSend {
242
242
  topic_id?: string;
243
243
  };
244
244
  }
245
+ interface QuickMenuEvent {
246
+ quick_menu_event: {
247
+ menu_name: string;
248
+ message: {
249
+ /** Clan Id */
250
+ clan_id: string;
251
+ /** The server-assigned channel ID. */
252
+ channel_id: string;
253
+ mode: number;
254
+ channel_label: string;
255
+ /** The content payload. */
256
+ content: any;
257
+ mentions?: Array<ApiMessageMention>;
258
+ attachments?: Array<ApiMessageAttachment>;
259
+ anonymous_message?: boolean;
260
+ mention_everyone?: boolean;
261
+ avatar: string;
262
+ is_public: boolean;
263
+ code: number;
264
+ topic_id?: string;
265
+ };
266
+ };
267
+ }
245
268
  interface EphemeralMessageSend {
246
269
  ephemeral_message_send: {
247
270
  receiver_id: string;
@@ -880,6 +903,8 @@ export interface Socket {
880
903
  writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, avatar?: string, code?: number, topic_id?: string): Promise<ChannelMessageAck>;
881
904
  /** Send a chat message to a chat channel on the server. */
882
905
  writeEphemeralMessage(receiver_id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, avatar?: string, code?: number, topic_id?: string): Promise<ChannelMessageAck>;
906
+ /** Send a quick menu event to a chat channel on the server. */
907
+ writeQuickMenuEvent(menu_name: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, avatar?: string, code?: number, topic_id?: string): Promise<QuickMenuEvent>;
883
908
  /** Send message typing */
884
909
  writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean, sender_display_name: string): Promise<MessageTypingEvent>;
885
910
  /** Send message reaction */
@@ -983,8 +1008,9 @@ export interface Socket {
983
1008
  onsdtopicevent: (sd_topic_event: SdTopicEvent) => void;
984
1009
  onchannelappevent: (event: ChannelAppEvent) => void;
985
1010
  onuserstatusevent: (user_status_event: UserStatusEvent) => void;
986
- onJoinChannelAppEvent: (join_channel_app_data: JoinChannelAppData) => void;
987
- onUnpinMessageEvent: (unpin_message_event: UnpinMessageEvent) => void;
1011
+ onjoinchannelappevent: (join_channel_app_data: JoinChannelAppData) => void;
1012
+ onunpinmessageevent: (unpin_message_event: UnpinMessageEvent) => void;
1013
+ onquickmenuevent: (event: QuickMenuEvent) => void;
988
1014
  }
989
1015
  /** Reports an error received from a socket message. */
990
1016
  export interface SocketError {
@@ -1075,9 +1101,10 @@ export declare class DefaultSocket implements Socket {
1075
1101
  onsdtopicevent(sd_topic_event: SdTopicEvent): void;
1076
1102
  onchannelappevent(event: ChannelAppEvent): void;
1077
1103
  onuserstatusevent(user_status_event: UserStatusEvent): void;
1078
- onJoinChannelAppEvent(join_channel_app_data: JoinChannelAppData): void;
1079
- onUnpinMessageEvent(unpin_message_event: UnpinMessageEvent): void;
1080
- send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | IncomingCallPush | MessageButtonClicked | DropdownBoxSelected | ChannelAppEvent | EphemeralMessageSend | VoiceReactionSend | ListDataSocket, sendTimeout?: number): Promise<any>;
1104
+ onjoinchannelappevent(join_channel_app_data: JoinChannelAppData): void;
1105
+ onunpinmessageevent(unpin_message_event: UnpinMessageEvent): void;
1106
+ onquickmenuevent(event: QuickMenuEvent): void;
1107
+ send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | IncomingCallPush | MessageButtonClicked | DropdownBoxSelected | ChannelAppEvent | EphemeralMessageSend | VoiceReactionSend | ListDataSocket | QuickMenuEvent, sendTimeout?: number): Promise<any>;
1081
1108
  followUsers(userIds: string[]): Promise<Status>;
1082
1109
  joinClanChat(clan_id: string): Promise<ClanJoin>;
1083
1110
  follower(): Promise<void>;
@@ -1089,6 +1116,7 @@ export declare class DefaultSocket implements Socket {
1089
1116
  unfollowUsers(user_ids: string[]): Promise<void>;
1090
1117
  updateChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean, topic_id?: string, is_update_msg_topic?: boolean): Promise<ChannelMessageAck>;
1091
1118
  updateStatus(status?: string): Promise<void>;
1119
+ writeQuickMenuEvent(menu_name: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string, code?: number, topic_id?: string): Promise<QuickMenuEvent>;
1092
1120
  writeEphemeralMessage(receiver_id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string, code?: number, topic_id?: string): Promise<ChannelMessageAck>;
1093
1121
  writeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string, code?: number, topic_id?: string): Promise<ChannelMessageAck>;
1094
1122
  writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean, topic_id?: string, emoji_recent_id?: string, sender_name?: string): Promise<ApiMessageReaction>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.12.44",
3
+ "version": "2.12.46",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -389,6 +389,40 @@ interface ChannelMessageSend {
389
389
  };
390
390
  }
391
391
 
392
+ interface QuickMenuEvent {
393
+ quick_menu_event: {
394
+ menu_name: string,
395
+ message: {
396
+ /** Clan Id */
397
+ clan_id: string;
398
+ /** The server-assigned channel ID. */
399
+ channel_id: string;
400
+ // The mode
401
+ mode: number;
402
+ // channel label
403
+ channel_label: string;
404
+ /** The content payload. */
405
+ content: any;
406
+ //
407
+ mentions?: Array<ApiMessageMention>;
408
+ //
409
+ attachments?: Array<ApiMessageAttachment>;
410
+ //
411
+ anonymous_message?: boolean;
412
+ //
413
+ mention_everyone?: boolean;
414
+ //
415
+ avatar: string;
416
+ // Is public
417
+ is_public: boolean;
418
+ // code
419
+ code: number;
420
+ //
421
+ topic_id?: string;
422
+ }
423
+ }
424
+ }
425
+
392
426
  interface EphemeralMessageSend {
393
427
  ephemeral_message_send: {
394
428
  receiver_id: string,
@@ -1406,6 +1440,24 @@ export interface Socket {
1406
1440
  topic_id?: string
1407
1441
  ): Promise<ChannelMessageAck>;
1408
1442
 
1443
+ /** Send a quick menu event to a chat channel on the server. */
1444
+ writeQuickMenuEvent(
1445
+ menu_name: string,
1446
+ clan_id: string,
1447
+ channel_id: string,
1448
+ mode: number,
1449
+ is_public: boolean,
1450
+ content?: any,
1451
+ mentions?: Array<ApiMessageMention>,
1452
+ attachments?: Array<ApiMessageAttachment>,
1453
+ references?: Array<ApiMessageRef>,
1454
+ anonymous_message?: boolean,
1455
+ mention_everyone?: boolean,
1456
+ avatar?: string,
1457
+ code?: number,
1458
+ topic_id?: string
1459
+ ): Promise<QuickMenuEvent>;
1460
+
1409
1461
  /** Send message typing */
1410
1462
  writeMessageTyping(
1411
1463
  clan_id: string,
@@ -1694,9 +1746,11 @@ export interface Socket {
1694
1746
 
1695
1747
  onuserstatusevent: (user_status_event: UserStatusEvent) => void;
1696
1748
 
1697
- onJoinChannelAppEvent: (join_channel_app_data: JoinChannelAppData) => void;
1749
+ onjoinchannelappevent: (join_channel_app_data: JoinChannelAppData) => void;
1750
+
1751
+ onunpinmessageevent: (unpin_message_event: UnpinMessageEvent)=> void;
1698
1752
 
1699
- onUnpinMessageEvent: (unpin_message_event: UnpinMessageEvent)=> void;
1753
+ onquickmenuevent: (event: QuickMenuEvent) => void;
1700
1754
  }
1701
1755
 
1702
1756
  /** Reports an error received from a socket message. */
@@ -1937,9 +1991,11 @@ export class DefaultSocket implements Socket {
1937
1991
  } else if (message.user_status_event) {
1938
1992
  this.onuserstatusevent(<UserStatusEvent>message.user_status_event);
1939
1993
  } else if (message.join_channel_app_data) {
1940
- this.onJoinChannelAppEvent(<JoinChannelAppData>message.join_channel_app_data);
1994
+ this.onjoinchannelappevent(<JoinChannelAppData>message.join_channel_app_data);
1941
1995
  } else if (message.unpin_message_event) {
1942
- this.onUnpinMessageEvent(<UnpinMessageEvent>message.unpin_message_event);
1996
+ this.onunpinmessageevent(<UnpinMessageEvent>message.unpin_message_event);
1997
+ } else if (message.quick_menu_event) {
1998
+ this.onquickmenuevent(<QuickMenuEvent>message.quick_menu_event);
1943
1999
  } else {
1944
2000
  if (this.verbose && window && window.console) {
1945
2001
  console.log("Unrecognized message received: %o", message);
@@ -2367,18 +2423,24 @@ export class DefaultSocket implements Socket {
2367
2423
  }
2368
2424
  }
2369
2425
 
2370
- onJoinChannelAppEvent(join_channel_app_data: JoinChannelAppData) {
2426
+ onjoinchannelappevent(join_channel_app_data: JoinChannelAppData) {
2371
2427
  if (this.verbose && window && window.console) {
2372
2428
  console.log(join_channel_app_data);
2373
2429
  }
2374
2430
  }
2375
2431
 
2376
- onUnpinMessageEvent(unpin_message_event: UnpinMessageEvent) {
2432
+ onunpinmessageevent(unpin_message_event: UnpinMessageEvent) {
2377
2433
  if (this.verbose && window && window.console) {
2378
2434
  console.log(unpin_message_event);
2379
2435
  }
2380
2436
  }
2381
2437
 
2438
+ onquickmenuevent(event: QuickMenuEvent) {
2439
+ if (this.verbose && window && window.console) {
2440
+ console.log(event);
2441
+ }
2442
+ }
2443
+
2382
2444
  send(
2383
2445
  message:
2384
2446
  | ChannelJoin
@@ -2401,7 +2463,8 @@ export class DefaultSocket implements Socket {
2401
2463
  | ChannelAppEvent
2402
2464
  | EphemeralMessageSend
2403
2465
  | VoiceReactionSend
2404
- | ListDataSocket,
2466
+ | ListDataSocket
2467
+ | QuickMenuEvent,
2405
2468
  sendTimeout = DefaultSocket.DefaultSendTimeoutMs
2406
2469
  ): Promise<any> {
2407
2470
  const untypedMessage = message as any;
@@ -2422,6 +2485,10 @@ export class DefaultSocket implements Socket {
2422
2485
  untypedMessage.ephemeral_message_send.message.content = JSON.stringify(
2423
2486
  untypedMessage.ephemeral_message_send.message?.content
2424
2487
  );
2488
+ } else if (untypedMessage.quick_menu_event) {
2489
+ untypedMessage.quick_menu_event.message.content = JSON.stringify(
2490
+ untypedMessage.quick_menu_event.message?.content
2491
+ );
2425
2492
  }
2426
2493
 
2427
2494
  const cid = this.generatecid();
@@ -2587,6 +2654,45 @@ export class DefaultSocket implements Socket {
2587
2654
  return this.send({ status_update: { status: status } });
2588
2655
  }
2589
2656
 
2657
+ async writeQuickMenuEvent(
2658
+ menu_name: string,
2659
+ clan_id: string,
2660
+ channel_id: string,
2661
+ mode: number,
2662
+ is_public: boolean,
2663
+ content: any,
2664
+ mentions?: Array<ApiMessageMention>,
2665
+ attachments?: Array<ApiMessageAttachment>,
2666
+ references?: Array<ApiMessageRef>,
2667
+ anonymous_message?: boolean,
2668
+ mention_everyone?: Boolean,
2669
+ avatar?: string,
2670
+ code?: number,
2671
+ topic_id?: string
2672
+ ): Promise<QuickMenuEvent> {
2673
+ const response = await this.send({
2674
+ quick_menu_event: {
2675
+ menu_name: menu_name,
2676
+ message: {
2677
+ clan_id: clan_id,
2678
+ channel_id: channel_id,
2679
+ mode: mode,
2680
+ is_public: is_public,
2681
+ content: content,
2682
+ mentions: mentions,
2683
+ attachments: attachments,
2684
+ references: references,
2685
+ anonymous_message: anonymous_message,
2686
+ mention_everyone: mention_everyone,
2687
+ avatar: avatar,
2688
+ code: code,
2689
+ topic_id: topic_id,
2690
+ }
2691
+ }
2692
+ });
2693
+ return response.ephemeral_message_send;
2694
+ }
2695
+
2590
2696
  async writeEphemeralMessage(
2591
2697
  receiver_id: string,
2592
2698
  clan_id: string,