mezon-js 2.9.80 → 2.9.83

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -2324,6 +2324,24 @@ export interface ApiUserPermissionInChannelListResponse {
2324
2324
  permissions?: ApiPermissionList;
2325
2325
  }
2326
2326
 
2327
+ /** */
2328
+ export interface ApiUserStatus {
2329
+ //
2330
+ status?: string;
2331
+ //
2332
+ user_id?: string;
2333
+ }
2334
+
2335
+ /** */
2336
+ export interface ApiUserStatusUpdate {
2337
+ //
2338
+ minutes?: number;
2339
+ //
2340
+ status?: string;
2341
+ //
2342
+ until_turn_on?: boolean;
2343
+ }
2344
+
2327
2345
  /** A collection of zero or more users. */
2328
2346
  export interface ApiUsers {
2329
2347
  //The User objects.
@@ -2590,6 +2608,30 @@ export interface ApiListClanWebhookResponse {
2590
2608
  list_clan_webhooks?: Array<ApiClanWebhook>;
2591
2609
  }
2592
2610
 
2611
+ /** */
2612
+ export interface MezonUpdateOnboardingStepByClanIdBody {
2613
+ //onboarding step.
2614
+ onboarding_step?: number;
2615
+ }
2616
+
2617
+ /** */
2618
+ export interface ApiListOnboardingStepResponse {
2619
+ //list onboarding steps.
2620
+ list_onboarding_step?: Array<ApiOnboardingSteps>;
2621
+ }
2622
+
2623
+ /** */
2624
+ export interface ApiOnboardingSteps {
2625
+ //clan id.
2626
+ clan_id?: string;
2627
+ //id.
2628
+ id?: string;
2629
+ //onboarding step.
2630
+ onboarding_step?: number;
2631
+ //user id.
2632
+ user_id?: string;
2633
+ }
2634
+
2593
2635
  export class MezonApi {
2594
2636
  constructor(
2595
2637
  readonly serverKey: string,
@@ -9373,6 +9415,73 @@ pushPubKey(bearerToken: string,
9373
9415
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9374
9416
  }
9375
9417
 
9418
+ return Promise.race([
9419
+ fetch(fullUrl, fetchOptions).then((response) => {
9420
+ if (response.status == 204) {
9421
+ return response;
9422
+ } else if (response.status >= 200 && response.status < 300) {
9423
+ return response.json();
9424
+ } else {
9425
+ throw response;
9426
+ }
9427
+ }),
9428
+ new Promise((_, reject) =>
9429
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9430
+ ),
9431
+ ]);
9432
+ }
9433
+
9434
+ /** Get user status */
9435
+ getUserStatus(bearerToken: string,
9436
+ options: any = {}): Promise<ApiUserStatus> {
9437
+
9438
+ const urlPath = "/v2/userstatus";
9439
+ const queryParams = new Map<string, any>();
9440
+
9441
+ let bodyJson : string = "";
9442
+
9443
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9444
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
9445
+ if (bearerToken) {
9446
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9447
+ }
9448
+
9449
+ return Promise.race([
9450
+ fetch(fullUrl, fetchOptions).then((response) => {
9451
+ if (response.status == 204) {
9452
+ return response;
9453
+ } else if (response.status >= 200 && response.status < 300) {
9454
+ return response.json();
9455
+ } else {
9456
+ throw response;
9457
+ }
9458
+ }),
9459
+ new Promise((_, reject) =>
9460
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9461
+ ),
9462
+ ]);
9463
+ }
9464
+
9465
+ /** Update user status */
9466
+ updateUserStatus(bearerToken: string,
9467
+ body:ApiUserStatusUpdate,
9468
+ options: any = {}): Promise<any> {
9469
+
9470
+ if (body === null || body === undefined) {
9471
+ throw new Error("'body' is a required parameter but is null or undefined.");
9472
+ }
9473
+ const urlPath = "/v2/userstatus";
9474
+ const queryParams = new Map<string, any>();
9475
+
9476
+ let bodyJson : string = "";
9477
+ bodyJson = JSON.stringify(body || {});
9478
+
9479
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9480
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
9481
+ if (bearerToken) {
9482
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9483
+ }
9484
+
9376
9485
  return Promise.race([
9377
9486
  fetch(fullUrl, fetchOptions).then((response) => {
9378
9487
  if (response.status == 204) {
@@ -10087,4 +10196,82 @@ pushPubKey(bearerToken: string,
10087
10196
  ),
10088
10197
  ]);
10089
10198
  }
10199
+
10200
+ /** List onboarding step. */
10201
+ listOnboardingStep(bearerToken: string,
10202
+ clanId?:string,
10203
+ limit?:number,
10204
+ page?:number,
10205
+ options: any = {}): Promise<ApiListOnboardingStepResponse> {
10206
+
10207
+ const urlPath = "/v2/onboardingsteps";
10208
+ const queryParams = new Map<string, any>();
10209
+ queryParams.set("clan_id", clanId);
10210
+ queryParams.set("limit", limit);
10211
+ queryParams.set("page", page);
10212
+
10213
+ let bodyJson : string = "";
10214
+
10215
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
10216
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
10217
+ if (bearerToken) {
10218
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
10219
+ }
10220
+
10221
+ return Promise.race([
10222
+ fetch(fullUrl, fetchOptions).then((response) => {
10223
+ if (response.status == 204) {
10224
+ return response;
10225
+ } else if (response.status >= 200 && response.status < 300) {
10226
+ return response.json();
10227
+ } else {
10228
+ throw response;
10229
+ }
10230
+ }),
10231
+ new Promise((_, reject) =>
10232
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
10233
+ ),
10234
+ ]);
10235
+ }
10236
+
10237
+ /** Update onboarding step. */
10238
+ updateOnboardingStepByClanId(bearerToken: string,
10239
+ clanId:string,
10240
+ body:MezonUpdateOnboardingStepByClanIdBody,
10241
+ options: any = {}): Promise<any> {
10242
+
10243
+ if (clanId === null || clanId === undefined) {
10244
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
10245
+ }
10246
+ if (body === null || body === undefined) {
10247
+ throw new Error("'body' is a required parameter but is null or undefined.");
10248
+ }
10249
+ const urlPath = "/v2/onboardingsteps/{clanId}"
10250
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
10251
+ const queryParams = new Map<string, any>();
10252
+
10253
+ let bodyJson : string = "";
10254
+ bodyJson = JSON.stringify(body || {});
10255
+
10256
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
10257
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
10258
+ if (bearerToken) {
10259
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
10260
+ }
10261
+
10262
+ return Promise.race([
10263
+ fetch(fullUrl, fetchOptions).then((response) => {
10264
+ if (response.status == 204) {
10265
+ return response;
10266
+ } else if (response.status >= 200 && response.status < 300) {
10267
+ return response.json();
10268
+ } else {
10269
+ throw response;
10270
+ }
10271
+ }),
10272
+ new Promise((_, reject) =>
10273
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
10274
+ ),
10275
+ ]);
10276
+ }
10090
10277
  }
package/client.ts CHANGED
@@ -149,6 +149,10 @@ import {
149
149
  ApiListClanWebhookResponse,
150
150
  MezonUpdateClanWebhookByIdBody,
151
151
  MezonUpdateClanDescBody,
152
+ ApiUserStatusUpdate,
153
+ ApiUserStatus,
154
+ ApiListOnboardingStepResponse,
155
+ MezonUpdateOnboardingStepByClanIdBody,
152
156
  } from "./api.gen";
153
157
 
154
158
  import { Session } from "./session";
@@ -4548,7 +4552,7 @@ export class Client {
4548
4552
  }
4549
4553
 
4550
4554
  return this.apiClient
4551
- .generateWebhook(session.token, request)
4555
+ .generateClanWebhook(session.token, request)
4552
4556
  .then((response: any) => {
4553
4557
  return Promise.resolve(response);
4554
4558
  });
@@ -4615,4 +4619,87 @@ export class Client {
4615
4619
  return response !== undefined;
4616
4620
  });
4617
4621
  }
4622
+
4623
+ //**list onboarding step */
4624
+ async listOnboardingStep(
4625
+ session: Session,
4626
+ clan_id?: string,
4627
+ limit?: number,
4628
+ page? :number,
4629
+ ): Promise<ApiListOnboardingStepResponse> {
4630
+ if (
4631
+ this.autoRefreshSession &&
4632
+ session.refresh_token &&
4633
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4634
+ ) {
4635
+ await this.sessionRefresh(session);
4636
+ }
4637
+
4638
+ return this.apiClient
4639
+ .listOnboardingStep(session.token, clan_id, limit, page)
4640
+ .then((response: ApiListOnboardingStepResponse) => {
4641
+ return Promise.resolve(response);
4642
+ });
4643
+ }
4644
+
4645
+ //**update onboarding step by id */
4646
+ async updateOnboardingStepByClanId(
4647
+ session: Session,
4648
+ id: string,
4649
+ request: MezonUpdateOnboardingStepByClanIdBody
4650
+ ) {
4651
+ if (
4652
+ this.autoRefreshSession &&
4653
+ session.refresh_token &&
4654
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4655
+ ) {
4656
+ await this.sessionRefresh(session);
4657
+ }
4658
+
4659
+ return this.apiClient
4660
+ .updateOnboardingStepByClanId(session.token, id, request)
4661
+ .then((response: any) => {
4662
+ return response !== undefined;
4663
+ });
4664
+ }
4665
+
4666
+ //**update status */
4667
+ async updateUserStatus(
4668
+ session: Session,
4669
+ request: ApiUserStatusUpdate
4670
+ ) {
4671
+ if (
4672
+ this.autoRefreshSession &&
4673
+ session.refresh_token &&
4674
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4675
+ ) {
4676
+ await this.sessionRefresh(session);
4677
+ }
4678
+
4679
+ return this.apiClient
4680
+ .updateUserStatus(session.token, request)
4681
+ .then((response: any) => {
4682
+ return response !== undefined;
4683
+ });
4684
+ }
4685
+
4686
+ //**get user status */
4687
+ async getUserStatus(
4688
+ session: Session
4689
+ ): Promise<ApiUserStatus> {
4690
+ if (
4691
+ this.autoRefreshSession &&
4692
+ session.refresh_token &&
4693
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4694
+ ) {
4695
+ await this.sessionRefresh(session);
4696
+ }
4697
+
4698
+ return this.apiClient
4699
+ .getUserStatus(session.token)
4700
+ .then((response: ApiUserStatus) => {
4701
+ return Promise.resolve(response);
4702
+ });
4703
+ }
4704
+
4618
4705
  }
package/dist/api.gen.d.ts CHANGED
@@ -1350,6 +1350,17 @@ export interface ApiUserPermissionInChannelListResponse {
1350
1350
  clan_id?: string;
1351
1351
  permissions?: ApiPermissionList;
1352
1352
  }
1353
+ /** */
1354
+ export interface ApiUserStatus {
1355
+ status?: string;
1356
+ user_id?: string;
1357
+ }
1358
+ /** */
1359
+ export interface ApiUserStatusUpdate {
1360
+ minutes?: number;
1361
+ status?: string;
1362
+ until_turn_on?: boolean;
1363
+ }
1353
1364
  /** A collection of zero or more users. */
1354
1365
  export interface ApiUsers {
1355
1366
  users?: Array<ApiUser>;
@@ -1506,6 +1517,21 @@ export interface ApiGenerateClanWebhookResponse {
1506
1517
  export interface ApiListClanWebhookResponse {
1507
1518
  list_clan_webhooks?: Array<ApiClanWebhook>;
1508
1519
  }
1520
+ /** */
1521
+ export interface MezonUpdateOnboardingStepByClanIdBody {
1522
+ onboarding_step?: number;
1523
+ }
1524
+ /** */
1525
+ export interface ApiListOnboardingStepResponse {
1526
+ list_onboarding_step?: Array<ApiOnboardingSteps>;
1527
+ }
1528
+ /** */
1529
+ export interface ApiOnboardingSteps {
1530
+ clan_id?: string;
1531
+ id?: string;
1532
+ onboarding_step?: number;
1533
+ user_id?: string;
1534
+ }
1509
1535
  export declare class MezonApi {
1510
1536
  readonly serverKey: string;
1511
1537
  readonly basePath: string;
@@ -1853,6 +1879,10 @@ export declare class MezonApi {
1853
1879
  listUserClansByUserId(bearerToken: string, options?: any): Promise<ApiAllUserClans>;
1854
1880
  /** ListUserPermissionInChannel */
1855
1881
  listUserPermissionInChannel(bearerToken: string, clanId?: string, channelId?: string, options?: any): Promise<ApiUserPermissionInChannelListResponse>;
1882
+ /** Get user status */
1883
+ getUserStatus(bearerToken: string, options?: any): Promise<ApiUserStatus>;
1884
+ /** Update user status */
1885
+ updateUserStatus(bearerToken: string, body: ApiUserStatusUpdate, options?: any): Promise<any>;
1856
1886
  /** create webhook */
1857
1887
  generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
1858
1888
  /** update webhook name by id */
@@ -1888,4 +1918,8 @@ export declare class MezonApi {
1888
1918
  deleteClanWebhookById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1889
1919
  /** Update clan webhook by id. */
1890
1920
  updateClanWebhookById(bearerToken: string, id: string, body: MezonUpdateClanWebhookByIdBody, options?: any): Promise<any>;
1921
+ /** List onboarding step. */
1922
+ listOnboardingStep(bearerToken: string, clanId?: string, limit?: number, page?: number, options?: any): Promise<ApiListOnboardingStepResponse>;
1923
+ /** Update onboarding step. */
1924
+ updateOnboardingStepByClanId(bearerToken: string, clanId: string, body: MezonUpdateOnboardingStepByClanIdBody, options?: any): Promise<any>;
1891
1925
  }
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, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody } 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, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -619,4 +619,8 @@ export declare class Client {
619
619
  listClanWebhook(session: Session, clan_id: string): Promise<ApiListClanWebhookResponse>;
620
620
  deleteClanWebhookById(session: Session, id: string, clan_id: string): Promise<boolean>;
621
621
  updateClanWebhookById(session: Session, id: string, request: MezonUpdateClanWebhookByIdBody): Promise<boolean>;
622
+ listOnboardingStep(session: Session, clan_id?: string, limit?: number, page?: number): Promise<ApiListOnboardingStepResponse>;
623
+ updateOnboardingStepByClanId(session: Session, id: string, request: MezonUpdateOnboardingStepByClanIdBody): Promise<boolean>;
624
+ updateUserStatus(session: Session, request: ApiUserStatusUpdate): Promise<boolean>;
625
+ getUserStatus(session: Session): Promise<ApiUserStatus>;
622
626
  }
@@ -6005,6 +6005,60 @@ var MezonApi = class {
6005
6005
  )
6006
6006
  ]);
6007
6007
  }
6008
+ /** Get user status */
6009
+ getUserStatus(bearerToken, options = {}) {
6010
+ const urlPath = "/v2/userstatus";
6011
+ const queryParams = /* @__PURE__ */ new Map();
6012
+ let bodyJson = "";
6013
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6014
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6015
+ if (bearerToken) {
6016
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6017
+ }
6018
+ return Promise.race([
6019
+ fetch(fullUrl, fetchOptions).then((response) => {
6020
+ if (response.status == 204) {
6021
+ return response;
6022
+ } else if (response.status >= 200 && response.status < 300) {
6023
+ return response.json();
6024
+ } else {
6025
+ throw response;
6026
+ }
6027
+ }),
6028
+ new Promise(
6029
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6030
+ )
6031
+ ]);
6032
+ }
6033
+ /** Update user status */
6034
+ updateUserStatus(bearerToken, body, options = {}) {
6035
+ if (body === null || body === void 0) {
6036
+ throw new Error("'body' is a required parameter but is null or undefined.");
6037
+ }
6038
+ const urlPath = "/v2/userstatus";
6039
+ const queryParams = /* @__PURE__ */ new Map();
6040
+ let bodyJson = "";
6041
+ bodyJson = JSON.stringify(body || {});
6042
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6043
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6044
+ if (bearerToken) {
6045
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6046
+ }
6047
+ return Promise.race([
6048
+ fetch(fullUrl, fetchOptions).then((response) => {
6049
+ if (response.status == 204) {
6050
+ return response;
6051
+ } else if (response.status >= 200 && response.status < 300) {
6052
+ return response.json();
6053
+ } else {
6054
+ throw response;
6055
+ }
6056
+ }),
6057
+ new Promise(
6058
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6059
+ )
6060
+ ]);
6061
+ }
6008
6062
  /** create webhook */
6009
6063
  generateWebhook(bearerToken, body, options = {}) {
6010
6064
  if (body === null || body === void 0) {
@@ -6548,6 +6602,66 @@ var MezonApi = class {
6548
6602
  )
6549
6603
  ]);
6550
6604
  }
