mezon-js 2.9.67 → 2.9.69

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -2444,6 +2444,86 @@ export interface RpcStatus {
2444
2444
  message?: string;
2445
2445
  }
2446
2446
 
2447
+ /** */
2448
+ export interface ApiListOnboardingResponse {
2449
+ //
2450
+ list_onboarding?: Array<ApiOnboardingItem>;
2451
+ }
2452
+
2453
+ /** */
2454
+ export interface ApiAnswer {
2455
+ //
2456
+ answer?: string;
2457
+ //
2458
+ description?: string;
2459
+ //
2460
+ title?: string;
2461
+ }
2462
+
2463
+ /** */
2464
+ export interface ApiOnboardingContent {
2465
+ //
2466
+ answers?: Array<ApiAnswer>;
2467
+ //
2468
+ channel_id?: string;
2469
+ //
2470
+ content?: string;
2471
+ //
2472
+ guide_type?: number;
2473
+ //
2474
+ task_type?: number;
2475
+ //
2476
+ title?: string;
2477
+ }
2478
+
2479
+ /** */
2480
+ export interface MezonUpdateOnboardingBody {
2481
+ //
2482
+ answers?: Array<ApiAnswer>;
2483
+ //
2484
+ channel_id?: string;
2485
+ //
2486
+ clan_id?: string;
2487
+ //
2488
+ content?: string;
2489
+ //
2490
+ task_type?: number;
2491
+ //
2492
+ title?: string;
2493
+ }
2494
+
2495
+ /** */
2496
+ export interface ApiCreateOnboardingRequest {
2497
+ //
2498
+ clan_id?: string;
2499
+ //
2500
+ contents?: Array<ApiOnboardingContent>;
2501
+ }
2502
+
2503
+ /** */
2504
+ export interface ApiOnboardingItem {
2505
+ //
2506
+ answers?: Array<ApiAnswer>;
2507
+ //
2508
+ channel_id?: string;
2509
+ //
2510
+ clan_id?: string;
2511
+ //
2512
+ content?: string;
2513
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
2514
+ create_time?: string;
2515
+ //
2516
+ guide_type?: number;
2517
+ //
2518
+ id?: string;
2519
+ //
2520
+ task_type?: number;
2521
+ //
2522
+ title?: string;
2523
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated.
2524
+ update_time?: string;
2525
+ }
2526
+
2447
2527
  export class MezonApi {
2448
2528
  constructor(
2449
2529
  readonly serverKey: string,
@@ -9598,4 +9678,196 @@ pushPubKey(bearerToken: string,
9598
9678
  ),
9599
9679
  ]);
9600
9680
  }
