mezon-js 2.9.34 → 2.9.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.gen.ts CHANGED
@@ -528,6 +528,79 @@ export interface ApiChannelAttachmentList {
528
528
  attachments?: Array<ApiChannelAttachment>;
529
529
  }
530
530
 
531
+ /** */
532
+ export interface ApiChannelCanvasDetailResponse {
533
+ //
534
+ content?: string;
535
+ //
536
+ creator_id?: string;
537
+ //
538
+ editor_id?: string;
539
+ //
540
+ id?: string;
541
+ //
542
+ title?: string;
543
+ }
544
+
545
+ /** */
546
+ export interface ApiChannelCanvasItem {
547
+ //
548
+ id?: string;
549
+ //
550
+ title?: string;
551
+ }
552
+
553
+ /** */
554
+ export interface ApiChannelCanvasListResponse {
555
+ //
556
+ channel_canvases?: Array<ApiChannelCanvasItem>;
557
+ //
558
+ channel_id?: string;
559
+ //
560
+ clan_id?: string;
561
+ }
562
+
563
+ /** */
564
+ export interface ApiEditChannelCanvasRequest {
565
+ //
566
+ channel_id?: string;
567
+ //
568
+ clan_id?: string;
569
+ //
570
+ content?: string;
571
+ //
572
+ id?: string;
573
+ //
574
+ title?: string;
575
+ }
576
+
577
+ /** */
578
+ export interface ApiEditChannelCanvasRequest {
579
+ //
580
+ channel_id?: string;
581
+ //
582
+ clan_id?: string;
583
+ //
584
+ content?: string;
585
+ //
586
+ id?: string;
587
+ //
588
+ title?: string;
589
+ }
590
+
591
+ /** */
592
+ export interface ApiEditChannelCanvasResponse {
593
+ //
594
+ id?: string;
595
+ }
596
+
597
+
598
+ /** */
599
+ export interface ApiEditChannelCanvasResponse {
600
+ //
601
+ id?: string;
602
+ }
603
+
531
604
  /** A list of channel description, usually a result of a list operation. */