6605
+ /** List onboarding step. */
6606
+ listOnboardingStep(bearerToken, clanId, limit, page, options = {}) {
6607
+ const urlPath = "/v2/onboardingsteps";
6608
+ const queryParams = /* @__PURE__ */ new Map();
6609
+ queryParams.set("clan_id", clanId);
6610
+ queryParams.set("limit", limit);
6611
+ queryParams.set("page", page);
6612
+ let bodyJson = "";
6613
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6614
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6615
+ if (bearerToken) {
6616
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6617
+ }
6618
+ return Promise.race([
6619
+ fetch(fullUrl, fetchOptions).then((response) => {
6620
+ if (response.status == 204) {
6621
+ return response;
6622
+ } else if (response.status >= 200 && response.status < 300) {
6623
+ return response.json();
6624
+ } else {
6625
+ throw response;
6626
+ }
6627
+ }),
6628
+ new Promise(
6629
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6630
+ )
6631
+ ]);
6632
+ }
6633
+ /** Update onboarding step. */
6634
+ updateOnboardingStepByClanId(bearerToken, clanId, body, options = {}) {
6635
+ if (clanId === null || clanId === void 0) {
6636
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
6637
+ }
6638
+ if (body === null || body === void 0) {
6639
+ throw new Error("'body' is a required parameter but is null or undefined.");
6640
+ }
6641
+ const urlPath = "/v2/onboardingsteps/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
6642
+ const queryParams = /* @__PURE__ */ new Map();
6643
+ let bodyJson = "";
6644
+ bodyJson = JSON.stringify(body || {});
6645
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6646
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6647
+ if (bearerToken) {
6648
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6649
+ }
6650
+ return Promise.race([
6651
+ fetch(fullUrl, fetchOptions).then((response) => {
6652
+ if (response.status == 204) {
6653
+ return response;
6654
+ } else if (response.status >= 200 && response.status < 300) {
6655
+ return response.json();
6656
+ } else {
6657
+ throw response;
6658
+ }
6659
+ }),
6660
+ new Promise(
6661
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6662
+ )
6663
+ ]);
6664
+ }
6551
6665
  };
