mezon-js 2.11.20 → 2.11.22

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
  /** */
@@ -1213,6 +1217,8 @@ export interface ApiCreateRoleRequest {
1213
1217
  role_icon?: string;
1214
1218
  //
1215
1219
  title?: string;
1220
+ //
1221
+ order_role?: number;
1216
1222
  }
1217
1223
 
1218
1224
  /** Delete a channel the user has access to. */
@@ -2091,6 +2097,22 @@ export interface ApiRegistrationEmailRequest {
2091
2097
  vars?: Record<string, string>;
2092
2098
  }
2093
2099
 
2100
+ /** */
2101
+ export interface ApiUpdateRoleOrderRequest {
2102
+ //
2103
+ clan_id?: string;
2104
+ //
2105
+ roles?: Array<ApiRoleOrderUpdate>;
2106
+ }
2107
+
2108
+ /** */
2109
+ export interface ApiRoleOrderUpdate {
2110
+ //
2111
+ order?: number;
2112
+ //
2113
+ role_id?: string;
2114
+ }
2115
+
2094
2116
  /** */
2095
2117
  export interface ApiRole {
2096
2118
  //
@@ -2125,6 +2147,8 @@ export interface ApiRole {
2125
2147
  slug?: string;
2126
2148
  //
2127
2149
  title?: string;
2150
+ //
2151
+ order_role ?: number;
2128
2152
  }
2129
2153
 
2130
2154
  /** A list of role description, usually a result of a list operation. */
@@ -3455,30 +3479,24 @@ export class MezonApi {
3455
3479
  }
3456
3480
 
3457
3481
  /** Authenticate a user with an email+password against the server. */
3458
- authenticateEmail(
3459
- basicAuthUsername: string,
3482
+ authenticateEmail(basicAuthUsername: string,
3460
3483
  basicAuthPassword: string,
3461
- account: ApiAccountEmail,
3462
- username?: string,
3463
- options: any = {}
3464
- ): Promise<ApiSession> {
3465
- if (account === null || account === undefined) {
3466
- throw new Error(
3467
- "'account' is a required parameter but is null or undefined."
3468
- );
3484
+ body:ApiAuthenticateEmailRequest,
3485
+ options: any = {}): Promise<ApiSession> {
3486
+
3487
+ if (body === null || body === undefined) {
3488
+ throw new Error("'body' is a required parameter but is null or undefined.");
3469
3489
  }
3470
3490
  const urlPath = "/v2/account/authenticate/email";
3471
3491
  const queryParams = new Map<string, any>();
3472
- queryParams.set("username", username);
3473
3492
 
3474
- let bodyJson: string = "";
3475
- bodyJson = JSON.stringify(account || {});
3493
+ let bodyJson : string = "";
3494
+ bodyJson = JSON.stringify(body || {});
3476
3495
 
3477
3496
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3478
3497
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3479
3498
  if (basicAuthUsername) {
3480
- fetchOptions.headers["Authorization"] =
3481
- "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3499
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3482
3500
  }
3483
3501
 
3484
3502
  return Promise.race([
@@ -11433,4 +11451,40 @@ export class MezonApi {
11433
11451
  ),
11434
11452
  ]);
11435
11453
  }
11454
+
11455
+ /** */
11456
+ updateRoleOrder(bearerToken: string,
11457
+ body:ApiUpdateRoleOrderRequest,
11458
+ options: any = {}): Promise<any> {
11459
+
11460
+ if (body === null || body === undefined) {
11461
+ throw new Error("'body' is a required parameter but is null or undefined.");
11462
+ }
11463
+ const urlPath = "/v2/role/orders";
11464
+ const queryParams = new Map<string, any>();
11465
+
11466
+ let bodyJson : string = "";
11467
+ bodyJson = JSON.stringify(body || {});
11468
+
11469
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
11470
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
11471
+ if (bearerToken) {
11472
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
11473
+ }
11474
+
11475
+ return Promise.race([
11476
+ fetch(fullUrl, fetchOptions).then((response) => {
11477
+ if (response.status == 204) {
11478
+ return response;
11479
+ } else if (response.status >= 200 && response.status < 300) {
11480
+ return response.json();
11481
+ } else {
11482
+ throw response;
11483
+ }
11484
+ }),
11485
+ new Promise((_, reject) =>
11486
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
11487
+ ),
11488
+ ]);
11489
+ }
11436
11490
  }
package/client.ts CHANGED
@@ -166,6 +166,7 @@ import {
166
166
  ApiCreateHashChannelAppsResponse,
167
167
  MezonapiEmojiRecentList,
168
168
  ApiUserEventRequest,
169
+ ApiUpdateRoleOrderRequest,
169
170
  } from "./api.gen";
170
171
 
171
172
  import { Session } from "./session";
@@ -707,9 +708,12 @@ export class Client {
707
708
  vars?: Record<string, string>
708
709
  ): Promise<Session> {
709
710
  const request = {
710
- email: email,
711
- password: password,
712
- vars: vars,
711
+ username: username,
712
+ account: {
713
+ email: email,
714
+ password: password,
715
+ vars: vars,
716
+ }
713
717
  };
714
718
 
715
719
  return this.apiClient
@@ -5134,4 +5138,24 @@ export class Client {
5134
5138
  return response !== undefined;
5135
5139
  });
5136
5140
  }
5141
+
5142
+ async updateRoleOrder(
5143
+ session: Session,
5144
+ request: ApiUpdateRoleOrderRequest
5145
+ ): Promise<any> {
5146
+ if (
5147
+ this.autoRefreshSession &&
5148
+ session.refresh_token &&
5149
+ session.isexpired(Date.now() / 1000)
5150
+ ) {
5151
+ await this.sessionRefresh(session);
5152
+ }
5153
+
5154
+ return this.apiClient
5155
+ .updateRoleOrder(session.token, request)
5156
+ .then((response: any) => {
5157
+ return Promise.resolve(response);
5158
+ });
5159
+ }
5160
+
5137
5161
  }
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 {
@@ -690,6 +692,7 @@ export interface ApiCreateRoleRequest {
690
692
  max_permission_id: string;
691
693
  role_icon?: string;
692
694
  title?: string;
695
+ order_role?: number;
693
696
  }
694
697
  /** Delete a channel the user has access to. */
695
698
  export interface ApiDeleteChannelDescRequest {
@@ -1203,6 +1206,16 @@ export interface ApiRegistrationEmailRequest {
1203
1206
  vars?: Record<string, string>;
1204
1207
  }
1205
1208
  /** */
1209
+ export interface ApiUpdateRoleOrderRequest {
1210
+ clan_id?: string;
1211
+ roles?: Array<ApiRoleOrderUpdate>;
1212
+ }
1213
+ /** */
1214
+ export interface ApiRoleOrderUpdate {
1215
+ order?: number;
1216
+ role_id?: string;
1217
+ }
1218
+ /** */
1206
1219
  export interface ApiRole {
1207
1220
  active?: number;
1208
1221
  allow_mention?: number;
@@ -1220,6 +1233,7 @@ export interface ApiRole {
1220
1233
  role_user_list?: ApiRoleUserList;
1221
1234
  slug?: string;
1222
1235
  title?: string;
1236
+ order_role?: number;
1223
1237
  }
1224
1238
  /** A list of role description, usually a result of a list operation. */
1225
1239
  export interface ApiRoleList {
@@ -1809,7 +1823,7 @@ export declare class MezonApi {
1809
1823
  /** Authenticate a user with a device id against the server. */
1810
1824
  authenticateDevice(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountDevice, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1811
1825
  /** Authenticate a user with an email+password against the server. */
1812
- authenticateEmail(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountEmail, username?: string, options?: any): Promise<ApiSession>;
1826
+ authenticateEmail(basicAuthUsername: string, basicAuthPassword: string, body: ApiAuthenticateEmailRequest, options?: any): Promise<ApiSession>;
1813
1827
  /** Authenticate a user with a Facebook OAuth token against the server. */
1814
1828
  authenticateFacebook(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountFacebook, create?: boolean, username?: string, sync?: boolean, options?: any): Promise<ApiSession>;
1815
1829
  /** Authenticate a user with a Facebook Instant Game token against the server. */
@@ -2205,4 +2219,6 @@ export declare class MezonApi {
2205
2219
  addUserEvent(bearerToken: string, body: ApiUserEventRequest, options?: any): Promise<any>;
2206
2220
  /** Delete user event */
2207
2221
  deleteUserEvent(bearerToken: string, clanId?: string, eventId?: string, options?: any): Promise<any>;
2222
+ /** */
2223
+ updateRoleOrder(bearerToken: string, body: ApiUpdateRoleOrderRequest, options?: any): Promise<any>;
2208
2224
  }
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, 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, ApiUpdateRoleOrderRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -653,4 +653,5 @@ export declare class Client {
653
653
  addUserEvent(session: Session, request: ApiUserEventRequest): Promise<any>;
654
654
  /** Delete user event */
655
655
  deleteUserEvent(session: Session, clanId?: string, eventId?: string): Promise<any>;
656
+ updateRoleOrder(session: Session, request: ApiUpdateRoleOrderRequest): Promise<any>;
656
657
  }
@@ -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) {
@@ -7227,6 +7224,35 @@ var MezonApi = class {
7227
7224
  )
7228
7225
  ]);
7229
7226
  }
7227
+ /** */
7228
+ updateRoleOrder(bearerToken, body, options = {}) {
7229
+ if (body === null || body === void 0) {
7230
+ throw new Error("'body' is a required parameter but is null or undefined.");
7231
+ }
7232
+ const urlPath = "/v2/role/orders";
7233
+ const queryParams = /* @__PURE__ */ new Map();
7234
+ let bodyJson = "";
7235
+ bodyJson = JSON.stringify(body || {});
7236
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7237
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
7238
+ if (bearerToken) {
7239
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7240
+ }
7241
+ return Promise.race([
7242
+ fetch(fullUrl, fetchOptions).then((response) => {
7243
+ if (response.status == 204) {
7244
+ return response;
7245
+ } else if (response.status >= 200 && response.status < 300) {
7246
+ return response.json();
7247
+ } else {
7248
+ throw response;
7249
+ }
7250
+ }),
7251
+ new Promise(
7252
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7253
+ )
7254
+ ]);
7255
+ }
7230
7256
  };
7231
7257
 
7232
7258
  // session.ts
@@ -8527,9 +8553,12 @@ var Client = class {
8527
8553
  /** Authenticate a user with an email+password against the server. */
8528
8554
  authenticateEmail(email, password, username, vars) {
8529
8555
  const request = {
8530
- email,
8531
- password,
8532
- vars
8556
+ username,
8557
+ account: {
8558
+ email,
8559
+ password,
8560
+ vars
8561
+ }
8533
8562
  };
8534
8563
  return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8535
8564
  return new Session(
@@ -11133,4 +11162,14 @@ var Client = class {
11133
11162
  });
11134
11163
  });
11135
11164
  }
11165
+ updateRoleOrder(session, request) {
11166
+ return __async(this, null, function* () {
11167
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
11168
+ yield this.sessionRefresh(session);
11169
+ }
11170
+ return this.apiClient.updateRoleOrder(session.token, request).then((response) => {
11171
+ return Promise.resolve(response);
11172
+ });
11173
+ });
11174
+ }
11136
11175
  };
