mezon-js 2.8.92 → 2.8.93

Sign up to get free protection for your applications and to get access to all the features.
@@ -4990,6 +4990,8 @@ var _DefaultSocket = class _DefaultSocket {
4990
4990
  this.onvoiceleaved(message.voice_leaved_event);
4991
4991
  } else if (message.channel_created_event) {
4992
4992
  this.onchannelcreated(message.channel_created_event);
4993
+ } else if (message.role_event) {
4994
+ this.onroleevent(message.role_event);
4993
4995
  } else if (message.channel_deleted_event) {
4994
4996
  this.onchanneldeleted(message.channel_deleted_event);
4995
4997
  } else if (message.clan_deleted_event) {
@@ -5232,6 +5234,11 @@ var _DefaultSocket = class _DefaultSocket {
5232
5234
  console.log(channelCreated);
5233
5235
  }
5234
5236
  }
5237
+ onroleevent(roleEvent) {
5238
+ if (this.verbose && window && window.console) {
5239
+ console.log(roleEvent);
5240
+ }
5241
+ }
5235
5242
  onchanneldeleted(channelDeleted) {
5236
5243
  if (this.verbose && window && window.console) {
5237
5244
  console.log(channelDeleted);
@@ -5451,15 +5458,15 @@ var _DefaultSocket = class _DefaultSocket {
5451
5458
  return response.custom_status_event;
5452
5459
  });
5453
5460
  }
