mezon-js 2.8.21 → 2.8.23

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
@@ -557,26 +557,6 @@ export interface ApiClanEmojiCreateRequest {
557
557
  source?: string;
558
558
  }
559
559
 
560
- /** */
561
- export interface ApiClanEmojiList {
562
- //
563
- emoji_list?: Array<ApiClanEmojiListResponse>;
564
- }
565
-
566
- /** */
567
- export interface ApiClanEmojiListResponse {
568
- //
569
- category?: string;
570
- //
571
- creator_id?: string;
572
- //
573
- id?: string;
574
- //
575
- shortname?: string;
576
- //
577
- src?: string;
578
- }
579
-
580
560
  /** Get clan profile. */
581
561
  export interface ApiClanProfile {
582
562
  //
@@ -589,24 +569,6 @@ export interface ApiClanProfile {
589
569
  user_id?: string;
590
570
  }
591
571
 
592
- /** */
593
- export interface ApiClanSticker {
594
- //
595
- category?: string;
596
- //
597
- clan_id?: string;
598
- //
599
- create_time?: string;
600
- //
601
- creator_id?: string;
602
- //
603
- id?: string;
604
- //
605
- shortname?: string;
606
- //
607
- source?: string;
608
- }
609
-
610
572
  /** */
611
573
  export interface ApiClanStickerAddRequest {
612
574
  //
@@ -621,12 +583,6 @@ export interface ApiClanStickerAddRequest {
621
583
  source?: string;
622
584
  }
623
585
 
624
- /** */
625
- export interface ApiClanStickerListByClanIdResponse {
626
- //
627
- stickers?: Array<ApiClanSticker>;
628
- }
629
-
630
586
  /** A list of users belonging to a clan, along with their role. */
631
587
  export interface ApiClanUserList {
632
588
  //
@@ -1111,6 +1067,8 @@ export interface ApiPermission {
1111
1067
  //
1112
1068
  id?: string;
1113
1069
  //
1070
+ scope?: number;
1071
+ //
1114
1072
  slug?: string;
1115
1073
  //
1116
1074
  title?: string;
@@ -1122,6 +1080,28 @@ export interface ApiPermissionList {
1122
1080
  permissions?: Array<ApiPermission>;
1123
1081
  }
1124
1082
 
1083
+ /** */
1084
+ export interface ApiPermissionRoleChannel {
1085
+ //
1086
+ active?: boolean;
1087
+ //
1088
+ permission_id?: string;
1089
+ }
1090
+
1091
+ /** A list of permission role channel. */
1092
+ export interface ApiPermissionRoleChannelList {
1093
+ //A list of permission.
1094
+ permission_role_channel?: Array<ApiPermissionRoleChannel>;
1095
+ }
1096
+
1097
+ /** */
1098
+ export interface ApiPermissionUpdate {
1099
+ //
1100
+ permission_id?: string;
1101
+ //
1102
+ type?: number;
1103
+ }
1104
+
1125
1105
  /** */
1126
1106
  export interface ApiPinMessage {
1127
1107
  //
@@ -1458,6 +1438,16 @@ export interface ApiUpdateCategoryDescRequest {
1458
1438
  category_name?: string;
1459
1439
  }
1460
1440
 
1441
+ /** */
1442
+ export interface ApiUpdateRoleChannelRequest {
1443
+ //
1444
+ channel_id?: string;
1445
+ //The permissions to add.
1446
+ permission_update?: Array<ApiPermissionUpdate>;
1447
+ //The ID of the role to update.
1448
+ role_id?: string;
1449
+ }
1450
+
1461
1451
  /** Fetch a batch of zero or more users from the server. */
1462
1452
  export interface ApiUpdateUsersRequest {
1463
1453
  //The avarar_url of a user.
@@ -3910,42 +3900,6 @@ export class MezonApi {
3910
3900
  ]);
3911
3901
  }
3912
3902
 
3913
- /** Get emoji list by clan id */
3914
- listClanEmojiByClanId(bearerToken: string,
3915
- clanId:string,
3916
- options: any = {}): Promise<ApiClanEmojiList> {
3917
-
3918
- if (clanId === null || clanId === undefined) {
3919
- throw new Error("'clanId' is a required parameter but is null or undefined.");
3920
- }
3921
- const urlPath = "/v2/emoji/{clanId}"
3922
- .replace("{clanId}", encodeURIComponent(String(clanId)));
3923
- const queryParams = new Map<string, any>();
3924
-
3925
- let bodyJson : string = "";
3926
-
3927
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3928
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3929
- if (bearerToken) {
3930
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3931
- }
3932
-
3933
- return Promise.race([
3934
- fetch(fullUrl, fetchOptions).then((response) => {
3935
- if (response.status == 204) {
3936
- return response;
3937
- } else if (response.status >= 200 && response.status < 300) {
3938
- return response.json();
3939
- } else {
3940
- throw response;
3941
- }
3942
- }),
3943
- new Promise((_, reject) =>
3944
- setTimeout(reject, this.timeoutMs, "Request timed out.")
3945
- ),
3946
- ]);
3947
- }
3948
-
3949
3903
  /** Delete a emoji by ID. */
3950
3904
  deleteByIdClanEmoji(bearerToken: string,
3951
3905
  id:string,
@@ -5190,6 +5144,77 @@ export class MezonApi {
5190
5144
  ]);
5191
5145
  }
5192
5146
 
5147
+ /** List permission role channel */
5148
+ getListPermissionRoleChannel(bearerToken: string,
5149
+ roleId?:string,
5150
+ channelId?:string,
5151
+ options: any = {}): Promise<ApiPermissionRoleChannelList> {
5152
+
5153
+ const urlPath = "/v2/permissionrolechannel/get";
5154
+ const queryParams = new Map<string, any>();
5155
+ queryParams.set("role_id", roleId);
5156
+ queryParams.set("channel_id", channelId);
5157
+
5158
+ let bodyJson : string = "";
5159
+
5160
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5161
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5162
+ if (bearerToken) {
5163
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5164
+ }
5165
+
5166
+ return Promise.race([
5167
+ fetch(fullUrl, fetchOptions).then((response) => {
5168
+ if (response.status == 204) {
5169
+ return response;
5170
+ } else if (response.status >= 200 && response.status < 300) {
5171
+ return response.json();
5172
+ } else {
5173
+ throw response;
5174
+ }
5175
+ }),
5176
+ new Promise((_, reject) =>
5177
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5178
+ ),
5179
+ ]);
5180
+ }
5181
+
5182
+ /** set permission role channel. */
5183
+ setRoleChannelPermission(bearerToken: string,
5184
+ body:ApiUpdateRoleChannelRequest,
5185
+ options: any = {}): Promise<any> {
5186
+
5187
+ if (body === null || body === undefined) {
5188
+ throw new Error("'body' is a required parameter but is null or undefined.");
5189
+ }
5190
+ const urlPath = "/v2/permissionrolechannel/set";
5191
+ const queryParams = new Map<string, any>();
5192
+
5193
+ let bodyJson : string = "";
5194
+ bodyJson = JSON.stringify(body || {});
5195
+
5196
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5197
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5198
+ if (bearerToken) {
5199
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5200
+ }
5201
+
5202
+ return Promise.race([
5203
+ fetch(fullUrl, fetchOptions).then((response) => {
5204
+ if (response.status == 204) {
5205
+ return response;
5206
+ } else if (response.status >= 200 && response.status < 300) {
5207
+ return response.json();
5208
+ } else {
5209
+ throw response;
5210
+ }
5211
+ }),
5212
+ new Promise((_, reject) =>
5213
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5214
+ ),
5215
+ ]);
5216
+ }
5217
+
5193
5218
  /** Get permission list */
5194
5219
  getListPermission(bearerToken: string,
5195
5220
  options: any = {}): Promise<ApiPermissionList> {
@@ -5906,42 +5931,6 @@ export class MezonApi {
5906
5931
  ]);
5907
5932
  }
5908
5933
 
5909
- /** List stickers by clan ID */
5910
- listClanStickersByClanId(bearerToken: string,
5911
- clanId:string,
5912
- options: any = {}): Promise<ApiClanStickerListByClanIdResponse> {
5913
-
5914
- if (clanId === null || clanId === undefined) {
5915
- throw new Error("'clanId' is a required parameter but is null or undefined.");
5916
- }
5917
- const urlPath = "/v2/sticker/{clanId}"
5918
- .replace("{clanId}", encodeURIComponent(String(clanId)));
5919
- const queryParams = new Map<string, any>();
5920
-
5921
- let bodyJson : string = "";
5922
-
5923
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5924
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5925
- if (bearerToken) {
5926
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5927
- }
5928
-
5929
- return Promise.race([
5930
- fetch(fullUrl, fetchOptions).then((response) => {
5931
- if (response.status == 204) {
5932
- return response;
5933
- } else if (response.status >= 200 && response.status < 300) {
5934
- return response.json();
5935
- } else {
5936
- throw response;
5937
- }
5938
- }),
5939
- new Promise((_, reject) =>
5940
- setTimeout(reject, this.timeoutMs, "Request timed out.")
5941
- ),
5942
- ]);
5943
- }
5944
-
5945
5934
  /** Delete a sticker by ID */
5946
5935
  deleteClanStickerById(bearerToken: string,
5947
5936
  id:string,
package/client.ts CHANGED
@@ -92,7 +92,6 @@ import {
92
92
  ApiPinMessagesList,
93
93
  ApiDeleteChannelDescRequest,
94
94
  ApiChangeChannelPrivateRequest,
95
- ApiClanEmojiList,
96
95
  ApiClanEmojiCreateRequest,
97
96
  MezonUpdateClanEmojiByIdBody,
98
97
  ApiWebhookCreateRequest,
@@ -101,10 +100,11 @@ import {
101
100
  ApiWebhookGenerateResponse,
102
101
  ApiCheckDuplicateClanNameResponse,
103
102
  ApiClanStickerAddRequest,
104
- ApiClanStickerListByClanIdResponse,
105
103
  MezonUpdateClanStickerByIdBody,
106
104
  MezonChangeChannelCategoryBody,
107
105
  ApiHashtagDmVoiceList,
106
+ ApiPermissionRoleChannelList,
107
+ ApiUpdateRoleChannelRequest,
108
108
  } from "./api.gen";
109
109
 
110
110
  import { Session } from "./session";
@@ -2280,18 +2280,6 @@ async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
2280
2280
  });
2281
2281
  }
2282
2282
 
2283
- /** List clan emoji. */
2284
- async listClanEmoji(session: Session, clan_id: string): Promise<ApiClanEmojiList> {
2285
- if (this.autoRefreshSession && session.refresh_token &&
2286
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2287
- await this.sessionRefresh(session);
2288
- }
2289
-
2290
- return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response: ApiClanEmojiList) => {
2291
- return Promise.resolve(response);
2292
- });
2293
- }
2294
-
2295
2283
  /** create clan emoji */
