mezon-js 2.9.51 → 2.9.53

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -952,6 +952,12 @@ export interface ApiClanUserList {
952
952
  cursor?: string;
953
953
  }
954
954
 
955
+ /** */
956
+ export interface ApiConfirmLoginRequest {
957
+ //
958
+ login_id?: string;
959
+ }
960
+
955
961
  /** */
956
962
  export interface ApiCreateActivityRequest {
957
963
  //
@@ -1370,6 +1376,23 @@ export interface ApiListUserActivity {
1370
1376
  //
1371
1377
  activities?: Array<ApiUserActivity>;
1372
1378
  }
1379
+ /** */
1380
+ export interface ApiLoginIDResponse {
1381
+ //
1382
+ address?: string;
1383
+ //
1384
+ create_time_second?: string;
1385
+ //
1386
+ login_id?: string;
1387
+ //
1388
+ platform?: string;
1389
+ //
1390
+ status?: number;
1391
+ //
1392
+ user_id?: string;
1393
+ //
1394
+ user_name?: string;
1395
+ }
1373
1396
 
1374
1397
  /** */
1375
1398
  export interface ApiMarkAsReadRequest {
@@ -1411,6 +1434,14 @@ export interface ApiMessageMention {
1411
1434
  sender_id?: string;
1412
1435
  }
1413
1436
 
1437
+ /** */
1438
+ export interface ApiLoginRequest {
1439
+ //
1440
+ address?: string;
1441
+ //
1442
+ platform?: string;
1443
+ }
1444
+
1414
1445
  /** */
1415
1446
  export interface ApiMessageReaction {
1416
1447
  //
@@ -2449,8 +2480,117 @@ export class MezonApi {
2449
2480
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2450
2481
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2451
2482
  if (basicAuthUsername) {
2452
- fetchOptions.headers["Authorization"] =
2453
- "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
2483
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
2484
+ }
2485
+
2486
+ return Promise.race([
2487
+ fetch(fullUrl, fetchOptions).then((response) => {
2488
+ if (response.status == 204) {
2489
+ return response;
2490
+ } else if (response.status >= 200 && response.status < 300) {
2491
+ return response.json();
2492
+ } else {
2493
+ throw response;
2494
+ }
2495
+ }),
2496
+ new Promise((_, reject) =>
2497
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2498
+ ),
2499
+ ]);
2500
+ }
2501
+
2502
+ /** */
2503
+ checkLoginRequest(basicAuthUsername: string,
2504
+ basicAuthPassword: string,
2505
+ body:ApiConfirmLoginRequest,
2506
+ options: any = {}): Promise<ApiSession> {
2507
+
2508
+ if (body === null || body === undefined) {
2509
+ throw new Error("'body' is a required parameter but is null or undefined.");
2510
+ }
2511
+ const urlPath = "/v2/account/authenticate/checklogin";
2512
+ const queryParams = new Map<string, any>();
2513
+
2514
+ let bodyJson : string = "";
2515
+ bodyJson = JSON.stringify(body || {});
2516
+
2517
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2518
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2519
+ if (basicAuthUsername) {
2520
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
2521
+ }
2522
+
2523
+ return Promise.race([
2524
+ fetch(fullUrl, fetchOptions).then((response) => {
2525
+ if (response.status == 204) {
2526
+ return response;
2527
+ } else if (response.status >= 200 && response.status < 300) {
2528
+ return response.json();
2529
+ } else {
2530
+ throw response;
2531
+ }
2532
+ }),
2533
+ new Promise((_, reject) =>
2534
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2535
+ ),
2536
+ ]);
2537
+ }
2538
+
2539
+ /** */
2540
+ confirmLogin(bearerToken: string,
2541
+ body:ApiConfirmLoginRequest,
2542
+ options: any = {}): Promise<any> {
2543
+
2544
+ if (body === null || body === undefined) {
2545
+ throw new Error("'body' is a required parameter but is null or undefined.");
2546
+ }
2547
+ const urlPath = "/v2/account/authenticate/confirmlogin";
2548
+ const queryParams = new Map<string, any>();
2549
+
2550
+ let bodyJson : string = "";
2551
+ bodyJson = JSON.stringify(body || {});
2552
+
2553
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2554
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2555
+ if (bearerToken) {
2556
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2557
+ }
2558
+
2559
+ return Promise.race([
2560
+ fetch(fullUrl, fetchOptions).then((response) => {
2561
+ if (response.status == 204) {
2562
+ return response;
2563
+ } else if (response.status >= 200 && response.status < 300) {
2564
+ return response.json();
2565
+ } else {
2566
+ throw response;
2567
+ }
2568
+ }),
2569
+ new Promise((_, reject) =>
2570
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2571
+ ),
2572
+ ]);
2573
+ }
2574
+
2575
+ /** */
2576
+ createQRLogin(basicAuthUsername: string,
2577
+ basicAuthPassword: string,
2578
+ body:ApiLoginRequest,
2579
+ options: any = {}): Promise<ApiLoginIDResponse> {
2580
+
2581
+ if (body === null || body === undefined) {
2582
+ throw new Error("'body' is a required parameter but is null or undefined.");
2583
+ }
2584
+ const urlPath = "/v2/account/authenticate/createqrlogin";
2585
+ const queryParams = new Map<string, any>();
2586
+
2587
+ let bodyJson : string = "";
2588
+ bodyJson = JSON.stringify(body || {});
2589
+
2590
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2591
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2592
+ if (basicAuthUsername) {
2593
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
2454
2594
  }
2455
2595
 
2456
2596
  return Promise.race([
@@ -2721,6 +2861,39 @@ export class MezonApi {
2721
2861
  if (basicAuthUsername) {
2722
2862
  fetchOptions.headers["Authorization"] =
2723
2863
  "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
2864
+ }
2865
+
2866
+ return Promise.race([
2867
+ fetch(fullUrl, fetchOptions).then((response) => {
2868
+ if (response.status == 204) {
2869
+ return response;
2870
+ } else if (response.status >= 200 && response.status < 300) {
2871
+ return response.json();
2872
+ } else {
2873
+ throw response;
2874
+ }
2875
+ }),
2876
+ new Promise((_, reject) =>
2877
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
2878
+ ),
2879
+ ]);
2880
+ }
2881
+
2882
+ /** */
2883
+ getInfoLoginRequest(bearerToken: string,
2884
+ loginId?:string,
2885
+ options: any = {}): Promise<ApiLoginIDResponse> {
2886
+
2887
+ const urlPath = "/v2/account/authenticate/getinfologin";
2888
+ const queryParams = new Map<string, any>();
2889
+ queryParams.set("login_id", loginId);
2890
+
2891
+ let bodyJson : string = "";
2892
+
2893
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2894
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2895
+ if (bearerToken) {
2896
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2724
2897
  }
2725
2898
 
2726
2899
  return Promise.race([
package/client.ts CHANGED
@@ -128,6 +128,9 @@ import {
128
128
  ApiRegistFcmDeviceTokenResponse,
129
129
  ApiListUserActivity,
130
130
  ApiCreateActivityRequest,
131
+ ApiLoginIDResponse,
132
+ ApiLoginRequest,
133
+ ApiConfirmLoginRequest,
131
134
  } from "./api.gen";
132
135
 
133
136
  import { Session } from "./session";
@@ -155,6 +158,8 @@ export enum ChannelStreamMode {
155
158
  STREAM_MODE_CHANNEL = 2,
156
159
  STREAM_MODE_GROUP = 3,
157
160
  STREAM_MODE_DM = 4,
161
+ STREAM_MODE_CLAN = 5,
162
+ STREAM_MODE_THREAD = 6,
158
163
  }
159
164
 
160
165
  export enum NotificationType {
@@ -4212,4 +4217,66 @@ export class Client {
4212
4217
  return response;
4213
4218
  });
4214
4219
  }
4220
+
4221
+ async createQRLogin(requet: ApiLoginRequest): Promise<ApiLoginIDResponse> {
4222
+ const apiSession = await this.apiClient.createQRLogin(
4223
+ this.serverkey,
4224
+ "",
4225
+ requet
4226
+ );
4227
+ const response = {
4228
+ login_id: apiSession.login_id,
4229
+ create_time_second: apiSession.create_time_second,
4230
+
4231
+ }
4232
+ return response
4233
+ }
4234
+
4235
+ async checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<ApiSession> {
4236
+ const apiSession = await this.apiClient.checkLoginRequest(
4237
+ this.serverkey,
4238
+ "",
4239
+ requet
4240
+ );
4241
+
4242
+ return apiSession
4243
+ }
4244
+
4245
+ async confirmLogin(
4246
+ session: Session,
4247
+ body: ApiConfirmLoginRequest
4248
+ ): Promise<any> {
4249
+ if (
4250
+ this.autoRefreshSession &&
4251
+ session.refresh_token &&
4252
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4253
+ ) {
4254
+ await this.sessionRefresh(session);
4255
+ }
4256
+
4257
+ return this.apiClient
4258
+ .confirmLogin(session.token, body)
4259
+ .then((response: any) => {
4260
+ return response;
4261
+ });
4262
+ }
4263
+
4264
+ async getInfoLoginRequest(
4265
+ session: Session,
4266
+ loginId: string
4267
+ ): Promise<any> {
4268
+ if (
4269
+ this.autoRefreshSession &&
4270
+ session.refresh_token &&
4271
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4272
+ ) {
4273
+ await this.sessionRefresh(session);
4274
+ }
4275
+
4276
+ return this.apiClient
4277
+ .getInfoLoginRequest(session.token, loginId)
4278
+ .then((response: any) => {
4279
+ return response;
4280
+ });
4281
+ }
4215
4282
  }
package/dist/api.gen.d.ts CHANGED
@@ -549,6 +549,10 @@ export interface ApiClanUserList {
549
549
  cursor?: string;
550
550
  }
551
551
  /** */
552
+ export interface ApiConfirmLoginRequest {
553
+ login_id?: string;
554
+ }
555
+ /** */
552
556
  export interface ApiCreateActivityRequest {
553
557
  activity_description?: string;
554
558
  activity_name?: string;
@@ -795,6 +799,16 @@ export interface ApiListUserActivity {
795
799
  activities?: Array<ApiUserActivity>;
796
800
  }
797
801
  /** */
802
+ export interface ApiLoginIDResponse {
803
+ address?: string;
804
+ create_time_second?: string;
805
+ login_id?: string;
806
+ platform?: string;
807
+ status?: number;
808
+ user_id?: string;
809
+ user_name?: string;
810
+ }
811
+ /** */
798
812
  export interface ApiMarkAsReadRequest {
799
813
  category_id?: string;
800
814
  channel_id?: string;
@@ -820,6 +834,11 @@ export interface ApiMessageMention {
820
834
  sender_id?: string;
821
835
  }
822
836
  /** */
837
+ export interface ApiLoginRequest {
838
+ address?: string;
839
+ platform?: string;
840
+ }
841
+ /** */
823
842
  export interface ApiMessageReaction {
824
843
  action?: boolean;
825
844
  emoji_id: string;
@@ -1346,6 +1365,12 @@ export declare class MezonApi {
1346
1365
  updateAccount(bearerToken: string, body: ApiUpdateAccountRequest, options?: any): Promise<any>;
1347
1366
  /** Authenticate a user with an Apple ID against the server. */
1348
1367
  authenticateApple(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountApple, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1368
+ /** */
1369
+ checkLoginRequest(basicAuthUsername: string, basicAuthPassword: string, body: ApiConfirmLoginRequest, options?: any): Promise<ApiSession>;
1370
+ /** */
1371
+ confirmLogin(bearerToken: string, body: ApiConfirmLoginRequest, options?: any): Promise<any>;
1372
+ /** */
1373
+ createQRLogin(basicAuthUsername: string, basicAuthPassword: string, body: ApiLoginRequest, options?: any): Promise<ApiLoginIDResponse>;
1349
1374
  /** Authenticate a user with a custom id against the server. */
1350
1375
  authenticateCustom(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountCustom, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1351
1376
  /** Authenticate a user with a device id against the server. */
@@ -1358,6 +1383,8 @@ export declare class MezonApi {
1358
1383
  authenticateFacebookInstantGame(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountFacebookInstantGame, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1359
1384
  /** Authenticate a user with Apple's GameCenter against the server. */
1360
1385
  authenticateGameCenter(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountGameCenter, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1386
+ /** */
1387
+ getInfoLoginRequest(bearerToken: string, loginId?: string, options?: any): Promise<ApiLoginIDResponse>;
1361
1388
  /** Authenticate a user with Google against the server. */
1362
1389
  authenticateGoogle(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountGoogle, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1363
1390
  /** Authenticate a user with Steam against the server. */
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 } 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, ApiSession, 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -31,7 +31,9 @@ export declare enum ChannelType {
31
31
  export declare enum ChannelStreamMode {
32
32
  STREAM_MODE_CHANNEL = 2,
33
33
  STREAM_MODE_GROUP = 3,
34
- STREAM_MODE_DM = 4
34
+ STREAM_MODE_DM = 4,
35
+ STREAM_MODE_CLAN = 5,
36
+ STREAM_MODE_THREAD = 6
35
37
  }
36
38
  export declare enum NotificationType {
37
39
  ALL_MESSAGE = 1,
@@ -592,4 +594,8 @@ export declare class Client {
592
594
  /** List activity */
593
595
  listActivity(session: Session): Promise<ApiListUserActivity>;
594
596
  createActiviy(session: Session, request: ApiCreateActivityRequest): Promise<any>;
597
+ createQRLogin(requet: ApiLoginRequest): Promise<ApiLoginIDResponse>;
598
+ checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<ApiSession>;
599
+ confirmLogin(session: Session, body: ApiConfirmLoginRequest): Promise<any>;
600
+ getInfoLoginRequest(session: Session, loginId: string): Promise<any>;
595
601
  }
@@ -826,6 +826,93 @@ var MezonApi = class {
826
826
  )
827
827
  ]);
828
828
  }
829
+ /** */
830
+ checkLoginRequest(basicAuthUsername, basicAuthPassword, body, options = {}) {
831
+ if (body === null || body === void 0) {
832
+ throw new Error("'body' is a required parameter but is null or undefined.");
833
+ }
834
+ const urlPath = "/v2/account/authenticate/checklogin";
835
+ const queryParams = /* @__PURE__ */ new Map();
836
+ let bodyJson = "";
837
+ bodyJson = JSON.stringify(body || {});
838
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
839
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
840
+ if (basicAuthUsername) {
841
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
842
+ }
843
+ return Promise.race([
844
+ fetch(fullUrl, fetchOptions).then((response) => {
845
+ if (response.status == 204) {
846
+ return response;
847
+ } else if (response.status >= 200 && response.status < 300) {
848
+ return response.json();
849
+ } else {
850
+ throw response;
851
+ }
852
+ }),
853
+ new Promise(
854
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
855
+ )
856
+ ]);
857
+ }
858
+ /** */
859
+ confirmLogin(bearerToken, body, options = {}) {
860
+ if (body === null || body === void 0) {
861
+ throw new Error("'body' is a required parameter but is null or undefined.");
862
+ }
863
+ const urlPath = "/v2/account/authenticate/confirmlogin";
864
+ const queryParams = /* @__PURE__ */ new Map();
865
+ let bodyJson = "";
866
+ bodyJson = JSON.stringify(body || {});
867
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
868
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
869
+ if (bearerToken) {
870
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
871
+ }
872
+ return Promise.race([
873
+ fetch(fullUrl, fetchOptions).then((response) => {
874
+ if (response.status == 204) {
875
+ return response;
876
+ } else if (response.status >= 200 && response.status < 300) {
877
+ return response.json();
878
+ } else {
879
+ throw response;
880
+ }
881
+ }),
882
+ new Promise(
883
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
884
+ )
885
+ ]);
886
+ }
887
+ /** */
888
+ createQRLogin(basicAuthUsername, basicAuthPassword, body, options = {}) {
889
+ if (body === null || body === void 0) {
890
+ throw new Error("'body' is a required parameter but is null or undefined.");
891
+ }
892
+ const urlPath = "/v2/account/authenticate/createqrlogin";
893
+ const queryParams = /* @__PURE__ */ new Map();
894
+ let bodyJson = "";
895
+ bodyJson = JSON.stringify(body || {});
896
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
897
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
898
+ if (basicAuthUsername) {
899
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
900
+ }
901
+ return Promise.race([
902
+ fetch(fullUrl, fetchOptions).then((response) => {
903
+ if (response.status == 204) {
904
+ return response;
905
+ } else if (response.status >= 200 && response.status < 300) {
906
+ return response.json();
907
+ } else {
908
+ throw response;
909
+ }
910
+ }),
911
+ new Promise(
912
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
913
+ )
914
+ ]);
915
+ }
829
916
  /** Authenticate a user with a custom id against the server. */
830
917
  authenticateCustom(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
831
918
  if (account === null || account === void 0) {
@@ -1024,6 +1111,32 @@ var MezonApi = class {
1024
1111
  )
1025
1112
  ]);
1026
1113
  }
1114
+ /** */
1115
+ getInfoLoginRequest(bearerToken, loginId, options = {}) {
1116
+ const urlPath = "/v2/account/authenticate/getinfologin";
1117
+ const queryParams = /* @__PURE__ */ new Map();
1118
+ queryParams.set("login_id", loginId);
1119
+ let bodyJson = "";
1120
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1121
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1122
+ if (bearerToken) {
1123
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1124
+ }
1125
+ return Promise.race([
1126
+ fetch(fullUrl, fetchOptions).then((response) => {
1127
+ if (response.status == 204) {
1128
+ return response;
1129
+ } else if (response.status >= 200 && response.status < 300) {
1130
+ return response.json();
1131
+ } else {
1132
+ throw response;
1133
+ }
1134
+ }),
1135
+ new Promise(
1136
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1137
+ )
1138
+ ]);
1139
+ }
1027
1140
  /** Authenticate a user with Google against the server. */
1028
1141
  authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1029
1142
  if (account === null || account === void 0) {
@@ -6757,6 +6870,8 @@ var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
6757
6870
  ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_CHANNEL"] = 2] = "STREAM_MODE_CHANNEL";
6758
6871
  ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_GROUP"] = 3] = "STREAM_MODE_GROUP";
6759
6872
  ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_DM"] = 4] = "STREAM_MODE_DM";
6873
+ ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_CLAN"] = 5] = "STREAM_MODE_CLAN";
6874
+ ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_THREAD"] = 6] = "STREAM_MODE_THREAD";
6760
6875
  return ChannelStreamMode2;
6761
6876
  })(ChannelStreamMode || {});
6762
6877
  var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
@@ -8966,4 +9081,48 @@ var Client = class {
8966
9081
  });
8967
9082
  });
8968
9083
  }
9084
+ createQRLogin(requet) {
9085
+ return __async(this, null, function* () {
9086
+ const apiSession = yield this.apiClient.createQRLogin(
9087
+ this.serverkey,
9088
+ "",
9089
+ requet
9090
+ );
9091
+ const response = {
9092
+ login_id: apiSession.login_id,
9093
+ create_time_second: apiSession.create_time_second
9094
+ };
9095
+ return response;
9096
+ });
9097
+ }
9098
+ checkLoginRequest(requet) {
9099
+ return __async(this, null, function* () {
9100
+ const apiSession = yield this.apiClient.checkLoginRequest(
9101
+ this.serverkey,
9102
+ "",
9103
+ requet
9104
+ );
9105
+ return apiSession;
9106
+ });
9107
+ }
9108
+ confirmLogin(session, body) {
9109
+ return __async(this, null, function* () {
9110
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9111
+ yield this.sessionRefresh(session);
9112
+ }
9113
+ return this.apiClient.confirmLogin(session.token, body).then((response) => {
9114
+ return response;
9115
+ });
9116
+ });
9117
+ }
9118
+ getInfoLoginRequest(session, loginId) {
9119
+ return __async(this, null, function* () {
9120
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9121
+ yield this.sessionRefresh(session);
9122
+ }
9123
+ return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9124
+ return response;
9125
+ });
9126
+ });
9127
+ }
8969
9128
  };
@@ -797,6 +797,93 @@ var MezonApi = class {
797
797
  )
798
798
  ]);
799
799
  }
800
+ /** */
801
+ checkLoginRequest(basicAuthUsername, basicAuthPassword, body, options = {}) {
802
+ if (body === null || body === void 0) {
803
+ throw new Error("'body' is a required parameter but is null or undefined.");
804
+ }
805
+ const urlPath = "/v2/account/authenticate/checklogin";
806
+ const queryParams = /* @__PURE__ */ new Map();
807
+ let bodyJson = "";
808
+ bodyJson = JSON.stringify(body || {});
809
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
810
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
811
+ if (basicAuthUsername) {
812
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
813
+ }
814
+ return Promise.race([
815
+ fetch(fullUrl, fetchOptions).then((response) => {
816
+ if (response.status == 204) {
817
+ return response;
818
+ } else if (response.status >= 200 && response.status < 300) {
819
+ return response.json();
820
+ } else {
821
+ throw response;
822
+ }
823
+ }),
824
+ new Promise(
825
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
826
+ )
827
+ ]);
828
+ }
829
+ /** */
830
+ confirmLogin(bearerToken, body, options = {}) {
831
+ if (body === null || body === void 0) {
832
+ throw new Error("'body' is a required parameter but is null or undefined.");
833
+ }
834
+ const urlPath = "/v2/account/authenticate/confirmlogin";
835
+ const queryParams = /* @__PURE__ */ new Map();
836
+ let bodyJson = "";
837
+ bodyJson = JSON.stringify(body || {});
838
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
839
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
840
+ if (bearerToken) {
841
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
842
+ }
843
+ return Promise.race([
844
+ fetch(fullUrl, fetchOptions).then((response) => {
845
+ if (response.status == 204) {
846
+ return response;
847
+ } else if (response.status >= 200 && response.status < 300) {
848
+ return response.json();
849
+ } else {
850
+ throw response;
851
+ }
852
+ }),
853
+ new Promise(
854
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
855
+ )
856
+ ]);
857
+ }
858
+ /** */
859
+ createQRLogin(basicAuthUsername, basicAuthPassword, body, options = {}) {
860
+ if (body === null || body === void 0) {
861
+ throw new Error("'body' is a required parameter but is null or undefined.");
862
+ }
863
+ const urlPath = "/v2/account/authenticate/createqrlogin";
864
+ const queryParams = /* @__PURE__ */ new Map();
865
+ let bodyJson = "";
866
+ bodyJson = JSON.stringify(body || {});
867
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
868
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
869
+ if (basicAuthUsername) {
870
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
871
+ }
872
+ return Promise.race([
873
+ fetch(fullUrl, fetchOptions).then((response) => {
874
+ if (response.status == 204) {
875
+ return response;
876
+ } else if (response.status >= 200 && response.status < 300) {
877
+ return response.json();
878
+ } else {
879
+ throw response;
880
+ }
881
+ }),
882
+ new Promise(
883
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
884
+ )
885
+ ]);
886
+ }
800
887
  /** Authenticate a user with a custom id against the server. */
801
888
  authenticateCustom(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
802
889
  if (account === null || account === void 0) {
@@ -995,6 +1082,32 @@ var MezonApi = class {
995
1082
  )
996
1083
  ]);
997
1084
  }