9681
+
9682
+ /** list onboarding. */
9683
+ listOnboarding(bearerToken: string,
9684
+ clanId?:string,
9685
+ guideType?:number,
9686
+ limit?:number,
9687
+ page?:number,
9688
+ options: any = {}): Promise<ApiListOnboardingResponse> {
9689
+
9690
+ const urlPath = "/v2/onboarding";
9691
+ const queryParams = new Map<string, any>();
9692
+ queryParams.set("clan_id", clanId);
9693
+ queryParams.set("guide_type", guideType);
9694
+ queryParams.set("limit", limit);
9695
+ queryParams.set("page", page);
9696
+
9697
+ let bodyJson : string = "";
9698
+
9699
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9700
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
9701
+ if (bearerToken) {
9702
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9703
+ }
9704
+
9705
+ return Promise.race([
9706
+ fetch(fullUrl, fetchOptions).then((response) => {
9707
+ if (response.status == 204) {
9708
+ return response;
9709
+ } else if (response.status >= 200 && response.status < 300) {
9710
+ return response.json();
9711
+ } else {
9712
+ throw response;
9713
+ }
9714
+ }),
9715
+ new Promise((_, reject) =>
9716
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9717
+ ),
9718
+ ]);
9719
+ }
9720
+
9721
+ /** create onboarding. */
9722
+ createOnboarding(bearerToken: string,
9723
+ body:ApiCreateOnboardingRequest,
9724
+ options: any = {}): Promise<any> {
9725
+
9726
+ if (body === null || body === undefined) {
9727
+ throw new Error("'body' is a required parameter but is null or undefined.");
9728
+ }
9729
+ const urlPath = "/v2/onboarding";
9730
+ const queryParams = new Map<string, any>();
9731
+
9732
+ let bodyJson : string = "";
9733
+ bodyJson = JSON.stringify(body || {});
9734
+
9735
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9736
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
9737
+ if (bearerToken) {
9738
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9739
+ }
9740
+
9741
+ return Promise.race([
9742
+ fetch(fullUrl, fetchOptions).then((response) => {
9743
+ if (response.status == 204) {
9744
+ return response;
9745
+ } else if (response.status >= 200 && response.status < 300) {
9746
+ return response.json();
9747
+ } else {
9748
+ throw response;
9749
+ }
9750
+ }),
9751
+ new Promise((_, reject) =>
9752
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9753
+ ),
9754
+ ]);
9755
+ }
9756
+
9757
+ /** delete onboarding. */
9758
+ deleteOnboarding(bearerToken: string,
9759
+ id:string,
9760
+ clanId?:string,
9761
+ options: any = {}): Promise<any> {
9762
+
9763
+ if (id === null || id === undefined) {
9764
+ throw new Error("'id' is a required parameter but is null or undefined.");
9765
+ }
9766
+ const urlPath = "/v2/onboarding/{id}"
9767
+ .replace("{id}", encodeURIComponent(String(id)));
9768
+ const queryParams = new Map<string, any>();
9769
+ queryParams.set("clan_id", clanId);
9770
+
9771
+ let bodyJson : string = "";
9772
+
9773
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9774
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
9775
+ if (bearerToken) {
9776
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9777
+ }
9778
+
9779
+ return Promise.race([
9780
+ fetch(fullUrl, fetchOptions).then((response) => {
9781
+ if (response.status == 204) {
9782
+ return response;
9783
+ } else if (response.status >= 200 && response.status < 300) {
9784
+ return response.json();
9785
+ } else {
9786
+ throw response;
9787
+ }
9788
+ }),
9789
+ new Promise((_, reject) =>
9790
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9791
+ ),
9792
+ ]);
9793
+ }
9794
+
9795
+ /** get detailed onboarding information. */
9796
+ getOnboardingDetail(bearerToken: string,
9797
+ id:string,
9798
+ clanId?:string,
9799
+ options: any = {}): Promise<ApiOnboardingItem> {
9800
+
9801
+ if (id === null || id === undefined) {
9802
+ throw new Error("'id' is a required parameter but is null or undefined.");
9803
+ }
9804
+ const urlPath = "/v2/onboarding/{id}"
9805
+ .replace("{id}", encodeURIComponent(String(id)));
9806
+ const queryParams = new Map<string, any>();
9807
+ queryParams.set("clan_id", clanId);
9808
+
9809
+ let bodyJson : string = "";
9810
+
9811
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9812
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
9813
+ if (bearerToken) {
9814
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9815
+ }
9816
+
9817
+ return Promise.race([
9818
+ fetch(fullUrl, fetchOptions).then((response) => {
9819
+ if (response.status == 204) {
9820
+ return response;
9821
+ } else if (response.status >= 200 && response.status < 300) {
9822
+ return response.json();
9823
+ } else {
9824
+ throw response;
9825
+ }
9826
+ }),
9827
+ new Promise((_, reject) =>
9828
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9829
+ ),
9830
+ ]);
9831
+ }
9832
+
9833
+ /** update onboarding. */
9834
+ updateOnboarding(bearerToken: string,
9835
+ id:string,
9836
+ body:MezonUpdateOnboardingBody,
9837
+ options: any = {}): Promise<any> {
9838
+
9839
+ if (id === null || id === undefined) {
9840
+ throw new Error("'id' is a required parameter but is null or undefined.");
9841
+ }
9842
+ if (body === null || body === undefined) {
9843
+ throw new Error("'body' is a required parameter but is null or undefined.");
9844
+ }
9845
+ const urlPath = "/v2/onboarding/{id}"
9846
+ .replace("{id}", encodeURIComponent(String(id)));
9847
+ const queryParams = new Map<string, any>();
9848
+
9849
+ let bodyJson : string = "";
9850
+ bodyJson = JSON.stringify(body || {});
9851
+
9852
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9853
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
9854
+ if (bearerToken) {
9855
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9856
+ }
9857
+
9858
+ return Promise.race([
9859
+ fetch(fullUrl, fetchOptions).then((response) => {
9860
+ if (response.status == 204) {
9861
+ return response;
9862
+ } else if (response.status >= 200 && response.status < 300) {
9863
+ return response.json();
9864
+ } else {
9865
+ throw response;
9866
+ }
9867
+ }),
9868
+ new Promise((_, reject) =>
9869
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9870
+ ),
9871
+ ]);
9872
+ }
9601
9873
  }