532
605
  export interface ApiChannelDescList {
533
606
  //Cacheable cursor to list newer channel description. Durable and designed to be stored, unlike next/prev cursors.
@@ -716,10 +789,14 @@ export interface ApiChannelSettingItem {
716
789
 
717
790
  /** */
718
791
  export interface ApiChannelSettingListResponse {
792
+ //
793
+ channel_count?: number;
719
794
  //
720
795
  channel_setting_list?: Array<ApiChannelSettingItem>;
721
796
  //
722
797
  clan_id?: string;
798
+ //
799
+ thread_count?: number;
723
800
  }
724
801
 
725
802
  /** A list of users belonging to a channel, along with their role. */
@@ -8541,4 +8618,121 @@ export class MezonApi {
8541
8618
 
8542
8619
  return fullPath;
8543
8620
  }
8621
+
8622
+ /** Channel canvas editor */
8623
+ editChannelCanvases(bearerToken: string,
8624
+ body:ApiEditChannelCanvasRequest,
8625
+ options: any = {}): Promise<ApiEditChannelCanvasResponse> {
8626
+
8627
+ if (body === null || body === undefined) {
8628
+ throw new Error("'body' is a required parameter but is null or undefined.");
8629
+ }
8630
+ const urlPath = "/v2/canvases/editor";
8631
+ const queryParams = new Map<string, any>();
8632
+
8633
+ let bodyJson : string = "";
8634
+ bodyJson = JSON.stringify(body || {});
8635
+
8636
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8637
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
8638
+ if (bearerToken) {
8639
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8640
+ }
8641
+
8642
+ return Promise.race([
8643
+ fetch(fullUrl, fetchOptions).then((response) => {
8644
+ if (response.status == 204) {
8645
+ return response;
8646
+ } else if (response.status >= 200 && response.status < 300) {
8647
+ return response.json();
8648
+ } else {
8649
+ throw response;
8650
+ }
8651
+ }),
8652
+ new Promise((_, reject) =>
8653
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8654
+ ),
8655
+ ]);
8656
+ }
8657
+
8658
+ /** */
8659
+ getChannelCanvasDetail(bearerToken: string,
8660
+ id:string,
8661
+ clanId?:string,
8662
+ channelId?:string,
8663
+ options: any = {}): Promise<ApiChannelCanvasDetailResponse> {
8664
+
8665
+ if (id === null || id === undefined) {
8666
+ throw new Error("'id' is a required parameter but is null or undefined.");
8667
+ }
8668
+ const urlPath = "/v2/canvases/{id}"
8669
+ .replace("{id}", encodeURIComponent(String(id)));
8670
+ const queryParams = new Map<string, any>();
8671
+ queryParams.set("clan_id", clanId);
8672
+ queryParams.set("channel_id", channelId);
8673
+
8674
+ let bodyJson : string = "";
8675
+
8676
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8677
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8678
+ if (bearerToken) {
8679
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8680
+ }
8681
+
8682
+ return Promise.race([
8683
+ fetch(fullUrl, fetchOptions).then((response) => {
8684
+ if (response.status == 204) {
8685
+ return response;
8686
+ } else if (response.status >= 200 && response.status < 300) {
8687
+ return response.json();
8688
+ } else {
8689
+ throw response;
8690
+ }
8691
+ }),
8692
+ new Promise((_, reject) =>
8693
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8694
+ ),
8695
+ ]);
8696
+ }
8697
+ /** */
8698
+ getChannelCanvasList(bearerToken: string,
8699
+ channelId:string,
8700
+ clanId?:string,
8701
+ limit?:number,
8702
+ page?:number,
8703
+ options: any = {}): Promise<ApiChannelCanvasListResponse> {
8704
+
8705
+ if (channelId === null || channelId === undefined) {
8706
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
8707
+ }
8708
+ const urlPath = "/v2/channel-canvases/{channelId}"
8709
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
8710
+ const queryParams = new Map<string, any>();
8711
+ queryParams.set("clan_id", clanId);
8712
+ queryParams.set("limit", limit);
8713
+ queryParams.set("page", page);
8714
+
8715
+ let bodyJson : string = "";
8716
+
8717
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8718
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8719
+ if (bearerToken) {
8720
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8721
+ }
8722
+
8723
+ return Promise.race([
8724
+ fetch(fullUrl, fetchOptions).then((response) => {
8725
+ if (response.status == 204) {
8726
+ return response;
8727
+ } else if (response.status >= 200 && response.status < 300) {
8728
+ return response.json();
8729
+ } else {
8730
+ throw response;
8731
+ }
8732
+ }),
8733
+ new Promise((_, reject) =>
8734
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8735
+ ),
8736
+ ]);
8737
+ }
8544
8738
  }
package/client.ts CHANGED
@@ -121,6 +121,8 @@ import {
121
121
  ApiUserPermissionInChannelListResponse,
122
122
  ApiPermissionRoleChannelListEventResponse,
123
123
  ApiMarkAsReadRequest,
124
+ ApiChannelCanvasListResponse,
125
+ ApiEditChannelCanvasRequest,
124
126
  } from "./api.gen";
125
127
 
126
128
  import { Session } from "./session";
@@ -3998,4 +4000,88 @@ export class Client {
3998
4000
  return Promise.resolve(response);
3999
4001
  });
4000
4002
  }