6552
6666
 
6553
6667
  // session.ts
@@ -6938,6 +7052,10 @@ var _DefaultSocket = class _DefaultSocket {
6938
7052
  this.onwebrtcsignalingfwd(message.webrtc_signaling_fwd);
6939
7053
  } else if (message.list_activity) {
6940
7054
  this.onactivityupdated(message.list_activity);
7055
+ } else if (message.join_ptt_channel) {
7056
+ this.onjoinpttchannel(message.join_ptt_channel);
7057
+ } else if (message.talk_ptt_channel) {
7058
+ this.ontalkpttchannel(message.talk_ptt_channel);
6941
7059
  } else {
6942
7060
  if (this.verbose && window && window.console) {
6943
7061
  console.log("Unrecognized message received: %o", message);
@@ -7230,6 +7348,16 @@ var _DefaultSocket = class _DefaultSocket {
7230
7348
  console.log(list_activity);
7231
7349
  }
7232
7350
  }
7351
+ onjoinpttchannel(join_ptt_channel) {
7352
+ if (this.verbose && window && window.console) {
7353
+ console.log(join_ptt_channel);
7354
+ }
7355
+ }
7356
+ ontalkpttchannel(talk_ptt_channel) {
7357
+ if (this.verbose && window && window.console) {
7358
+ console.log(talk_ptt_channel);
7359
+ }
7360
+ }
7233
7361
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
7234
7362
  const untypedMessage = message;
7235
7363
  return new Promise((resolve, reject) => {
@@ -9956,7 +10084,7 @@ var Client = class {
9956
10084
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9957
10085
  yield this.sessionRefresh(session);
9958
10086
  }
9959
- return this.apiClient.generateWebhook(session.token, request).then((response) => {
10087
+ return this.apiClient.generateClanWebhook(session.token, request).then((response) => {
9960
10088
  return Promise.resolve(response);
9961
10089
  });
9962
10090
  });
@@ -9994,4 +10122,48 @@ var Client = class {
9994
10122
  });
9995
10123
  });