package/client.ts CHANGED
@@ -140,6 +140,10 @@ import {
140
140
  ApiTokenSentEvent,
141
141
  MezonDeleteWebhookByIdBody,
142
142
  ApiWithdrawTokenRequest,
143
+ ApiListOnboardingResponse,
144
+ ApiCreateOnboardingRequest,
145
+ MezonUpdateOnboardingBody,
146
+ ApiOnboardingItem,
143
147
  } from "./api.gen";
144
148
 
145
149
  import { Session } from "./session";
@@ -4417,4 +4421,105 @@ export class Client {
4417
4421
  return response;
4418
4422
  });
4419
4423
  }
4424
+
4425
+ async listOnboarding(
4426
+ session: Session,
4427
+ clanId?:string,
4428
+ guideType?:number,
4429
+ limit?:number,
4430
+ page?:number,
4431
+ ) : Promise<ApiListOnboardingResponse> {
4432
+ if (
4433
+ this.autoRefreshSession &&
4434
+ session.refresh_token &&
4435
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4436
+ ) {
4437
+ await this.sessionRefresh(session);
4438
+ }
4439
+
4440
+ return this.apiClient
4441
+ .listOnboarding(session.token, clanId, guideType, limit, page)
4442
+ .then((response: ApiListOnboardingResponse) => {
4443
+ return response;
4444
+ });
4445
+ }
4446
+
4447
+ async getOnboardingDetail(
4448
+ session: Session,
4449
+ id: string,
4450
+ clanId?: string,
4451
+ ): Promise<ApiOnboardingItem> {
4452
+ if (
4453
+ this.autoRefreshSession &&
4454
+ session.refresh_token &&
4455
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4456
+ ) {
4457
+ await this.sessionRefresh(session);
4458
+ }
4459
+
4460
+ return this.apiClient
4461
+ .getOnboardingDetail(session.token, id, clanId)
4462
+ .then((response: ApiOnboardingItem) => {
4463
+ return Promise.resolve(response);
4464
+ });
4465
+ }
4466
+
4467
+ async createOnboarding(
4468
+ session: Session,
4469
+ request: ApiCreateOnboardingRequest
4470
+ ): Promise<any> {
4471
+ if (
4472
+ this.autoRefreshSession &&
4473
+ session.refresh_token &&
4474
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4475
+ ) {
4476
+ await this.sessionRefresh(session);
4477
+ }
4478
+
4479
+ return this.apiClient
4480
+ .createOnboarding(session.token, request)
4481
+ .then((response: any) => {
4482
+ return response;
4483
+ });
4484
+ }
4485
+
4486
+ async updateOnboarding(
4487
+ session: Session,
4488
+ id: string,
4489
+ request: MezonUpdateOnboardingBody
4490
+ ) {
4491
+ if (
4492
+ this.autoRefreshSession &&
4493
+ session.refresh_token &&
4494
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4495
+ ) {
4496
+ await this.sessionRefresh(session);
4497
+ }
4498
+
4499
+ return this.apiClient
4500
+ .updateOnboarding(session.token, id, request)
4501
+ .then((response: any) => {
4502
+ return response !== undefined;
4503
+ });
4504
+ }
4505
+
4506
+ async deleteOnboarding(
4507
+ session: Session,
4508
+ id:string,
4509
+ clanId?:string,
4510
+ ): Promise<any> {
4511
+ if (
4512
+ this.autoRefreshSession &&
4513
+ session.refresh_token &&
4514
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4515
+ ) {
4516
+ await this.sessionRefresh(session);
4517
+ }
4518
+
4519
+ return this.apiClient
4520
+ .deleteOnboarding(session.token, id, clanId)
4521
+ .then((response: any) => {
4522
+ return response !== undefined;
4523
+ });
4524
+ }
4420
4525
  }