2296
2284
  async createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest) {
2297
2285
  if (this.autoRefreshSession && session.refresh_token &&
@@ -2400,18 +2388,6 @@ async addClanSticker(session: Session, request: ApiClanStickerAddRequest) {
2400
2388
  })
2401
2389
  }
2402
2390
 
2403
- //**List stickers by clan ID */
2404
- async listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse> {
2405
- if (this.autoRefreshSession && session.refresh_token &&
2406
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2407
- await this.sessionRefresh(session);
2408
- }
2409
-
2410
- return this.apiClient.listClanStickersByClanId(session.token, id).then((response: any) => {
2411
- return Promise.resolve(response);
2412
- })
2413
- }
2414
-
2415
2391
  //**Delete a sticker by ID*/
2416
2392
  async deleteClanStickerById(session: Session, id: string, clan_id: string) {
2417
2393
  if (this.autoRefreshSession && session.refresh_token &&
@@ -2448,4 +2424,28 @@ async changeChannelCategory(session: Session, id: string, request: MezonChangeCh
2448
2424
  })
2449
2425
  }
2450
2426
 
2427
+ /** */
2428
+ async getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList> {
2429
+ if (this.autoRefreshSession && session.refresh_token &&
2430
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2431
+ await this.sessionRefresh(session);
2432
+ }
2433
+
2434
+ return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response: ApiPermissionRoleChannelList) => {
2435
+ return Promise.resolve(response);
2436
+ });
2437
+ }
2438
+
2439
+ /** */
2440
+ async setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean> {
2441
+ if (this.autoRefreshSession && session.refresh_token &&
2442
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2443
+ await this.sessionRefresh(session);
2444
+ }
2445
+
2446
+ return this.apiClient.setRoleChannelPermission(session.token, request).then((response: any) => {
2447
+ return response !== undefined;
2448
+ });
2449
+ }
2450
+
2451
2451
  };
