mezon-js 2.9.63 → 2.9.65

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -2060,6 +2060,8 @@ export interface ApiSetNotificationRequest {
2060
2060
  notification_type?: number;
2061
2061
  //
2062
2062
  time_mute?: string;
2063
+ // clan_id
2064
+ clan_id?: string;
2063
2065
  }
2064
2066
 
2065
2067
  /** */
@@ -2146,6 +2148,20 @@ export interface ApiSystemMessagesList {
2146
2148
  system_messages_list?: Array<ApiSystemMessage>;
2147
2149
  }
2148
2150
 
2151
+ /** */
2152
+ export interface ApiTokenSentEvent {
2153
+ //
2154
+ amount?: number;
2155
+ //
2156
+ note?: string;
2157
+ //
2158
+ receiver_id?: string;
2159
+ //
2160
+ sender_id?: string;
2161
+ //
2162
+ sender_name?: string;
2163
+ }
2164
+
2149
2165
  /** Update a user's account details. */
2150
2166
  export interface ApiUpdateAccountRequest {
2151
2167
  //
@@ -8278,12 +8294,47 @@ pushPubKey(bearerToken: string,
8278
8294
 
8279
8295
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8280
8296
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
8281
- if (bearerToken) {
8282
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8297
+ if (bearerToken) {
8298
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8299
+ }
8300
+ if (basicAuthUsername) {
8301
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
8302
+ }
8303
+
8304
+ return Promise.race([
8305
+ fetch(fullUrl, fetchOptions).then((response) => {
8306
+ if (response.status == 204) {
8307
+ return response;
8308
+ } else if (response.status >= 200 && response.status < 300) {
8309
+ return response.json();
8310
+ } else {
8311
+ throw response;
8312
+ }
8313
+ }),
8314
+ new Promise((_, reject) =>
8315
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8316
+ ),
8317
+ ]);
8318
+ }
8319
+
8320
+ /** UpdateWallets */
8321
+ sendToken(bearerToken: string,
8322
+ body:ApiTokenSentEvent,
8323
+ options: any = {}): Promise<any> {
8324
+
8325
+ if (body === null || body === undefined) {
8326
+ throw new Error("'body' is a required parameter but is null or undefined.");
8283
8327
  }
8284
- if (basicAuthUsername) {
8285
- fetchOptions.headers["Authorization"] =
8286
- "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
8328
+ const urlPath = "/v2/sendtoken";
8329
+ const queryParams = new Map<string, any>();
8330
+
8331
+ let bodyJson : string = "";
8332
+ bodyJson = JSON.stringify(body || {});
8333
+
8334
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8335
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
8336
+ if (bearerToken) {
8337
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8287
8338
  }
8288
8339
 
8289
8340
  return Promise.race([
package/client.ts CHANGED
@@ -137,6 +137,7 @@ import {
137
137
  ApiPubKey,
138
138
  ApiGetKeyServerResp,
139
139
  MezonapiListAuditLog,
140
+ ApiTokenSentEvent,
140
141
  } from "./api.gen";
141
142
 
142
143
  import { Session } from "./session";
@@ -2885,7 +2886,7 @@ export class Client {
2885
2886
  /** Set default notification category*/
2886
2887
  async setNotificationCategory(
2887
2888
  session: Session,
2888
- request: ApiSetDefaultNotificationRequest
2889
+ request: ApiSetNotificationRequest
2889
2890
  ): Promise<boolean> {
2890
2891
  if (
2891
2892
  this.autoRefreshSession &&
@@ -3516,6 +3517,22 @@ export class Client {
3516
3517
  });
3517
3518
  }
3518
3519
 
3520
+ async updateWallets(session: Session, request: ApiTokenSentEvent) {
3521
+ if (
3522
+ this.autoRefreshSession &&
3523
+ session.refresh_token &&
3524
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3525
+ ) {
3526
+ await this.sessionRefresh(session);
3527
+ }
3528
+
3529
+ return this.apiClient
3530
+ .sendToken(session.token, request)
3531
+ .then((response: ApiTokenSentEvent) => {
3532
+ return Promise.resolve(response);
3533
+ });
3534
+ }
3535
+
3519
3536
  async listStreamingChannels(
3520
3537
  session: Session,
3521
3538
  clanId: string
package/dist/api.gen.d.ts CHANGED
@@ -1200,6 +1200,7 @@ export interface ApiSetNotificationRequest {
1200
1200
  channel_category_id?: string;
1201
1201
  notification_type?: number;
1202
1202
  time_mute?: string;
1203
+ clan_id?: string;
1203
1204
  }
1204
1205
  /** */
1205
1206
  export interface ApiSortParam {
@@ -1251,6 +1252,14 @@ export interface ApiSystemMessageRequest {
1251
1252
  export interface ApiSystemMessagesList {
1252
1253
  system_messages_list?: Array<ApiSystemMessage>;
1253
1254
  }
1255
+ /** */
1256
+ export interface ApiTokenSentEvent {
1257
+ amount?: number;
1258
+ note?: string;
1259
+ receiver_id?: string;
1260
+ sender_id?: string;
1261
+ sender_name?: string;
1262
+ }
1254
1263
  /** Update a user's account details. */
1255
1264
  export interface ApiUpdateAccountRequest {
1256
1265
  about_me?: string;
@@ -1708,6 +1717,8 @@ export declare class MezonApi {
1708
1717
  rpcFunc2(bearerToken: string, basicAuthUsername: string, basicAuthPassword: string, id: string, payload?: string, httpKey?: string, options?: any): Promise<ApiRpc>;
1709
1718
  /** Execute a Lua function on the server. */
1710
1719
  rpcFunc(bearerToken: string, basicAuthUsername: string, basicAuthPassword: string, id: string, payload: string, httpKey?: string, options?: any): Promise<ApiRpc>;
1720
+ /** UpdateWallets */
1721
+ sendToken(bearerToken: string, body: ApiTokenSentEvent, options?: any): Promise<any>;
1711
1722
  /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
1712
1723
  sessionLogout(bearerToken: string, body: ApiSessionLogoutRequest, options?: any): Promise<any>;
1713
1724
  /** Add a new sticker */
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -520,7 +520,7 @@ export declare class Client {
520
520
  /** update channel private*/
521
521
  updateChannelPrivate(session: Session, request: ApiChangeChannelPrivateRequest): Promise<boolean>;
522
522
  /** Set default notification category*/
523
- setNotificationCategory(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
523
+ setNotificationCategory(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
524
524
  deleteNotificationCategory(session: Session, category_id: string): Promise<boolean>;
525
525
  deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean>;
526
526
  /** */
@@ -559,6 +559,7 @@ export declare class Client {
559
559
  updateCategoryOrder(session: Session, request: ApiUpdateCategoryOrderRequest): Promise<any>;
560
560
  deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
561
561
  givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<boolean>;
562
+ updateWallets(session: Session, request: ApiTokenSentEvent): Promise<ApiTokenSentEvent>;
562
563
  listStreamingChannels(session: Session, clanId: string): Promise<ApiListStreamingChannelsResponse>;
563
564
  /** List a channel's users. */
564
565
  listStreamingChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiStreamingChannelUserList>;
@@ -5287,6 +5287,35 @@ var MezonApi = class {
5287
5287
  )
5288
5288
  ]);
5289
5289
  }
5290
+ /** UpdateWallets */
5291
+ sendToken(bearerToken, body, options = {}) {
5292
+ if (body === null || body === void 0) {
5293
+ throw new Error("'body' is a required parameter but is null or undefined.");
5294
+ }
5295
+ const urlPath = "/v2/sendtoken";
5296
+ const queryParams = /* @__PURE__ */ new Map();
5297
+ let bodyJson = "";
5298
+ bodyJson = JSON.stringify(body || {});
5299
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5300
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5301
+ if (bearerToken) {
5302
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5303
+ }
5304
+ return Promise.race([
5305
+ fetch(fullUrl, fetchOptions).then((response) => {
5306
+ if (response.status == 204) {
5307
+ return response;
5308
+ } else if (response.status >= 200 && response.status < 300) {
5309
+ return response.json();
5310
+ } else {
5311
+ throw response;
5312
+ }
5313
+ }),
5314
+ new Promise(
5315
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5316
+ )
5317
+ ]);
5318
+ }
5290
5319
  /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
5291
5320
  sessionLogout(bearerToken, body, options = {}) {
5292
5321
  if (body === null || body === void 0) {
@@ -6553,6 +6582,8 @@ var _DefaultSocket = class _DefaultSocket {
6553
6582
  this.onpermissionset(message.permission_set_event);
6554
6583
  } else if (message.permission_changed_event) {
6555
6584
  this.onpermissionchanged(message.permission_changed_event);
6585
+ } else if (message.unmute_event) {
6586
+ this.onunmuteevent(message.unmute_event);
6556
6587
  } else if (message.token_sent_event) {
6557
6588
  this.ontokensent(message.token_sent_event);
6558
6589
  } else if (message.message_button_clicked) {
@@ -6824,6 +6855,11 @@ var _DefaultSocket = class _DefaultSocket {
6824
6855
  console.log(permission_changed_event);
6825
6856
  }
6826
6857
  }
6858
+ onunmuteevent(unmute_event) {
6859
+ if (this.verbose && window && window.console) {
6860
+ console.log(unmute_event);
6861
+ }
6862
+ }
6827
6863
  ontokensent(tokenSentEvent) {
6828
6864
  if (this.verbose && window && window.console) {
6829
6865
  console.log(tokenSentEvent);
@@ -6985,12 +7021,6 @@ var _DefaultSocket = class _DefaultSocket {
6985
7021
  return response.check_name_existed_event;
6986
7022
  });
6987
7023
  }
6988
- sendToken(receiver_id, amount) {
6989
- return __async(this, null, function* () {
6990
- const response = yield this.send({ token_sent_event: { receiver_id, amount } });
6991
- return response.token_sent_event;
6992
- });
6993
- }
6994
7024
  pingPong() {
6995
7025
  return __async(this, null, function* () {
6996
7026
  if (!this.adapter.isOpen()) {
@@ -8858,6 +8888,16 @@ var Client = class {
8858
8888
  });
8859
8889
  });
8860
8890
  }
8891
+ updateWallets(session, request) {
8892
+ return __async(this, null, function* () {
8893
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8894
+ yield this.sessionRefresh(session);
8895
+ }
8896
+ return this.apiClient.sendToken(session.token, request).then((response) => {
8897
+ return Promise.resolve(response);
8898
+ });
8899
+ });
8900
+ }
8861
8901
  listStreamingChannels(session, clanId) {
8862
8902
  return __async(this, null, function* () {
8863
8903
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
@@ -5258,6 +5258,35 @@ var MezonApi = class {
5258
5258
  )
5259
5259
  ]);
5260
5260
  }
5261
+ /** UpdateWallets */
5262
+ sendToken(bearerToken, body, options = {}) {
5263
+ if (body === null || body === void 0) {
5264
+ throw new Error("'body' is a required parameter but is null or undefined.");
5265
+ }
5266
+ const urlPath = "/v2/sendtoken";
5267
+ const queryParams = /* @__PURE__ */ new Map();
5268
+ let bodyJson = "";
5269
+ bodyJson = JSON.stringify(body || {});
5270
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5271
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5272
+ if (bearerToken) {
5273
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5274
+ }
5275
+ return Promise.race([
5276
+ fetch(fullUrl, fetchOptions).then((response) => {
5277
+ if (response.status == 204) {
5278
+ return response;
5279
+ } else if (response.status >= 200 && response.status < 300) {
5280
+ return response.json();
5281
+ } else {
5282
+ throw response;
5283
+ }
5284
+ }),
5285
+ new Promise(
5286
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5287
+ )
5288
+ ]);
5289
+ }
5261
5290
  /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
5262
5291
  sessionLogout(bearerToken, body, options = {}) {
5263
5292
  if (body === null || body === void 0) {
@@ -6524,6 +6553,8 @@ var _DefaultSocket = class _DefaultSocket {
6524
6553
  this.onpermissionset(message.permission_set_event);
6525
6554
  } else if (message.permission_changed_event) {
6526
6555
  this.onpermissionchanged(message.permission_changed_event);
6556
+ } else if (message.unmute_event) {
6557
+ this.onunmuteevent(message.unmute_event);
6527
6558
  } else if (message.token_sent_event) {
6528
6559
  this.ontokensent(message.token_sent_event);
6529
6560
  } else if (message.message_button_clicked) {
@@ -6795,6 +6826,11 @@ var _DefaultSocket = class _DefaultSocket {
6795
6826
  console.log(permission_changed_event);
6796
6827
  }
6797
6828
  }
6829
+ onunmuteevent(unmute_event) {
6830
+ if (this.verbose && window && window.console) {
6831
+ console.log(unmute_event);
6832
+ }
6833
+ }
6798
6834
  ontokensent(tokenSentEvent) {
6799
6835
  if (this.verbose && window && window.console) {
6800
6836
  console.log(tokenSentEvent);
@@ -6956,12 +6992,6 @@ var _DefaultSocket = class _DefaultSocket {
6956
6992
  return response.check_name_existed_event;
6957
6993
  });
6958
6994
  }
6959
- sendToken(receiver_id, amount) {
6960
- return __async(this, null, function* () {
6961
- const response = yield this.send({ token_sent_event: { receiver_id, amount } });
6962
- return response.token_sent_event;
6963
- });
6964
- }
6965
6995
  pingPong() {
6966
6996
  return __async(this, null, function* () {
6967
6997
  if (!this.adapter.isOpen()) {
@@ -8829,6 +8859,16 @@ var Client = class {
8829
8859
  });
8830
8860
  });
8831
8861
  }
8862
+ updateWallets(session, request) {
8863
+ return __async(this, null, function* () {
8864
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8865
+ yield this.sessionRefresh(session);
8866
+ }
8867
+ return this.apiClient.sendToken(session.token, request).then((response) => {
8868
+ return Promise.resolve(response);
8869
+ });
8870
+ });
8871
+ }
8832
8872
  listStreamingChannels(session, clanId) {
8833
8873
  return __async(this, null, function* () {
8834
8874
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
package/dist/socket.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 { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc } from "./api.gen";
16
+ import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { ChannelMessage, Notification } from "./client";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -128,6 +128,11 @@ export interface LastPinMessageEvent {
128
128
  operation: number;
129
129
  is_public: boolean;
130
130
  }
131
+ export interface UnmuteEvent {
132
+ channel_id: string;
133
+ category_id: string;
134
+ clan_id: string;
135
+ }
131
136
  /** Last seen message by user */
132
137
  export interface LastSeenMessageEvent {
133
138
  clan_id: string;
@@ -572,12 +577,6 @@ export interface PermissionChangedEvent {
572
577
  user_id: string;
573
578
  channel_id: string;
574
579
  }
575
- export interface TokenSentEvent {
576
- sender_id: string;
577
- sender_name: string;
578
- receiver_id: string;
579
- amount: number;
580
- }
581
580
  export interface MessageButtonClicked {
582
581
  message_id: string;
583
582
  channel_id: string;
@@ -627,8 +626,6 @@ export interface Socket {
627
626
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
628
627
  /** send voice leaved */
629
628
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
630
- /** send token */
631
- sendToken(receiver_id: string, amount: number): Promise<TokenSentEvent>;
632
629
  /** Handle disconnect events received from the socket. */
633
630
  ondisconnect: (evt: Event) => void;
634
631
  /** Handle error events received from the socket. */
@@ -698,7 +695,8 @@ export interface Socket {
698
695
  onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
699
696
  onpermissionset: (permission_set_event: PermissionSet) => void;
700
697
  onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
701
- ontokensent: (token: TokenSentEvent) => void;
698
+ onunmuteevent: (unmute_event: UnmuteEvent) => void;
699
+ ontokensent: (token: ApiTokenSentEvent) => void;
702
700
  }
703
701
  /** Reports an error received from a socket message. */
704
702
  export interface SocketError {
@@ -771,7 +769,8 @@ export declare class DefaultSocket implements Socket {
771
769
  onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
772
770
  onpermissionset(permission_set_event: PermissionSet): void;
773
771
  onpermissionchanged(permission_changed_event: PermissionChangedEvent): void;
774
- ontokensent(tokenSentEvent: TokenSentEvent): void;
772
+ onunmuteevent(unmute_event: UnmuteEvent): void;
773
+ ontokensent(tokenSentEvent: ApiTokenSentEvent): void;
775
774
  handleMessageButtonClick(messageButtonClicked: MessageButtonClicked): void;
776
775
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
777
776
  followUsers(userIds: string[]): Promise<Status>;
@@ -792,7 +791,6 @@ export declare class DefaultSocket implements Socket {
792
791
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
793
792
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
794
793
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
795
- sendToken(receiver_id: string, amount: number): Promise<TokenSentEvent>;
796
794
  private pingPong;
797
795
  }
798
796
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.63",
4
+ "version": "2.9.65",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionUpdate, ApiRole, ApiRpc } from "./api.gen";
17
+ import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent } from "./api.gen";
18
18
  import { Session } from "./session";
19
19
  import { ChannelMessage, Notification } from "./client";
20
20
  import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
@@ -170,6 +170,15 @@ export interface LastPinMessageEvent {
170
170
  is_public: boolean;
171
171
  }
172
172
 
173
+ export interface UnmuteEvent {
174
+ // channel id
175
+ channel_id: string;
176
+ // category_id
177
+ category_id: string;
178
+ // clan_id
179
+ clan_id: string;
180
+ }
181
+
173
182
  /** Last seen message by user */
174
183
  export interface LastSeenMessageEvent {
175
184
  // The clan id
@@ -799,16 +808,6 @@ export interface PermissionChangedEvent{
799
808
  channel_id: string;
800
809
  }
801
810
 
802
- export interface TokenSentEvent {
803
- // sender id
804
- sender_id: string;
805
- // sender name
806
- sender_name: string;
807
- // receiver
808
- receiver_id: string;
809
- // amount of token
810
- amount: number;
811
- }
812
811
  export interface MessageButtonClicked {
813
812
  message_id: string;
814
813
  channel_id: string;
@@ -879,9 +878,6 @@ export interface Socket {
879
878
  /** send voice leaved */
880
879
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string) : Promise<VoiceLeavedEvent>;
881
880
 
882
- /** send token */
883
- sendToken(receiver_id: string, amount: number) : Promise<TokenSentEvent>;
884
-
885
881
  /** Handle disconnect events received from the socket. */
886
882
  ondisconnect: (evt: Event) => void;
887
883
 
@@ -1014,7 +1010,9 @@ export interface Socket {
1014
1010
 
1015
1011
  onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
1016
1012
 
1017
- ontokensent: (token: TokenSentEvent) => void;
1013
+ onunmuteevent: (unmute_event: UnmuteEvent) => void;
1014
+
1015
+ ontokensent: (token: ApiTokenSentEvent) => void;
1018
1016
  }
1019
1017
 
1020
1018
  /** Reports an error received from a socket message. */
@@ -1218,8 +1216,10 @@ export class DefaultSocket implements Socket {
1218
1216
  this.onpermissionset(<PermissionSet>message.permission_set_event);
1219
1217
  } else if(message.permission_changed_event){
1220
1218
  this.onpermissionchanged(<PermissionChangedEvent>message.permission_changed_event);
1219
+ } else if(message.unmute_event){
1220
+ this.onunmuteevent(<UnmuteEvent>message.unmute_event);
1221
1221
  } else if (message.token_sent_event) {
1222
- this.ontokensent(<TokenSentEvent>message.token_sent_event);
1222
+ this.ontokensent(<ApiTokenSentEvent>message.token_sent_event);
1223
1223
  } else if (message.message_button_clicked){
1224
1224
  this.handleMessageButtonClick(<MessageButtonClicked>message.message_button_clicked)
1225
1225
  } else {
@@ -1542,7 +1542,13 @@ export class DefaultSocket implements Socket {
1542
1542
  }
1543
1543
  }
1544
1544
 
1545
- ontokensent(tokenSentEvent: TokenSentEvent) {
1545
+ onunmuteevent(unmute_event: UnmuteEvent){
1546
+ if (this.verbose && window && window.console) {
1547
+ console.log(unmute_event);
1548
+ }
1549
+ }
1550
+
1551
+ ontokensent(tokenSentEvent: ApiTokenSentEvent) {
1546
1552
  if (this.verbose && window && window.console) {
1547
1553
  console.log(tokenSentEvent);
1548
1554
  }
@@ -1704,11 +1710,6 @@ export class DefaultSocket implements Socket {
1704
1710
  return response.check_name_existed_event;
1705
1711
  }
1706
1712
 
1707
- async sendToken(receiver_id: string, amount: number) : Promise<TokenSentEvent> {
1708
- const response = await this.send({token_sent_event: {receiver_id: receiver_id, amount: amount}});
1709
- return response.token_sent_event;
1710
- }
1711
-
1712
1713
  private async pingPong(): Promise<void> {
1713
1714
  if (!this.adapter.isOpen()) {
1714
1715
  return;