1085
+ /** */
1086
+ getInfoLoginRequest(bearerToken, loginId, options = {}) {
1087
+ const urlPath = "/v2/account/authenticate/getinfologin";
1088
+ const queryParams = /* @__PURE__ */ new Map();
1089
+ queryParams.set("login_id", loginId);
1090
+ let bodyJson = "";
1091
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1092
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1093
+ if (bearerToken) {
1094
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1095
+ }
1096
+ return Promise.race([
1097
+ fetch(fullUrl, fetchOptions).then((response) => {
1098
+ if (response.status == 204) {
1099
+ return response;
1100
+ } else if (response.status >= 200 && response.status < 300) {
1101
+ return response.json();
1102
+ } else {
1103
+ throw response;
1104
+ }
1105
+ }),
1106
+ new Promise(
1107
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1108
+ )
1109
+ ]);
1110
+ }
998
1111
  /** Authenticate a user with Google against the server. */
999
1112
  authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1000
1113
  if (account === null || account === void 0) {
@@ -6728,6 +6841,8 @@ var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
6728
6841
  ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_CHANNEL"] = 2] = "STREAM_MODE_CHANNEL";
6729
6842
  ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_GROUP"] = 3] = "STREAM_MODE_GROUP";
6730
6843
  ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_DM"] = 4] = "STREAM_MODE_DM";
6844
+ ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_CLAN"] = 5] = "STREAM_MODE_CLAN";
6845
+ ChannelStreamMode2[ChannelStreamMode2["STREAM_MODE_THREAD"] = 6] = "STREAM_MODE_THREAD";
6731
6846
  return ChannelStreamMode2;
6732
6847
  })(ChannelStreamMode || {});