package/dist/api.gen.d.ts CHANGED
@@ -316,18 +316,6 @@ export interface ApiClanEmojiCreateRequest {
316
316
  shortname?: string;
317
317
  source?: string;
318
318
  }
319
- /** */
320
- export interface ApiClanEmojiList {
321
- emoji_list?: Array<ApiClanEmojiListResponse>;
322
- }
323
- /** */
324
- export interface ApiClanEmojiListResponse {
325
- category?: string;
326
- creator_id?: string;
327
- id?: string;
328
- shortname?: string;
329
- src?: string;
330
- }
331
319
  /** Get clan profile. */
332
320
  export interface ApiClanProfile {
333
321
  avartar?: string;
@@ -336,16 +324,6 @@ export interface ApiClanProfile {
336
324
  user_id?: string;
337
325
  }
338
326
  /** */
339
- export interface ApiClanSticker {
340
- category?: string;
341
- clan_id?: string;
342
- create_time?: string;
343
- creator_id?: string;
344
- id?: string;
345
- shortname?: string;
346
- source?: string;
347
- }
348
- /** */
349
327
  export interface ApiClanStickerAddRequest {
350
328
  category?: string;
351
329
  clan_id?: string;
@@ -353,10 +331,6 @@ export interface ApiClanStickerAddRequest {
353
331
  shortname?: string;
354
332
  source?: string;
355
333
  }
356
- /** */
357
- export interface ApiClanStickerListByClanIdResponse {
358
- stickers?: Array<ApiClanSticker>;
359
- }
360
334
  /** A list of users belonging to a clan, along with their role. */
361
335
  export interface ApiClanUserList {
362
336
  clan_id?: string;
@@ -636,6 +610,7 @@ export interface ApiPermission {
636
610
  active?: number;
637
611
  description?: string;
638
612
  id?: string;
613
+ scope?: number;
639
614
  slug?: string;
640
615
  title?: string;
641
616
  }
@@ -644,6 +619,20 @@ export interface ApiPermissionList {
644
619
  permissions?: Array<ApiPermission>;
645
620
  }
646
621
  /** */
622
+ export interface ApiPermissionRoleChannel {
623
+ active?: boolean;
624
+ permission_id?: string;
625
+ }
626
+ /** A list of permission role channel. */
627
+ export interface ApiPermissionRoleChannelList {
628
+ permission_role_channel?: Array<ApiPermissionRoleChannel>;
629
+ }
630
+ /** */
631
+ export interface ApiPermissionUpdate {
632
+ permission_id?: string;
633
+ type?: number;
634
+ }
635
+ /** */
647
636
  export interface ApiPinMessage {
648
637
  avatar?: string;
649
638
  channel_id?: string;
@@ -838,6 +827,12 @@ export interface ApiUpdateCategoryDescRequest {
838
827
  category_id?: string;
839
828
  category_name?: string;
840
829
  }
830
+ /** */
831
+ export interface ApiUpdateRoleChannelRequest {
832
+ channel_id?: string;
833
+ permission_update?: Array<ApiPermissionUpdate>;
834
+ role_id?: string;
835
+ }
841
836
  /** Fetch a batch of zero or more users from the server. */
842
837
  export interface ApiUpdateUsersRequest {
843
838
  avatar_url?: string;
@@ -1071,8 +1066,6 @@ export declare class MezonApi {
1071
1066
  openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
1072
1067
  /** Post clan Emoji /v2/emoji/create */
1073
1068
  createClanEmoji(bearerToken: string, body: ApiClanEmojiCreateRequest, options?: any): Promise<any>;
1074
- /** Get emoji list by clan id */
1075
- listClanEmojiByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanEmojiList>;
1076
1069
  /** Delete a emoji by ID. */
1077
1070
  deleteByIdClanEmoji(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1078
1071
  /** Update ClanEmoj By id */
@@ -1143,6 +1136,10 @@ export declare class MezonApi {
1143
1136
  getNotificationReactMessage(bearerToken: string, channelId?: string, options?: any): Promise<ApiNotifiReactMessage>;
1144
1137
  /** */
1145
1138
  setNotificationReactMessage(bearerToken: string, body: ApiNotificationChannel, options?: any): Promise<any>;
1139
+ /** List permission role channel */
1140
+ getListPermissionRoleChannel(bearerToken: string, roleId?: string, channelId?: string, options?: any): Promise<ApiPermissionRoleChannelList>;
1141
+ /** set permission role channel. */
1142
+ setRoleChannelPermission(bearerToken: string, body: ApiUpdateRoleChannelRequest, options?: any): Promise<any>;
1146
1143
  /** Get permission list */
1147
1144
  getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
1148
1145
  /** */
@@ -1181,8 +1178,6 @@ export declare class MezonApi {
1181
1178
  sessionLogout(bearerToken: string, body: ApiSessionLogoutRequest, options?: any): Promise<any>;
1182
1179
  /** Add a new sticker */
1183
1180
  addClanSticker(bearerToken: string, body: ApiClanStickerAddRequest, options?: any): Promise<any>;
1184
- /** List stickers by clan ID */
1185
- listClanStickersByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanStickerListByClanIdResponse>;
1186
1181
  /** Delete a sticker by ID */
1187
1182
  deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1188
1183
  /** Update a sticker by ID */
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, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, ApiClanStickerListByClanIdResponse, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiHashtagDmVoiceList } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiHashtagDmVoiceList, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -584,8 +584,6 @@ export declare class Client {
584
584
  pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
585
585
  hashtagDmVoiceList(session: Session, userId: Array<string>, limit?: number): Promise<ApiHashtagDmVoiceList>;
586
586
  deletePinMessage(session: Session, message_id: string): Promise<boolean>;
587
- /** List clan emoji. */
588
- listClanEmoji(session: Session, clan_id: string): Promise<ApiClanEmojiList>;
589
587
  /** create clan emoji */
590
588
  createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
591
589
  updateClanEmojiById(session: Session, id: string, request: MezonUpdateClanEmojiByIdBody): Promise<boolean>;
@@ -596,8 +594,11 @@ export declare class Client {
596
594
  deleteWebhookById(session: Session, id: string): Promise<boolean>;
597
595
  checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
598
596
  addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
599
- listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse>;
600
597
  deleteClanStickerById(session: Session, id: string, clan_id: string): Promise<boolean>;
601
598
  updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
602
599
  changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody): Promise<boolean>;
600
+ /** */
601
+ getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList>;
602
+ /** */
603
+ setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
603
604
  }
@@ -2417,34 +2417,6 @@ var MezonApi = class {
2417
2417
  )
2418
2418
  ]);
2419
2419
  }
2420
- /** Get emoji list by clan id */
2421
- listClanEmojiByClanId(bearerToken, clanId, options = {}) {
2422
- if (clanId === null || clanId === void 0) {
2423
- throw new Error("'clanId' is a required parameter but is null or undefined.");
2424
- }
2425
- const urlPath = "/v2/emoji/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2426
- const queryParams = /* @__PURE__ */ new Map();
2427
- let bodyJson = "";
2428
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2429
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2430
- if (bearerToken) {
2431
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2432
- }
2433
- return Promise.race([
2434
- fetch(fullUrl, fetchOptions).then((response) => {
2435
- if (response.status == 204) {
2436
- return response;
2437
- } else if (response.status >= 200 && response.status < 300) {
2438
- return response.json();
2439
- } else {
2440
- throw response;
2441
- }
2442
- }),
2443
- new Promise(
2444
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2445
- )
2446
- ]);
2447
- }
2448
2420
  /** Delete a emoji by ID. */
2449
2421
  deleteByIdClanEmoji(bearerToken, id, clanId, options = {}) {
2450
2422
  if (id === null || id === void 0) {
@@ -3424,6 +3396,62 @@ var MezonApi = class {
3424
3396
  )
3425
3397
  ]);
3426
3398
  }
3399
+ /** List permission role channel */
3400
+ getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
3401
+ const urlPath = "/v2/permissionrolechannel/get";
3402
+ const queryParams = /* @__PURE__ */ new Map();
3403
+ queryParams.set("role_id", roleId);
3404
+ queryParams.set("channel_id", channelId);
3405
+ let bodyJson = "";
3406
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3407
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3408
+ if (bearerToken) {
3409
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3410
+ }
3411
+ return Promise.race([
3412
+ fetch(fullUrl, fetchOptions).then((response) => {
3413
+ if (response.status == 204) {
3414
+ return response;
3415
+ } else if (response.status >= 200 && response.status < 300) {
3416
+ return response.json();
3417
+ } else {
3418
+ throw response;
3419
+ }
3420
+ }),
3421
+ new Promise(
3422
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3423
+ )
3424
+ ]);
3425
+ }
3426
+ /** set permission role channel. */
3427
+ setRoleChannelPermission(bearerToken, body, options = {}) {
3428
+ if (body === null || body === void 0) {
3429
+ throw new Error("'body' is a required parameter but is null or undefined.");
3430
+ }
3431
+ const urlPath = "/v2/permissionrolechannel/set";
3432
+ const queryParams = /* @__PURE__ */ new Map();
3433
+ let bodyJson = "";
3434
+ bodyJson = JSON.stringify(body || {});
3435
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3436
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3437
+ if (bearerToken) {
3438
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3439
+ }
3440
+ return Promise.race([
3441
+ fetch(fullUrl, fetchOptions).then((response) => {
3442
+ if (response.status == 204) {
3443
+ return response;
3444
+ } else if (response.status >= 200 && response.status < 300) {
3445
+ return response.json();
3446
+ } else {
3447
+ throw response;
3448
+ }
3449
+ }),
3450
+ new Promise(
3451
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3452
+ )
3453
+ ]);
3454
+ }
3427
3455
  /** Get permission list */
3428
3456
  getListPermission(bearerToken, options = {}) {
3429
3457
  const urlPath = "/v2/permissions";
@@ -3984,34 +4012,6 @@ var MezonApi = class {
3984
4012
  )
3985
4013
  ]);
3986
4014
  }
3987
- /** List stickers by clan ID */
3988
- listClanStickersByClanId(bearerToken, clanId, options = {}) {
3989
- if (clanId === null || clanId === void 0) {
3990
- throw new Error("'clanId' is a required parameter but is null or undefined.");
3991
- }
3992
- const urlPath = "/v2/sticker/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
3993
- const queryParams = /* @__PURE__ */ new Map();
3994
- let bodyJson = "";
3995
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3996
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3997
- if (bearerToken) {
3998
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3999
- }
4000
- return Promise.race([
4001
- fetch(fullUrl, fetchOptions).then((response) => {
4002
- if (response.status == 204) {
4003
- return response;
4004
- } else if (response.status >= 200 && response.status < 300) {
4005
- return response.json();
4006
- } else {
4007
- throw response;
4008
- }
4009
- }),
4010
- new Promise(
4011
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4012
- )
4013
- ]);
4014
- }
4015
4015
  /** Delete a sticker by ID */
4016
4016
  deleteClanStickerById(bearerToken, id, clanId, options = {}) {
4017
4017
  if (id === null || id === void 0) {
@@ -5156,6 +5156,18 @@ var _DefaultSocket = class _DefaultSocket {
5156
5156
  return response.clan_name_existed_event;
5157
5157
  });
5158
5158
  }
5159
+ listClanEmojiByClanId(clan_id) {
5160
+ return __async(this, null, function* () {
5161
+ const response = yield this.send({ emojis_listed_event: { clan_id } });
5162
+ return response.emojis_listed_event;
5163
+ });
5164
+ }
5165
+ listClanStickersByClanId(clan_id) {
5166
+ return __async(this, null, function* () {
5167
+ const response = yield this.send({ sticker_listed_event: { clan_id } });
5168
+ return response.sticker_listed_event;
5169
+ });
5170
+ }
5159
5171
  pingPong() {
5160
5172
  return __async(this, null, function* () {
5161
5173
  if (!this.adapter.isOpen()) {
@@ -6805,17 +6817,6 @@ var Client = class {
6805
6817
  });
6806
6818
  });
6807
6819
  }
6808
- /** List clan emoji. */
6809
- listClanEmoji(session, clan_id) {
6810
- return __async(this, null, function* () {
6811
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6812
- yield this.sessionRefresh(session);
6813
- }
6814
- return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response) => {
6815
- return Promise.resolve(response);
6816
- });
6817
- });
6818
- }
6819
6820
  /** create clan emoji */