4003
+
4004
+ async getChannelCanvasList(
4005
+ session: Session,
4006
+ channelId:string,
4007
+ clanId?:string,
4008
+ limit?:number,
4009
+ page?:number,
4010
+ ): Promise<any> {
4011
+ if (
4012
+ this.autoRefreshSession &&
4013
+ session.refresh_token &&
4014
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4015
+ ) {
4016
+ await this.sessionRefresh(session);
4017
+ }
4018
+
4019
+ return this.apiClient
4020
+ .getChannelCanvasList(
4021
+ session.token,
4022
+ channelId,
4023
+ clanId,
4024
+ limit,
4025
+ page
4026
+ )
4027
+ .then((response: ApiChannelCanvasListResponse) => {
4028
+ var result: ApiChannelCanvasListResponse = {
4029
+ channel_canvases: [],
4030
+ };
4031
+
4032
+ if (response.channel_canvases == null) {
4033
+ return Promise.resolve(result);
4034
+ }
4035
+
4036
+ result.clan_id = response.clan_id;
4037
+ result.channel_id = response.channel_id;
4038
+ result.channel_canvases = response.channel_canvases;
4039
+ return Promise.resolve(result);
4040
+ });
4041
+ }
4042
+
4043
+ async getChannelCanvasDetail(
4044
+ session: Session,
4045
+ id:string,
4046
+ clanId?:string,
4047
+ channelId?:string,
4048
+ ): Promise<any> {
4049
+ if (
4050
+ this.autoRefreshSession &&
4051
+ session.refresh_token &&
4052
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4053
+ ) {
4054
+ await this.sessionRefresh(session);
4055
+ }
4056
+
4057
+ return this.apiClient
4058
+ .getChannelCanvasDetail(
4059
+ session.token,
4060
+ id,
4061
+ clanId,
4062
+ channelId,
4063
+ )
4064
+ .then((response: any) => {
4065
+ return Promise.resolve(response);
4066
+ });
4067
+ }
4068
+
4069
+ async editChannelCanvases(
4070
+ session: Session,
4071
+ request: ApiEditChannelCanvasRequest
4072
+ ): Promise<any> {
4073
+ if (
4074
+ this.autoRefreshSession &&
4075
+ session.refresh_token &&
4076
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4077
+ ) {
4078
+ await this.sessionRefresh(session);
4079
+ }
4080
+
4081
+ return this.apiClient
4082
+ .editChannelCanvases(session.token, request)
4083
+ .then((response: any) => {
4084
+ return Promise.resolve(response);
4085
+ });
4086
+ }
4001
4087
  }
