mezon-js 2.9.90 → 2.9.93

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
@@ -1158,6 +1158,14 @@ export interface ApiCreateRoleRequest {
1158
1158
  title?: string;
1159
1159
  }
1160
1160
 
1161
+ /** */
1162
+ export interface ApiCustomDisplay {
1163
+ //
1164
+ logo?: string;
1165
+ //
1166
+ splash_screen?: string;
1167
+ }
1168
+
1161
1169
  /** Delete a channel the user has access to. */
1162
1170
  export interface ApiDeleteChannelDescRequest {
1163
1171
  //The id of a channel.
@@ -1718,6 +1726,25 @@ export interface ApiOssrsHttpCallbackResponse {
1718
1726
  //
1719
1727
  msg?: string;
1720
1728
  }
1729
+
1730
+ /** A list of users belonging to a channel, along with their role. */
1731
+ export interface ApiPTTChannelUser {
1732
+ //
1733
+ channel_id?: string;
1734
+ //
1735
+ id?: string;
1736
+ //
1737
+ participant?: string;
1738
+ //user for a channel.
1739
+ user_id?: string;
1740
+ }
1741
+
1742
+ /** A list of users belonging to a channel, along with their role. */
1743
+ export interface ApiPTTChannelUserList {
1744
+ //
1745
+ ptt_channel_users?: Array<ApiPTTChannelUser>;
1746
+ }
1747
+
1721
1748
  /** */
1722
1749
  export interface ApiPermission {
1723
1750
  //
@@ -2382,6 +2409,28 @@ export interface ApiVoiceChannelUserList {
2382
2409
  voice_channel_users?: Array<ApiVoiceChannelUser>;
2383
2410
  }
2384
2411
 
2412
+ /** */
2413
+ export interface ApiWalletLedger {
2414
+ //
2415
+ create_time?: string;
2416
+ //
2417
+ id?: string;
2418
+ //
2419
+ user_id?: string;
2420
+ //
2421
+ value?: number;
2422
+ }
2423
+
2424
+ /** */
2425
+ export interface ApiWalletLedgerList {
2426
+ //
2427
+ next_cursor?: string;
2428
+ //
2429
+ prev_cursor?: string;
2430
+ //
2431
+ wallet_ledger?: Array<ApiWalletLedger>;
2432
+ }
2433
+
2385
2434
  /** */
2386
2435
  export interface ApiWebhook {
2387
2436
  //
@@ -5859,7 +5908,74 @@ export class MezonApi {
5859
5908
  setTimeout(reject, this.timeoutMs, "Request timed out.")
5860
5909
  ),
5861
5910
  ]);
5862
- }
5911
+ }
5912
+
5913
+ /** */
5914
+ getCustomDisplay(bearerToken: string,
5915
+ options: any = {}): Promise<ApiCustomDisplay> {
5916
+
5917
+ const urlPath = "/v2/customdisplay";
5918
+ const queryParams = new Map<string, any>();
5919
+
5920
+ let bodyJson : string = "";
5921
+
5922
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5923
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5924
+ if (bearerToken) {
5925
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5926
+ }
5927
+
5928
+ return Promise.race([
5929
+ fetch(fullUrl, fetchOptions).then((response) => {
5930
+ if (response.status == 204) {
5931
+ return response;
5932
+ } else if (response.status >= 200 && response.status < 300) {
5933
+ return response.json();
5934
+ } else {
5935
+ throw response;
5936
+ }
5937
+ }),
5938
+ new Promise((_, reject) =>
5939
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5940
+ ),
5941
+ ]);
5942
+ }
5943
+
5944
+ /** */
5945
+ updateCustomDisplay(bearerToken: string,
5946
+ body:ApiCustomDisplay,
5947
+ options: any = {}): Promise<any> {
5948
+
5949
+ if (body === null || body === undefined) {
5950
+ throw new Error("'body' is a required parameter but is null or undefined.");
5951
+ }
5952
+ const urlPath = "/v2/customdisplay";
5953
+ const queryParams = new Map<string, any>();
5954
+
5955
+ let bodyJson : string = "";
5956
+ bodyJson = JSON.stringify(body || {});
5957
+
5958
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5959
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
5960
+ if (bearerToken) {
5961
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5962
+ }
5963
+
5964
+ return Promise.race([
5965
+ fetch(fullUrl, fetchOptions).then((response) => {
5966
+ if (response.status == 204) {
5967
+ return response;
5968
+ } else if (response.status >= 200 && response.status < 300) {
5969
+ return response.json();
5970
+ } else {
5971
+ throw response;
5972
+ }
5973
+ }),
5974
+ new Promise((_, reject) =>
5975
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5976
+ ),
5977
+ ]);
5978
+ }
5863
5979
 
5864
5980
  /** */
5865
5981
  deleteCategoryDesc(
@@ -7897,6 +8013,49 @@ export class MezonApi {
7897
8013
  ]);
7898
8014
  }
7899
8015
 
8016
+ /** List all users in ptt channel. */
8017
+ listPTTChannelUsers(bearerToken: string,
8018
+ clanId?:string,
8019
+ channelId?:string,
8020
+ channelType?:number,
8021
+ limit?:number,
8022
+ state?:number,
8023
+ cursor?:string,
8024
+ options: any = {}): Promise<ApiPTTChannelUserList> {
8025
+
8026
+ const urlPath = "/v2/ptt_channels/users";
8027
+ const queryParams = new Map<string, any>();
8028
+ queryParams.set("clan_id", clanId);
8029
+ queryParams.set("channel_id", channelId);
8030
+ queryParams.set("channel_type", channelType);
8031
+ queryParams.set("limit", limit);
8032
+ queryParams.set("state", state);
8033
+ queryParams.set("cursor", cursor);
8034
+
8035
+ let bodyJson : string = "";
8036
+
8037
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8038
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8039
+ if (bearerToken) {
8040
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8041
+ }
8042
+
8043
+ return Promise.race([
8044
+ fetch(fullUrl, fetchOptions).then((response) => {
8045
+ if (response.status == 204) {
8046
+ return response;
8047
+ } else if (response.status >= 200 && response.status < 300) {
8048
+ return response.json();
8049
+ } else {
8050
+ throw response;
8051
+ }
8052
+ }),
8053
+ new Promise((_, reject) =>
8054
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8055
+ ),
8056
+ ]);
8057
+ }
8058
+
7900
8059
  /** get pubkey */
