mezon-js 2.8.39 → 2.8.41

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/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, 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, ApiNotificationChannelCategoySettingsList, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp } 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, 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, ApiNotificationChannelCategoySettingsList, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateRoleDeleteBody } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -71,6 +71,7 @@ export interface ChannelMessage {
71
71
  update_time_ms?: number;
72
72
  mode?: number;
73
73
  message_id?: string;
74
+ hideEditted?: boolean;
74
75
  }
75
76
  /** A list of channel messages, usually a result of a list operation. */
76
77
  export interface ChannelMessageList {
@@ -308,6 +309,7 @@ export interface ApiUpdateRoleRequest {
308
309
  remove_user_ids: string[];
309
310
  /** The permissions to remove. */
310
311
  remove_permission_ids: string[];
312
+ clan_id: string;
311
313
  }
312
314
  /** A client for Mezon server. */
313
315
  export declare class Client {
@@ -417,7 +419,7 @@ export declare class Client {
417
419
  /** List permission */
418
420
  getListPermission(session: Session): Promise<ApiPermissionList>;
419
421
  /** Update action role when delete role */
420
- updateRoleDelete(session: Session, roleId: string, request: {}): Promise<boolean>;
422
+ updateRoleDelete(session: Session, roleId: string, request: MezonUpdateRoleDeleteBody): Promise<boolean>;
421
423
  /** List user roles */
422
424
  listRolePermissions(session: Session, roleId: string): Promise<ApiPermissionList>;
423
425
  /** List user roles */
@@ -535,8 +537,6 @@ export declare class Client {
535
537
  updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
536
538
  changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody): Promise<boolean>;
537
539
  /** */
538
- getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList>;
539
- /** */
540
540
  setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
541
541
  addApp(session: Session, request: ApiAddAppRequest): Promise<boolean>;
542
542
  getApp(session: Session, id: string): Promise<ApiApp>;
@@ -3468,33 +3468,6 @@ var MezonApi = class {
3468
3468
  )
3469
3469
  ]);
3470
3470
  }
3471
- /** List permission role channel */
3472
- getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
3473
- const urlPath = "/v2/permissionrolechannel/get";
3474
- const queryParams = /* @__PURE__ */ new Map();
3475
- queryParams.set("role_id", roleId);
3476
- queryParams.set("channel_id", channelId);
3477
- let bodyJson = "";
3478
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3479
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3480
- if (bearerToken) {
3481
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3482
- }
3483
- return Promise.race([
3484
- fetch(fullUrl, fetchOptions).then((response) => {
3485
- if (response.status == 204) {
3486
- return response;
3487
- } else if (response.status >= 200 && response.status < 300) {
3488
- return response.json();
3489
- } else {
3490
- throw response;
3491
- }
3492
- }),
3493
- new Promise(
3494
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3495
- )
3496
- ]);
3497
- }
3498
3471
  /** set permission role channel. */
3499
3472
  setRoleChannelPermission(bearerToken, body, options = {}) {
3500
3473
  if (body === null || body === void 0) {
@@ -4715,7 +4688,8 @@ var _DefaultSocket = class _DefaultSocket {
4715
4688
  reactions,
4716
4689
  mentions,
4717
4690
  attachments,
4718
- references
4691
+ references,
4692
+ hideEditted: message.channel_message.hide_editted
4719
4693
  };
4720
4694
  this.onchannelmessage(e);
4721
4695
  } else if (message.message_typing_event) {
@@ -5096,6 +5070,12 @@ var _DefaultSocket = class _DefaultSocket {
5096
5070
  return response.hashtag_dm_list_event;
5097
5071
  });
5098
5072
  }
5073
+ GetPermissionByRoleIdChannelId(role_id, channel_id) {
5074
+ return __async(this, null, function* () {
5075
+ const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id } });
5076
+ return response.permission_role_channel_list_event;
5077
+ });
5078
+ }
5099
5079
  listClanStickersByClanId(clan_id) {
5100
5080
  return __async(this, null, function* () {
5101
5081
  const response = yield this.send({ sticker_listed_event: { clan_id } });
@@ -6764,17 +6744,6 @@ var Client = class {
6764
6744
  });
6765
6745
  }
6766
6746
  /** */
6767
- getListPermissionRoleChannel(session, roleId, channelId) {
6768
- return __async(this, null, function* () {
6769
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6770
- yield this.sessionRefresh(session);
6771
- }
6772
- return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
6773
- return Promise.resolve(response);
6774
- });
6775
- });
6776
- }
6777
- /** */
6778
6747
  setRoleChannelPermission(session, request) {
6779
6748
  return __async(this, null, function* () {
6780
6749
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
@@ -3439,33 +3439,6 @@ var MezonApi = class {
3439
3439
  )
3440
3440
  ]);
3441
3441
  }
3442
- /** List permission role channel */
3443
- getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
3444
- const urlPath = "/v2/permissionrolechannel/get";
3445
- const queryParams = /* @__PURE__ */ new Map();
3446
- queryParams.set("role_id", roleId);
3447
- queryParams.set("channel_id", channelId);
3448
- let bodyJson = "";
3449
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3450
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3451
- if (bearerToken) {
3452
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3453
- }
3454
- return Promise.race([
3455
- fetch(fullUrl, fetchOptions).then((response) => {
3456
- if (response.status == 204) {
3457
- return response;
3458
- } else if (response.status >= 200 && response.status < 300) {
3459
- return response.json();
3460
- } else {
3461
- throw response;
3462
- }
3463
- }),
3464
- new Promise(
3465
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3466
- )
3467
- ]);
3468
- }
3469
3442
  /** set permission role channel. */