9996
10124
  }
10125
+ //**list onboarding step */
10126
+ listOnboardingStep(session, clan_id, limit, page) {
10127
+ return __async(this, null, function* () {
10128
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10129
+ yield this.sessionRefresh(session);
10130
+ }
10131
+ return this.apiClient.listOnboardingStep(session.token, clan_id, limit, page).then((response) => {
10132
+ return Promise.resolve(response);
10133
+ });
10134
+ });
10135
+ }
10136
+ //**update onboarding step by id */
10137
+ updateOnboardingStepByClanId(session, id, request) {
10138
+ return __async(this, null, function* () {
10139
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10140
+ yield this.sessionRefresh(session);
10141
+ }
10142
+ return this.apiClient.updateOnboardingStepByClanId(session.token, id, request).then((response) => {
10143
+ return response !== void 0;
10144
+ });
10145
+ });
10146
+ }
10147
+ //**update status */
10148
+ updateUserStatus(session, request) {
10149
+ return __async(this, null, function* () {
10150
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10151
+ yield this.sessionRefresh(session);
10152
+ }
10153
+ return this.apiClient.updateUserStatus(session.token, request).then((response) => {
10154
+ return response !== void 0;
10155
+ });
10156
+ });
10157
+ }
10158
+ //**get user status */
10159
+ getUserStatus(session) {
10160
+ return __async(this, null, function* () {
10161
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10162
+ yield this.sessionRefresh(session);
10163
+ }
10164
+ return this.apiClient.getUserStatus(session.token).then((response) => {
10165
+ return Promise.resolve(response);
10166
+ });
10167
+ });
10168
+ }
9997
10169
  };