7901
8060
  getPubKeys(bearerToken: string,
7902
8061
  userIds?:Array<string>,
@@ -9522,6 +9681,42 @@ pushPubKey(bearerToken: string,
9522
9681
  ]);
9523
9682
  }
9524
9683
 
9684
+ /** Get user status */
9685
+ listWalletLedger(
9686
+ bearerToken: string,
9687
+ limit?: number,
9688
+ cursor?: string,
9689
+ options: any = {}
9690
+ ): Promise<ApiWalletLedgerList> {
9691
+ const urlPath = "/v2/walletledger";
9692
+ const queryParams = new Map<string, any>();
9693
+ queryParams.set("limit", limit);
9694
+ queryParams.set("cursor", cursor);
9695
+
9696
+ let bodyJson: string = "";
9697
+
9698
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9699
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
9700
+ if (bearerToken) {
9701
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9702
+ }
9703
+
9704
+ return Promise.race([
9705
+ fetch(fullUrl, fetchOptions).then((response) => {
9706
+ if (response.status == 204) {
9707
+ return response;
9708
+ } else if (response.status >= 200 && response.status < 300) {
9709
+ return response.json();
9710
+ } else {
9711
+ throw response;
9712
+ }
9713
+ }),
9714
+ new Promise((_, reject) =>
9715
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9716
+ ),
9717
+ ]);
9718
+ }
9719
+
9525
9720
  /** create webhook */