6820
6821
  createClanEmoji(session, request) {
6821
6822
  return __async(this, null, function* () {
@@ -6915,17 +6916,6 @@ var Client = class {
6915
6916
  });
6916
6917
  });
6917
6918
  }
6918
- //**List stickers by clan ID */
6919
- listClanStickersByClanId(session, id) {
6920
- return __async(this, null, function* () {
6921
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6922
- yield this.sessionRefresh(session);
6923
- }
6924
- return this.apiClient.listClanStickersByClanId(session.token, id).then((response) => {
6925
- return Promise.resolve(response);
6926
- });
6927
- });
6928
- }
6929
6919
  //**Delete a sticker by ID*/
6930
6920
  deleteClanStickerById(session, id, clan_id) {
6931
6921
  return __async(this, null, function* () {
@@ -6959,4 +6949,26 @@ var Client = class {
6959
6949
  });
6960
6950
  });
6961
6951
  }
6952
+ /** */
6953
+ getListPermissionRoleChannel(session, roleId, channelId) {
6954
+ return __async(this, null, function* () {
6955
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6956
+ yield this.sessionRefresh(session);
6957
+ }
6958
+ return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
6959
+ return Promise.resolve(response);
6960
+ });
6961
+ });
6962
+ }
6963
+ /** */
6964
+ setRoleChannelPermission(session, request) {
6965
+ return __async(this, null, function* () {
6966
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6967
+ yield this.sessionRefresh(session);
6968
+ }
6969
+ return this.apiClient.setRoleChannelPermission(session.token, request).then((response) => {
6970
+ return response !== void 0;
6971
+ });
6972
+ });
6973
+ }
6962
6974
  };