@@ -5975,6 +5975,60 @@ var MezonApi = class {
5975
5975
  )
5976
5976
  ]);
5977
5977
  }
5978
+ /** Get user status */
5979
+ getUserStatus(bearerToken, options = {}) {
5980
+ const urlPath = "/v2/userstatus";
5981
+ const queryParams = /* @__PURE__ */ new Map();
5982
+ let bodyJson = "";
5983
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5984
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5985
+ if (bearerToken) {
5986
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5987
+ }
5988
+ return Promise.race([
5989
+ fetch(fullUrl, fetchOptions).then((response) => {
5990
+ if (response.status == 204) {
5991
+ return response;
5992
+ } else if (response.status >= 200 && response.status < 300) {
5993
+ return response.json();
5994
+ } else {
5995
+ throw response;
5996
+ }
5997
+ }),
5998
+ new Promise(
5999
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6000
+ )
6001
+ ]);
6002
+ }
6003
+ /** Update user status */
6004
+ updateUserStatus(bearerToken, body, options = {}) {
6005
+ if (body === null || body === void 0) {
6006
+ throw new Error("'body' is a required parameter but is null or undefined.");
6007
+ }
6008
+ const urlPath = "/v2/userstatus";
6009
+ const queryParams = /* @__PURE__ */ new Map();
6010
+ let bodyJson = "";
6011
+ bodyJson = JSON.stringify(body || {});
6012
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6013
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6014
+ if (bearerToken) {
6015
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6016
+ }
6017
+ return Promise.race([
6018
+ fetch(fullUrl, fetchOptions).then((response) => {
6019
+ if (response.status == 204) {
6020
+ return response;
6021
+ } else if (response.status >= 200 && response.status < 300) {
6022
+ return response.json();
6023
+ } else {
6024
+ throw response;
6025
+ }
6026
+ }),
6027
+ new Promise(
6028
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6029
+ )
6030
+ ]);
6031
+ }
5978
6032
  /** create webhook */
