mezon-js 2.9.40 → 2.9.42

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
@@ -383,6 +383,20 @@ export interface ApiAccountSteam {
383
383
  vars?: Record<string, string>;
384
384
  }
385
385
 
386
+ /** */
387
+ export interface ApiAddFavoriteChannelRequest {
388
+ //
389
+ channel_id?: string;
390
+ //
391
+ clan_id?: string;
392
+ }
393
+
394
+ /** */
395
+ export interface ApiAddFavoriteChannelResponse {
396
+ //
397
+ channel_id?: string;
398
+ }
399
+
386
400
  /** Add a role for channel. */
387
401
  export interface ApiAddRoleChannelDescRequest {
388
402
  //
@@ -539,6 +553,8 @@ export interface ApiChannelCanvasDetailResponse {
539
553
  //
540
554
  id?: string;
541
555
  //
556
+ is_default?: boolean;
557
+ //
542
558
  title?: string;
543
559
  }
544
560
 
@@ -547,6 +563,8 @@ export interface ApiChannelCanvasItem {
547
563
  //
548
564
  id?: string;
549
565
  //
566
+ is_default?: boolean;
567
+ //
550
568
  title?: string;
551
569
  }
552
570
 
@@ -571,30 +589,11 @@ export interface ApiEditChannelCanvasRequest {
571
589
  //
572
590
  id?: string;
573
591
  //
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;
592
+ is_default?: boolean;
587
593
  //
588
594
  title?: string;
589
595
  }
590
596
 
591
- /** */
592
- export interface ApiEditChannelCanvasResponse {
593
- //
594
- id?: string;
595
- }
596
-
597
-
598
597
  /** */
599
598
  export interface ApiEditChannelCanvasResponse {
600
599
  //
@@ -1178,6 +1177,12 @@ export interface ApiEventManagement {
1178
1177
  create_time?: string;
1179
1178
  }
1180
1179
 
1180
+ /** */
1181
+ export interface ApiListFavoriteChannelResponse {
1182
+ //
1183
+ channel_ids?: Array<string>;
1184
+ }
1185
+
1181
1186
  /** */
1182
1187
  export interface ApiFilterParam {
1183
1188
  //
@@ -3879,11 +3884,10 @@ export class MezonApi {
3879
3884
  }
3880
3885
 
3881
3886
  /** */
3882
- updateCategoryOrder(
3883
- bearerToken: string,
3884
- body: ApiUpdateCategoryOrderRequest,
3885
- options: any = {}
3886
- ): Promise<any> {
3887
+ updateCategoryOrder(bearerToken: string,
3888
+ body:ApiUpdateCategoryOrderRequest,
3889
+ options: any = {}): Promise<any> {
3890
+
3887
3891
  if (body === null || body === undefined) {
3888
3892
  throw new Error(
3889
3893
  "'body' is a required parameter but is null or undefined."
@@ -3976,7 +3980,115 @@ export class MezonApi {
3976
3980
  const queryParams = new Map<string, any>();
3977
3981
  queryParams.set("clan_id", clanId);
3978
3982
 
3979
- let bodyJson: string = "";
3983
+ let bodyJson : string = "";
3984
+
3985
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3986
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3987
+ if (bearerToken) {
3988
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3989
+ }
3990
+
3991
+ return Promise.race([
3992
+ fetch(fullUrl, fetchOptions).then((response) => {
3993
+ if (response.status == 204) {
3994
+ return response;
3995
+ } else if (response.status >= 200 && response.status < 300) {
3996
+ return response.json();
3997
+ } else {
3998
+ throw response;
3999
+ }
4000
+ }),
4001
+ new Promise((_, reject) =>
4002
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4003
+ ),
4004
+ ]);
4005
+ }
4006
+
4007
+ /** */
4008
+ addChannelFavorite(bearerToken: string,
4009
+ body:ApiAddFavoriteChannelRequest,
4010
+ options: any = {}): Promise<any> {
4011
+
4012
+ if (body === null || body === undefined) {
4013
+ throw new Error("'body' is a required parameter but is null or undefined.");
4014
+ }
4015
+ const urlPath = "/v2/channel/favorite";
4016
+ const queryParams = new Map<string, any>();
4017
+
4018
+ let bodyJson : string = "";
4019
+ bodyJson = JSON.stringify(body || {});
4020
+
4021
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4022
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4023
+ if (bearerToken) {
4024
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4025
+ }
4026
+
4027
+ return Promise.race([
4028
+ fetch(fullUrl, fetchOptions).then((response) => {
4029
+ if (response.status == 204) {
4030
+ return response;
4031
+ } else if (response.status >= 200 && response.status < 300) {
4032
+ return response.json();
4033
+ } else {
4034
+ throw response;
4035
+ }
4036
+ }),
4037
+ new Promise((_, reject) =>
4038
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4039
+ ),
4040
+ ]);
4041
+ }
4042
+
4043
+ /** */
4044
+ removeChannelFavorite(bearerToken: string,
4045
+ channelId:string,
4046
+ options: any = {}): Promise<any> {
4047
+
4048
+ if (channelId === null || channelId === undefined) {
4049
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
4050
+ }
4051
+ const urlPath = "/v2/channel/favorite/{channelId}"
4052
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
4053
+ const queryParams = new Map<string, any>();
4054
+
4055
+ let bodyJson : string = "";
4056
+
4057
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4058
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
4059
+ if (bearerToken) {
4060
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4061
+ }
4062
+
4063
+ return Promise.race([
4064
+ fetch(fullUrl, fetchOptions).then((response) => {
4065
+ if (response.status == 204) {
4066
+ return response;
4067
+ } else if (response.status >= 200 && response.status < 300) {
4068
+ return response.json();
4069
+ } else {
4070
+ throw response;
4071
+ }
4072
+ }),
4073
+ new Promise((_, reject) =>
4074
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4075
+ ),
4076
+ ]);
4077
+ }
4078
+
4079
+ /** */
4080
+ getListFavoriteChannel(bearerToken: string,
4081
+ clanId:string,
4082
+ options: any = {}): Promise<ApiListFavoriteChannelResponse> {
4083
+
4084
+ if (clanId === null || clanId === undefined) {
4085
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
4086
+ }
4087
+ const urlPath = "/v2/channel/favorite/{clanId}"
4088
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
4089
+ const queryParams = new Map<string, any>();
4090
+
4091
+ let bodyJson : string = "";
3980
4092
 
3981
4093
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3982
4094
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -8652,24 +8764,27 @@ export class MezonApi {
8652
8764
  return fullPath;
8653
8765
  }
8654
8766
 
8655
- /** Channel canvas editor */
8656
- editChannelCanvases(bearerToken: string,
8657
- body:ApiEditChannelCanvasRequest,
8658
- options: any = {}): Promise<ApiEditChannelCanvasResponse> {
8659
-
8767
+ /** Channel canvas editor */
8768
+ editChannelCanvases(
8769
+ bearerToken: string,
8770
+ body: ApiEditChannelCanvasRequest,
8771
+ options: any = {}
8772
+ ): Promise<ApiEditChannelCanvasResponse> {
8660
8773
  if (body === null || body === undefined) {
8661
- throw new Error("'body' is a required parameter but is null or undefined.");
8774
+ throw new Error(
8775
+ "'body' is a required parameter but is null or undefined."
8776
+ );
8662
8777
  }
8663
8778
  const urlPath = "/v2/canvases/editor";
8664
8779
  const queryParams = new Map<string, any>();
8665
8780
 
8666
- let bodyJson : string = "";
8781
+ let bodyJson: string = "";
8667
8782
  bodyJson = JSON.stringify(body || {});
8668
8783
 
8669
8784
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8670
8785
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
8671
8786
  if (bearerToken) {
8672
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8787
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8673
8788
  }
8674
8789
 
8675
8790
  return Promise.race([
@@ -8686,30 +8801,33 @@ export class MezonApi {
8686
8801
  setTimeout(reject, this.timeoutMs, "Request timed out.")
8687
8802
  ),
8688
8803
  ]);
8689
- }
8804
+ }
8690
8805
 
8691
8806
  /** */
8692
- getChannelCanvasDetail(bearerToken: string,
8693
- id:string,
8694
- clanId?:string,
8695
- channelId?:string,
8696
- options: any = {}): Promise<ApiChannelCanvasDetailResponse> {
8697
-
8807
+ getChannelCanvasDetail(
8808
+ bearerToken: string,
8809
+ id: string,
8810
+ clanId?: string,
8811
+ channelId?: string,
8812
+ options: any = {}
8813
+ ): Promise<ApiChannelCanvasDetailResponse> {
8698
8814
  if (id === null || id === undefined) {
8699
8815
  throw new Error("'id' is a required parameter but is null or undefined.");
8700
8816
  }
8701
- const urlPath = "/v2/canvases/{id}"
8702
- .replace("{id}", encodeURIComponent(String(id)));
8817
+ const urlPath = "/v2/canvases/{id}".replace(
8818
+ "{id}",
8819
+ encodeURIComponent(String(id))
8820
+ );
8703
8821
  const queryParams = new Map<string, any>();
8704
8822
  queryParams.set("clan_id", clanId);
8705
8823
  queryParams.set("channel_id", channelId);
8706
8824
 
8707
- let bodyJson : string = "";
8825
+ let bodyJson: string = "";
8708
8826
 
8709
8827
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8710
8828
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8711
8829
  if (bearerToken) {
8712
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8830
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8713
8831
  }
8714
8832
 
8715
8833
  return Promise.race([
@@ -8726,31 +8844,82 @@ export class MezonApi {
8726
8844
  setTimeout(reject, this.timeoutMs, "Request timed out.")
8727
8845
  ),
8728
8846
  ]);
8729
- }
8847
+ }
8848
+
8730
8849
  /** */
8731
- getChannelCanvasList(bearerToken: string,
8732
- channelId:string,
8733
- clanId?:string,
8734
- limit?:number,
8735
- page?:number,
8736
- options: any = {}): Promise<ApiChannelCanvasListResponse> {
8737
-
8850
+ getChannelCanvasList(
8851
+ bearerToken: string,
8852
+ channelId: string,
8853
+ clanId?: string,
8854
+ limit?: number,
8855
+ page?: number,
8856
+ options: any = {}
8857
+ ): Promise<ApiChannelCanvasListResponse> {
8738
8858
  if (channelId === null || channelId === undefined) {
8739
- throw new Error("'channelId' is a required parameter but is null or undefined.");
8859
+ throw new Error(
8860
+ "'channelId' is a required parameter but is null or undefined."
8861
+ );
8740
8862
  }
8741
- const urlPath = "/v2/channel-canvases/{channelId}"
8742
- .replace("{channelId}", encodeURIComponent(String(channelId)));
8863
+ const urlPath = "/v2/channel_canvases/{channelId}".replace(
8864
+ "{channelId}",
8865
+ encodeURIComponent(String(channelId))
8866
+ );
8743
8867
  const queryParams = new Map<string, any>();
8744
8868
  queryParams.set("clan_id", clanId);
8745
8869
  queryParams.set("limit", limit);
8746
8870
  queryParams.set("page", page);
8747
8871
 
8748
- let bodyJson : string = "";
8872
+ let bodyJson: string = "";
8749
8873
 
8750
8874
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8751
8875
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8752
8876
  if (bearerToken) {
8753
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8877
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8878
+ }
8879
+
8880
+ return Promise.race([
8881
+ fetch(fullUrl, fetchOptions).then((response) => {
8882
+ if (response.status == 204) {
8883
+ return response;
8884
+ } else if (response.status >= 200 && response.status < 300) {
8885
+ return response.json();
8886
+ } else {
8887
+ throw response;
8888
+ }
8889
+ }),
8890
+ new Promise((_, reject) =>
8891
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8892
+ ),
8893
+ ]);
8894
+ }
8895
+
8896
+ /** */
8897
+ deleteChannelCanvas(
8898
+ bearerToken: string,
8899
+ canvasId: string,
8900
+ clanId?: string,
8901
+ channelId?: string,
8902
+ options: any = {}
8903
+ ): Promise<any> {
8904
+ if (canvasId === null || canvasId === undefined) {
8905
+ throw new Error(
8906
+ "'canvasId' is a required parameter but is null or undefined."
8907
+ );
8908
+ }
8909
+ const urlPath = "/v2/canvases/{canvasId}".replace(
8910
+ "{canvasId}",
8911
+ encodeURIComponent(String(canvasId))
8912
+ );
8913
+ const queryParams = new Map<string, any>();
8914
+ queryParams.set("clan_id", clanId);
8915
+ queryParams.set("channel_id", channelId);
8916
+
8917
+ let bodyJson: string = "";
8918
+
8919
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8920
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
8921
+ if (bearerToken) {
8922
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8754
8923
  }
8755
8924
 
8756
8925
  return Promise.race([
package/client.ts CHANGED
@@ -124,6 +124,7 @@ import {
124
124
  ApiChannelCanvasListResponse,
125
125
  ApiEditChannelCanvasRequest,
126
126
  ApiChannelSettingListResponse,
127
+ ApiAddFavoriteChannelResponse,
127
128
  } from "./api.gen";
128
129
 
129
130
  import { Session } from "./session";
@@ -4083,4 +4084,88 @@ export class Client {
4083
4084
  return Promise.resolve(response);
4084
4085
  });
4085
4086
  }
4087
+
4088
+ //** */
4089
+ async deleteChannelCanvas(
4090
+ session: Session,
4091
+ canvasId: string,
4092
+ clanId?: string,
4093
+ channelId?: string
4094
+ ): Promise<any> {
4095
+ if (
4096
+ this.autoRefreshSession &&
4097
+ session.refresh_token &&
4098
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4099
+ ) {
4100
+ await this.sessionRefresh(session);
4101
+ }
4102
+
4103
+ return this.apiClient
4104
+ .deleteChannelCanvas(session.token, canvasId, clanId, channelId)
4105
+ .then((response: any) => {
4106
+ return response !== undefined;
4107
+ });
4108
+ }
4109
+
4110
+
4111
+ async addFavoriteChannel(
4112
+ session: Session,
4113
+ channelId: string,
4114
+ clanId: string,
4115
+ ): Promise<ApiAddFavoriteChannelResponse> {
4116
+ if (
4117
+ this.autoRefreshSession &&
4118
+ session.refresh_token &&
4119
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4120
+ ) {
4121
+ await this.sessionRefresh(session);
4122
+ }
4123
+
4124
+ return this.apiClient
4125
+ .addChannelFavorite(session.token, {
4126
+ channel_id: channelId,
4127
+ clan_id: clanId
4128
+ })
4129
+ .then((response: ApiAddFavoriteChannelResponse) => {
4130
+ return response;
4131
+ });
4132
+ }
4133
+
4134
+ async removeFavoriteChannel(
4135
+ session: Session,
4136
+ channelId: string
4137
+ ): Promise<any> {
4138
+ if (
4139
+ this.autoRefreshSession &&
4140
+ session.refresh_token &&
4141
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4142
+ ) {
4143
+ await this.sessionRefresh(session);
4144
+ }
4145
+
4146
+ return this.apiClient
4147
+ .removeChannelFavorite(session.token, channelId)
4148
+ .then((response: any) => {
4149
+ return response;
4150
+ });
4151
+ }
4152
+
4153
+ async getListFavoriteChannel(
4154
+ session: Session,
4155
+ clanId: string
4156
+ ): Promise<any> {
4157
+ if (
4158
+ this.autoRefreshSession &&
4159
+ session.refresh_token &&
4160
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4161
+ ) {
4162
+ await this.sessionRefresh(session);
4163
+ }
4164
+
4165
+ return this.apiClient
4166
+ .getListFavoriteChannel(session.token, clanId)
4167
+ .then((response: any) => {
4168
+ return response;
4169
+ });
4170
+ }
4086
4171
  }
package/dist/api.gen.d.ts CHANGED
@@ -225,6 +225,15 @@ export interface ApiAccountSteam {
225
225
  token?: string;
226
226
  vars?: Record<string, string>;
227
227
  }
228
+ /** */
229
+ export interface ApiAddFavoriteChannelRequest {
230
+ channel_id?: string;
231
+ clan_id?: string;
232
+ }
233
+ /** */
234
+ export interface ApiAddFavoriteChannelResponse {
235
+ channel_id?: string;
236
+ }
228
237
  /** Add a role for channel. */
229
238
  export interface ApiAddRoleChannelDescRequest {
230
239
  channel_id?: string;
@@ -317,11 +326,13 @@ export interface ApiChannelCanvasDetailResponse {
317
326
  creator_id?: string;
318
327
  editor_id?: string;
319
328
  id?: string;
329
+ is_default?: boolean;
320
330
  title?: string;
321
331
  }
322
332
  /** */
323
333
  export interface ApiChannelCanvasItem {
324
334
  id?: string;
335
+ is_default?: boolean;
325
336
  title?: string;
326
337
  }
327
338
  /** */
@@ -336,24 +347,13 @@ export interface ApiEditChannelCanvasRequest {
336
347
  clan_id?: string;
337
348
  content?: string;
338
349
  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;
350
+ is_default?: boolean;
347
351
  title?: string;
348
352
  }
349
353
  /** */
350
354
  export interface ApiEditChannelCanvasResponse {
351
355
  id?: string;
352
356
  }
353
- /** */
354
- export interface ApiEditChannelCanvasResponse {
355
- id?: string;
356
- }
357
357
  /** A list of channel description, usually a result of a list operation. */
358
358
  export interface ApiChannelDescList {
359
359
  cacheable_cursor?: string;
@@ -679,6 +679,10 @@ export interface ApiEventManagement {
679
679
  create_time?: string;
680
680
  }
681
681
  /** */
682
+ export interface ApiListFavoriteChannelResponse {
683
+ channel_ids?: Array<string>;
684
+ }
685
+ /** */
682
686
  export interface ApiFilterParam {
683
687
  field_name?: string;
684
688
  field_value?: string;
@@ -1393,6 +1397,12 @@ export declare class MezonApi {
1393
1397
  listCategoryDescs(bearerToken: string, clanId: string, creatorId?: string, categoryName?: string, categoryId?: string, categoryOrder?: number, options?: any): Promise<ApiCategoryDescList>;
1394
1398
  /** List channel apps. */
1395
1399
  listChannelApps(bearerToken: string, clanId?: string, options?: any): Promise<ApiListChannelAppsResponse>;
1400
+ /** */
1401
+ addChannelFavorite(bearerToken: string, body: ApiAddFavoriteChannelRequest, options?: any): Promise<any>;
1402
+ /** */
1403
+ removeChannelFavorite(bearerToken: string, channelId: string, options?: any): Promise<any>;
1404
+ /** */
1405
+ getListFavoriteChannel(bearerToken: string, clanId: string, options?: any): Promise<ApiListFavoriteChannelResponse>;
1396
1406
  /** List a channel's message history. */
1397
1407
  listChannelMessages(bearerToken: string, clanId: string, channelId: string, messageId?: string, direction?: number, limit?: number, options?: any): Promise<ApiChannelMessageList>;
1398
1408
  /** Add users to a channel. */
@@ -1630,4 +1640,6 @@ export declare class MezonApi {
1630
1640
  getChannelCanvasDetail(bearerToken: string, id: string, clanId?: string, channelId?: string, options?: any): Promise<ApiChannelCanvasDetailResponse>;
1631
1641
  /** */
1632
1642
  getChannelCanvasList(bearerToken: string, channelId: string, clanId?: string, limit?: number, page?: number, options?: any): Promise<ApiChannelCanvasListResponse>;
1643
+ /** */
1644
+ deleteChannelCanvas(bearerToken: string, canvasId: string, clanId?: string, channelId?: string, options?: any): Promise<any>;
1633
1645
  }
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -584,4 +584,8 @@ export declare class Client {
584
584
  getChannelCanvasList(session: Session, channelId: string, clanId?: string, limit?: number, page?: number): Promise<any>;
585
585
  getChannelCanvasDetail(session: Session, id: string, clanId?: string, channelId?: string): Promise<any>;
586
586
  editChannelCanvases(session: Session, request: ApiEditChannelCanvasRequest): Promise<any>;
587
+ deleteChannelCanvas(session: Session, canvasId: string, clanId?: string, channelId?: string): Promise<any>;
588
+ addFavoriteChannel(session: Session, channelId: string, clanId: string): Promise<ApiAddFavoriteChannelResponse>;
589
+ removeFavoriteChannel(session: Session, channelId: string): Promise<any>;
590
+ getListFavoriteChannel(session: Session, clanId: string): Promise<any>;
587
591
  }
@@ -2062,6 +2062,91 @@ var MezonApi = class {
2062
2062
  )
2063
2063
  ]);
2064
2064
  }
2065
+ /** */
2066
+ addChannelFavorite(bearerToken, body, options = {}) {
2067
+ if (body === null || body === void 0) {
2068
+ throw new Error("'body' is a required parameter but is null or undefined.");
2069
+ }
2070
+ const urlPath = "/v2/channel/favorite";
2071
+ const queryParams = /* @__PURE__ */ new Map();
2072
+ let bodyJson = "";
2073
+ bodyJson = JSON.stringify(body || {});
2074
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2075
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2076
+ if (bearerToken) {
2077
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2078
+ }
2079
+ return Promise.race([
2080
+ fetch(fullUrl, fetchOptions).then((response) => {
2081
+ if (response.status == 204) {
2082
+ return response;
2083
+ } else if (response.status >= 200 && response.status < 300) {
2084
+ return response.json();
2085
+ } else {
2086
+ throw response;
2087
+ }
2088
+ }),
2089
+ new Promise(
2090
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2091
+ )
2092
+ ]);
2093
+ }
2094
+ /** */
2095
+ removeChannelFavorite(bearerToken, channelId, options = {}) {
2096
+ if (channelId === null || channelId === void 0) {
2097
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2098
+ }
2099
+ const urlPath = "/v2/channel/favorite/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
2100
+ const queryParams = /* @__PURE__ */ new Map();
2101
+ let bodyJson = "";
2102
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2103
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2104
+ if (bearerToken) {
2105
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2106
+ }
2107
+ return Promise.race([
2108
+ fetch(fullUrl, fetchOptions).then((response) => {
2109
+ if (response.status == 204) {
2110
+ return response;
2111
+ } else if (response.status >= 200 && response.status < 300) {
2112
+ return response.json();
2113
+ } else {
2114
+ throw response;
2115
+ }
2116
+ }),
2117
+ new Promise(
2118
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2119
+ )
2120
+ ]);
2121
+ }
2122
+ /** */
2123
+ getListFavoriteChannel(bearerToken, clanId, options = {}) {
2124
+ if (clanId === null || clanId === void 0) {
2125
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2126
+ }
2127
+ const urlPath = "/v2/channel/favorite/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2128
+ const queryParams = /* @__PURE__ */ new Map();
2129
+ let bodyJson = "";
2130
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2131
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2132
+ if (bearerToken) {
2133
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2134
+ }
2135
+ return Promise.race([
2136
+ fetch(fullUrl, fetchOptions).then((response) => {
2137
+ if (response.status == 204) {
2138
+ return response;
2139
+ } else if (response.status >= 200 && response.status < 300) {
2140
+ return response.json();
2141
+ } else {
2142
+ throw response;
2143
+ }
2144
+ }),
2145
+ new Promise(
2146
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2147
+ )
2148
+ ]);
2149
+ }
2065
2150
  /** List a channel's message history. */
2066
2151
  listChannelMessages(bearerToken, clanId, channelId, messageId, direction, limit, options = {}) {
2067
2152
  if (channelId === null || channelId === void 0) {
@@ -5699,7 +5784,9 @@ var MezonApi = class {
5699
5784
  /** Channel canvas editor */
5700
5785
  editChannelCanvases(bearerToken, body, options = {}) {
5701
5786
  if (body === null || body === void 0) {
5702
- throw new Error("'body' is a required parameter but is null or undefined.");
5787
+ throw new Error(
5788
+ "'body' is a required parameter but is null or undefined."
5789
+ );
5703
5790
  }
5704
5791
  const urlPath = "/v2/canvases/editor";
5705
5792
  const queryParams = /* @__PURE__ */ new Map();
@@ -5730,7 +5817,10 @@ var MezonApi = class {
5730
5817
  if (id === null || id === void 0) {
5731
5818
  throw new Error("'id' is a required parameter but is null or undefined.");
5732
5819
  }
5733
- const urlPath = "/v2/canvases/{id}".replace("{id}", encodeURIComponent(String(id)));
5820
+ const urlPath = "/v2/canvases/{id}".replace(
5821
+ "{id}",
5822
+ encodeURIComponent(String(id))
5823
+ );
5734
5824
  const queryParams = /* @__PURE__ */ new Map();
5735
5825
  queryParams.set("clan_id", clanId);
5736
5826
  queryParams.set("channel_id", channelId);
@@ -5758,9 +5848,14 @@ var MezonApi = class {
5758
5848
  /** */
5759
5849
  getChannelCanvasList(bearerToken, channelId, clanId, limit, page, options = {}) {
5760
5850
  if (channelId === null || channelId === void 0) {
5761
- throw new Error("'channelId' is a required parameter but is null or undefined.");
5851
+ throw new Error(
5852
+ "'channelId' is a required parameter but is null or undefined."
5853
+ );
5762
5854
  }
5763
- const urlPath = "/v2/channel-canvases/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
5855
+ const urlPath = "/v2/channel_canvases/{channelId}".replace(
5856
+ "{channelId}",
5857
+ encodeURIComponent(String(channelId))
5858
+ );
5764
5859
  const queryParams = /* @__PURE__ */ new Map();
5765
5860
  queryParams.set("clan_id", clanId);
5766
5861
  queryParams.set("limit", limit);
@@ -5786,6 +5881,41 @@ var MezonApi = class {
5786
5881
  )
5787
5882
  ]);
5788
5883
  }
5884
+ /** */
5885
+ deleteChannelCanvas(bearerToken, canvasId, clanId, channelId, options = {}) {
5886
+ if (canvasId === null || canvasId === void 0) {
5887
+ throw new Error(
5888
+ "'canvasId' is a required parameter but is null or undefined."
5889
+ );
5890
+ }
5891
+ const urlPath = "/v2/canvases/{canvasId}".replace(
5892
+ "{canvasId}",
5893
+ encodeURIComponent(String(canvasId))
5894
+ );
5895
+ const queryParams = /* @__PURE__ */ new Map();
5896
+ queryParams.set("clan_id", clanId);
5897
+ queryParams.set("channel_id", channelId);
5898
+ let bodyJson = "";
5899
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5900
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
5901
+ if (bearerToken) {
5902
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5903
+ }
5904
+ return Promise.race([
5905
+ fetch(fullUrl, fetchOptions).then((response) => {
5906
+ if (response.status == 204) {
5907
+ return response;
5908
+ } else if (response.status >= 200 && response.status < 300) {
5909
+ return response.json();
5910
+ } else {
5911
+ throw response;
5912
+ }
5913
+ }),
5914
+ new Promise(
5915
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5916
+ )
5917
+ ]);
5918
+ }
5789
5919
  };
5790
5920
 
5791
5921
  // session.ts
@@ -5914,13 +6044,13 @@ var WebSocketAdapterText = class {
5914
6044
  var _a;
5915
6045
  return ((_a = this._socket) == null ? void 0 : _a.readyState) == WebSocket.OPEN;
5916
6046
  }
5917
- connect(scheme, host, port, createStatus, token, signal) {
6047
+ connect(scheme, host, port, createStatus, token, platform, signal) {
5918
6048
  if (signal) {
5919
6049
  signal.addEventListener("abort", () => {
5920
6050
  this.close();
5921
6051
  });
5922
6052
  }
5923
- const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
6053
+ const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
5924
6054
  this._socket = new WebSocket(url);
5925
6055
  }
5926
6056
  close() {
@@ -5963,12 +6093,12 @@ var _DefaultSocket = class _DefaultSocket {
5963
6093
  isOpen() {
5964
6094
  return this.adapter.isOpen();
5965
6095
  }
5966
- connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
6096
+ connect(session, createStatus = false, platform = "", connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
5967
6097
  if (this.adapter.isOpen()) {
5968
6098
  return Promise.resolve(session);
5969
6099
  }
5970
6100
  const scheme = this.useSSL ? "wss://" : "ws://";
5971
- this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
6101
+ this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
5972
6102
  this.adapter.onClose = (evt) => {
5973
6103
  this.ondisconnect(evt);
5974
6104
  };
@@ -8718,4 +8848,48 @@ var Client = class {
8718
8848
  });
8719
8849
  });
8720
8850
  }
8851
+ //** */
8852
+ deleteChannelCanvas(session, canvasId, clanId, channelId) {
8853
+ return __async(this, null, function* () {
8854
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8855
+ yield this.sessionRefresh(session);
8856
+ }
8857
+ return this.apiClient.deleteChannelCanvas(session.token, canvasId, clanId, channelId).then((response) => {
8858
+ return response !== void 0;
8859
+ });
8860
+ });
8861
+ }
8862
+ addFavoriteChannel(session, channelId, clanId) {
8863
+ return __async(this, null, function* () {
8864
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8865
+ yield this.sessionRefresh(session);
8866
+ }
8867
+ return this.apiClient.addChannelFavorite(session.token, {
8868
+ channel_id: channelId,
8869
+ clan_id: clanId
8870
+ }).then((response) => {
8871
+ return response;
8872
+ });
8873
+ });
8874
+ }
8875
+ removeFavoriteChannel(session, channelId) {
8876
+ return __async(this, null, function* () {
8877
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8878
+ yield this.sessionRefresh(session);
8879
+ }
8880
+ return this.apiClient.removeChannelFavorite(session.token, channelId).then((response) => {
8881
+ return response;
8882
+ });
8883
+ });
8884
+ }
8885
+ getListFavoriteChannel(session, clanId) {
8886
+ return __async(this, null, function* () {
8887
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8888
+ yield this.sessionRefresh(session);
8889
+ }
8890
+ return this.apiClient.getListFavoriteChannel(session.token, clanId).then((response) => {
8891
+ return response;
8892
+ });
8893
+ });
8894
+ }
8721
8895
  };
@@ -2033,6 +2033,91 @@ var MezonApi = class {
2033
2033
  )
2034
2034
  ]);
2035
2035
  }
2036
+ /** */
2037
+ addChannelFavorite(bearerToken, body, options = {}) {
2038
+ if (body === null || body === void 0) {
2039
+ throw new Error("'body' is a required parameter but is null or undefined.");
2040
+ }
2041
+ const urlPath = "/v2/channel/favorite";
2042
+ const queryParams = /* @__PURE__ */ new Map();
2043
+ let bodyJson = "";
2044
+ bodyJson = JSON.stringify(body || {});
2045
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2046
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2047
+ if (bearerToken) {
2048
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2049
+ }
2050
+ return Promise.race([
2051
+ fetch(fullUrl, fetchOptions).then((response) => {
2052
+ if (response.status == 204) {
2053
+ return response;
2054
+ } else if (response.status >= 200 && response.status < 300) {
2055
+ return response.json();
2056
+ } else {
2057
+ throw response;
2058
+ }
2059
+ }),
2060
+ new Promise(
2061
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2062
+ )
2063
+ ]);
2064
+ }
2065
+ /** */
2066
+ removeChannelFavorite(bearerToken, channelId, options = {}) {
2067
+ if (channelId === null || channelId === void 0) {
2068
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2069
+ }
2070
+ const urlPath = "/v2/channel/favorite/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
2071
+ const queryParams = /* @__PURE__ */ new Map();
2072
+ let bodyJson = "";
2073
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2074
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2075
+ if (bearerToken) {
2076
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2077
+ }
2078
+ return Promise.race([
2079
+ fetch(fullUrl, fetchOptions).then((response) => {
2080
+ if (response.status == 204) {
2081
+ return response;
2082
+ } else if (response.status >= 200 && response.status < 300) {
2083
+ return response.json();
2084
+ } else {
2085
+ throw response;
2086
+ }
2087
+ }),
2088
+ new Promise(
2089
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2090
+ )
2091
+ ]);
2092
+ }
2093
+ /** */
2094
+ getListFavoriteChannel(bearerToken, clanId, options = {}) {
2095
+ if (clanId === null || clanId === void 0) {
2096
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2097
+ }
2098
+ const urlPath = "/v2/channel/favorite/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2099
+ const queryParams = /* @__PURE__ */ new Map();
2100
+ let bodyJson = "";
2101
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2102
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2103
+ if (bearerToken) {
2104
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2105
+ }
2106
+ return Promise.race([
2107
+ fetch(fullUrl, fetchOptions).then((response) => {
2108
+ if (response.status == 204) {
2109
+ return response;
2110
+ } else if (response.status >= 200 && response.status < 300) {
2111
+ return response.json();
2112
+ } else {
2113
+ throw response;
2114
+ }
2115
+ }),
2116
+ new Promise(
2117
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2118
+ )
2119
+ ]);
2120
+ }
2036
2121
  /** List a channel's message history. */
2037
2122
  listChannelMessages(bearerToken, clanId, channelId, messageId, direction, limit, options = {}) {
2038
2123
  if (channelId === null || channelId === void 0) {
@@ -5670,7 +5755,9 @@ var MezonApi = class {
5670
5755
  /** Channel canvas editor */
5671
5756
  editChannelCanvases(bearerToken, body, options = {}) {
5672
5757
  if (body === null || body === void 0) {
5673
- throw new Error("'body' is a required parameter but is null or undefined.");
5758
+ throw new Error(
5759
+ "'body' is a required parameter but is null or undefined."
5760
+ );
5674
5761
  }
5675
5762
  const urlPath = "/v2/canvases/editor";
5676
5763
  const queryParams = /* @__PURE__ */ new Map();
@@ -5701,7 +5788,10 @@ var MezonApi = class {
5701
5788
  if (id === null || id === void 0) {
5702
5789
  throw new Error("'id' is a required parameter but is null or undefined.");
5703
5790
  }
5704
- const urlPath = "/v2/canvases/{id}".replace("{id}", encodeURIComponent(String(id)));
5791
+ const urlPath = "/v2/canvases/{id}".replace(
5792
+ "{id}",
5793
+ encodeURIComponent(String(id))
5794
+ );
5705
5795
  const queryParams = /* @__PURE__ */ new Map();
5706
5796
  queryParams.set("clan_id", clanId);
5707
5797
  queryParams.set("channel_id", channelId);
@@ -5729,9 +5819,14 @@ var MezonApi = class {
5729
5819
  /** */
5730
5820
  getChannelCanvasList(bearerToken, channelId, clanId, limit, page, options = {}) {
5731
5821
  if (channelId === null || channelId === void 0) {
5732
- throw new Error("'channelId' is a required parameter but is null or undefined.");
5822
+ throw new Error(
5823
+ "'channelId' is a required parameter but is null or undefined."
5824
+ );
5733
5825
  }
5734
- const urlPath = "/v2/channel-canvases/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
5826
+ const urlPath = "/v2/channel_canvases/{channelId}".replace(
5827
+ "{channelId}",
5828
+ encodeURIComponent(String(channelId))
5829
+ );
5735
5830
  const queryParams = /* @__PURE__ */ new Map();
5736
5831
  queryParams.set("clan_id", clanId);
5737
5832
  queryParams.set("limit", limit);
@@ -5757,6 +5852,41 @@ var MezonApi = class {
5757
5852
  )
5758
5853
  ]);
5759
5854
  }
5855
+ /** */
5856
+ deleteChannelCanvas(bearerToken, canvasId, clanId, channelId, options = {}) {
5857
+ if (canvasId === null || canvasId === void 0) {
5858
+ throw new Error(
5859
+ "'canvasId' is a required parameter but is null or undefined."
5860
+ );
5861
+ }
5862
+ const urlPath = "/v2/canvases/{canvasId}".replace(
5863
+ "{canvasId}",
5864
+ encodeURIComponent(String(canvasId))
5865
+ );
5866
+ const queryParams = /* @__PURE__ */ new Map();
5867
+ queryParams.set("clan_id", clanId);
5868
+ queryParams.set("channel_id", channelId);
5869
+ let bodyJson = "";
5870
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5871
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
5872
+ if (bearerToken) {
5873
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5874
+ }
5875
+ return Promise.race([
5876
+ fetch(fullUrl, fetchOptions).then((response) => {
5877
+ if (response.status == 204) {
5878
+ return response;
5879
+ } else if (response.status >= 200 && response.status < 300) {
5880
+ return response.json();
5881
+ } else {
5882
+ throw response;
5883
+ }
5884
+ }),
5885
+ new Promise(
5886
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5887
+ )
5888
+ ]);
5889
+ }
5760
5890
  };
5761
5891
 
5762
5892
  // session.ts
@@ -5885,13 +6015,13 @@ var WebSocketAdapterText = class {
5885
6015
  var _a;
5886
6016
  return ((_a = this._socket) == null ? void 0 : _a.readyState) == WebSocket.OPEN;
5887
6017
  }
5888
- connect(scheme, host, port, createStatus, token, signal) {
6018
+ connect(scheme, host, port, createStatus, token, platform, signal) {
5889
6019
  if (signal) {
5890
6020
  signal.addEventListener("abort", () => {
5891
6021
  this.close();
5892
6022
  });
5893
6023
  }
5894
- const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
6024
+ const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
5895
6025
  this._socket = new WebSocket(url);
5896
6026
  }
5897
6027
  close() {
@@ -5934,12 +6064,12 @@ var _DefaultSocket = class _DefaultSocket {
5934
6064
  isOpen() {
5935
6065
  return this.adapter.isOpen();
5936
6066
  }
5937
- connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
6067
+ connect(session, createStatus = false, platform = "", connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
5938
6068
  if (this.adapter.isOpen()) {
5939
6069
  return Promise.resolve(session);
5940
6070
  }
5941
6071
  const scheme = this.useSSL ? "wss://" : "ws://";
5942
- this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
6072
+ this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
5943
6073
  this.adapter.onClose = (evt) => {
5944
6074
  this.ondisconnect(evt);
5945
6075
  };
@@ -8689,6 +8819,50 @@ var Client = class {
8689
8819
  });
8690
8820
  });
8691
8821
  }
8822
+ //** */
8823
+ deleteChannelCanvas(session, canvasId, clanId, channelId) {
8824
+ return __async(this, null, function* () {
8825
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8826
+ yield this.sessionRefresh(session);
8827
+ }
8828
+ return this.apiClient.deleteChannelCanvas(session.token, canvasId, clanId, channelId).then((response) => {
8829
+ return response !== void 0;
8830
+ });
8831
+ });
8832
+ }
8833
+ addFavoriteChannel(session, channelId, clanId) {
8834
+ return __async(this, null, function* () {
8835
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8836
+ yield this.sessionRefresh(session);
8837
+ }
8838
+ return this.apiClient.addChannelFavorite(session.token, {
8839
+ channel_id: channelId,
8840
+ clan_id: clanId
8841
+ }).then((response) => {
8842
+ return response;
8843
+ });
8844
+ });
8845
+ }
8846
+ removeFavoriteChannel(session, channelId) {
8847
+ return __async(this, null, function* () {
8848
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8849
+ yield this.sessionRefresh(session);
8850
+ }
8851
+ return this.apiClient.removeChannelFavorite(session.token, channelId).then((response) => {
8852
+ return response;
8853
+ });
8854
+ });
8855
+ }
8856
+ getListFavoriteChannel(session, clanId) {
8857
+ return __async(this, null, function* () {
8858
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8859
+ yield this.sessionRefresh(session);
8860
+ }
8861
+ return this.apiClient.getListFavoriteChannel(session.token, clanId).then((response) => {
8862
+ return response;
8863
+ });
8864
+ });
8865
+ }
8692
8866
  };
8693
8867
  export {
8694
8868
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -574,7 +574,7 @@ export interface Socket {
574
574
  /** Connection is Open */
575
575
  isOpen(): boolean;
576
576
  /** Connect to the server. */
577
- connect(session: Session, createStatus: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
577
+ connect(session: Session, createStatus: boolean, platform: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
578
578
  /** Disconnect from the server. */
579
579
  disconnect(fireDisconnectEvent: boolean): void;
580
580
  /** Subscribe to one or more users for their status updates. */
@@ -704,7 +704,7 @@ export declare class DefaultSocket implements Socket {
704
704
  constructor(host: string, port: string, useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number);
705
705
  generatecid(): string;
706
706
  isOpen(): boolean;
707
- connect(session: Session, createStatus?: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
707
+ connect(session: Session, createStatus?: boolean, platform?: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
708
708
  disconnect(fireDisconnectEvent?: boolean): void;
709
709
  setHeartbeatTimeoutMs(ms: number): void;
710
710
  getHeartbeatTimeoutMs(): number;
@@ -35,7 +35,7 @@ export interface WebSocketAdapter {
35
35
  onOpen: SocketOpenHandler | null;
36
36
  isOpen(): boolean;
37
37
  close(): void;
38
- connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
38
+ connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
39
39
  send(message: any): void;
40
40
  }
41
41
  /**
@@ -77,7 +77,7 @@ export declare class WebSocketAdapterText implements WebSocketAdapter {
77
77
  get onOpen(): SocketOpenHandler | null;
78
78
  set onOpen(value: SocketOpenHandler | null);
79
79
  isOpen(): boolean;
80
- connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
80
+ connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
81
81
  close(): void;
82
82
  send(msg: any): void;
83
83
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.40",
4
+ "version": "2.9.42",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -801,7 +801,7 @@ export interface Socket {
801
801
  isOpen(): boolean;
802
802
 
803
803
  /** Connect to the server. */
804
- connect(session: Session, createStatus: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
804
+ connect(session: Session, createStatus: boolean, platform: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
805
805
 
806
806
  /** Disconnect from the server. */
807
807
  disconnect(fireDisconnectEvent: boolean): void;
@@ -1029,13 +1029,13 @@ export class DefaultSocket implements Socket {
1029
1029
  return this.adapter.isOpen();
1030
1030
  }
1031
1031
 
1032
- connect(session: Session, createStatus: boolean = false, connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs, signal?: AbortSignal): Promise<Session> {
1032
+ connect(session: Session, createStatus: boolean = false, platform: string = "", connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs, signal?: AbortSignal): Promise<Session> {
1033
1033
  if (this.adapter.isOpen()) {
1034
1034
  return Promise.resolve(session);
1035
1035
  }
1036
1036
 
1037
1037
  const scheme = (this.useSSL) ? "wss://" : "ws://";
1038
- this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
1038
+ this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
1039
1039
 
1040
1040
  this.adapter.onClose = (evt: Event) => {
1041
1041
  this.ondisconnect(evt);
@@ -44,7 +44,7 @@ export interface WebSocketAdapter {
44
44
 
45
45
  isOpen(): boolean;
46
46
  close(): void;
47
- connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
47
+ connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
48
48
  send(message: any): void;
49
49
  }
50
50
 
@@ -131,13 +131,13 @@ export class WebSocketAdapterText implements WebSocketAdapter {
131
131
  return this._socket?.readyState == WebSocket.OPEN;
132
132
  }
133
133
 
134
- connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void {
134
+ connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void {
135
135
  if (signal) {
136
136
  signal.addEventListener('abort', () => {
137
137
  this.close();
138
138
  });
139
139
  }
140
- const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
140
+ const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
141
141
  this._socket = new WebSocket(url);
142
142
  }
143
143