6733
6848
  var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
@@ -8937,6 +9052,50 @@ var Client = class {
8937
9052
  });
8938
9053
  });
8939
9054
  }
9055
+ createQRLogin(requet) {
9056
+ return __async(this, null, function* () {
9057
+ const apiSession = yield this.apiClient.createQRLogin(
9058
+ this.serverkey,
9059
+ "",
9060
+ requet
9061
+ );
9062
+ const response = {
9063
+ login_id: apiSession.login_id,
9064
+ create_time_second: apiSession.create_time_second
9065
+ };
9066
+ return response;
9067
+ });
9068
+ }
9069
+ checkLoginRequest(requet) {
9070
+ return __async(this, null, function* () {
9071
+ const apiSession = yield this.apiClient.checkLoginRequest(
9072
+ this.serverkey,
9073
+ "",
9074
+ requet
9075
+ );
9076
+ return apiSession;
9077
+ });
9078
+ }
9079
+ confirmLogin(session, body) {
9080
+ return __async(this, null, function* () {
9081
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9082
+ yield this.sessionRefresh(session);
9083
+ }
9084
+ return this.apiClient.confirmLogin(session.token, body).then((response) => {
9085
+ return response;
9086
+ });
9087
+ });
9088
+ }
9089
+ getInfoLoginRequest(session, loginId) {
9090
+ return __async(this, null, function* () {
9091
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9092
+ yield this.sessionRefresh(session);
9093
+ }
9094
+ return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9095
+ return response;
9096
+ });
9097
+ });
9098
+ }
8940
9099
  };
8941
9100
  export {
8942
9101
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.51",
4
+ "version": "2.9.53",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"