5979
6033
  generateWebhook(bearerToken, body, options = {}) {
5980
6034
  if (body === null || body === void 0) {
@@ -6518,6 +6572,66 @@ var MezonApi = class {
6518
6572
  )
6519
6573
  ]);
6520
6574
  }
6575
+ /** List onboarding step. */
6576
+ listOnboardingStep(bearerToken, clanId, limit, page, options = {}) {
6577
+ const urlPath = "/v2/onboardingsteps";
6578
+ const queryParams = /* @__PURE__ */ new Map();
6579
+ queryParams.set("clan_id", clanId);
6580
+ queryParams.set("limit", limit);
6581
+ queryParams.set("page", page);
6582
+ let bodyJson = "";
6583
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6584
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6585
+ if (bearerToken) {
6586
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6587
+ }
6588
+ return Promise.race([
6589
+ fetch(fullUrl, fetchOptions).then((response) => {
6590
+ if (response.status == 204) {
6591
+ return response;
6592
+ } else if (response.status >= 200 && response.status < 300) {
6593
+ return response.json();
6594
+ } else {
6595
+ throw response;
6596
+ }
6597
+ }),
6598
+ new Promise(
6599
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6600
+ )
6601
+ ]);
6602
+ }
6603
+ /** Update onboarding step. */
6604
+ updateOnboardingStepByClanId(bearerToken, clanId, body, options = {}) {
6605
+ if (clanId === null || clanId === void 0) {
6606
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
6607
+ }
6608
+ if (body === null || body === void 0) {
6609
+ throw new Error("'body' is a required parameter but is null or undefined.");
6610
+ }
6611
+ const urlPath = "/v2/onboardingsteps/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
6612
+ const queryParams = /* @__PURE__ */ new Map();
6613
+ let bodyJson = "";
6614
+ bodyJson = JSON.stringify(body || {});
6615
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6616
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6617
+ if (bearerToken) {
6618
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6619
+ }
6620
+ return Promise.race([
6621
+ fetch(fullUrl, fetchOptions).then((response) => {
6622
+ if (response.status == 204) {
6623
+ return response;
6624
+ } else if (response.status >= 200 && response.status < 300) {
6625
+ return response.json();
6626
+ } else {
6627
+ throw response;
6628
+ }
6629
+ }),
6630
+ new Promise(
6631
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6632
+ )
6633
+ ]);
6634
+ }
6521
6635
  };