3470
3443
  setRoleChannelPermission(bearerToken, body, options = {}) {
3471
3444
  if (body === null || body === void 0) {
@@ -4686,7 +4659,8 @@ var _DefaultSocket = class _DefaultSocket {
4686
4659
  reactions,
4687
4660
  mentions,
4688
4661
  attachments,
4689
- references
4662
+ references,
4663
+ hideEditted: message.channel_message.hide_editted
4690
4664
  };
4691
4665
  this.onchannelmessage(e);
4692
4666
  } else if (message.message_typing_event) {
@@ -5067,6 +5041,12 @@ var _DefaultSocket = class _DefaultSocket {
5067
5041
  return response.hashtag_dm_list_event;
5068
5042
  });
5069
5043
  }
5044
+ GetPermissionByRoleIdChannelId(role_id, channel_id) {
5045
+ return __async(this, null, function* () {
5046
+ const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id } });
5047
+ return response.permission_role_channel_list_event;
5048
+ });
5049
+ }
5070
5050
  listClanStickersByClanId(clan_id) {
5071
5051
  return __async(this, null, function* () {
5072
5052
  const response = yield this.send({ sticker_listed_event: { clan_id } });
@@ -6735,17 +6715,6 @@ var Client = class {
6735
6715
  });
6736
6716
  }
6737
6717
  /** */
6738
- getListPermissionRoleChannel(session, roleId, channelId) {
6739
- return __async(this, null, function* () {
6740
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6741
- yield this.sessionRefresh(session);
6742
- }
6743
- return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
6744
- return Promise.resolve(response);
6745
- });
6746
- });
6747
- }
6748
- /** */
6749
6718
  setRoleChannelPermission(session, request) {
6750
6719
  return __async(this, null, function* () {
6751
6720
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
package/dist/socket.d.ts CHANGED
@@ -267,6 +267,15 @@ export interface ChannelDeletedEvent {
267
267
  channel_id: string;
268
268
  deletor: string;
269
269
  }
270
+ export interface PermissionRoleChannelListEvent {
271
+ role_id?: string;
272
+ channel_id?: string;
273
+ permission_role_channel?: Array<PermissionRoleChannel>;
274
+ }
275
+ export interface PermissionRoleChannel {
276
+ permission_id?: string;
277
+ active?: boolean;
278
+ }
270
279
  export interface ClanUpdatedEvent {
271
280
  clan_id: string;
272
281
  clan_name: string;
@@ -542,6 +551,7 @@ export interface Socket {
542
551
  getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
543
552
  getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
544
553
  getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
554
+ GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
545
555
  }
546
556
  /** Reports an error received from a socket message. */
547
557
  export interface SocketError {
@@ -621,6 +631,7 @@ export declare class DefaultSocket implements Socket {
621
631
  listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
622
632
  ListChannelByUserId(): Promise<ChannelDescListEvent>;
623
633
  hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
634
+ GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
624
635
  listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
625
636
  getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
626
637
  getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.39",
3
+ "version": "2.8.41",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -385,6 +385,24 @@ export interface ChannelDeletedEvent {
385
385
  deletor: string;
386
386
  }
387
387
 
388
+ // A list of permission role channel.
389
+ export interface PermissionRoleChannelListEvent {
390
+ //
391
+ role_id?: string;
392
+ //
393
+ channel_id?: string;
394
+ // A list of permission.
395
+ permission_role_channel?: Array<PermissionRoleChannel>;
396
+ }
397
+
398
+ // Permission role channel
399
+ export interface PermissionRoleChannel {
400
+ // Permission id
401
+ permission_id?: string;
402
+ // active
403
+ active?: boolean;
404
+ }
405
+
388
406
  // clan updated event
389
407
  export interface ClanUpdatedEvent {
390
408
  // the clan id
@@ -814,6 +832,7 @@ export interface Socket {
814
832
 
815
833
  getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
816
834
 
835
+ GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
817
836
  }
818
837
 
819
838
  /** Reports an error received from a socket message. */
@@ -959,6 +978,7 @@ export class DefaultSocket implements Socket {
959
978
  mentions: mentions,
960
979
  attachments: attachments,
961
980
  references: references,
981
+ hideEditted: message.channel_message.hide_editted,
962
982
  };
963
983
  this.onchannelmessage(e);
964
984
  } else if (message.message_typing_event) {
@@ -1370,6 +1390,11 @@ export class DefaultSocket implements Socket {
1370
1390
  return response.hashtag_dm_list_event
1371
1391
  }
1372
1392
 
1393
+ async GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent> {
1394
+ const response = await this.send({permission_role_channel_list_event: {role_id: role_id, channel_id: channel_id }});
1395
+ return response.permission_role_channel_list_event
1396
+ }
1397
+
1373
1398
  async listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent> {
1374
1399
  const response = await this.send({sticker_listed_event: {clan_id: clan_id}});
1375
1400
  return response.sticker_listed_event