@@ -2388,34 +2388,6 @@ var MezonApi = class {
2388
2388
  )
2389
2389
  ]);
2390
2390
  }
2391
- /** Get emoji list by clan id */
2392
- listClanEmojiByClanId(bearerToken, clanId, options = {}) {
2393
- if (clanId === null || clanId === void 0) {
2394
- throw new Error("'clanId' is a required parameter but is null or undefined.");
2395
- }
2396
- const urlPath = "/v2/emoji/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2397
- const queryParams = /* @__PURE__ */ new Map();
2398
- let bodyJson = "";
2399
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2400
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2401
- if (bearerToken) {
2402
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2403
- }
2404
- return Promise.race([
2405
- fetch(fullUrl, fetchOptions).then((response) => {
2406
- if (response.status == 204) {
2407
- return response;
2408
- } else if (response.status >= 200 && response.status < 300) {
2409
- return response.json();
2410
- } else {
2411
- throw response;
2412
- }
2413
- }),
2414
- new Promise(
2415
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2416
- )
2417
- ]);
2418
- }
2419
2391
  /** Delete a emoji by ID. */
2420
2392
  deleteByIdClanEmoji(bearerToken, id, clanId, options = {}) {
2421
2393
  if (id === null || id === void 0) {
@@ -3395,6 +3367,62 @@ var MezonApi = class {
3395
3367
  )
3396
3368
  ]);