6522
6636
 
6523
6637
  // session.ts
@@ -6908,6 +7022,10 @@ var _DefaultSocket = class _DefaultSocket {
6908
7022
  this.onwebrtcsignalingfwd(message.webrtc_signaling_fwd);
6909
7023
  } else if (message.list_activity) {
6910
7024
  this.onactivityupdated(message.list_activity);
7025
+ } else if (message.join_ptt_channel) {
7026
+ this.onjoinpttchannel(message.join_ptt_channel);
7027
+ } else if (message.talk_ptt_channel) {
7028
+ this.ontalkpttchannel(message.talk_ptt_channel);
6911
7029
  } else {
6912
7030
  if (this.verbose && window && window.console) {
6913
7031
  console.log("Unrecognized message received: %o", message);
@@ -7200,6 +7318,16 @@ var _DefaultSocket = class _DefaultSocket {
7200
7318
  console.log(list_activity);
7201
7319
  }
7202
7320
  }
7321
+ onjoinpttchannel(join_ptt_channel) {
7322
+ if (this.verbose && window && window.console) {
7323
+ console.log(join_ptt_channel);
7324
+ }
7325
+ }
7326
+ ontalkpttchannel(talk_ptt_channel) {
7327
+ if (this.verbose && window && window.console) {
7328
+ console.log(talk_ptt_channel);
7329
+ }
7330
+ }
7203
7331
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
7204
7332
  const untypedMessage = message;
7205
7333
  return new Promise((resolve, reject) => {
@@ -9926,7 +10054,7 @@ var Client = class {
9926
10054
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9927
10055
  yield this.sessionRefresh(session);
9928
10056
  }
9929
- return this.apiClient.generateWebhook(session.token, request).then((response) => {
10057
+ return this.apiClient.generateClanWebhook(session.token, request).then((response) => {
9930
10058
  return Promise.resolve(response);
9931
10059
  });
9932
10060
  });
@@ -9964,6 +10092,50 @@ var Client = class {
9964
10092
  });
9965
10093
  });
9966
10094
  }
10095
+ //**list onboarding step */
10096
+ listOnboardingStep(session, clan_id, limit, page) {
10097
+ return __async(this, null, function* () {
10098
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10099
+ yield this.sessionRefresh(session);
10100
+ }
10101
+ return this.apiClient.listOnboardingStep(session.token, clan_id, limit, page).then((response) => {
10102
+ return Promise.resolve(response);
10103
+ });
10104
+ });
10105
+ }
10106
+ //**update onboarding step by id */
10107
+ updateOnboardingStepByClanId(session, id, request) {
10108
+ return __async(this, null, function* () {
10109
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10110
+ yield this.sessionRefresh(session);
10111
+ }
10112
+ return this.apiClient.updateOnboardingStepByClanId(session.token, id, request).then((response) => {
10113
+ return response !== void 0;
10114
+ });
10115
+ });
10116
+ }
10117
+ //**update status */
10118
+ updateUserStatus(session, request) {
10119
+ return __async(this, null, function* () {
10120
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10121
+ yield this.sessionRefresh(session);
10122
+ }
10123
+ return this.apiClient.updateUserStatus(session.token, request).then((response) => {
10124
+ return response !== void 0;
10125
+ });
10126
+ });
10127
+ }
10128
+ //**get user status */
10129
+ getUserStatus(session) {
10130
+ return __async(this, null, function* () {
10131
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10132
+ yield this.sessionRefresh(session);
10133
+ }
10134
+ return this.apiClient.getUserStatus(session.token).then((response) => {
10135
+ return Promise.resolve(response);
10136
+ });
10137
+ });
10138
+ }
9967
10139
  };
