mezon-js 2.9.52 → 2.9.54

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
  //
@@ -1839,7 +1870,7 @@ export interface ApiRpc {
1839
1870
  /** */
1840
1871
  export interface ApiSearchMessageDocument {
1841
1872
  //
1842
- attachment?: string;
1873
+ attachments?: Array<ApiMessageAttachment>;
1843
1874
  //
1844
1875
  avatar_url?: string;
1845
1876
  //The channel ID.
@@ -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([
@@ -7236,15 +7409,12 @@ export class MezonApi {
7236
7409
  }
7237
7410
 
7238
7411
  /** set notification user channel. */
7239
- createPinMessage(
7240
- bearerToken: string,
7241
- body: ApiPinMessageRequest,
7242
- options: any = {}
7243
- ): Promise<any> {
7412
+ createPinMessage(bearerToken: string,
7413
+ body:ApiPinMessageRequest,
7414
+ options: any = {}): Promise<ApiChannelMessageHeader> {
7415
+
7244
7416
  if (body === null || body === undefined) {
7245
- throw new Error(
7246
- "'body' is a required parameter but is null or undefined."
7247
- );
7417
+ throw new Error("'body' is a required parameter but is null or undefined.");
7248
7418
  }
7249
7419
  const urlPath = "/v2/pinmessage/set";
7250
7420
  const queryParams = new Map<string, any>();
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";
@@ -2995,7 +2998,7 @@ export class Client {
2995
2998
  async createPinMessage(
2996
2999
  session: Session,
2997
3000
  request: ApiPinMessageRequest
2998
- ): Promise<boolean> {
3001
+ ): Promise<ApiChannelMessageHeader> {
2999
3002
  if (
3000
3003
  this.autoRefreshSession &&
3001
3004
  session.refresh_token &&
@@ -3006,8 +3009,8 @@ export class Client {
3006
3009
 
3007
3010
  return this.apiClient
3008
3011
  .createPinMessage(session.token, request)
3009
- .then((response: any) => {
3010
- return response !== undefined;
3012
+ .then((response: ApiChannelMessageHeader) => {
3013
+ return Promise.resolve(response);
3011
3014
  });
3012
3015
  }
3013
3016
 
@@ -4116,11 +4119,10 @@ export class Client {
4116
4119
  });
4117
4120
  }
4118
4121
 
4119
-
4120
4122
  async addFavoriteChannel(
4121
4123
  session: Session,
4122
4124
  channelId: string,
4123
- clanId: string,
4125
+ clanId: string
4124
4126
  ): Promise<ApiAddFavoriteChannelResponse> {
4125
4127
  if (
4126
4128
  this.autoRefreshSession &&
@@ -4133,7 +4135,7 @@ export class Client {
4133
4135
  return this.apiClient
4134
4136
  .addChannelFavorite(session.token, {
4135
4137
  channel_id: channelId,
4136
- clan_id: clanId
4138
+ clan_id: clanId,
4137
4139
  })
4138
4140
  .then((response: ApiAddFavoriteChannelResponse) => {
4139
4141
  return response;
@@ -4159,10 +4161,7 @@ export class Client {
4159
4161
  });
4160
4162
  }
4161
4163
 
4162
- async getListFavoriteChannel(
4163
- session: Session,
4164
- clanId: string
4165
- ): Promise<any> {
4164
+ async getListFavoriteChannel(session: Session, clanId: string): Promise<any> {
4166
4165
  if (
4167
4166
  this.autoRefreshSession &&
4168
4167
  session.refresh_token &&
@@ -4214,4 +4213,66 @@ export class Client {
4214
4213
  return response;
4215
4214
  });
4216
4215
  }
4216
+
4217
+ async createQRLogin(requet: ApiLoginRequest): Promise<ApiLoginIDResponse> {
4218
+ const apiSession = await this.apiClient.createQRLogin(
4219
+ this.serverkey,
4220
+ "",
4221
+ requet
4222
+ );
4223
+ const response = {
4224
+ login_id: apiSession.login_id,
4225
+ create_time_second: apiSession.create_time_second,
4226
+
4227
+ }
4228
+ return response
4229
+ }
4230
+
4231
+ async checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<ApiSession> {
4232
+ const apiSession = await this.apiClient.checkLoginRequest(
4233
+ this.serverkey,
4234
+ "",
4235
+ requet
4236
+ );
4237
+
4238
+ return apiSession
4239
+ }
4240
+
4241
+ async confirmLogin(
4242
+ session: Session,
4243
+ body: ApiConfirmLoginRequest
4244
+ ): Promise<any> {
4245
+ if (
4246
+ this.autoRefreshSession &&
4247
+ session.refresh_token &&
4248
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4249
+ ) {
4250
+ await this.sessionRefresh(session);
4251
+ }
4252
+
4253
+ return this.apiClient
4254
+ .confirmLogin(session.token, body)
4255
+ .then((response: any) => {
4256
+ return response;
4257
+ });
4258
+ }
4259
+
4260
+ async getInfoLoginRequest(
4261
+ session: Session,
4262
+ loginId: string
4263
+ ): Promise<any> {
4264
+ if (
4265
+ this.autoRefreshSession &&
4266
+ session.refresh_token &&
4267
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4268
+ ) {
4269
+ await this.sessionRefresh(session);
4270
+ }
4271
+
4272
+ return this.apiClient
4273
+ .getInfoLoginRequest(session.token, loginId)
4274
+ .then((response: any) => {
4275
+ return response;
4276
+ });
4277
+ }
4217
4278
  }
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;
@@ -1068,7 +1087,7 @@ export interface ApiRpc {
1068
1087
  }
1069
1088
  /** */
1070
1089
  export interface ApiSearchMessageDocument {
1071
- attachment?: string;
1090
+ attachments?: Array<ApiMessageAttachment>;
1072
1091
  avatar_url?: string;
1073
1092
  channel_id?: string;
1074
1093
  channel_label?: 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. */
@@ -1587,7 +1614,7 @@ export declare class MezonApi {
1587
1614
  /** */
1588
1615
  getPinMessagesList(bearerToken: string, messageId?: string, channelId?: string, clanId?: string, options?: any): Promise<ApiPinMessagesList>;
1589
1616
  /** set notification user channel. */
1590
- createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<any>;
1617
+ createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<ApiChannelMessageHeader>;
1591
1618
  /** */
1592
1619
  addRolesChannelDesc(bearerToken: string, body: ApiAddRoleChannelDescRequest, options?: any): Promise<any>;
1593
1620
  /** update the category of a channel */
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";
@@ -529,7 +529,7 @@ export declare class Client {
529
529
  /** query message in elasticsearch */
530
530
  searchMessage(session: Session, request: ApiSearchMessageRequest): Promise<ApiSearchMessageResponse>;
531
531
  /** */
532
- createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean>;
532
+ createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<ApiChannelMessageHeader>;
533
533
  pinMessagesList(session: Session, messageId: string, channelId: string, clanId: string): Promise<ApiPinMessagesList>;
534
534
  deletePinMessage(session: Session, message_id: string): Promise<boolean>;
535
535
  /** create clan emoji */
@@ -594,4 +594,8 @@ export declare class Client {
594
594
  /** List activity */
595
595
  listActivity(session: Session): Promise<ApiListUserActivity>;
596
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>;
597
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) {
@@ -4549,9 +4662,7 @@ var MezonApi = class {
4549
4662
  /** set notification user channel. */
4550
4663
  createPinMessage(bearerToken, body, options = {}) {
4551
4664
  if (body === null || body === void 0) {
4552
- throw new Error(
4553
- "'body' is a required parameter but is null or undefined."
4554
- );
4665
+ throw new Error("'body' is a required parameter but is null or undefined.");
4555
4666
  }
4556
4667
  const urlPath = "/v2/pinmessage/set";
4557
4668
  const queryParams = /* @__PURE__ */ new Map();
@@ -8283,7 +8394,7 @@ var Client = class {
8283
8394
  yield this.sessionRefresh(session);
8284
8395
  }
8285
8396
  return this.apiClient.createPinMessage(session.token, request).then((response) => {
8286
- return response !== void 0;
8397
+ return Promise.resolve(response);
8287
8398
  });
8288
8399
  });
8289
8400
  }
@@ -8968,4 +9079,48 @@ var Client = class {
8968
9079
  });
8969
9080
  });
8970
9081
  }
9082
+ createQRLogin(requet) {
9083
+ return __async(this, null, function* () {
9084
+ const apiSession = yield this.apiClient.createQRLogin(
9085
+ this.serverkey,
9086
+ "",
9087
+ requet
9088
+ );
9089
+ const response = {
9090
+ login_id: apiSession.login_id,
9091
+ create_time_second: apiSession.create_time_second
9092
+ };
9093
+ return response;
9094
+ });
9095
+ }
9096
+ checkLoginRequest(requet) {
9097
+ return __async(this, null, function* () {
9098
+ const apiSession = yield this.apiClient.checkLoginRequest(
9099
+ this.serverkey,
9100
+ "",
9101
+ requet
9102
+ );
9103
+ return apiSession;
9104
+ });
9105
+ }
9106
+ confirmLogin(session, body) {
9107
+ return __async(this, null, function* () {
9108
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9109
+ yield this.sessionRefresh(session);
9110
+ }
9111
+ return this.apiClient.confirmLogin(session.token, body).then((response) => {
9112
+ return response;
9113
+ });
9114
+ });
9115
+ }
9116
+ getInfoLoginRequest(session, loginId) {
9117
+ return __async(this, null, function* () {
9118
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9119
+ yield this.sessionRefresh(session);
9120
+ }
9121
+ return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9122
+ return response;
9123
+ });
9124
+ });
9125
+ }
8971
9126
  };
@@ -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) {
@@ -4520,9 +4633,7 @@ var MezonApi = class {
4520
4633
  /** set notification user channel. */
4521
4634
  createPinMessage(bearerToken, body, options = {}) {
4522
4635
  if (body === null || body === void 0) {
4523
- throw new Error(
4524
- "'body' is a required parameter but is null or undefined."
4525
- );
4636
+ throw new Error("'body' is a required parameter but is null or undefined.");
4526
4637
  }
4527
4638
  const urlPath = "/v2/pinmessage/set";
4528
4639
  const queryParams = /* @__PURE__ */ new Map();
@@ -8254,7 +8365,7 @@ var Client = class {
8254
8365
  yield this.sessionRefresh(session);
8255
8366
  }
8256
8367
  return this.apiClient.createPinMessage(session.token, request).then((response) => {
8257
- return response !== void 0;
8368
+ return Promise.resolve(response);
8258
8369
  });
8259
8370
  });
8260
8371
  }
@@ -8939,6 +9050,50 @@ var Client = class {
8939
9050
  });
8940
9051
  });
8941
9052
  }
9053
+ createQRLogin(requet) {
9054
+ return __async(this, null, function* () {
9055
+ const apiSession = yield this.apiClient.createQRLogin(
9056
+ this.serverkey,
9057
+ "",
9058
+ requet
9059
+ );
9060
+ const response = {
9061
+ login_id: apiSession.login_id,
9062
+ create_time_second: apiSession.create_time_second
9063
+ };
9064
+ return response;
9065
+ });
9066
+ }
9067
+ checkLoginRequest(requet) {
9068
+ return __async(this, null, function* () {
9069
+ const apiSession = yield this.apiClient.checkLoginRequest(
9070
+ this.serverkey,
9071
+ "",
9072
+ requet
9073
+ );
9074
+ return apiSession;
9075
+ });
9076
+ }
9077
+ confirmLogin(session, body) {
9078
+ return __async(this, null, function* () {
9079
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9080
+ yield this.sessionRefresh(session);
9081
+ }
9082
+ return this.apiClient.confirmLogin(session.token, body).then((response) => {
9083
+ return response;
9084
+ });
9085
+ });
9086
+ }
9087
+ getInfoLoginRequest(session, loginId) {
9088
+ return __async(this, null, function* () {
9089
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9090
+ yield this.sessionRefresh(session);
9091
+ }
9092
+ return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9093
+ return response;
9094
+ });
9095
+ });
9096
+ }
8942
9097
  };
8943
9098
  export {
8944
9099
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.52",
4
+ "version": "2.9.54",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"