3397
3369
  }
3370
+ /** List permission role channel */
3371
+ getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
3372
+ const urlPath = "/v2/permissionrolechannel/get";
3373
+ const queryParams = /* @__PURE__ */ new Map();
3374
+ queryParams.set("role_id", roleId);
3375
+ queryParams.set("channel_id", channelId);
3376
+ let bodyJson = "";
3377
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3378
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3379
+ if (bearerToken) {
3380
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3381
+ }
3382
+ return Promise.race([
3383
+ fetch(fullUrl, fetchOptions).then((response) => {
3384
+ if (response.status == 204) {
3385
+ return response;
3386
+ } else if (response.status >= 200 && response.status < 300) {
3387
+ return response.json();
3388
+ } else {
3389
+ throw response;
3390
+ }
3391
+ }),
3392
+ new Promise(
3393
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3394
+ )
3395
+ ]);
3396
+ }
3397
+ /** set permission role channel. */
3398
+ setRoleChannelPermission(bearerToken, body, options = {}) {
3399
+ if (body === null || body === void 0) {
3400
+ throw new Error("'body' is a required parameter but is null or undefined.");
3401
+ }
3402
+ const urlPath = "/v2/permissionrolechannel/set";
3403
+ const queryParams = /* @__PURE__ */ new Map();
3404
+ let bodyJson = "";
3405
+ bodyJson = JSON.stringify(body || {});
3406
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3407
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3408
+ if (bearerToken) {
3409
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3410
+ }
3411
+ return Promise.race([
3412
+ fetch(fullUrl, fetchOptions).then((response) => {
3413
+ if (response.status == 204) {
3414
+ return response;
3415
+ } else if (response.status >= 200 && response.status < 300) {
3416
+ return response.json();
3417
+ } else {
3418
+ throw response;
3419
+ }
3420
+ }),
3421
+ new Promise(
3422
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3423
+ )
3424
+ ]);
3425
+ }
3398
3426
  /** Get permission list */
3399
3427
  getListPermission(bearerToken, options = {}) {
3400
3428
  const urlPath = "/v2/permissions";
@@ -3955,34 +3983,6 @@ var MezonApi = class {
3955
3983
  )
3956
3984
  ]);
3957
3985
  }
3958
- /** List stickers by clan ID */
3959
- listClanStickersByClanId(bearerToken, clanId, options = {}) {
3960
- if (clanId === null || clanId === void 0) {
3961
- throw new Error("'clanId' is a required parameter but is null or undefined.");
3962
- }
3963
- const urlPath = "/v2/sticker/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
3964
- const queryParams = /* @__PURE__ */ new Map();
3965
- let bodyJson = "";
3966
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3967
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3968
- if (bearerToken) {
3969
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3970
- }
3971
- return Promise.race([
3972
- fetch(fullUrl, fetchOptions).then((response) => {
3973
- if (response.status == 204) {
3974
- return response;
3975
- } else if (response.status >= 200 && response.status < 300) {
3976
- return response.json();
3977
- } else {
3978
- throw response;
3979
- }
3980
- }),
3981
- new Promise(
3982
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3983
- )
3984
- ]);
3985
- }
3986
3986
  /** Delete a sticker by ID */