9968
10140
  export {
9969
10141
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -724,6 +724,8 @@ export interface Socket {
724
724
  onunmuteevent: (unmute_event: UnmuteEvent) => void;
725
725
  ontokensent: (token: ApiTokenSentEvent) => void;
726
726
  onactivityupdated: (list_activity: ListActivity) => void;
727
+ onjoinpttchannel: (join_ptt_channel: JoinPTTChannel) => void;
728
+ ontalkpttchannel: (talk_ptt_channel: TalkPTTChannel) => void;
727
729
  }
728
730
  /** Reports an error received from a socket message. */
729
731
  export interface SocketError {
@@ -801,6 +803,8 @@ export declare class DefaultSocket implements Socket {
801
803
  onmessagebuttonclicked(messageButtonClicked: MessageButtonClicked): void;
802
804
  onwebrtcsignalingfwd(event: WebrtcSignalingFwd): void;
803
805
  onactivityupdated(list_activity: ListActivity): void;
806
+ onjoinpttchannel(join_ptt_channel: JoinPTTChannel): void;
807
+ ontalkpttchannel(talk_ptt_channel: TalkPTTChannel): void;
804
808
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | MessageButtonClicked | JoinPTTChannel | TalkPTTChannel, sendTimeout?: number): Promise<any>;
805
809
  followUsers(userIds: string[]): Promise<Status>;
806
810
  joinClanChat(clan_id: string): Promise<ClanJoin>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.80",
4
+ "version": "2.9.83",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -1185,6 +1185,10 @@ export interface Socket {
1185
1185
  ontokensent: (token: ApiTokenSentEvent) => void;
1186
1186
 
1187
1187
  onactivityupdated: (list_activity: ListActivity) => void;
1188
+
1189
+ onjoinpttchannel: (join_ptt_channel: JoinPTTChannel) => void;
1190
+
1191
+ ontalkpttchannel: (talk_ptt_channel: TalkPTTChannel) => void;
1188
1192
  }
1189
1193
 
1190
1194
  /** Reports an error received from a socket message. */
@@ -1262,7 +1266,6 @@ export class DefaultSocket implements Socket {
1262
1266
  if (this.verbose && window && window.console) {
1263
1267
  console.log("Response: %o", JSON.stringify(message));
1264
1268
  }
1265
-
1266
1269
  /** Inbound message from server. */
1267
1270
  if (!message.cid) {
1268
1271
  if (message.notifications) {
@@ -1442,6 +1445,10 @@ export class DefaultSocket implements Socket {
1442
1445
  this.onwebrtcsignalingfwd(<WebrtcSignalingFwd>message.webrtc_signaling_fwd);
1443
1446
  } else if (message.list_activity){
1444
1447
  this.onactivityupdated(<ListActivity>message.list_activity);
1448
+ } else if (message.join_ptt_channel){
1449
+ this.onjoinpttchannel(<JoinPTTChannel>message.join_ptt_channel);
1450
+ } else if (message.talk_ptt_channel){
1451
+ this.ontalkpttchannel(<TalkPTTChannel>message.talk_ptt_channel);
1445
1452
  } else {
1446
1453
  if (this.verbose && window && window.console) {
1447
1454
  console.log("Unrecognized message received: %o", message);
@@ -1790,6 +1797,18 @@ export class DefaultSocket implements Socket {
1790
1797
  console.log(list_activity);
1791
1798
  }
1792
1799
  }
1800
+
1801
+ onjoinpttchannel(join_ptt_channel: JoinPTTChannel) {
1802
+ if (this.verbose && window && window.console) {
1803
+ console.log(join_ptt_channel);
1804
+ }
1805
+ }
1806
+
1807
+ ontalkpttchannel(talk_ptt_channel: TalkPTTChannel) {
1808
+ if (this.verbose && window && window.console) {
1809
+ console.log(talk_ptt_channel);
1810
+ }
1811
+ }
1793
1812
  send(
1794
1813
  message:
1795
1814
  | ChannelJoin