package/dist/api.gen.d.ts CHANGED
@@ -1422,6 +1422,52 @@ export interface RpcStatus {
1422
1422
  details?: Array<ProtobufAny>;
1423
1423
  message?: string;
1424
1424
  }
1425
+ /** */
1426
+ export interface ApiListOnboardingResponse {
1427
+ list_onboarding?: Array<ApiOnboardingItem>;
1428
+ }
1429
+ /** */
1430
+ export interface ApiAnswer {
1431
+ answer?: string;
1432
+ description?: string;
1433
+ title?: string;
1434
+ }
1435
+ /** */
1436
+ export interface ApiOnboardingContent {
1437
+ answers?: Array<ApiAnswer>;
1438
+ channel_id?: string;
1439
+ content?: string;
1440
+ guide_type?: number;
1441
+ task_type?: number;
1442
+ title?: string;
1443
+ }
1444
+ /** */
1445
+ export interface MezonUpdateOnboardingBody {
1446
+ answers?: Array<ApiAnswer>;
1447
+ channel_id?: string;
1448
+ clan_id?: string;
1449
+ content?: string;
1450
+ task_type?: number;
1451
+ title?: string;
1452
+ }
1453
+ /** */
1454
+ export interface ApiCreateOnboardingRequest {
1455
+ clan_id?: string;
1456
+ contents?: Array<ApiOnboardingContent>;
1457
+ }
1458
+ /** */
1459
+ export interface ApiOnboardingItem {
1460
+ answers?: Array<ApiAnswer>;
1461
+ channel_id?: string;
1462
+ clan_id?: string;
1463
+ content?: string;
1464
+ create_time?: string;
1465
+ guide_type?: number;
1466
+ id?: string;
1467
+ task_type?: number;
1468
+ title?: string;
1469
+ update_time?: string;
1470
+ }
1425
1471
  export declare class MezonApi {
1426
1472
  readonly serverKey: string;
1427
1473
  readonly basePath: string;
@@ -1786,4 +1832,14 @@ export declare class MezonApi {
1786
1832
  getChannelCanvasDetail(bearerToken: string, id: string, clanId?: string, channelId?: string, options?: any): Promise<ApiChannelCanvasDetailResponse>;
1787
1833
  /** */
1788
1834
  deleteChannelCanvas(bearerToken: string, canvasId: string, clanId?: string, channelId?: string, options?: any): Promise<any>;
1835
+ /** list onboarding. */
1836
+ listOnboarding(bearerToken: string, clanId?: string, guideType?: number, limit?: number, page?: number, options?: any): Promise<ApiListOnboardingResponse>;
1837
+ /** create onboarding. */
1838
+ createOnboarding(bearerToken: string, body: ApiCreateOnboardingRequest, options?: any): Promise<any>;
1839
+ /** delete onboarding. */
1840
+ deleteOnboarding(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1841
+ /** get detailed onboarding information. */
1842
+ getOnboardingDetail(bearerToken: string, id: string, clanId?: string, options?: any): Promise<ApiOnboardingItem>;
1843
+ /** update onboarding. */
1844
+ updateOnboarding(bearerToken: string, id: string, body: MezonUpdateOnboardingBody, options?: any): Promise<any>;
1789
1845
  }
package/dist/client.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -605,4 +605,9 @@ export declare class Client {
605
605
  pushPubKey(session: Session, PK: ApiPubKey): Promise<ApiGetPubKeysResponse>;
606
606
  getKeyServer(session: Session): Promise<ApiGetKeyServerResp>;
607
607
  listAuditLog(session: Session, actionLog?: string, userId?: string, clanId?: string, page?: number, pageSize?: number): Promise<MezonapiListAuditLog>;
608
+ listOnboarding(session: Session, clanId?: string, guideType?: number, limit?: number, page?: number): Promise<ApiListOnboardingResponse>;
609
+ getOnboardingDetail(session: Session, id: string, clanId?: string): Promise<ApiOnboardingItem>;
610
+ createOnboarding(session: Session, request: ApiCreateOnboardingRequest): Promise<any>;
611
+ updateOnboarding(session: Session, id: string, request: MezonUpdateOnboardingBody): Promise<boolean>;
612
+ deleteOnboarding(session: Session, id: string, clanId?: string): Promise<any>;
608
613
  }
@@ -6281,6 +6281,154 @@ var MezonApi = class {
6281
6281
  )
6282
6282
  ]);