3987
3987
  deleteClanStickerById(bearerToken, id, clanId, options = {}) {
3988
3988
  if (id === null || id === void 0) {
@@ -5127,6 +5127,18 @@ var _DefaultSocket = class _DefaultSocket {
5127
5127
  return response.clan_name_existed_event;
5128
5128
  });
5129
5129
  }
5130
+ listClanEmojiByClanId(clan_id) {
5131
+ return __async(this, null, function* () {
5132
+ const response = yield this.send({ emojis_listed_event: { clan_id } });
5133
+ return response.emojis_listed_event;
5134
+ });
5135
+ }
5136
+ listClanStickersByClanId(clan_id) {
5137
+ return __async(this, null, function* () {
5138
+ const response = yield this.send({ sticker_listed_event: { clan_id } });
5139
+ return response.sticker_listed_event;
5140
+ });
5141
+ }
5130
5142
  pingPong() {
5131
5143
  return __async(this, null, function* () {
5132
5144
  if (!this.adapter.isOpen()) {
@@ -6776,17 +6788,6 @@ var Client = class {
6776
6788
  });
6777
6789
  });
6778
6790
  }
6779
- /** List clan emoji. */
6780
- listClanEmoji(session, clan_id) {
6781
- return __async(this, null, function* () {
6782
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6783
- yield this.sessionRefresh(session);
6784
- }
6785
- return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response) => {
6786
- return Promise.resolve(response);
6787
- });
6788
- });
6789
- }
6790
6791
  /** create clan emoji */
6791
6792
  createClanEmoji(session, request) {
6792
6793
  return __async(this, null, function* () {
@@ -6886,17 +6887,6 @@ var Client = class {
6886
6887
  });
6887
6888
  });
6888
6889
  }
6889
- //**List stickers by clan ID */
6890
- listClanStickersByClanId(session, id) {
6891
- return __async(this, null, function* () {
6892
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6893
- yield this.sessionRefresh(session);
6894
- }
6895
- return this.apiClient.listClanStickersByClanId(session.token, id).then((response) => {
6896
- return Promise.resolve(response);
6897
- });
6898
- });
6899
- }
6900
6890
  //**Delete a sticker by ID*/
6901
6891
  deleteClanStickerById(session, id, clan_id) {
6902
6892
  return __async(this, null, function* () {
@@ -6930,6 +6920,28 @@ var Client = class {
6930
6920
  });
6931
6921
  });
6932
6922
  }
6923
+ /** */
6924
+ getListPermissionRoleChannel(session, roleId, channelId) {
6925
+ return __async(this, null, function* () {
6926
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6927
+ yield this.sessionRefresh(session);
6928
+ }
6929
+ return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
6930
+ return Promise.resolve(response);
6931
+ });
6932
+ });
6933
+ }
6934
+ /** */
6935
+ setRoleChannelPermission(session, request) {
6936
+ return __async(this, null, function* () {
6937
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6938
+ yield this.sessionRefresh(session);
6939
+ }
6940
+ return this.apiClient.setRoleChannelPermission(session.token, request).then((response) => {
6941
+ return response !== void 0;
6942
+ });
6943
+ });
6944
+ }
6933
6945
  };