package/dist/api.gen.d.ts CHANGED
@@ -311,6 +311,49 @@ export interface ApiChannelAttachment {
311
311
  export interface ApiChannelAttachmentList {
312
312
  attachments?: Array<ApiChannelAttachment>;
313
313
  }
314
+ /** */
315
+ export interface ApiChannelCanvasDetailResponse {
316
+ content?: string;
317
+ creator_id?: string;
318
+ editor_id?: string;
319
+ id?: string;
320
+ title?: string;
321
+ }
322
+ /** */
323
+ export interface ApiChannelCanvasItem {
324
+ id?: string;
325
+ title?: string;
326
+ }
327
+ /** */
328
+ export interface ApiChannelCanvasListResponse {
329
+ channel_canvases?: Array<ApiChannelCanvasItem>;
330
+ channel_id?: string;
331
+ clan_id?: string;
332
+ }
333
+ /** */
334
+ export interface ApiEditChannelCanvasRequest {
335
+ channel_id?: string;
336
+ clan_id?: string;
337
+ content?: string;
338
+ id?: string;
339
+ title?: string;
340
+ }
341
+ /** */
342
+ export interface ApiEditChannelCanvasRequest {
343
+ channel_id?: string;
344
+ clan_id?: string;
345
+ content?: string;
346
+ id?: string;
347
+ title?: string;
348
+ }
349
+ /** */
350
+ export interface ApiEditChannelCanvasResponse {
351
+ id?: string;
352
+ }
353
+ /** */
354
+ export interface ApiEditChannelCanvasResponse {
355
+ id?: string;
356
+ }
314
357
  /** A list of channel description, usually a result of a list operation. */
315
358
  export interface ApiChannelDescList {
316
359
  cacheable_cursor?: string;
@@ -412,8 +455,10 @@ export interface ApiChannelSettingItem {
412
455
  }
413
456
  /** */
414
457
  export interface ApiChannelSettingListResponse {
458
+ channel_count?: number;
415
459
  channel_setting_list?: Array<ApiChannelSettingItem>;
416
460
  clan_id?: string;
461
+ thread_count?: number;
417
462
  }
418
463
  /** A list of users belonging to a channel, along with their role. */
419
464
  export interface ApiChannelUserList {
@@ -1559,4 +1604,10 @@ export declare class MezonApi {
1559
1604
  /** disabled webhook */
1560
1605
  deleteWebhookById(bearerToken: string, id: string, options?: any): Promise<any>;
1561
1606
  buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
1607
+ /** Channel canvas editor */
1608
+ editChannelCanvases(bearerToken: string, body: ApiEditChannelCanvasRequest, options?: any): Promise<ApiEditChannelCanvasResponse>;
1609
+ /** */
1610
+ getChannelCanvasDetail(bearerToken: string, id: string, clanId?: string, channelId?: string, options?: any): Promise<ApiChannelCanvasDetailResponse>;
1611
+ /** */
1612
+ getChannelCanvasList(bearerToken: string, channelId: string, clanId?: string, limit?: number, page?: number, options?: any): Promise<ApiChannelCanvasListResponse>;
1562
1613
  }
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -580,4 +580,7 @@ export declare class Client {
580
580
  /** List Threads. */
581
581
  listThreadDescs(session: Session, channelId: string, limit?: number, state?: number, clanId?: string, threadId?: string): Promise<ApiChannelDescList>;
582
582
  getChannelSettingInClan(session: Session, clanId: string, parentId?: string, categoryId?: string, privateChannel?: number, active?: number, status?: number, type?: number, limit?: number, page?: number): Promise<any>;
583
+ getChannelCanvasList(session: Session, channelId: string, clanId?: string, limit?: number, page?: number): Promise<any>;
584
+ getChannelCanvasDetail(session: Session, id: string, clanId?: string, channelId?: string): Promise<any>;
585
+ editChannelCanvases(session: Session, request: ApiEditChannelCanvasRequest): Promise<any>;
583
586
  }
@@ -5696,6 +5696,96 @@ var MezonApi = class {
5696
5696
  }
5697
5697
  return fullPath;
5698
5698
  }
5699
+ /** Channel canvas editor */
5700
+ editChannelCanvases(bearerToken, body, options = {}) {
5701
+ if (body === null || body === void 0) {
5702
+ throw new Error("'body' is a required parameter but is null or undefined.");
5703
+ }
5704
+ const urlPath = "/v2/canvases/editor";
5705
+ const queryParams = /* @__PURE__ */ new Map();
5706
+ let bodyJson = "";
5707
+ bodyJson = JSON.stringify(body || {});
5708
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5709
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5710
+ if (bearerToken) {
5711
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5712
+ }
5713
+ return Promise.race([
5714
+ fetch(fullUrl, fetchOptions).then((response) => {
5715
+ if (response.status == 204) {
5716
+ return response;
5717
+ } else if (response.status >= 200 && response.status < 300) {
5718
+ return response.json();
5719
+ } else {
5720
+ throw response;
5721
+ }
5722
+ }),
5723
+ new Promise(
5724
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5725
+ )
5726
+ ]);
5727
+ }
5728
+ /** */
5729
+ getChannelCanvasDetail(bearerToken, id, clanId, channelId, options = {}) {
5730
+ if (id === null || id === void 0) {
5731
+ throw new Error("'id' is a required parameter but is null or undefined.");
5732
+ }
5733
+ const urlPath = "/v2/canvases/{id}".replace("{id}", encodeURIComponent(String(id)));
5734
+ const queryParams = /* @__PURE__ */ new Map();
5735
+ queryParams.set("clan_id", clanId);
5736
+ queryParams.set("channel_id", channelId);
5737
+ let bodyJson = "";
5738
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5739
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5740
+ if (bearerToken) {
5741
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5742
+ }
5743
+ return Promise.race([
5744
+ fetch(fullUrl, fetchOptions).then((response) => {
5745
+ if (response.status == 204) {
5746
+ return response;
5747
+ } else if (response.status >= 200 && response.status < 300) {
5748
+ return response.json();
5749
+ } else {
5750
+ throw response;
5751
+ }
5752
+ }),
5753
+ new Promise(
5754
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5755
+ )
5756
+ ]);
5757
+ }
5758
+ /** */
5759
+ getChannelCanvasList(bearerToken, channelId, clanId, limit, page, options = {}) {
5760
+ if (channelId === null || channelId === void 0) {
5761
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
5762
+ }
5763
+ const urlPath = "/v2/channel-canvases/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
5764
+ const queryParams = /* @__PURE__ */ new Map();
5765
+ queryParams.set("clan_id", clanId);
5766
+ queryParams.set("limit", limit);
5767
+ queryParams.set("page", page);
5768
+ let bodyJson = "";
5769
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5770
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5771
+ if (bearerToken) {
5772
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5773
+ }
5774
+ return Promise.race([
5775
+ fetch(fullUrl, fetchOptions).then((response) => {
5776
+ if (response.status == 204) {
5777
+ return response;
5778
+ } else if (response.status >= 200 && response.status < 300) {
5779
+ return response.json();
5780
+ } else {
5781
+ throw response;
5782
+ }
5783
+ }),
5784
+ new Promise(
5785
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5786
+ )
5787
+ ]);
5788
+ }
5699
5789
  };
5700
5790
 
5701
5791
  // session.ts
@@ -8586,4 +8676,54 @@ var Client = class {
8586
8676
  });