6283
6283
  }
6284
+ /** list onboarding. */
6285
+ listOnboarding(bearerToken, clanId, guideType, limit, page, options = {}) {
6286
+ const urlPath = "/v2/onboarding";
6287
+ const queryParams = /* @__PURE__ */ new Map();
6288
+ queryParams.set("clan_id", clanId);
6289
+ queryParams.set("guide_type", guideType);
6290
+ queryParams.set("limit", limit);
6291
+ queryParams.set("page", page);
6292
+ let bodyJson = "";
6293
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6294
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6295
+ if (bearerToken) {
6296
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6297
+ }
6298
+ return Promise.race([
6299
+ fetch(fullUrl, fetchOptions).then((response) => {
6300
+ if (response.status == 204) {
6301
+ return response;
6302
+ } else if (response.status >= 200 && response.status < 300) {
6303
+ return response.json();
6304
+ } else {
6305
+ throw response;
6306
+ }
6307
+ }),
6308
+ new Promise(
6309
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6310
+ )
6311
+ ]);
6312
+ }
6313
+ /** create onboarding. */
6314
+ createOnboarding(bearerToken, body, options = {}) {
6315
+ if (body === null || body === void 0) {
6316
+ throw new Error("'body' is a required parameter but is null or undefined.");
6317
+ }
6318
+ const urlPath = "/v2/onboarding";
6319
+ const queryParams = /* @__PURE__ */ new Map();
6320
+ let bodyJson = "";
6321
+ bodyJson = JSON.stringify(body || {});
6322
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6323
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
6324
+ if (bearerToken) {
6325
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6326
+ }
6327
+ return Promise.race([
6328
+ fetch(fullUrl, fetchOptions).then((response) => {
6329
+ if (response.status == 204) {
6330
+ return response;
6331
+ } else if (response.status >= 200 && response.status < 300) {
6332
+ return response.json();
6333
+ } else {
6334
+ throw response;
6335
+ }
6336
+ }),
6337
+ new Promise(
6338
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6339
+ )
6340
+ ]);
6341
+ }
6342
+ /** delete onboarding. */
6343
+ deleteOnboarding(bearerToken, id, clanId, options = {}) {
6344
+ if (id === null || id === void 0) {
6345
+ throw new Error("'id' is a required parameter but is null or undefined.");
6346
+ }
6347
+ const urlPath = "/v2/onboarding/{id}".replace("{id}", encodeURIComponent(String(id)));
6348
+ const queryParams = /* @__PURE__ */ new Map();
6349
+ queryParams.set("clan_id", clanId);
6350
+ let bodyJson = "";
6351
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6352
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
6353
+ if (bearerToken) {
6354
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6355
+ }
6356
+ return Promise.race([
6357
+ fetch(fullUrl, fetchOptions).then((response) => {
6358
+ if (response.status == 204) {
6359
+ return response;
6360
+ } else if (response.status >= 200 && response.status < 300) {
6361
+ return response.json();
6362
+ } else {
6363
+ throw response;
6364
+ }
6365
+ }),
6366
+ new Promise(
6367
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6368
+ )
6369
+ ]);
6370
+ }
6371
+ /** get detailed onboarding information. */
6372
+ getOnboardingDetail(bearerToken, id, clanId, options = {}) {
6373
+ if (id === null || id === void 0) {
6374
+ throw new Error("'id' is a required parameter but is null or undefined.");
6375
+ }
6376
+ const urlPath = "/v2/onboarding/{id}".replace("{id}", encodeURIComponent(String(id)));
6377
+ const queryParams = /* @__PURE__ */ new Map();
6378
+ queryParams.set("clan_id", clanId);
6379
+ let bodyJson = "";
6380
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6381
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6382
+ if (bearerToken) {
6383
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6384
+ }
6385
+ return Promise.race([
6386
+ fetch(fullUrl, fetchOptions).then((response) => {
6387
+ if (response.status == 204) {
6388
+ return response;
6389
+ } else if (response.status >= 200 && response.status < 300) {
6390
+ return response.json();
6391
+ } else {
6392
+ throw response;
6393
+ }
6394
+ }),
6395
+ new Promise(
6396
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6397
+ )
6398
+ ]);
6399
+ }
6400
+ /** update onboarding. */
6401
+ updateOnboarding(bearerToken, id, body, options = {}) {
6402
+ if (id === null || id === void 0) {
6403
+ throw new Error("'id' is a required parameter but is null or undefined.");
6404
+ }
6405
+ if (body === null || body === void 0) {
6406
+ throw new Error("'body' is a required parameter but is null or undefined.");
6407
+ }
6408
+ const urlPath = "/v2/onboarding/{id}".replace("{id}", encodeURIComponent(String(id)));
6409
+ const queryParams = /* @__PURE__ */ new Map();
6410
+ let bodyJson = "";
6411
+ bodyJson = JSON.stringify(body || {});
6412
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6413
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6414
+ if (bearerToken) {
6415
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6416
+ }
6417
+ return Promise.race([
6418
+ fetch(fullUrl, fetchOptions).then((response) => {
6419
+ if (response.status == 204) {
6420
+ return response;
6421
+ } else if (response.status >= 200 && response.status < 300) {
6422
+ return response.json();
6423
+ } else {
6424
+ throw response;
6425
+ }
6426
+ }),
6427
+ new Promise(
6428
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6429
+ )
6430
+ ]);
6431
+ }
6284
6432
  };