6934
6946
  export {
6935
6947
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -441,6 +441,34 @@ interface StatusUpdate {
441
441
  export interface ClanNameExistedEvent {
442
442
  clan_name: string;
443
443
  }
444
+ /** */
445
+ export interface StrickerListedEvent {
446
+ clan_id: string;
447
+ stickers?: Array<ClanSticker>;
448
+ }
449
+ /** */
450
+ export interface ClanSticker {
451
+ category?: string;
452
+ clan_id?: string;
453
+ create_time?: string;
454
+ creator_id?: string;
455
+ id?: string;
456
+ shortname?: string;
457
+ source?: string;
458
+ }
459
+ /** */
460
+ export interface EmojiListedEvent {
461
+ clan_id: string;
462
+ emoji_list?: Array<ClanEmoji>;
463
+ }
464
+ /** */
465
+ export interface ClanEmoji {
466
+ category?: string;
467
+ creator_id?: string;
468
+ id?: string;
469
+ shortname?: string;
470
+ src?: string;
471
+ }
444
472
  /** A socket connection to Mezon server. */
445
473
  export interface Socket {
446
474
  /** Connection is Open */
@@ -533,6 +561,8 @@ export interface Socket {
533
561
  setHeartbeatTimeoutMs(ms: number): void;
534
562
  getHeartbeatTimeoutMs(): number;
535
563
  checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
564
+ listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
565
+ listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
536
566
  }
537
567
  /** Reports an error received from a socket message. */
538
568
  export interface SocketError {
@@ -609,6 +639,8 @@ export declare class DefaultSocket implements Socket {
609
639
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
610
640
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
611
641
  checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
642
+ listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
643
+ listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
612
644
  private pingPong;
613
645
  }
614
646
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.21",
3
+ "version": "2.8.23",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -623,6 +623,56 @@ interface StatusUpdate {
623
623
  export interface ClanNameExistedEvent {
624
624
  clan_name: string;
625
625
  }
626
+
627
+
628
+ /** */
629
+ export interface StrickerListedEvent {
630
+ // clan id
631
+ clan_id: string;
632
+ // sticker data
633
+ stickers?: Array<ClanSticker>;
634
+ }
635
+
636
+ /** */
637
+ export interface ClanSticker {
638
+ //
639
+ category?: string;
640
+ //
641
+ clan_id?: string;
642
+ //
643
+ create_time?: string;
644
+ //
645
+ creator_id?: string;
646
+ //
647
+ id?: string;
648
+ //
649
+ shortname?: string;
650
+ //
651
+ source?: string;
652
+ }
653
+
654
+ /** */
655
+ export interface EmojiListedEvent {
656
+ // clan id
657
+ clan_id: string;
658
+ // emoji data
659
+ emoji_list?: Array<ClanEmoji>;
660
+ }
661
+
662
+ /** */
663
+ export interface ClanEmoji {
664
+ //
665
+ category?: string;
666
+ //
667
+ creator_id?: string;
668
+ //
669
+ id?: string;
670
+ //
671
+ shortname?: string;
672
+ //
673
+ src?: string;
674
+ }
675
+
626
676
  /** A socket connection to Mezon server. */
627
677
  export interface Socket {
628
678
  /** Connection is Open */
@@ -773,8 +823,11 @@ export interface Socket {
773
823
  /* Get the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
774
824
  getHeartbeatTimeoutMs() : number;
775
825
 
776
- checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>
826
+ checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
827
+
828
+ listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
777
829
 
830
+ listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
778
831
  }
779
832
 
780
833
  /** Reports an error received from a socket message. */
@@ -1238,7 +1291,7 @@ export class DefaultSocket implements Socket {
1238
1291
  }});
1239
1292
  }
1240
1293
 
1241
- async rpc(id?: string, payload?: string, http_key?: string) : Promise<ApiRpc> {
1294
+ async rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc> {
1242
1295
  const response = await this.send(
1243
1296
  {
1244
1297
  rpc: {
@@ -1273,37 +1326,37 @@ export class DefaultSocket implements Socket {
1273
1326
  return response.channel_message_ack;
1274
1327
  }
1275
1328
 
1276
- async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<MessageReactionEvent> {
1329
+ async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent> {
1277
1330
  const response = await this.send({message_reaction_event: {id: id, clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, emoji_id: emoji_id, emoji: emoji, count: count, message_sender_id: message_sender_id, action: action_delete}});
1278
1331
  return response.message_reaction_event
1279
1332
  }
1280
1333
 
1281
- async writeMessageTyping(clan_id: string, channel_id: string, mode: number) : Promise<MessageTypingEvent> {
1334
+ async writeMessageTyping(clan_id: string, channel_id: string, mode: number): Promise<MessageTypingEvent> {
1282
1335
  const response = await this.send({message_typing_event: {clan_id: clan_id, channel_id: channel_id, mode:mode}});
1283
1336
  return response.message_typing_event
1284
1337
  }
1285
1338
 
1286
- async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string) : Promise<LastSeenMessageEvent> {
1339
+ async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent> {
1287
1340
  const response = await this.send({last_seen_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, timestamp: timestamp}});
1288
1341
  return response.last_seen_message_event
1289
1342
  }
1290
1343
 
1291
- async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number) : Promise<LastPinMessageEvent> {
1344
+ async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number): Promise<LastPinMessageEvent> {
1292
1345
  const response = await this.send({last_pin_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, timestamp: timestamp, operation: operation}});
1293
1346
  return response.last_pin_message_event
1294
1347
  }
1295
1348
 
1296
- async writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string) : Promise<VoiceJoinedEvent> {
1349
+ async writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent> {
1297
1350
  const response = await this.send({voice_joined_event: {clan_id: clanId, clan_name: clanName, id: id, participant: participant, voice_channel_id: voiceChannelId, voice_channel_label: voiceChannelLabel, last_screenshot: lastScreenshot}});
1298
1351
  return response.voice_joined_event
1299
1352
  }
1300
1353
 
1301
- async writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string) : Promise<VoiceLeavedEvent> {
1354
+ async writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent> {
1302
1355
  const response = await this.send({voice_leaved_event: {id: id, clan_id: clanId, voice_channel_id: voiceChannelId, voice_user_id: voiceUserId}});
1303
1356
  return response.voice_leaved_event
1304
1357
  }
1305
1358
 
1306
- async writeCustomStatus(clan_id: string, status: string) : Promise<CustomStatusEvent> {
1359
+ async writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent> {
1307
1360
  const response = await this.send({custom_status_event: {clan_id: clan_id, status: status}});
1308
1361
  return response.custom_status_event
1309
1362
  }
@@ -1313,7 +1366,17 @@ export class DefaultSocket implements Socket {
1313
1366
  return response.clan_name_existed_event
1314
1367
  }
1315
1368
 
1316
- private async pingPong() : Promise<void> {
1369
+ async listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent> {
1370
+ const response = await this.send({emojis_listed_event: {clan_id: clan_id}});
1371
+ return response.emojis_listed_event
1372
+ }
1373
+
1374
+ async listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent> {
1375
+ const response = await this.send({sticker_listed_event: {clan_id: clan_id}});
1376
+ return response.sticker_listed_event
1377
+ }
1378
+
1379
+ private async pingPong(): Promise<void> {
1317
1380
  if (!this.adapter.isOpen()) {
1318
1381
  return;
1319
1382
  }