9526
9721
  generateWebhook(
9527
9722
  bearerToken: string,
package/client.ts CHANGED
@@ -153,6 +153,9 @@ import {
153
153
  ApiUserStatus,
154
154
  ApiListOnboardingStepResponse,
155
155
  MezonUpdateOnboardingStepByClanIdBody,
156
+ ApiPTTChannelUserList,
157
+ ApiCustomDisplay,
158
+ ApiWalletLedgerList,
156
159
  } from "./api.gen";
157
160
 
158
161
  import { Session } from "./session";
@@ -4633,7 +4636,7 @@ export class Client {
4633
4636
  session: Session,
4634
4637
  clan_id?: string,
4635
4638
  limit?: number,
4636
- page? :number,
4639
+ page?: number
4637
4640
  ): Promise<ApiListOnboardingStepResponse> {
4638
4641
  if (
4639
4642
  this.autoRefreshSession &&
@@ -4672,10 +4675,7 @@ export class Client {
4672
4675
  }
4673
4676
 
4674
4677
  //**update status */
4675
- async updateUserStatus(
4676
- session: Session,
4677
- request: ApiUserStatusUpdate
4678
- ) {
4678
+ async updateUserStatus(session: Session, request: ApiUserStatusUpdate) {
4679
4679
  if (
4680
4680
  this.autoRefreshSession &&
4681
4681
  session.refresh_token &&
@@ -4692,9 +4692,7 @@ export class Client {
4692
4692
  }
4693
4693
 
4694
4694
  //**get user status */
4695
- async getUserStatus(
4696
- session: Session
4697
- ): Promise<ApiUserStatus> {
4695
+ async getUserStatus(session: Session): Promise<ApiUserStatus> {
4698
4696
  if (
4699
4697
  this.autoRefreshSession &&
4700
4698
  session.refresh_token &&
@@ -4709,5 +4707,108 @@ export class Client {
4709
4707
  return Promise.resolve(response);
4710
4708
  });
4711
4709
  }
4712
-
4710
+
4711
+ /** List a ptt channel's users. */
4712
+ async listPTTChannelUsers(
4713
+ session: Session,
4714
+ clanId: string,
4715
+ channelId: string,
4716
+ channelType: number,
4717
+ state?: number,
4718
+ limit?: number,
4719
+ cursor?: string
4720
+ ): Promise<ApiPTTChannelUserList> {
4721
+ if (
4722
+ this.autoRefreshSession &&
4723
+ session.refresh_token &&
4724
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4725
+ ) {
4726
+ await this.sessionRefresh(session);
4727
+ }
4728
+
4729
+ return this.apiClient
4730
+ .listPTTChannelUsers(
4731
+ session.token,
4732
+ clanId,
4733
+ channelId,
4734
+ channelType,
4735
+ limit,
4736
+ state,
4737
+ cursor
4738
+ )
4739
+ .then((response: ApiPTTChannelUserList) => {
4740
+ var result: ApiPTTChannelUserList = {
4741
+ ptt_channel_users: [],
4742
+ };
4743
+
4744
+ if (response.ptt_channel_users == null) {
4745
+ return Promise.resolve(result);
4746
+ }
4747
+
4748
+ response.ptt_channel_users!.forEach((gu) => {
4749
+ result.ptt_channel_users!.push({
4750
+ id: gu.id,
4751
+ channel_id: gu.channel_id,
4752
+ user_id: gu.user_id,
4753
+ participant: gu.participant,
4754
+ });
4755
+ });
4756
+ return Promise.resolve(result);
4757
+ });
4758
+ }
4759
+
4760
+ //**get custom display */
4761
+ async getCustomDisplay(session: Session): Promise<ApiCustomDisplay> {
4762
+ if (
4763
+ this.autoRefreshSession &&
4764
+ session.refresh_token &&
4765
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4766
+ ) {
4767
+ await this.sessionRefresh(session);
4768
+ }
4769
+
4770
+ return this.apiClient
4771
+ .getCustomDisplay(session.token)
4772
+ .then((response: ApiCustomDisplay) => {
4773
+ return Promise.resolve(response);
4774
+ });
4775
+ }
4776
+
4777
+ //**update custom display */
4778
+ async updateCustomDisplay(session: Session, request: ApiCustomDisplay) {
4779
+ if (
4780
+ this.autoRefreshSession &&
4781
+ session.refresh_token &&
4782
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4783
+ ) {
4784
+ await this.sessionRefresh(session);
4785
+ }
4786
+
4787
+ return this.apiClient
4788
+ .updateCustomDisplay(session.token, request)
4789
+ .then((response: any) => {
4790
+ return response !== undefined;
4791
+ });
4792
+ }
4793
+
4794
+ //**list wallet ledger */
4795
+ async listWalletLedger(
4796
+ session: Session,
4797
+ limit?: number,
4798
+ cursor?: string
4799
+ ): Promise<ApiWalletLedgerList> {
4800
+ if (
4801
+ this.autoRefreshSession &&
4802
+ session.refresh_token &&
4803
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4804
+ ) {
4805
+ await this.sessionRefresh(session);
4806
+ }
4807
+
4808
+ return this.apiClient
4809
+ .listWalletLedger(session.token, limit, cursor)
4810
+ .then((response: ApiWalletLedgerList) => {
4811
+ return Promise.resolve(response);
4812
+ });
4813
+ }
4713
4814
  }
package/dist/api.gen.d.ts CHANGED
@@ -663,6 +663,11 @@ export interface ApiCreateRoleRequest {
663
663
  role_icon?: string;
664
664
  title?: string;
665
665
  }
666
+ /** */
667
+ export interface ApiCustomDisplay {
668
+ logo?: string;
669
+ splash_screen?: string;
670
+ }
666
671
  /** Delete a channel the user has access to. */
667
672
  export interface ApiDeleteChannelDescRequest {
668
673
  channel_id?: string;
@@ -998,6 +1003,17 @@ export interface ApiOssrsHttpCallbackResponse {
998
1003
  code?: number;
999
1004
  msg?: string;
1000
1005
  }
1006
+ /** A list of users belonging to a channel, along with their role. */
1007
+ export interface ApiPTTChannelUser {
1008
+ channel_id?: string;
1009
+ id?: string;
1010
+ participant?: string;
1011
+ user_id?: string;
1012
+ }
1013
+ /** A list of users belonging to a channel, along with their role. */
1014
+ export interface ApiPTTChannelUserList {
1015
+ ptt_channel_users?: Array<ApiPTTChannelUser>;
1016
+ }
1001
1017
  /** */
1002
1018
  export interface ApiPermission {
1003
1019
  active?: number;
@@ -1385,6 +1401,19 @@ export interface ApiVoiceChannelUserList {
1385
1401
  voice_channel_users?: Array<ApiVoiceChannelUser>;
1386
1402
  }
1387
1403
  /** */
1404
+ export interface ApiWalletLedger {
1405
+ create_time?: string;
1406
+ id?: string;
1407
+ user_id?: string;
1408
+ value?: number;
1409
+ }
1410
+ /** */
1411
+ export interface ApiWalletLedgerList {
1412
+ next_cursor?: string;
1413
+ prev_cursor?: string;
1414
+ wallet_ledger?: Array<ApiWalletLedger>;
1415
+ }
1416
+ /** */
1388
1417
  export interface ApiWebhook {
1389
1418
  active?: number;
1390
1419
  avatar?: string;
@@ -1708,6 +1737,10 @@ export declare class MezonApi {
1708
1737
  /** */
1709
1738
  createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
1710
1739
  /** */
1740
+ getCustomDisplay(bearerToken: string, options?: any): Promise<ApiCustomDisplay>;
1741
+ /** */
1742
+ updateCustomDisplay(bearerToken: string, body: ApiCustomDisplay, options?: any): Promise<any>;
1743
+ /** */
1711
1744
  deleteCategoryDesc(bearerToken: string, categoryId: string, clanId: string, options?: any): Promise<any>;
1712
1745
  /** */
1713
1746
  deleteCategoryOrder(bearerToken: string, clanId: string, options?: any): Promise<any>;
@@ -1815,6 +1848,8 @@ export declare class MezonApi {
1815
1848
  getPinMessagesList(bearerToken: string, messageId?: string, channelId?: string, clanId?: string, options?: any): Promise<ApiPinMessagesList>;
1816
1849
  /** set notification user channel. */
1817
1850
  createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<ApiChannelMessageHeader>;
1851
+ /** List all users in ptt channel. */
1852
+ listPTTChannelUsers(bearerToken: string, clanId?: string, channelId?: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiPTTChannelUserList>;
1818
1853
  /** get pubkey */
1819
1854
  getPubKeys(bearerToken: string, userIds?: Array<string>, options?: any): Promise<ApiGetPubKeysResponse>;
1820
1855
  /** store pubkey for e2ee */
@@ -1895,6 +1930,8 @@ export declare class MezonApi {
1895
1930
  getUserStatus(bearerToken: string, options?: any): Promise<ApiUserStatus>;
1896
1931
  /** Update user status */
1897
1932
  updateUserStatus(bearerToken: string, body: ApiUserStatusUpdate, options?: any): Promise<any>;
1933
+ /** Get user status */
1934
+ listWalletLedger(bearerToken: string, limit?: number, cursor?: string, options?: any): Promise<ApiWalletLedgerList>;
1898
1935
  /** create webhook */
1899
1936
  generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
1900
1937
  /** update webhook name by id */
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, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, 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, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, 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, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiPTTChannelUserList, ApiCustomDisplay, ApiWalletLedgerList } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -627,4 +627,9 @@ export declare class Client {
627
627
  updateOnboardingStepByClanId(session: Session, clan_id: string, request: MezonUpdateOnboardingStepByClanIdBody): Promise<boolean>;
628
628
  updateUserStatus(session: Session, request: ApiUserStatusUpdate): Promise<boolean>;
629
629
  getUserStatus(session: Session): Promise<ApiUserStatus>;
630
+ /** List a ptt channel's users. */
631
+ listPTTChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiPTTChannelUserList>;
632
+ getCustomDisplay(session: Session): Promise<ApiCustomDisplay>;
633
+ updateCustomDisplay(session: Session, request: ApiCustomDisplay): Promise<boolean>;
634
+ listWalletLedger(session: Session, limit?: number, cursor?: string): Promise<ApiWalletLedgerList>;
630
635
  }
@@ -3188,6 +3188,60 @@ var MezonApi = class {
3188
3188
  ]);
3189
3189
  }
3190
3190
  /** */
3191
+ getCustomDisplay(bearerToken, options = {}) {
3192
+ const urlPath = "/v2/customdisplay";
3193
+ const queryParams = /* @__PURE__ */ new Map();
3194
+ let bodyJson = "";
3195
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3196
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3197
+ if (bearerToken) {
3198
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3199
+ }
3200
+ return Promise.race([
3201
+ fetch(fullUrl, fetchOptions).then((response) => {
3202
+ if (response.status == 204) {
3203
+ return response;
3204
+ } else if (response.status >= 200 && response.status < 300) {
3205
+ return response.json();
3206
+ } else {
3207
+ throw response;
3208
+ }
3209
+ }),
3210
+ new Promise(
3211
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3212
+ )
3213
+ ]);
3214
+ }
3215
+ /** */
3216
+ updateCustomDisplay(bearerToken, body, options = {}) {
3217
+ if (body === null || body === void 0) {
3218
+ throw new Error("'body' is a required parameter but is null or undefined.");
3219
+ }
3220
+ const urlPath = "/v2/customdisplay";
3221
+ const queryParams = /* @__PURE__ */ new Map();
3222
+ let bodyJson = "";
3223
+ bodyJson = JSON.stringify(body || {});
3224
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3225
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3226
+ if (bearerToken) {
3227
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3228
+ }
3229
+ return Promise.race([
3230
+ fetch(fullUrl, fetchOptions).then((response) => {
3231
+ if (response.status == 204) {
3232
+ return response;
3233
+ } else if (response.status >= 200 && response.status < 300) {
3234
+ return response.json();
3235
+ } else {
3236
+ throw response;
3237
+ }
3238
+ }),
3239
+ new Promise(
3240
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3241
+ )
3242
+ ]);
3243
+ }
3244
+ /** */
3191
3245
  deleteCategoryDesc(bearerToken, categoryId, clanId, options = {}) {
3192
3246
  if (categoryId === null || categoryId === void 0) {
3193
3247
  throw new Error(
@@ -4780,6 +4834,37 @@ var MezonApi = class {
4780
4834
  )
4781
4835
  ]);
4782
4836
  }
4837
+ /** List all users in ptt channel. */
4838
+ listPTTChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
4839
+ const urlPath = "/v2/ptt_channels/users";
4840
+ const queryParams = /* @__PURE__ */ new Map();
4841
+ queryParams.set("clan_id", clanId);
4842
+ queryParams.set("channel_id", channelId);
4843
+ queryParams.set("channel_type", channelType);
4844
+ queryParams.set("limit", limit);
4845
+ queryParams.set("state", state);
4846
+ queryParams.set("cursor", cursor);
4847
+ let bodyJson = "";
4848
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4849
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4850
+ if (bearerToken) {
4851
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4852
+ }
4853
+ return Promise.race([
4854
+ fetch(fullUrl, fetchOptions).then((response) => {
4855
+ if (response.status == 204) {
4856
+ return response;
4857
+ } else if (response.status >= 200 && response.status < 300) {
4858
+ return response.json();
4859
+ } else {
4860
+ throw response;
4861
+ }
4862
+ }),
4863
+ new Promise(
4864
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4865
+ )
4866
+ ]);
4867
+ }
4783
4868
  /** get pubkey */
4784
4869
  getPubKeys(bearerToken, userIds, options = {}) {
4785
4870
  const urlPath = "/v2/pubkey";
@@ -6059,6 +6144,33 @@ var MezonApi = class {
6059
6144
  )
6060
6145
  ]);
6061
6146
  }
6147
+ /** Get user status */
6148
+ listWalletLedger(bearerToken, limit, cursor, options = {}) {
6149
+ const urlPath = "/v2/walletledger";
6150
+ const queryParams = /* @__PURE__ */ new Map();
6151
+ queryParams.set("limit", limit);
6152
+ queryParams.set("cursor", cursor);
6153
+ let bodyJson = "";
6154
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6155
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6156
+ if (bearerToken) {
6157
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6158
+ }
6159
+ return Promise.race([
6160
+ fetch(fullUrl, fetchOptions).then((response) => {
6161
+ if (response.status == 204) {
6162
+ return response;
6163
+ } else if (response.status >= 200 && response.status < 300) {
6164
+ return response.json();
6165
+ } else {
6166
+ throw response;
6167
+ }
6168
+ }),
6169
+ new Promise(
6170
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6171
+ )
6172
+ ]);
6173
+ }
6062
6174
  /** create webhook */
6063
6175
  generateWebhook(bearerToken, body, options = {}) {
6064
6176
  if (body === null || body === void 0) {
@@ -7064,6 +7176,10 @@ var _DefaultSocket = class _DefaultSocket {
7064
7176
  this.onjoinpttchannel(message.join_ptt_channel);
7065
7177
  } else if (message.talk_ptt_channel) {
7066
7178
  this.ontalkpttchannel(message.talk_ptt_channel);
7179
+ } else if (message.ptt_joined_event) {
7180
+ this.onpttchanneljoined(message.ptt_joined_event);
7181
+ } else if (message.ptt_leaved_event) {
7182
+ this.onpttchannelleaved(message.ptt_leaved_event);
7067
7183
  } else {
7068
7184
  if (this.verbose && window && window.console) {
7069
7185
  console.log("Unrecognized message received: %o", message);
@@ -7321,6 +7437,16 @@ var _DefaultSocket = class _DefaultSocket {
7321
7437
  console.log(streaming_leaved_event);
7322
7438
  }
7323
7439
  }
7440
+ onpttchanneljoined(ptt_joined_event) {
7441
+ if (this.verbose && window && window.console) {
7442
+ console.log(ptt_joined_event);
7443
+ }
7444
+ }
7445
+ onpttchannelleaved(ptt_leaved_event) {
7446
+ if (this.verbose && window && window.console) {
7447
+ console.log(ptt_leaved_event);
7448
+ }
7449
+ }
7324
7450
  onpermissionset(permission_set_event) {
7325
7451
  if (this.verbose && window && window.console) {
7326
7452
  console.log(permission_set_event);
@@ -7485,7 +7611,7 @@ var _DefaultSocket = class _DefaultSocket {
7485
7611
  updateStatus(status) {
7486
7612
  return this.send({ status_update: { status } });
7487
7613
  }
7488
- writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar) {
7614
+ writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code) {
7489
7615
  return __async(this, null, function* () {
7490
7616
  const response = yield this.send({
7491
7617
  channel_message_send: {
@@ -7499,7 +7625,8 @@ var _DefaultSocket = class _DefaultSocket {
7499
7625
  references,
7500
7626
  anonymous_message,
7501
7627
  mention_everyone,
7502
- avatar
7628
+ avatar,
7629
+ code
7503
7630
  }
7504
7631
  });
7505
7632
  return response.channel_message_ack;
@@ -7647,7 +7774,7 @@ var _DefaultSocket = class _DefaultSocket {
7647
7774
  handleDropdownBoxSelected(message_id, channel_id, selectbox_id, sender_id, user_id, value) {
7648
7775
  return __async(this, null, function* () {
7649
7776
  const response = yield this.send({
7650
- message_button_clicked: {
7777
+ dropdown_box_selected: {
7651
7778
  message_id,
7652
7779
  channel_id,
7653
7780
  selectbox_id,
@@ -7674,10 +7801,11 @@ var _DefaultSocket = class _DefaultSocket {
7674
7801
  return response.webrtc_signaling_fwd;
7675
7802
  });
7676
7803
  }
7677
- joinPTTChannel(channelId, dataType, jsonData) {
7804
+ joinPTTChannel(clanId, channelId, dataType, jsonData) {
7678
7805
  return __async(this, null, function* () {
7679
7806
  const response = yield this.send({
7680
7807
  join_ptt_channel: {
7808
+ clan_id: clanId,
7681
7809
  channel_id: channelId,
7682
7810
  data_type: dataType,
7683
7811
  json_data: jsonData,
@@ -10231,4 +10359,70 @@ var Client = class {
10231
10359
  });
10232
10360
  });
10233
10361
  }
10362
+ /** List a ptt channel's users. */
10363
+ listPTTChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
10364
+ return __async(this, null, function* () {
10365
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10366
+ yield this.sessionRefresh(session);
10367
+ }
10368
+ return this.apiClient.listPTTChannelUsers(
10369
+ session.token,
10370
+ clanId,
10371
+ channelId,
10372
+ channelType,
10373
+ limit,
10374
+ state,
10375
+ cursor
10376
+ ).then((response) => {
10377
+ var result = {
10378
+ ptt_channel_users: []
10379
+ };
10380
+ if (response.ptt_channel_users == null) {
10381
+ return Promise.resolve(result);
10382
+ }
10383
+ response.ptt_channel_users.forEach((gu) => {
10384
+ result.ptt_channel_users.push({
10385
+ id: gu.id,
10386
+ channel_id: gu.channel_id,
10387
+ user_id: gu.user_id,
10388
+ participant: gu.participant
10389
+ });
10390
+ });
10391
+ return Promise.resolve(result);
10392
+ });
10393
+ });
10394
+ }
10395
+ //**get custom display */
10396
+ getCustomDisplay(session) {
10397
+ return __async(this, null, function* () {
10398
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10399
+ yield this.sessionRefresh(session);
10400
+ }
10401
+ return this.apiClient.getCustomDisplay(session.token).then((response) => {
10402
+ return Promise.resolve(response);
10403
+ });
10404
+ });
10405
+ }
10406
+ //**update custom display */
10407
+ updateCustomDisplay(session, request) {
10408
+ return __async(this, null, function* () {
10409
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10410
+ yield this.sessionRefresh(session);
10411
+ }
10412
+ return this.apiClient.updateCustomDisplay(session.token, request).then((response) => {
10413
+ return response !== void 0;
10414
+ });
10415
+ });
10416
+ }
10417
+ //**list wallet ledger */
10418
+ listWalletLedger(session, limit, cursor) {
10419
+ return __async(this, null, function* () {
10420
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10421
+ yield this.sessionRefresh(session);
10422
+ }
10423
+ return this.apiClient.listWalletLedger(session.token, limit, cursor).then((response) => {
10424
+ return Promise.resolve(response);
10425
+ });
10426
+ });
10427
+ }
10234
10428
  };
@@ -3158,6 +3158,60 @@ var MezonApi = class {
3158
3158
  ]);
3159
3159
  }
3160
3160
  /** */
3161
+ getCustomDisplay(bearerToken, options = {}) {
3162
+ const urlPath = "/v2/customdisplay";
3163
+ const queryParams = /* @__PURE__ */ new Map();
3164
+ let bodyJson = "";
3165
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3166
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3167
+ if (bearerToken) {
3168
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3169
+ }
3170
+ return Promise.race([
3171
+ fetch(fullUrl, fetchOptions).then((response) => {
3172
+ if (response.status == 204) {
3173
+ return response;
3174
+ } else if (response.status >= 200 && response.status < 300) {
3175
+ return response.json();
3176
+ } else {
3177
+ throw response;
3178
+ }
3179
+ }),
3180
+ new Promise(
3181
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3182
+ )
3183
+ ]);
3184
+ }
3185
+ /** */
3186
+ updateCustomDisplay(bearerToken, body, options = {}) {
3187
+ if (body === null || body === void 0) {
3188
+ throw new Error("'body' is a required parameter but is null or undefined.");
3189
+ }
3190
+ const urlPath = "/v2/customdisplay";
3191
+ const queryParams = /* @__PURE__ */ new Map();
3192
+ let bodyJson = "";
3193
+ bodyJson = JSON.stringify(body || {});
3194
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3195
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3196
+ if (bearerToken) {
3197
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3198
+ }
3199
+ return Promise.race([
3200
+ fetch(fullUrl, fetchOptions).then((response) => {
3201
+ if (response.status == 204) {
3202
+ return response;
3203
+ } else if (response.status >= 200 && response.status < 300) {
3204
+ return response.json();
3205
+ } else {
3206
+ throw response;
3207
+ }
3208
+ }),
3209
+ new Promise(
3210
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3211
+ )
3212
+ ]);
3213
+ }
3214
+ /** */
3161
3215
  deleteCategoryDesc(bearerToken, categoryId, clanId, options = {}) {
3162
3216
  if (categoryId === null || categoryId === void 0) {
3163
3217
  throw new Error(
@@ -4750,6 +4804,37 @@ var MezonApi = class {
4750
4804
  )
4751
4805
  ]);
4752
4806
  }
4807
+ /** List all users in ptt channel. */
4808
+ listPTTChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
4809
+ const urlPath = "/v2/ptt_channels/users";
4810
+ const queryParams = /* @__PURE__ */ new Map();
4811
+ queryParams.set("clan_id", clanId);
4812
+ queryParams.set("channel_id", channelId);
4813
+ queryParams.set("channel_type", channelType);
4814
+ queryParams.set("limit", limit);
4815
+ queryParams.set("state", state);
4816
+ queryParams.set("cursor", cursor);
4817
+ let bodyJson = "";
4818
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4819
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4820
+ if (bearerToken) {
4821
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4822
+ }
4823
+ return Promise.race([
4824
+ fetch(fullUrl, fetchOptions).then((response) => {
4825
+ if (response.status == 204) {
4826
+ return response;
4827
+ } else if (response.status >= 200 && response.status < 300) {
4828
+ return response.json();
4829
+ } else {
4830
+ throw response;
4831
+ }
4832
+ }),
4833
+ new Promise(
4834
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4835
+ )
4836
+ ]);
4837
+ }
4753
4838
  /** get pubkey */
4754
4839
  getPubKeys(bearerToken, userIds, options = {}) {
4755
4840
  const urlPath = "/v2/pubkey";
@@ -6029,6 +6114,33 @@ var MezonApi = class {
6029
6114
  )
6030
6115
  ]);
6031
6116
  }
6117
+ /** Get user status */
6118
+ listWalletLedger(bearerToken, limit, cursor, options = {}) {
6119
+ const urlPath = "/v2/walletledger";
6120
+ const queryParams = /* @__PURE__ */ new Map();
6121
+ queryParams.set("limit", limit);
6122
+ queryParams.set("cursor", cursor);
6123
+ let bodyJson = "";
6124
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6125
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6126
+ if (bearerToken) {
6127
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6128
+ }
6129
+ return Promise.race([
6130
+ fetch(fullUrl, fetchOptions).then((response) => {
6131
+ if (response.status == 204) {
6132
+ return response;
6133
+ } else if (response.status >= 200 && response.status < 300) {
6134
+ return response.json();
6135
+ } else {
6136
+ throw response;
6137
+ }
6138
+ }),
6139
+ new Promise(
6140
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6141
+ )
6142
+ ]);
6143
+ }
6032
6144
  /** create webhook */
6033
6145
  generateWebhook(bearerToken, body, options = {}) {
6034
6146
  if (body === null || body === void 0) {
@@ -7034,6 +7146,10 @@ var _DefaultSocket = class _DefaultSocket {
7034
7146
  this.onjoinpttchannel(message.join_ptt_channel);
7035
7147
  } else if (message.talk_ptt_channel) {
7036
7148
  this.ontalkpttchannel(message.talk_ptt_channel);
7149
+ } else if (message.ptt_joined_event) {
7150
+ this.onpttchanneljoined(message.ptt_joined_event);
7151
+ } else if (message.ptt_leaved_event) {
7152
+ this.onpttchannelleaved(message.ptt_leaved_event);
7037
7153
  } else {
7038
7154
  if (this.verbose && window && window.console) {
7039
7155
  console.log("Unrecognized message received: %o", message);
@@ -7291,6 +7407,16 @@ var _DefaultSocket = class _DefaultSocket {
7291
7407
  console.log(streaming_leaved_event);
7292
7408
  }
7293
7409
  }
7410
+ onpttchanneljoined(ptt_joined_event) {
7411
+ if (this.verbose && window && window.console) {
7412
+ console.log(ptt_joined_event);
7413
+ }
7414
+ }
7415
+ onpttchannelleaved(ptt_leaved_event) {
7416
+ if (this.verbose && window && window.console) {
7417
+ console.log(ptt_leaved_event);
7418
+ }
7419
+ }
7294
7420
  onpermissionset(permission_set_event) {
7295
7421
  if (this.verbose && window && window.console) {
7296
7422
  console.log(permission_set_event);
@@ -7455,7 +7581,7 @@ var _DefaultSocket = class _DefaultSocket {
7455
7581
  updateStatus(status) {
7456
7582
  return this.send({ status_update: { status } });
7457
7583
  }
7458
- writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar) {
7584
+ writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar, code) {
7459
7585
  return __async(this, null, function* () {
7460
7586
  const response = yield this.send({
7461
7587
  channel_message_send: {
@@ -7469,7 +7595,8 @@ var _DefaultSocket = class _DefaultSocket {
7469
7595
  references,
7470
7596
  anonymous_message,
7471
7597
  mention_everyone,
7472
- avatar
7598
+ avatar,
7599
+ code
7473
7600
  }
7474
7601
  });
7475
7602
  return response.channel_message_ack;
@@ -7617,7 +7744,7 @@ var _DefaultSocket = class _DefaultSocket {
7617
7744
  handleDropdownBoxSelected(message_id, channel_id, selectbox_id, sender_id, user_id, value) {
7618
7745
  return __async(this, null, function* () {
7619
7746
  const response = yield this.send({
7620
- message_button_clicked: {
7747
+ dropdown_box_selected: {
7621
7748
  message_id,
7622
7749
  channel_id,
7623
7750
  selectbox_id,
@@ -7644,10 +7771,11 @@ var _DefaultSocket = class _DefaultSocket {
7644
7771
  return response.webrtc_signaling_fwd;
7645
7772
  });
7646
7773
  }
7647
- joinPTTChannel(channelId, dataType, jsonData) {
7774
+ joinPTTChannel(clanId, channelId, dataType, jsonData) {
7648
7775
  return __async(this, null, function* () {
7649
7776
  const response = yield this.send({
7650
7777
  join_ptt_channel: {
7778
+ clan_id: clanId,
7651
7779
  channel_id: channelId,
7652
7780
  data_type: dataType,
7653
7781
  json_data: jsonData,
@@ -10201,6 +10329,72 @@ var Client = class {
10201
10329
  });
10202
10330
  });
10203
10331
  }
10332
+ /** List a ptt channel's users. */
10333
+ listPTTChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
10334
+ return __async(this, null, function* () {
10335
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10336
+ yield this.sessionRefresh(session);
10337
+ }
10338
+ return this.apiClient.listPTTChannelUsers(
10339
+ session.token,
10340
+ clanId,
10341
+ channelId,
10342
+ channelType,
10343
+ limit,
10344
+ state,
10345
+ cursor
10346
+ ).then((response) => {
10347
+ var result = {
10348
+ ptt_channel_users: []
10349
+ };
10350
+ if (response.ptt_channel_users == null) {
10351
+ return Promise.resolve(result);
10352
+ }
10353
+ response.ptt_channel_users.forEach((gu) => {
10354
+ result.ptt_channel_users.push({
10355
+ id: gu.id,
10356
+ channel_id: gu.channel_id,
10357
+ user_id: gu.user_id,
10358
+ participant: gu.participant
10359
+ });
10360
+ });
10361
+ return Promise.resolve(result);
10362
+ });
10363
+ });
10364
+ }
10365
+ //**get custom display */
10366
+ getCustomDisplay(session) {
10367
+ return __async(this, null, function* () {
10368
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10369
+ yield this.sessionRefresh(session);
10370
+ }
10371
+ return this.apiClient.getCustomDisplay(session.token).then((response) => {
10372
+ return Promise.resolve(response);
10373
+ });
10374
+ });
10375
+ }
10376
+ //**update custom display */
10377
+ updateCustomDisplay(session, request) {
10378
+ return __async(this, null, function* () {
10379
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10380
+ yield this.sessionRefresh(session);
10381
+ }
10382
+ return this.apiClient.updateCustomDisplay(session.token, request).then((response) => {
10383
+ return response !== void 0;
10384
+ });
10385
+ });
10386
+ }
10387
+ //**list wallet ledger */
10388
+ listWalletLedger(session, limit, cursor) {
10389
+ return __async(this, null, function* () {
10390
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10391
+ yield this.sessionRefresh(session);
10392
+ }
10393
+ return this.apiClient.listWalletLedger(session.token, limit, cursor).then((response) => {
10394
+ return Promise.resolve(response);
10395
+ });
10396
+ });
10397
+ }
10204
10398
  };
10205
10399
  export {
10206
10400
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -197,6 +197,7 @@ interface ChannelMessageSend {
197
197
  mention_everyone?: boolean;
198
198
  avatar: string;
199
199
  is_public: boolean;
200
+ code: number;
200
201
  };
201
202
  }
202
203
  /** Update a message previously sent to a realtime chat channel. */
@@ -619,6 +620,8 @@ export interface JoinPTTChannel {
619
620
  json_data: string;
620
621
  /** receiver id */
621
622
  receiver_id: string;
623
+ /** clan id */
624
+ clan_id: string;
622
625
  }
623
626
  export interface TalkPTTChannel {
624
627
  channel_id: string;
@@ -626,6 +629,34 @@ export interface TalkPTTChannel {
626
629
  json_data: string;
627
630
  state: number;
628
631
  }
632
+ /** PTT Joined event */
633
+ export interface PTTLeavedEvent {
634
+ /** id */
635
+ id: string;
636
+ /** The unique identifier of the chat clan. */
637
+ clan_id: string;
638
+ /** channel id */
639
+ channel_id: string;
640
+ /** user_id */
641
+ user_id: string;
642
+ }
643
+ /** PTT Joined event */
644
+ export interface PTTJoinedEvent {
645
+ /** The unique identifier of the chat clan. */
646
+ clan_id: string;
647
+ /** The clan_name */
648
+ clan_name: string;
649
+ /** id */
650
+ id: string;
651
+ /** ptt participant */
652
+ participant: string;
653
+ /** user id */
654
+ user_id: string;
655
+ /** channel label */
656
+ channel_label: string;
657
+ /** channel id */
658
+ channel_id: string;
659
+ }
629
660
  export interface ListActivity {
630
661
  acts: ApiUserActivity[];
631
662
  }
@@ -656,7 +687,7 @@ export interface Socket {
656
687
  /** Update the status for the current user online. */
657
688
  updateStatus(status?: string): Promise<void>;
658
689
  /** Send a chat message to a chat channel on the server. */
659
- 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): Promise<ChannelMessageAck>;
690
+ 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): Promise<ChannelMessageAck>;
660
691
  /** Send message typing */
661
692
  writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent>;
662
693
  /** Send message reaction */
@@ -671,7 +702,7 @@ export interface Socket {
671
702
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
672
703
  /** send voice leaved */
673
704
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
674
- joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
705
+ joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
675
706
  talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
676
707
  setHeartbeatTimeoutMs(ms: number): void;
677
708
  getHeartbeatTimeoutMs(): number;
@@ -753,6 +784,8 @@ export interface Socket {
753
784
  onactivityupdated: (list_activity: ListActivity) => void;
754
785
  onjoinpttchannel: (join_ptt_channel: JoinPTTChannel) => void;
755
786
  ontalkpttchannel: (talk_ptt_channel: TalkPTTChannel) => void;
787
+ onpttchanneljoined: (ptt_joined_event: PTTJoinedEvent) => void;
788
+ onpttchannelleaved: (ptt_leaved_event: PTTLeavedEvent) => void;
756
789
  }
757
790
  /** Reports an error received from a socket message. */
758
791
  export interface SocketError {
@@ -823,6 +856,8 @@ export declare class DefaultSocket implements Socket {
823
856
  onstreamingchannelended(streaming_ended_event: StreamingEndedEvent): void;
824
857
  onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent): void;
825
858
  onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
859
+ onpttchanneljoined(ptt_joined_event: PTTJoinedEvent): void;
860
+ onpttchannelleaved(ptt_leaved_event: PTTLeavedEvent): void;
826
861
  onpermissionset(permission_set_event: PermissionSet): void;
827
862
  onpermissionchanged(permission_changed_event: PermissionChangedEvent): void;
828
863
  onunmuteevent(unmute_event: UnmuteEvent): void;
@@ -843,7 +878,7 @@ export declare class DefaultSocket implements Socket {
843
878
  unfollowUsers(user_ids: string[]): Promise<void>;
844
879
  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): Promise<ChannelMessageAck>;
845
880
  updateStatus(status?: string): Promise<void>;
846
- 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): Promise<ChannelMessageAck>;
881
+ 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): Promise<ChannelMessageAck>;
847
882
  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): Promise<ApiMessageReaction>;
848
883
  writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent>;
849
884
  writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent>;
@@ -856,7 +891,7 @@ export declare class DefaultSocket implements Socket {
856
891
  makeCallPush(receiver_id: string, json_data: string, channel_id: string, caller_id: string): Promise<IncomingCallPush>;
857
892
  handleDropdownBoxSelected(message_id: string, channel_id: string, selectbox_id: string, sender_id: string, user_id: string, value: Array<string>): Promise<DropdownBoxSelected>;
858
893
  handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string, extra_data: string): Promise<MessageButtonClicked>;
859
- joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
894
+ joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
860
895
  talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
861
896
  private pingPong;
862
897
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.90",
4
+ "version": "2.9.93",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -284,6 +284,8 @@ interface ChannelMessageSend {
284
284
  avatar: string;
285
285
  // Is public
286
286
  is_public: boolean;
287
+ // code
288
+ code: number;
287
289
  };
288
290
  }
289
291
 
@@ -870,6 +872,8 @@ export interface JoinPTTChannel {
870
872
  json_data: string;
871
873
  /** receiver id */
872
874
  receiver_id: string;
875
+ /** clan id */
876
+ clan_id: string;
873
877
  }
874
878
 
875
879
  export interface TalkPTTChannel {
@@ -883,6 +887,36 @@ export interface TalkPTTChannel {
883
887
  state: number;
884
888
  }
885
889
 
890
+ /** PTT Joined event */
891
+ export interface PTTLeavedEvent {
892
+ /** id */
893
+ id: string;
894
+ /** The unique identifier of the chat clan. */
895
+ clan_id: string;
896
+ /** channel id */
897
+ channel_id: string;
898
+ /** user_id */
899
+ user_id: string;
900
+ }
901
+
902
+ /** PTT Joined event */
903
+ export interface PTTJoinedEvent {
904
+ /** The unique identifier of the chat clan. */
905
+ clan_id: string;
906
+ /** The clan_name */
907
+ clan_name: string;
908
+ /** id */
909
+ id: string;
910
+ /** ptt participant */
911
+ participant: string;
912
+ /** user id */
913
+ user_id: string;
914
+ /** channel label */
915
+ channel_label: string;
916
+ /** channel id */
917
+ channel_id: string;
918
+ }
919
+
886
920
  export interface ListActivity {
887
921
  acts: ApiUserActivity[];
888
922
  }
@@ -969,7 +1003,8 @@ export interface Socket {
969
1003
  references?: Array<ApiMessageRef>,
970
1004
  anonymous_message?: boolean,
971
1005
  mention_everyone?: boolean,
972
- avatar?: string
1006
+ avatar?: string,
1007
+ code?: number
973
1008
  ): Promise<ChannelMessageAck>;
974
1009
 
975
1010
  /** Send message typing */
@@ -1041,6 +1076,7 @@ export interface Socket {
1041
1076
  ): Promise<VoiceLeavedEvent>;
1042
1077
 
1043
1078
  joinPTTChannel(
1079
+ clanId: string,
1044
1080
  channelId: string,
1045
1081
  dataType: number,
1046
1082
  jsonData: string
@@ -1243,6 +1279,10 @@ export interface Socket {
1243
1279
  onjoinpttchannel: (join_ptt_channel: JoinPTTChannel) => void;
1244
1280
 
1245
1281
  ontalkpttchannel: (talk_ptt_channel: TalkPTTChannel) => void;
1282
+
1283
+ onpttchanneljoined: (ptt_joined_event: PTTJoinedEvent) => void;
1284
+
1285
+ onpttchannelleaved: (ptt_leaved_event: PTTLeavedEvent) => void;
1246
1286
  }
1247
1287
 
1248
1288
  /** Reports an error received from a socket message. */
@@ -1511,6 +1551,10 @@ export class DefaultSocket implements Socket {
1511
1551
  this.onjoinpttchannel(<JoinPTTChannel>message.join_ptt_channel);
1512
1552
  } else if (message.talk_ptt_channel) {
1513
1553
  this.ontalkpttchannel(<TalkPTTChannel>message.talk_ptt_channel);
1554
+ } else if (message.ptt_joined_event) {
1555
+ this.onpttchanneljoined(<PTTJoinedEvent>message.ptt_joined_event);
1556
+ } else if (message.ptt_leaved_event) {
1557
+ this.onpttchannelleaved(<PTTLeavedEvent>message.ptt_leaved_event);
1514
1558
  } else {
1515
1559
  if (this.verbose && window && window.console) {
1516
1560
  console.log("Unrecognized message received: %o", message);
@@ -1818,6 +1862,18 @@ export class DefaultSocket implements Socket {
1818
1862
  }
1819
1863
  }
1820
1864
 
1865
+ onpttchanneljoined(ptt_joined_event: PTTJoinedEvent) {
1866
+ if (this.verbose && window && window.console) {
1867
+ console.log(ptt_joined_event);
1868
+ }
1869
+ }
1870
+
1871
+ onpttchannelleaved(ptt_leaved_event: PTTLeavedEvent) {
1872
+ if (this.verbose && window && window.console) {
1873
+ console.log(ptt_leaved_event);
1874
+ }
1875
+ }
1876
+
1821
1877
  onpermissionset(permission_set_event: PermissionSet) {
1822
1878
  if (this.verbose && window && window.console) {
1823
1879
  console.log(permission_set_event);
@@ -2056,7 +2112,8 @@ export class DefaultSocket implements Socket {
2056
2112
  references?: Array<ApiMessageRef>,
2057
2113
  anonymous_message?: boolean,
2058
2114
  mention_everyone?: Boolean,
2059
- avatar?: string
2115
+ avatar?: string,
2116
+ code?: number,
2060
2117
  ): Promise<ChannelMessageAck> {
2061
2118
  const response = await this.send({
2062
2119
  channel_message_send: {
@@ -2071,6 +2128,7 @@ export class DefaultSocket implements Socket {
2071
2128
  anonymous_message: anonymous_message,
2072
2129
  mention_everyone: mention_everyone,
2073
2130
  avatar: avatar,
2131
+ code: code,
2074
2132
  },
2075
2133
  });
2076
2134
  return response.channel_message_ack;
@@ -2276,7 +2334,7 @@ export class DefaultSocket implements Socket {
2276
2334
  value: Array<string>
2277
2335
  ): Promise<DropdownBoxSelected> {
2278
2336
  const response = await this.send({
2279
- message_button_clicked: {
2337
+ dropdown_box_selected: {
2280
2338
  message_id: message_id,
2281
2339
  channel_id: channel_id,
2282
2340
  selectbox_id: selectbox_id,
@@ -2310,12 +2368,14 @@ export class DefaultSocket implements Socket {
2310
2368
  }
2311
2369
 
2312
2370
  async joinPTTChannel(
2371
+ clanId: string,
2313
2372
  channelId: string,
2314
2373
  dataType: number,
2315
2374
  jsonData: string
2316
2375
  ): Promise<JoinPTTChannel> {
2317
2376
  const response = await this.send({
2318
2377
  join_ptt_channel: {
2378
+ clan_id: clanId,
2319
2379
  channel_id: channelId,
2320
2380
  data_type: dataType,
2321
2381
  json_data: jsonData,