8587
8677
  });
8588
8678
  }
8679
+ getChannelCanvasList(session, channelId, clanId, limit, page) {
8680
+ return __async(this, null, function* () {
8681
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8682
+ yield this.sessionRefresh(session);
8683
+ }
8684
+ return this.apiClient.getChannelCanvasList(
8685
+ session.token,
8686
+ channelId,
8687
+ clanId,
8688
+ limit,
8689
+ page
8690
+ ).then((response) => {
8691
+ var result = {
8692
+ channel_canvases: []
8693
+ };
8694
+ if (response.channel_canvases == null) {
8695
+ return Promise.resolve(result);
8696
+ }
8697
+ result.clan_id = response.clan_id;
8698
+ result.channel_id = response.channel_id;
8699
+ result.channel_canvases = response.channel_canvases;
8700
+ return Promise.resolve(result);
8701
+ });
8702
+ });
8703
+ }
8704
+ getChannelCanvasDetail(session, id, clanId, channelId) {
8705
+ return __async(this, null, function* () {
8706
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8707
+ yield this.sessionRefresh(session);
8708
+ }
8709
+ return this.apiClient.getChannelCanvasDetail(
8710
+ session.token,
8711
+ id,
8712
+ clanId,
8713
+ channelId
8714
+ ).then((response) => {
8715
+ return Promise.resolve(response);
8716
+ });
8717
+ });
8718
+ }
8719
+ editChannelCanvases(session, request) {
8720
+ return __async(this, null, function* () {
8721
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8722
+ yield this.sessionRefresh(session);
8723
+ }
8724
+ return this.apiClient.editChannelCanvases(session.token, request).then((response) => {
8725
+ return Promise.resolve(response);
8726
+ });
8727
+ });
8728
+ }
8589
8729
  };
@@ -5667,6 +5667,96 @@ var MezonApi = class {
5667
5667
  }
5668
5668
  return fullPath;
5669
5669
  }
