mezon-js 2.9.33 → 2.9.35

Sign up to get free protection for your applications and to get access to all the features.
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.
@@ -7994,6 +8067,7 @@ export class MezonApi {
7994
8067
  limit?:number,
7995
8068
  state?:number,
7996
8069
  clanId?:string,
8070
+ threadId?:string,
7997
8071
  options: any = {}): Promise<ApiChannelDescList> {
7998
8072
 
7999
8073
  if (channelId === null || channelId === undefined) {
@@ -8005,6 +8079,7 @@ export class MezonApi {
8005
8079
  queryParams.set("limit", limit);
8006
8080
  queryParams.set("state", state);
8007
8081
  queryParams.set("clan_id", clanId);
8082
+ queryParams.set("thread_id", threadId);
8008
8083
 
8009
8084
  let bodyJson : string = "";
8010
8085
 
@@ -8539,4 +8614,121 @@ export class MezonApi {
8539
8614
 
8540
8615
  return fullPath;
8541
8616
  }
8617
+
8618
+ /** Channel canvas editor */
8619
+ editChannelCanvases(bearerToken: string,
8620
+ body:ApiEditChannelCanvasRequest,
8621
+ options: any = {}): Promise<ApiEditChannelCanvasResponse> {
8622
+
8623
+ if (body === null || body === undefined) {
8624
+ throw new Error("'body' is a required parameter but is null or undefined.");
8625
+ }
8626
+ const urlPath = "/v2/canvases/editor";
8627
+ const queryParams = new Map<string, any>();
8628
+
8629
+ let bodyJson : string = "";
8630
+ bodyJson = JSON.stringify(body || {});
8631
+
8632
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8633
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
8634
+ if (bearerToken) {
8635
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8636
+ }
8637
+
8638
+ return Promise.race([
8639
+ fetch(fullUrl, fetchOptions).then((response) => {
8640
+ if (response.status == 204) {
8641
+ return response;
8642
+ } else if (response.status >= 200 && response.status < 300) {
8643
+ return response.json();
8644
+ } else {
8645
+ throw response;
8646
+ }
8647
+ }),
8648
+ new Promise((_, reject) =>
8649
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8650
+ ),
8651
+ ]);
8652
+ }
8653
+
8654
+ /** */
8655
+ getChannelCanvasDetail(bearerToken: string,
8656
+ id:string,
8657
+ clanId?:string,
8658
+ channelId?:string,
8659
+ options: any = {}): Promise<ApiChannelCanvasDetailResponse> {
8660
+
8661
+ if (id === null || id === undefined) {
8662
+ throw new Error("'id' is a required parameter but is null or undefined.");
8663
+ }
8664
+ const urlPath = "/v2/canvases/{id}"
8665
+ .replace("{id}", encodeURIComponent(String(id)));
8666
+ const queryParams = new Map<string, any>();
8667
+ queryParams.set("clan_id", clanId);
8668
+ queryParams.set("channel_id", channelId);
8669
+
8670
+ let bodyJson : string = "";
8671
+
8672
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8673
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8674
+ if (bearerToken) {
8675
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8676
+ }
8677
+
8678
+ return Promise.race([
8679
+ fetch(fullUrl, fetchOptions).then((response) => {
8680
+ if (response.status == 204) {
8681
+ return response;
8682
+ } else if (response.status >= 200 && response.status < 300) {
8683
+ return response.json();
8684
+ } else {
8685
+ throw response;
8686
+ }
8687
+ }),
8688
+ new Promise((_, reject) =>
8689
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8690
+ ),
8691
+ ]);
8692
+ }
8693
+ /** */
8694
+ getChannelCanvasList(bearerToken: string,
8695
+ channelId:string,
8696
+ clanId?:string,
8697
+ limit?:number,
8698
+ page?:number,
8699
+ options: any = {}): Promise<ApiChannelCanvasListResponse> {
8700
+
8701
+ if (channelId === null || channelId === undefined) {
8702
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
8703
+ }
8704
+ const urlPath = "/v2/channel-canvases/{channelId}"
8705
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
8706
+ const queryParams = new Map<string, any>();
8707
+ queryParams.set("clan_id", clanId);
8708
+ queryParams.set("limit", limit);
8709
+ queryParams.set("page", page);
8710
+
8711
+ let bodyJson : string = "";
8712
+
8713
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8714
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8715
+ if (bearerToken) {
8716
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8717
+ }
8718
+
8719
+ return Promise.race([
8720
+ fetch(fullUrl, fetchOptions).then((response) => {
8721
+ if (response.status == 204) {
8722
+ return response;
8723
+ } else if (response.status >= 200 && response.status < 300) {
8724
+ return response.json();
8725
+ } else {
8726
+ throw response;
8727
+ }
8728
+ }),
8729
+ new Promise((_, reject) =>
8730
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8731
+ ),
8732
+ ]);
8733
+ }
8542
8734
  }
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";
@@ -3928,6 +3930,7 @@ export class Client {
3928
3930
  limit?:number,
3929
3931
  state?:number,
3930
3932
  clanId?:string,
3933
+ threadId?: string,
3931
3934
  ): Promise<ApiChannelDescList> {
3932
3935
  if (
3933
3936
  this.autoRefreshSession &&
@@ -3943,7 +3946,8 @@ export class Client {
3943
3946
  channelId,
3944
3947
  limit,
3945
3948
  state,
3946
- clanId
3949
+ clanId,
3950
+ threadId
3947
3951
  )
3948
3952
  .then((response: ApiChannelDescList) => {
3949
3953
  var result: ApiChannelDescList = {
@@ -3996,4 +4000,88 @@ export class Client {
3996
4000
  return Promise.resolve(response);
3997
4001
  });
3998
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
+ }
3999
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;
@@ -1533,7 +1576,7 @@ export declare class MezonApi {
1533
1576
  /** Update a system messages. */
1534
1577
  updateSystemMessage(bearerToken: string, clanId: string, body: MezonUpdateSystemMessageBody, options?: any): Promise<any>;
1535
1578
  /** List user channels */
1536
- listThreadDescs(bearerToken: string, channelId: string, limit?: number, state?: number, clanId?: string, options?: any): Promise<ApiChannelDescList>;
1579
+ listThreadDescs(bearerToken: string, channelId: string, limit?: number, state?: number, clanId?: string, threadId?: string, options?: any): Promise<ApiChannelDescList>;
1537
1580
  /** Update fields in a given category. */
1538
1581
  updateCategory(bearerToken: string, clanId: string, body: MezonUpdateCategoryBody, options?: any): Promise<any>;
1539
1582
  /** Update channel private. */
@@ -1559,4 +1602,10 @@ export declare class MezonApi {
1559
1602
  /** disabled webhook */
1560
1603
  deleteWebhookById(bearerToken: string, id: string, options?: any): Promise<any>;
1561
1604
  buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
1605
+ /** Channel canvas editor */
1606
+ editChannelCanvases(bearerToken: string, body: ApiEditChannelCanvasRequest, options?: any): Promise<ApiEditChannelCanvasResponse>;
1607
+ /** */
1608
+ getChannelCanvasDetail(bearerToken: string, id: string, clanId?: string, channelId?: string, options?: any): Promise<ApiChannelCanvasDetailResponse>;
1609
+ /** */
1610
+ getChannelCanvasList(bearerToken: string, channelId: string, clanId?: string, limit?: number, page?: number, options?: any): Promise<ApiChannelCanvasListResponse>;
1562
1611
  }
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";
@@ -578,6 +578,9 @@ export declare class Client {
578
578
  getPermissionByRoleIdChannelId(session: Session, roleId?: string, channelId?: string, userId?: string): Promise<ApiPermissionRoleChannelListEventResponse>;
579
579
  markAsRead(session: Session, request: ApiMarkAsReadRequest): Promise<any>;
580
580
  /** List Threads. */
581
- listThreadDescs(session: Session, channelId: string, limit?: number, state?: number, clanId?: string): Promise<ApiChannelDescList>;
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
  }
@@ -5266,7 +5266,7 @@ var MezonApi = class {
5266
5266
  ]);
5267
5267
  }
5268
5268
  /** List user channels */
5269
- listThreadDescs(bearerToken, channelId, limit, state, clanId, options = {}) {
5269
+ listThreadDescs(bearerToken, channelId, limit, state, clanId, threadId, options = {}) {
5270
5270
  if (channelId === null || channelId === void 0) {
5271
5271
  throw new Error("'channelId' is a required parameter but is null or undefined.");
5272
5272
  }
@@ -5275,6 +5275,7 @@ var MezonApi = class {
5275
5275
  queryParams.set("limit", limit);
5276
5276
  queryParams.set("state", state);
5277
5277
  queryParams.set("clan_id", clanId);
5278
+ queryParams.set("thread_id", threadId);
5278
5279
  let bodyJson = "";
5279
5280
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5280
5281
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -5695,6 +5696,96 @@ var MezonApi = class {
5695
5696
  }
5696
5697
  return fullPath;
5697
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
+ }
5698
5789
  };
5699
5790
 
5700
5791
  // session.ts
@@ -8540,7 +8631,7 @@ var Client = class {
8540
8631
  });
8541
8632
  }
8542
8633
  /** List Threads. */
8543
- listThreadDescs(session, channelId, limit, state, clanId) {
8634
+ listThreadDescs(session, channelId, limit, state, clanId, threadId) {
8544
8635
  return __async(this, null, function* () {
8545
8636
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8546
8637
  yield this.sessionRefresh(session);
@@ -8550,7 +8641,8 @@ var Client = class {
8550
8641
  channelId,
8551
8642
  limit,
8552
8643
  state,
8553
- clanId
8644
+ clanId,
8645
+ threadId
8554
8646
  ).then((response) => {
8555
8647
  var result = {
8556
8648
  channeldesc: []
@@ -8584,4 +8676,54 @@ var Client = class {
8584
8676
  });
8585
8677
  });
8586
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
+ }
8587
8729
  };
@@ -5237,7 +5237,7 @@ var MezonApi = class {
5237
5237
  ]);
5238
5238
  }
5239
5239
  /** List user channels */
5240
- listThreadDescs(bearerToken, channelId, limit, state, clanId, options = {}) {
5240
+ listThreadDescs(bearerToken, channelId, limit, state, clanId, threadId, options = {}) {
5241
5241
  if (channelId === null || channelId === void 0) {
5242
5242
  throw new Error("'channelId' is a required parameter but is null or undefined.");
5243
5243
  }
@@ -5246,6 +5246,7 @@ var MezonApi = class {
5246
5246
  queryParams.set("limit", limit);
5247
5247
  queryParams.set("state", state);
5248
5248
  queryParams.set("clan_id", clanId);
5249
+ queryParams.set("thread_id", threadId);
5249
5250
  let bodyJson = "";
5250
5251
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5251
5252
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -5666,6 +5667,96 @@ var MezonApi = class {
5666
5667
  }
5667
5668
  return fullPath;
5668
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
+ }
5669
5760
  };
5670
5761
 
5671
5762
  // session.ts
@@ -8511,7 +8602,7 @@ var Client = class {
8511
8602
  });
8512
8603
  }
8513
8604
  /** List Threads. */
8514
- listThreadDescs(session, channelId, limit, state, clanId) {
8605
+ listThreadDescs(session, channelId, limit, state, clanId, threadId) {
8515
8606
  return __async(this, null, function* () {
8516
8607
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8517
8608
  yield this.sessionRefresh(session);
@@ -8521,7 +8612,8 @@ var Client = class {
8521
8612
  channelId,
8522
8613
  limit,
8523
8614
  state,
8524
- clanId
8615
+ clanId,
8616
+ threadId
8525
8617
  ).then((response) => {
8526
8618
  var result = {
8527
8619
  channeldesc: []
@@ -8555,6 +8647,56 @@ var Client = class {
8555
8647
  });
8556
8648
  });
8557
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
+ }
8558
8700
  };
8559
8701
  export {
8560
8702
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.33",
4
+ "version": "2.9.35",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"