6285
6433
 
6286
6434
  // session.ts
@@ -9437,4 +9585,54 @@ var Client = class {
9437
9585
  });
9438
9586
  });
9439
9587
  }
9588
+ listOnboarding(session, clanId, guideType, limit, page) {
9589
+ return __async(this, null, function* () {
9590
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9591
+ yield this.sessionRefresh(session);
9592
+ }
9593
+ return this.apiClient.listOnboarding(session.token, clanId, guideType, limit, page).then((response) => {
9594
+ return response;
9595
+ });
9596
+ });
9597
+ }
9598
+ getOnboardingDetail(session, id, clanId) {
9599
+ return __async(this, null, function* () {
9600
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9601
+ yield this.sessionRefresh(session);
9602
+ }
9603
+ return this.apiClient.getOnboardingDetail(session.token, id, clanId).then((response) => {
9604
+ return Promise.resolve(response);
9605
+ });
9606
+ });
9607
+ }
9608
+ createOnboarding(session, request) {
9609
+ return __async(this, null, function* () {
9610
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9611
+ yield this.sessionRefresh(session);
9612
+ }
9613
+ return this.apiClient.createOnboarding(session.token, request).then((response) => {
9614
+ return response;
9615
+ });
9616
+ });
9617
+ }
9618
+ updateOnboarding(session, id, request) {
9619
+ return __async(this, null, function* () {
9620
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9621
+ yield this.sessionRefresh(session);
9622
+ }
9623
+ return this.apiClient.updateOnboarding(session.token, id, request).then((response) => {
9624
+ return response !== void 0;
9625
+ });
9626
+ });
9627
+ }
9628
+ deleteOnboarding(session, id, clanId) {
9629
+ return __async(this, null, function* () {
9630
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9631
+ yield this.sessionRefresh(session);
9632
+ }
9633
+ return this.apiClient.deleteOnboarding(session.token, id, clanId).then((response) => {
9634
+ return response !== void 0;
9635
+ });
9636
+ });
9637
+ }
9440
9638
  };
