mezon-js 2.11.19 → 2.11.21

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
@@ -534,10 +534,14 @@ export interface ApiAuditLog {
534
534
  user_id?: string;
535
535
  }
536
536
 
537
- /** Authenticate against the server with a device ID. */
538
- export interface ApiAuthenticateRequest {
539
- //The App account details.
540
- account?: ApiAccountApp;
537
+ /** Authenticate against the server with email+password. */
538
+ export interface ApiAuthenticateEmailRequest {
539
+ //The email account details.
540
+ account?: ApiAccountEmail;
541
+ //Register the account if the user does not already exist.
542
+ create?: boolean;
543
+ //Set the username on the account at register. Must be unique.
544
+ username?: string;
541
545
  }
542
546
 
543
547
  /** */
@@ -2997,19 +3001,6 @@ export interface ApiGenerateMeetTokenResponse {
2997
3001
  token?: string;
2998
3002
  }
2999
3003
 
3000
- /** */
3001
- export interface ApiHandleParticipantMeetStateRequest {
3002
- // clan id
3003
- clan_id?: string;
3004
- // channel id
3005
- channel_id?: string;
3006
- // user id
3007
- user_id?: string;
3008
- // display name
3009
- display_name?: string;
3010
- // state (0: join, 1: leave)
3011
- state?: number;
3012
- }
3013
3004
 
3014
3005
  /** */
3015
3006
  export interface ApiMezonOauthClient {
@@ -3468,30 +3459,24 @@ export class MezonApi {
3468
3459
  }
3469
3460
 
3470
3461
  /** Authenticate a user with an email+password against the server. */
3471
- authenticateEmail(
3472
- basicAuthUsername: string,
3462
+ authenticateEmail(basicAuthUsername: string,
3473
3463
  basicAuthPassword: string,
3474
- account: ApiAccountEmail,
3475
- username?: string,
3476
- options: any = {}
3477
- ): Promise<ApiSession> {
3478
- if (account === null || account === undefined) {
3479
- throw new Error(
3480
- "'account' is a required parameter but is null or undefined."
3481
- );
3464
+ body:ApiAuthenticateEmailRequest,
3465
+ options: any = {}): Promise<ApiSession> {
3466
+
3467
+ if (body === null || body === undefined) {
3468
+ throw new Error("'body' is a required parameter but is null or undefined.");
3482
3469
  }
3483
3470
  const urlPath = "/v2/account/authenticate/email";
3484
3471
  const queryParams = new Map<string, any>();
3485
- queryParams.set("username", username);
3486
3472
 
3487
- let bodyJson: string = "";
3488
- bodyJson = JSON.stringify(account || {});
3473
+ let bodyJson : string = "";
3474
+ bodyJson = JSON.stringify(body || {});
3489
3475
 
3490
3476
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3491
3477
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3492
3478
  if (basicAuthUsername) {
3493
- fetchOptions.headers["Authorization"] =
3494
- "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3479
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3495
3480
  }
3496
3481
 
3497
3482
  return Promise.race([
@@ -11267,44 +11252,6 @@ export class MezonApi {
11267
11252
  ]);
11268
11253
  }
11269
11254
 
11270
- /** Handle participant meet state */
11271
- handleParticipantMeetState(
11272
- bearerToken: string,
11273
- body:ApiHandleParticipantMeetStateRequest,
11274
- options: any = {}
11275
- ): Promise<any> {
11276
-
11277
- if (body === null || body === undefined) {
11278
- throw new Error("'body' is a required parameter but is null or undefined.");
11279
- }
11280
- const urlPath = "/v2/meet/handle_participant_state";
11281
- const queryParams = new Map<string, any>();
11282
-
11283
- let bodyJson : string = "";
11284
- bodyJson = JSON.stringify(body || {});
11285
-
11286
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
11287
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
11288
- if (bearerToken) {
11289
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
11290
- }
11291
-
11292
- return Promise.race([
11293
- fetch(fullUrl, fetchOptions).then((response) => {
11294
- if (response.status == 204) {
11295
- return response;
11296
- } else if (response.status >= 200 && response.status < 300) {
11297
- return response.json();
11298
- } else {
11299
- throw response;
11300
- }
11301
- }),
11302
- new Promise((_, reject) =>
11303
- setTimeout(reject, this.timeoutMs, "Request timed out.")
11304
- ),
11305
- ]);
11306
- }
11307
-
11308
11255
  /** Create mezon OAuth client */
11309
11256
  getMezonOauthClient(bearerToken: string,
11310
11257
  clientId?:string,
package/client.ts CHANGED
@@ -161,7 +161,6 @@ import {
161
161
  MezonapiCreateRoomChannelApps,
162
162
  ApiGenerateMeetTokenRequest,
163
163
  ApiGenerateMeetTokenResponse,
164
- ApiHandleParticipantMeetStateRequest,
165
164
  ApiMezonOauthClientList,
166
165
  ApiMezonOauthClient,
167
166
  ApiCreateHashChannelAppsResponse,
@@ -708,9 +707,12 @@ export class Client {
708
707
  vars?: Record<string, string>
709
708
  ): Promise<Session> {
710
709
  const request = {
711
- email: email,
712
- password: password,
713
- vars: vars,
710
+ username: username,
711
+ account: {
712
+ email: email,
713
+ password: password,
714
+ vars: vars,
715
+ }
714
716
  };
715
717
 
716
718
  return this.apiClient
@@ -4972,26 +4974,6 @@ export class Client {
4972
4974
  });
4973
4975
  }
4974
4976
 
4975
- /** Handle participant meet state */
4976
- async handleParticipantMeetState(
4977
- session: Session,
4978
- body:ApiHandleParticipantMeetStateRequest,
4979
- ): Promise<any> {
4980
- if (
4981
- this.autoRefreshSession &&
4982
- session.refresh_token &&
4983
- session.isexpired(Date.now() / 1000)
4984
- ) {
4985
- await this.sessionRefresh(session);
4986
- }
4987
-
4988
- return this.apiClient
4989
- .handleParticipantMeetState(session.token, body)
4990
- .then((response: any) => {
4991
- return Promise.resolve(response);
4992
- });
4993
- }
4994
-
4995
4977
  //**list webhook belong to the clan */
4996
4978
  async listMezonOauthClient(
4997
4979
  session: Session
package/dist/api.gen.d.ts CHANGED
@@ -310,9 +310,11 @@ export interface ApiAuditLog {
310
310
  time_log?: string;
311
311
  user_id?: string;
312
312
  }
313
- /** Authenticate against the server with a device ID. */
314
- export interface ApiAuthenticateRequest {
315
- account?: ApiAccountApp;
313
+ /** Authenticate against the server with email+password. */
314
+ export interface ApiAuthenticateEmailRequest {
315
+ account?: ApiAccountEmail;
316
+ create?: boolean;
317
+ username?: string;
316
318
  }
317
319
  /** */
318
320
  export interface ApiCategoryDesc {
@@ -1727,14 +1729,6 @@ export interface ApiGenerateMeetTokenResponse {
1727
1729
  token?: string;
1728
1730
  }
1729
1731
  /** */
1730
- export interface ApiHandleParticipantMeetStateRequest {
1731
- clan_id?: string;
1732
- channel_id?: string;
1733
- user_id?: string;
1734
- display_name?: string;
1735
- state?: number;
1736
- }
1737
- /** */
1738
1732
  export interface ApiMezonOauthClient {
1739
1733
  access_token_strategy?: string;
1740
1734
  allowed_cors_origins?: Array<string>;
@@ -1817,7 +1811,7 @@ export declare class MezonApi {
1817
1811
  /** Authenticate a user with a device id against the server. */
1818
1812
  authenticateDevice(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountDevice, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1819
1813
  /** Authenticate a user with an email+password against the server. */
1820
- authenticateEmail(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountEmail, username?: string, options?: any): Promise<ApiSession>;
1814
+ authenticateEmail(basicAuthUsername: string, basicAuthPassword: string, body: ApiAuthenticateEmailRequest, options?: any): Promise<ApiSession>;
1821
1815
  /** Authenticate a user with a Facebook OAuth token against the server. */
1822
1816
  authenticateFacebook(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountFacebook, create?: boolean, username?: string, sync?: boolean, options?: any): Promise<ApiSession>;
1823
1817
  /** Authenticate a user with a Facebook Instant Game token against the server. */
@@ -2203,8 +2197,6 @@ export declare class MezonApi {
2203
2197
  createRoomChannelApps(bearerToken: string, body: MezonapiCreateRoomChannelApps, options?: any): Promise<MezonapiCreateRoomChannelApps>;
2204
2198
  /** Generate Meet Token */
2205
2199
  generateMeetToken(bearerToken: string, body: ApiGenerateMeetTokenRequest, options?: any): Promise<ApiGenerateMeetTokenResponse>;
2206
- /** Handle participant meet state */
2207
- handleParticipantMeetState(bearerToken: string, body: ApiHandleParticipantMeetStateRequest, options?: any): Promise<any>;
2208
2200
  /** Create mezon OAuth client */
2209
2201
  getMezonOauthClient(bearerToken: string, clientId?: string, clientName?: string, options?: any): Promise<ApiMezonOauthClient>;
2210
2202
  /** update mezon OAuth */
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, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiAccountApple, ApiLinkSteamRequest, 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, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiHandleParticipantMeetStateRequest, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, MezonapiEmojiRecentList, ApiUserEventRequest } from "./api.gen";
16
+ import { ApiAccount, ApiAccountMezon, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiAccountApple, ApiLinkSteamRequest, 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, ApiWithdrawTokenRequest, 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, MezonapiEmojiRecentList, ApiUserEventRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -643,8 +643,6 @@ export declare class Client {
643
643
  createRoomChannelApps(session: Session, body: MezonapiCreateRoomChannelApps): Promise<MezonapiCreateRoomChannelApps>;
644
644
  /** Generate Meet Token */
645
645
  generateMeetToken(session: Session, body: ApiGenerateMeetTokenRequest): Promise<ApiGenerateMeetTokenResponse>;
646
- /** Handle participant meet state */
647
- handleParticipantMeetState(session: Session, body: ApiHandleParticipantMeetStateRequest): Promise<any>;
648
646
  listMezonOauthClient(session: Session): Promise<ApiMezonOauthClientList>;
649
647
  getMezonOauthClient(session: Session, clientId?: string, clientName?: string): Promise<ApiMezonOauthClient>;
650
648
  updateMezonOauthClient(session: Session, body: ApiMezonOauthClient): Promise<ApiMezonOauthClient>;
@@ -999,17 +999,14 @@ var MezonApi = class {
999
999
  ]);
1000
1000
  }
1001
1001
  /** Authenticate a user with an email+password against the server. */
1002
- authenticateEmail(basicAuthUsername, basicAuthPassword, account, username, options = {}) {
1003
- if (account === null || account === void 0) {
1004
- throw new Error(
1005
- "'account' is a required parameter but is null or undefined."
1006
- );
1002
+ authenticateEmail(basicAuthUsername, basicAuthPassword, body, options = {}) {
1003
+ if (body === null || body === void 0) {
1004
+ throw new Error("'body' is a required parameter but is null or undefined.");
1007
1005
  }
1008
1006
  const urlPath = "/v2/account/authenticate/email";
1009
1007
  const queryParams = /* @__PURE__ */ new Map();
1010
- queryParams.set("username", username);
1011
1008
  let bodyJson = "";
1012
- bodyJson = JSON.stringify(account || {});
1009
+ bodyJson = JSON.stringify(body || {});
1013
1010
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1014
1011
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1015
1012
  if (basicAuthUsername) {
@@ -7089,35 +7086,6 @@ var MezonApi = class {
7089
7086
  )
7090
7087
  ]);
7091
7088
  }
7092
- /** Handle participant meet state */
7093
- handleParticipantMeetState(bearerToken, body, options = {}) {
7094
- if (body === null || body === void 0) {
7095
- throw new Error("'body' is a required parameter but is null or undefined.");
7096
- }
7097
- const urlPath = "/v2/meet/handle_participant_state";
7098
- const queryParams = /* @__PURE__ */ new Map();
7099
- let bodyJson = "";
7100
- bodyJson = JSON.stringify(body || {});
7101
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7102
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
7103
- if (bearerToken) {
7104
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7105
- }
7106
- return Promise.race([
7107
- fetch(fullUrl, fetchOptions).then((response) => {
7108
- if (response.status == 204) {
7109
- return response;
7110
- } else if (response.status >= 200 && response.status < 300) {
7111
- return response.json();
7112
- } else {
7113
- throw response;
7114
- }
7115
- }),
7116
- new Promise(
7117
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7118
- )
7119
- ]);
7120
- }
7121
7089
  /** Create mezon OAuth client */
7122
7090
  getMezonOauthClient(bearerToken, clientId, clientName, options = {}) {
7123
7091
  const urlPath = "/v2/mznoauthclient";
@@ -8094,6 +8062,19 @@ var _DefaultSocket = class _DefaultSocket {
8094
8062
  return response.channel;
8095
8063
  });
8096
8064
  }
8065
+ handleParticipantMeetState(clan_id, channel_id, display_name, state) {
8066
+ return __async(this, null, function* () {
8067
+ const response = yield this.send({
8068
+ handle_participant_meet_state_event: {
8069
+ clan_id,
8070
+ channel_id,
8071
+ display_name,
8072
+ state
8073
+ }
8074
+ });
8075
+ return response.handle_participant_meet_state_event;
8076
+ });
8077
+ }
8097
8078
  leaveChat(clan_id, channel_id, channel_type, is_public) {
8098
8079
  return this.send({
8099
8080
  channel_leave: {
@@ -8543,9 +8524,12 @@ var Client = class {
8543
8524
  /** Authenticate a user with an email+password against the server. */
8544
8525
  authenticateEmail(email, password, username, vars) {
8545
8526
  const request = {
8546
- email,
8547
- password,
8548
- vars
8527
+ username,
8528
+ account: {
8529
+ email,
8530
+ password,
8531
+ vars
8532
+ }
8549
8533
  };
8550
8534
  return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8551
8535
  return new Session(
@@ -11061,17 +11045,6 @@ var Client = class {
11061
11045
  });
11062
11046
  });
11063
11047
  }
11064
- /** Handle participant meet state */
11065
- handleParticipantMeetState(session, body) {
11066
- return __async(this, null, function* () {
11067
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
11068
- yield this.sessionRefresh(session);
11069
- }
11070
- return this.apiClient.handleParticipantMeetState(session.token, body).then((response) => {
11071
- return Promise.resolve(response);
11072
- });
11073
- });
11074
- }
11075
11048
  //**list webhook belong to the clan */
11076
11049
  listMezonOauthClient(session) {
11077
11050
  return __async(this, null, function* () {
@@ -965,17 +965,14 @@ var MezonApi = class {
965
965
  ]);
966
966
  }
967
967
  /** Authenticate a user with an email+password against the server. */
968
- authenticateEmail(basicAuthUsername, basicAuthPassword, account, username, options = {}) {
969
- if (account === null || account === void 0) {
970
- throw new Error(
971
- "'account' is a required parameter but is null or undefined."
972
- );
968
+ authenticateEmail(basicAuthUsername, basicAuthPassword, body, options = {}) {
969
+ if (body === null || body === void 0) {
970
+ throw new Error("'body' is a required parameter but is null or undefined.");
973
971
  }
974
972
  const urlPath = "/v2/account/authenticate/email";
975
973
  const queryParams = /* @__PURE__ */ new Map();
976
- queryParams.set("username", username);
977
974
  let bodyJson = "";
978
- bodyJson = JSON.stringify(account || {});
975
+ bodyJson = JSON.stringify(body || {});
979
976
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
980
977
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
981
978
  if (basicAuthUsername) {
@@ -7055,35 +7052,6 @@ var MezonApi = class {
7055
7052
  )
7056
7053
  ]);
7057
7054
  }
7058
- /** Handle participant meet state */
7059
- handleParticipantMeetState(bearerToken, body, options = {}) {
7060
- if (body === null || body === void 0) {
7061
- throw new Error("'body' is a required parameter but is null or undefined.");
7062
- }
7063
- const urlPath = "/v2/meet/handle_participant_state";
7064
- const queryParams = /* @__PURE__ */ new Map();
7065
- let bodyJson = "";
7066
- bodyJson = JSON.stringify(body || {});
7067
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7068
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
7069
- if (bearerToken) {
7070
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7071
- }
7072
- return Promise.race([
7073
- fetch(fullUrl, fetchOptions).then((response) => {
7074
- if (response.status == 204) {
7075
- return response;
7076
- } else if (response.status >= 200 && response.status < 300) {
7077
- return response.json();
7078
- } else {
7079
- throw response;
7080
- }
7081
- }),
7082
- new Promise(
7083
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7084
- )
7085
- ]);
7086
- }
7087
7055
  /** Create mezon OAuth client */
7088
7056
  getMezonOauthClient(bearerToken, clientId, clientName, options = {}) {
7089
7057
  const urlPath = "/v2/mznoauthclient";
@@ -8060,6 +8028,19 @@ var _DefaultSocket = class _DefaultSocket {
8060
8028
  return response.channel;
8061
8029
  });
8062
8030
  }
8031
+ handleParticipantMeetState(clan_id, channel_id, display_name, state) {
8032
+ return __async(this, null, function* () {
8033
+ const response = yield this.send({
8034
+ handle_participant_meet_state_event: {
8035
+ clan_id,
8036
+ channel_id,
8037
+ display_name,
8038
+ state
8039
+ }
8040
+ });
8041
+ return response.handle_participant_meet_state_event;
8042
+ });
8043
+ }
8063
8044
  leaveChat(clan_id, channel_id, channel_type, is_public) {
8064
8045
  return this.send({
8065
8046
  channel_leave: {
@@ -8509,9 +8490,12 @@ var Client = class {
8509
8490
  /** Authenticate a user with an email+password against the server. */
8510
8491
  authenticateEmail(email, password, username, vars) {
8511
8492
  const request = {
8512
- email,
8513
- password,
8514
- vars
8493
+ username,
8494
+ account: {
8495
+ email,
8496
+ password,
8497
+ vars
8498
+ }
8515
8499
  };
8516
8500
  return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8517
8501
  return new Session(
@@ -11027,17 +11011,6 @@ var Client = class {
11027
11011
  });
11028
11012
  });
11029
11013
  }
11030
- /** Handle participant meet state */
11031
- handleParticipantMeetState(session, body) {
11032
- return __async(this, null, function* () {
11033
- if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
11034
- yield this.sessionRefresh(session);
11035
- }
11036
- return this.apiClient.handleParticipantMeetState(session.token, body).then((response) => {
11037
- return Promise.resolve(response);
11038
- });
11039
- });
11040
- }
11041
11014
  //**list webhook belong to the clan */
11042
11015
  listMezonOauthClient(session) {
11043
11016
  return __async(this, null, function* () {
package/dist/socket.d.ts CHANGED
@@ -640,6 +640,16 @@ export interface ChannelAppEvent {
640
640
  channel_id: string;
641
641
  action: number;
642
642
  }
643
+ export interface HandleParticipantMeetStateEvent {
644
+ /** clan id */
645
+ clan_id: string;
646
+ /** channel id */
647
+ channel_id: string;
648
+ /** display name */
649
+ display_name: string;
650
+ /** state (0: join, 1: leave) */
651
+ state: number;
652
+ }
643
653
  export interface PermissionSet {
644
654
  /** Role ID */
645
655
  role_id: string;
@@ -744,6 +754,8 @@ export interface Socket {
744
754
  joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
745
755
  /** Leave a chat channel on the server. */
746
756
  leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void>;
757
+ /** handle user join/leave channel voice on the server. */
758
+ handleParticipantMeetState(clan_id: string, channel_id: string, display_name: string, state: number): Promise<void>;
747
759
  /** Remove a chat message from a chat channel on the server. */
748
760
  removeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, has_attachment?: boolean, topic_id?: string): Promise<ChannelMessageAck>;
749
761
  /** Execute an RPC function to the server. */
@@ -955,6 +967,7 @@ export declare class DefaultSocket implements Socket {
955
967
  joinClanChat(clan_id: string): Promise<ClanJoin>;
956
968
  follower(): Promise<void>;
957
969
  joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
970
+ handleParticipantMeetState(clan_id: string, channel_id: string, display_name: string, state: number): Promise<void>;
958
971
  leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void>;
959
972
  removeChatMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, has_attachment?: boolean, topic_id?: string): Promise<ChannelMessageAck>;
960
973
  rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.11.19",
4
+ "version": "2.11.21",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -924,6 +924,17 @@ export interface ChannelAppEvent {
924
924
  action: number;
925
925
  }
926
926
 
927
+ export interface HandleParticipantMeetStateEvent {
928
+ /** clan id */
929
+ clan_id: string;
930
+ /** channel id */
931
+ channel_id: string;
932
+ /** display name */
933
+ display_name: string;
934
+ /** state (0: join, 1: leave) */
935
+ state: number;
936
+ }
937
+
927
938
  export interface PermissionSet {
928
939
  /** Role ID */
929
940
  role_id: string;
@@ -1072,6 +1083,14 @@ export interface Socket {
1072
1083
  is_public: boolean
1073
1084
  ): Promise<void>;
1074
1085
 
1086
+ /** handle user join/leave channel voice on the server. */
1087
+ handleParticipantMeetState (
1088
+ clan_id: string,
1089
+ channel_id: string,
1090
+ display_name: string,
1091
+ state: number
1092
+ ): Promise<void>
1093
+
1075
1094
  /** Remove a chat message from a chat channel on the server. */
1076
1095
  removeChatMessage(
1077
1096
  clan_id: string,
@@ -2225,6 +2244,24 @@ export class DefaultSocket implements Socket {
2225
2244
  return response.channel;
2226
2245
  }
2227
2246
 
2247
+ async handleParticipantMeetState (
2248
+ clan_id: string,
2249
+ channel_id: string,
2250
+ display_name: string,
2251
+ state: number
2252
+ ): Promise<void> {
2253
+ const response = await this.send({
2254
+ handle_participant_meet_state_event: {
2255
+ clan_id: clan_id,
2256
+ channel_id: channel_id,
2257
+ display_name: display_name,
2258
+ state: state,
2259
+ },
2260
+ });
2261
+
2262
+ return response.handle_participant_meet_state_event;
2263
+ }
2264
+
2228
2265
  leaveChat(
2229
2266
  clan_id: string,
2230
2267
  channel_id: string,