5670
+ /** Channel canvas editor */
5671
+ editChannelCanvases(bearerToken, body, options = {}) {
5672
+ if (body === null || body === void 0) {
5673
+ throw new Error("'body' is a required parameter but is null or undefined.");
5674
+ }
5675
+ const urlPath = "/v2/canvases/editor";
5676
+ const queryParams = /* @__PURE__ */ new Map();
5677
+ let bodyJson = "";
5678
+ bodyJson = JSON.stringify(body || {});
5679
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5680
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5681
+ if (bearerToken) {
5682
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5683
+ }
5684
+ return Promise.race([
5685
+ fetch(fullUrl, fetchOptions).then((response) => {
5686
+ if (response.status == 204) {
5687
+ return response;
5688
+ } else if (response.status >= 200 && response.status < 300) {
5689
+ return response.json();
5690
+ } else {
5691
+ throw response;
5692
+ }
5693
+ }),
5694
+ new Promise(
5695
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5696
+ )
5697
+ ]);
5698
+ }
5699
+ /** */
5700
+ getChannelCanvasDetail(bearerToken, id, clanId, channelId, options = {}) {
5701
+ if (id === null || id === void 0) {
5702
+ throw new Error("'id' is a required parameter but is null or undefined.");
5703
+ }
5704
+ const urlPath = "/v2/canvases/{id}".replace("{id}", encodeURIComponent(String(id)));
5705
+ const queryParams = /* @__PURE__ */ new Map();
5706
+ queryParams.set("clan_id", clanId);
5707
+ queryParams.set("channel_id", channelId);
5708
+ let bodyJson = "";
5709
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5710
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5711
+ if (bearerToken) {
5712
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5713
+ }
5714
+ return Promise.race([
5715
+ fetch(fullUrl, fetchOptions).then((response) => {
5716
+ if (response.status == 204) {
5717
+ return response;
5718
+ } else if (response.status >= 200 && response.status < 300) {
5719
+ return response.json();
5720
+ } else {
5721
+ throw response;
5722
+ }
5723
+ }),
5724
+ new Promise(
5725
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5726
+ )
5727
+ ]);
5728
+ }
5729
+ /** */
5730
+ getChannelCanvasList(bearerToken, channelId, clanId, limit, page, options = {}) {
5731
+ if (channelId === null || channelId === void 0) {
5732
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
5733
+ }
5734
+ const urlPath = "/v2/channel-canvases/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
5735
+ const queryParams = /* @__PURE__ */ new Map();
5736
+ queryParams.set("clan_id", clanId);
5737
+ queryParams.set("limit", limit);
5738
+ queryParams.set("page", page);
5739
+ let bodyJson = "";
5740
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5741
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5742
+ if (bearerToken) {
5743
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5744
+ }
5745
+ return Promise.race([
5746
+ fetch(fullUrl, fetchOptions).then((response) => {
5747
+ if (response.status == 204) {
5748
+ return response;
5749
+ } else if (response.status >= 200 && response.status < 300) {
5750
+ return response.json();
5751
+ } else {
5752
+ throw response;
5753
+ }
5754
+ }),
5755
+ new Promise(
5756
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5757
+ )
5758
+ ]);
5759
+ }
5670
5760
  };
5671
5761
 
5672
5762
  // session.ts
@@ -8557,6 +8647,56 @@ var Client = class {
8557
8647
  });
8558
8648
  });
8559
8649
  }
8650
+ getChannelCanvasList(session, channelId, clanId, limit, page) {
8651
+ return __async(this, null, function* () {
8652
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8653
+ yield this.sessionRefresh(session);
8654
+ }
8655
+ return this.apiClient.getChannelCanvasList(
8656
+ session.token,
8657
+ channelId,
8658
+ clanId,
8659
+ limit,
8660
+ page
8661
+ ).then((response) => {
8662
+ var result = {
8663
+ channel_canvases: []
8664
+ };
8665
+ if (response.channel_canvases == null) {
8666
+ return Promise.resolve(result);
8667
+ }
8668
+ result.clan_id = response.clan_id;
8669
+ result.channel_id = response.channel_id;
8670
+ result.channel_canvases = response.channel_canvases;
8671
+ return Promise.resolve(result);
8672
+ });
8673
+ });
8674
+ }
8675
+ getChannelCanvasDetail(session, id, clanId, channelId) {
8676
+ return __async(this, null, function* () {
8677
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8678
+ yield this.sessionRefresh(session);
8679
+ }
8680
+ return this.apiClient.getChannelCanvasDetail(
8681
+ session.token,
8682
+ id,
8683
+ clanId,
8684
+ channelId
8685
+ ).then((response) => {
8686
+ return Promise.resolve(response);
8687
+ });
8688
+ });
8689
+ }
8690
+ editChannelCanvases(session, request) {
8691
+ return __async(this, null, function* () {
8692
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8693
+ yield this.sessionRefresh(session);
8694
+ }
8695
+ return this.apiClient.editChannelCanvases(session.token, request).then((response) => {
8696
+ return Promise.resolve(response);
8697
+ });
8698
+ });
8699
+ }
8560
8700
  };
8561
8701
  export {
8562
8702
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.34",
4
+ "version": "2.9.36",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"