@@ -6252,6 +6252,154 @@ var MezonApi = class {
6252
6252
  )
6253
6253
  ]);
6254
6254
  }
6255
+ /** list onboarding. */
6256
+ listOnboarding(bearerToken, clanId, guideType, limit, page, options = {}) {
6257
+ const urlPath = "/v2/onboarding";
6258
+ const queryParams = /* @__PURE__ */ new Map();
6259
+ queryParams.set("clan_id", clanId);
6260
+ queryParams.set("guide_type", guideType);
6261
+ queryParams.set("limit", limit);
6262
+ queryParams.set("page", page);
6263
+ let bodyJson = "";
6264
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6265
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6266
+ if (bearerToken) {
6267
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6268
+ }
6269
+ return Promise.race([
6270
+ fetch(fullUrl, fetchOptions).then((response) => {
6271
+ if (response.status == 204) {
6272
+ return response;
6273
+ } else if (response.status >= 200 && response.status < 300) {
6274
+ return response.json();
6275
+ } else {
6276
+ throw response;
6277
+ }
6278
+ }),
6279
+ new Promise(
6280
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6281
+ )
6282
+ ]);
6283
+ }
6284
+ /** create onboarding. */
6285
+ createOnboarding(bearerToken, body, options = {}) {
6286
+ if (body === null || body === void 0) {
6287
+ throw new Error("'body' is a required parameter but is null or undefined.");
6288
+ }
6289
+ const urlPath = "/v2/onboarding";
6290
+ const queryParams = /* @__PURE__ */ new Map();
6291
+ let bodyJson = "";
6292
+ bodyJson = JSON.stringify(body || {});
6293
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6294
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
6295
+ if (bearerToken) {
6296
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6297
+ }
6298
+ return Promise.race([
6299
+ fetch(fullUrl, fetchOptions).then((response) => {
6300
+ if (response.status == 204) {
6301
+ return response;
6302
+ } else if (response.status >= 200 && response.status < 300) {
6303
+ return response.json();
6304
+ } else {
6305
+ throw response;
6306
+ }
6307
+ }),
6308
+ new Promise(
6309
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6310
+ )
6311
+ ]);
6312
+ }
6313
+ /** delete onboarding. */
6314
+ deleteOnboarding(bearerToken, id, clanId, options = {}) {
6315
+ if (id === null || id === void 0) {
6316
+ throw new Error("'id' is a required parameter but is null or undefined.");
6317
+ }
6318
+ const urlPath = "/v2/onboarding/{id}".replace("{id}", encodeURIComponent(String(id)));
6319
+ const queryParams = /* @__PURE__ */ new Map();
6320
+ queryParams.set("clan_id", clanId);
6321
+ let bodyJson = "";
6322
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6323
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
6324
+ if (bearerToken) {
6325
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6326
+ }
6327
+ return Promise.race([
6328
+ fetch(fullUrl, fetchOptions).then((response) => {
6329
+ if (response.status == 204) {
6330
+ return response;
6331
+ } else if (response.status >= 200 && response.status < 300) {
6332
+ return response.json();
6333
+ } else {
6334
+ throw response;
6335
+ }
6336
+ }),
6337
+ new Promise(
6338
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6339
+ )
6340
+ ]);
6341
+ }
6342
+ /** get detailed onboarding information. */
6343
+ getOnboardingDetail(bearerToken, id, clanId, options = {}) {
6344
+ if (id === null || id === void 0) {
6345
+ throw new Error("'id' is a required parameter but is null or undefined.");
6346
+ }
6347
+ const urlPath = "/v2/onboarding/{id}".replace("{id}", encodeURIComponent(String(id)));
6348
+ const queryParams = /* @__PURE__ */ new Map();
6349
+ queryParams.set("clan_id", clanId);
6350
+ let bodyJson = "";
6351
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6352
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6353
+ if (bearerToken) {
6354
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6355
+ }
6356
+ return Promise.race([
6357
+ fetch(fullUrl, fetchOptions).then((response) => {
6358
+ if (response.status == 204) {
6359
+ return response;
6360
+ } else if (response.status >= 200 && response.status < 300) {
6361
+ return response.json();
6362
+ } else {
6363
+ throw response;
6364
+ }
6365
+ }),
6366
+ new Promise(
6367
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6368
+ )
6369
+ ]);
6370
+ }
6371
+ /** update onboarding. */
6372
+ updateOnboarding(bearerToken, id, body, options = {}) {
6373
+ if (id === null || id === void 0) {
6374
+ throw new Error("'id' is a required parameter but is null or undefined.");
6375
+ }
6376
+ if (body === null || body === void 0) {
6377
+ throw new Error("'body' is a required parameter but is null or undefined.");
6378
+ }
6379
+ const urlPath = "/v2/onboarding/{id}".replace("{id}", encodeURIComponent(String(id)));
6380
+ const queryParams = /* @__PURE__ */ new Map();
6381
+ let bodyJson = "";
6382
+ bodyJson = JSON.stringify(body || {});
6383
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6384
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6385
+ if (bearerToken) {
6386
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6387
+ }
6388
+ return Promise.race([
6389
+ fetch(fullUrl, fetchOptions).then((response) => {
6390
+ if (response.status == 204) {
6391
+ return response;
6392
+ } else if (response.status >= 200 && response.status < 300) {
6393
+ return response.json();
6394
+ } else {
6395
+ throw response;
6396
+ }
6397
+ }),
6398
+ new Promise(
6399
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6400
+ )
6401
+ ]);
6402
+ }
6255
6403
  };