5454
- checkDuplicateClanName(clan_name) {
5461
+ checkDuplicateName(name, condition_id, type) {
5455
5462
  return __async(this, null, function* () {
5456
- const response = yield this.send({ clan_name_existed_event: { clan_name } });
5457
- return response.clan_name_existed_event;
5463
+ const response = yield this.send({ check_name_existed_event: { name, condition_id, type } });
5464
+ return response.check_name_existed_event;
5458
5465
  });
5459
5466
  }
5460
- listClanEmojiByClanId(clan_id) {
5467
+ listClanEmojiByUserId() {
5461
5468
  return __async(this, null, function* () {
5462
- const response = yield this.send({ emojis_listed_event: { clan_id } });
5469
+ const response = yield this.send({ emojis_listed_event: {} });
5463
5470
  return response.emojis_listed_event;
5464
5471
  });
5465
5472
  }
@@ -4961,6 +4961,8 @@ var _DefaultSocket = class _DefaultSocket {
4961
4961
  this.onvoiceleaved(message.voice_leaved_event);
4962
4962
  } else if (message.channel_created_event) {
4963
4963
  this.onchannelcreated(message.channel_created_event);
4964
+ } else if (message.role_event) {
4965
+ this.onroleevent(message.role_event);
4964
4966
  } else if (message.channel_deleted_event) {
4965
4967
  this.onchanneldeleted(message.channel_deleted_event);
4966
4968
  } else if (message.clan_deleted_event) {
@@ -5203,6 +5205,11 @@ var _DefaultSocket = class _DefaultSocket {
5203
5205
  console.log(channelCreated);
5204
5206
  }
5205
5207
  }
5208
+ onroleevent(roleEvent) {
5209
+ if (this.verbose && window && window.console) {
5210
+ console.log(roleEvent);
5211
+ }
5212
+ }
5206
5213
  onchanneldeleted(channelDeleted) {
5207
5214
  if (this.verbose && window && window.console) {
5208
5215
  console.log(channelDeleted);
@@ -5422,15 +5429,15 @@ var _DefaultSocket = class _DefaultSocket {
5422
5429
  return response.custom_status_event;
5423
5430
  });
5424
5431
  }
5425
- checkDuplicateClanName(clan_name) {
5432
+ checkDuplicateName(name, condition_id, type) {
5426
5433
  return __async(this, null, function* () {
5427
- const response = yield this.send({ clan_name_existed_event: { clan_name } });
5428
- return response.clan_name_existed_event;
5434
+ const response = yield this.send({ check_name_existed_event: { name, condition_id, type } });
5435
+ return response.check_name_existed_event;
5429
5436
  });
5430
5437
  }
5431
- listClanEmojiByClanId(clan_id) {
5438
+ listClanEmojiByUserId() {
5432
5439
  return __async(this, null, function* () {
5433
- const response = yield this.send({ emojis_listed_event: { clan_id } });
5440
+ const response = yield this.send({ emojis_listed_event: {} });
5434
5441
  return response.emojis_listed_event;
5435
5442
  });
5436
5443
  }
package/dist/socket.d.ts CHANGED
@@ -424,9 +424,11 @@ interface StatusUpdate {
424
424
  status?: string;
425
425
  };
426
426
  }
427
- export interface ClanNameExistedEvent {
427
+ export interface CheckNameExistedEvent {
428
428
  clan_name: string;
429
429
  exist: boolean;
430
+ condition_id: string;
431
+ type: number;
430
432
  }
431
433
  /** */
432
434
  export interface StrickerListedEvent {
@@ -446,7 +448,6 @@ export interface ClanSticker {
446
448
  }
447
449
  /** */
448
450
  export interface EmojiListedEvent {
449
- clan_id: string;
450
451
  emoji_list?: Array<ClanEmoji>;
451
452
  }
452
453
  export interface RoleListEvent {
@@ -456,6 +457,17 @@ export interface RoleListEvent {
456
457
  ClanId: string;
457
458
  roles: ApiRoleList;
458
459
  }
460
+ export interface RoleEvent {
461
+ clan_id: string;
462
+ role_id: string;
463
+ creator_id: string;
464
+ user_ids_assigned: Array<string>;
465
+ permission_ids_assigned: Array<string>;
466
+ user_ids_removed: Array<string>;
467
+ permission_ids_removed: Array<string>;
468
+ role_title: string;
469
+ status: string;
470
+ }
459
471
  export interface UserPermissionInChannelListEvent {
460
472
  clan_id: string;
461
473
  channel_id: string;
@@ -468,6 +480,9 @@ export interface ClanEmoji {
468
480
  id?: string;
469
481
  shortname?: string;
470
482
  src?: string;
483
+ logo?: string;
484
+ clan_name?: string;
485
+ clan_id?: string;
471
486
  }
472
487
  /** */
473
488
  export interface ChannelDescListEvent {
@@ -647,6 +662,7 @@ export interface Socket {
647
662
  onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
648
663
  onvoiceleaved: (voiceParticipant: VoiceLeavedEvent) => void;
649
664
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
665
+ onroleevent: (roleEvent: RoleEvent) => void;
650
666
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
651
667
  onstickercreated: (stickerCreated: StickerCreateEvent) => void;
652
668
  onstickerupdated: (stickerUpdated: StickerUpdateEvent) => void;
@@ -657,8 +673,8 @@ export interface Socket {
657
673
  onclanupdated: (clan: ClanUpdatedEvent) => void;
658
674
  setHeartbeatTimeoutMs(ms: number): void;
659
675
  getHeartbeatTimeoutMs(): number;
660
- checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
661
- listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
676
+ checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
677
+ listClanEmojiByUserId(): Promise<EmojiListedEvent>;
662
678
  listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
663
679
  listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
664
680
  listStickersByUserId(): Promise<StrickerListedEvent>;
@@ -721,6 +737,7 @@ export declare class DefaultSocket implements Socket {
721
737
  onvoicejoined(voiceParticipant: VoiceJoinedEvent): void;
722
738
  onvoiceleaved(voiceParticipant: VoiceLeavedEvent): void;
723
739
  onchannelcreated(channelCreated: ChannelCreatedEvent): void;
740
+ onroleevent(roleEvent: RoleEvent): void;
724
741
  onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
725
742
  onclandeleted(clanDeleted: ClanDeletedEvent): void;
726
743
  onstickercreated(stickerCreated: StickerCreateEvent): void;
@@ -753,8 +770,8 @@ export declare class DefaultSocket implements Socket {
753
770
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
754
771
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
755
772
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
756
- checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
757
- listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
773
+ checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
774
+ listClanEmojiByUserId(): Promise<EmojiListedEvent>;
758
775
  listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
759
776
  listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
760
777
  listChannelByUserId(): Promise<ChannelDescListEvent>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.8.92",
4
+ "version": "2.8.93",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -612,9 +612,11 @@ interface StatusUpdate {
612
612
  /** Status string to set, if not present the user will appear offline. */
613
613
  status_update: {status?: string;};
614
614
  }
615
- export interface ClanNameExistedEvent {
615
+ export interface CheckNameExistedEvent {
616
616
  clan_name: string;
617
617
  exist: boolean;
618
+ condition_id : string;
619
+ type: number;
618
620
  }
619
621
 
620
622
 
@@ -648,8 +650,6 @@ export interface ClanSticker {
648
650
 
649
651
  /** */
650
652
  export interface EmojiListedEvent {
651
- // clan id
652
- clan_id: string;
653
653
  // emoji data
654
654
  emoji_list?: Array<ClanEmoji>;
655
655
  }
@@ -666,6 +666,18 @@ export interface RoleListEvent {
666
666
  roles: ApiRoleList;
667
667
  }
668
668
 
669
+ export interface RoleEvent {
670
+ clan_id: string;
671
+ role_id: string;
672
+ creator_id: string;
673
+ user_ids_assigned: Array<string>;
674
+ permission_ids_assigned: Array<string>;
675
+ user_ids_removed: Array<string>;
676
+ permission_ids_removed: Array<string>;
677
+ role_title: string;
678
+ status: string;
679
+ }
680
+
669
681
  export interface UserPermissionInChannelListEvent {
670
682
  //
671
683
  clan_id: string;
@@ -687,6 +699,12 @@ export interface ClanEmoji {
687
699
  shortname?: string;
688
700
  //
689
701
  src?: string;
702
+ //
703
+ logo?: string;
704
+ //
705
+ clan_name?: string;
706
+ //
707
+ clan_id?: string;
690
708
  }
691
709
 
692
710
  /** */
@@ -977,6 +995,8 @@ export interface Socket {
977
995
  // when channel is created
978
996
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
979
997
 
998
+ onroleevent: (roleEvent: RoleEvent) => void;
999
+
980
1000
  // when channel is deleted
981
1001
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
982
1002
 
@@ -1007,9 +1027,9 @@ export interface Socket {
1007
1027
  /* Get the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
1008
1028
  getHeartbeatTimeoutMs() : number;
1009
1029
 
1010
- checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
1030
+ checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
1011
1031
 
1012
- listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
1032
+ listClanEmojiByUserId(): Promise<EmojiListedEvent>;
1013
1033
 
1014
1034
  listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
1015
1035
 
@@ -1120,6 +1140,8 @@ export class DefaultSocket implements Socket {
1120
1140
  this.onvoiceleaved(message.voice_leaved_event)
1121
1141
  } else if (message.channel_created_event) {
1122
1142
  this.onchannelcreated(message.channel_created_event)
1143
+ } else if (message.role_event) {
1144
+ this.onroleevent(message.role_event)
1123
1145
  } else if (message.channel_deleted_event) {
1124
1146
  this.onchanneldeleted(message.channel_deleted_event)
1125
1147
  } else if (message.clan_deleted_event) {
@@ -1395,6 +1417,12 @@ export class DefaultSocket implements Socket {
1395
1417
  }
1396
1418
  }
1397
1419
 
1420
+ onroleevent(roleEvent: RoleEvent) {
1421
+ if (this.verbose && window && window.console) {
1422
+ console.log(roleEvent);
1423
+ }
1424
+ }
1425
+
1398
1426
  onchanneldeleted(channelDeleted: ChannelDeletedEvent) {
1399
1427
  if (this.verbose && window && window.console) {
1400
1428
  console.log(channelDeleted);
@@ -1629,13 +1657,13 @@ export class DefaultSocket implements Socket {
1629
1657
  return response.custom_status_event
1630
1658
  }
1631
1659
 
1632
- async checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent> {
1633
- const response = await this.send({clan_name_existed_event: {clan_name: clan_name}});
1634
- return response.clan_name_existed_event
1660
+ async checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent> {
1661
+ const response = await this.send({check_name_existed_event: {name: name, condition_id: condition_id, type: type}});
1662
+ return response.check_name_existed_event
1635
1663
  }
1636
1664
 
1637
- async listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent> {
1638
- const response = await this.send({emojis_listed_event: {clan_id: clan_id}});
1665
+ async listClanEmojiByUserId(): Promise<EmojiListedEvent> {
1666
+ const response = await this.send({emojis_listed_event: {}});
1639
1667
  return response.emojis_listed_event
1640
1668
  }
1641
1669