@@ -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) {
@@ -7193,6 +7190,35 @@ var MezonApi = class {
7193
7190
  )
7194
7191
  ]);
7195
7192
  }
7193
+ /** */
7194
+ updateRoleOrder(bearerToken, body, options = {}) {
7195
+ if (body === null || body === void 0) {
7196
+ throw new Error("'body' is a required parameter but is null or undefined.");
7197
+ }
7198
+ const urlPath = "/v2/role/orders";
7199
+ const queryParams = /* @__PURE__ */ new Map();
7200
+ let bodyJson = "";
7201
+ bodyJson = JSON.stringify(body || {});
7202
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7203
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
7204
+ if (bearerToken) {
7205
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7206
+ }
7207
+ return Promise.race([
7208
+ fetch(fullUrl, fetchOptions).then((response) => {
7209
+ if (response.status == 204) {
7210
+ return response;
7211
+ } else if (response.status >= 200 && response.status < 300) {
7212
+ return response.json();
7213
+ } else {
7214
+ throw response;
7215
+ }
7216
+ }),
7217
+ new Promise(
7218
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7219
+ )
7220
+ ]);
7221
+ }
7196
7222
  };
7197
7223
 
7198
7224
  // session.ts
@@ -8493,9 +8519,12 @@ var Client = class {
8493
8519
  /** Authenticate a user with an email+password against the server. */
8494
8520
  authenticateEmail(email, password, username, vars) {
8495
8521
  const request = {
8496
- email,
8497
- password,
8498
- vars
8522
+ username,
8523
+ account: {
8524
+ email,
8525
+ password,
8526
+ vars
8527
+ }
8499
8528
  };
8500
8529
  return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8501
8530
  return new Session(
@@ -11099,6 +11128,16 @@ var Client = class {
11099
11128
  });
11100
11129
  });
11101
11130
  }
11131
+ updateRoleOrder(session, request) {
11132
+ return __async(this, null, function* () {
11133
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
11134
+ yield this.sessionRefresh(session);
11135
+ }
11136
+ return this.apiClient.updateRoleOrder(session.token, request).then((response) => {
11137
+ return Promise.resolve(response);
11138
+ });
11139
+ });
11140
+ }
11102
11141
  };
11103
11142
  export {
11104
11143
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.11.20",
4
+ "version": "2.11.22",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"