6256
6404
 
6257
6405
  // session.ts
@@ -9408,6 +9556,56 @@ var Client = class {
9408
9556
  });
9409
9557
  });
9410
9558
  }
9559
+ listOnboarding(session, clanId, guideType, limit, page) {
9560
+ return __async(this, null, function* () {
9561
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9562
+ yield this.sessionRefresh(session);
9563
+ }
9564
+ return this.apiClient.listOnboarding(session.token, clanId, guideType, limit, page).then((response) => {
9565
+ return response;
9566
+ });
9567
+ });
9568
+ }
9569
+ getOnboardingDetail(session, id, clanId) {
9570
+ return __async(this, null, function* () {
9571
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9572
+ yield this.sessionRefresh(session);
9573
+ }
9574
+ return this.apiClient.getOnboardingDetail(session.token, id, clanId).then((response) => {
9575
+ return Promise.resolve(response);
9576
+ });
9577
+ });
9578
+ }
9579
+ createOnboarding(session, request) {
9580
+ return __async(this, null, function* () {
9581
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9582
+ yield this.sessionRefresh(session);
9583
+ }
9584
+ return this.apiClient.createOnboarding(session.token, request).then((response) => {
9585
+ return response;
9586
+ });
9587
+ });
9588
+ }
9589
+ updateOnboarding(session, id, request) {
9590
+ return __async(this, null, function* () {
9591
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9592
+ yield this.sessionRefresh(session);
9593
+ }
9594
+ return this.apiClient.updateOnboarding(session.token, id, request).then((response) => {
9595
+ return response !== void 0;
9596
+ });
9597
+ });
9598
+ }
9599
+ deleteOnboarding(session, id, clanId) {
9600
+ return __async(this, null, function* () {
9601
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9602
+ yield this.sessionRefresh(session);
9603
+ }
9604
+ return this.apiClient.deleteOnboarding(session.token, id, clanId).then((response) => {
9605
+ return response !== void 0;
9606
+ });
9607
+ });
9608
+ }
9411
9609
  };
9412
9610
  export {
9413
9611
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.67",
4
+ "version": "2.9.69",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"