mezon-js 2.8.92 → 2.8.94

Sign up to get free protection for your applications and to get access to all the features.
@@ -4990,6 +4990,10 @@ 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);
4995
+ } else if (message.event_emoji) {
4996
+ this.oneventemoji(message.event_emoji);
4993
4997
  } else if (message.channel_deleted_event) {
4994
4998
  this.onchanneldeleted(message.channel_deleted_event);
4995
4999
  } else if (message.clan_deleted_event) {
@@ -5232,6 +5236,16 @@ var _DefaultSocket = class _DefaultSocket {
5232
5236
  console.log(channelCreated);
5233
5237
  }
5234
5238
  }
5239
+ onroleevent(roleEvent) {
5240
+ if (this.verbose && window && window.console) {
5241
+ console.log(roleEvent);
5242
+ }
5243
+ }
5244
+ oneventemoji(eventEmoji) {
5245
+ if (this.verbose && window && window.console) {
5246
+ console.log(eventEmoji);
5247
+ }
5248
+ }
5235
5249
  onchanneldeleted(channelDeleted) {
5236
5250
  if (this.verbose && window && window.console) {
5237
5251
  console.log(channelDeleted);
@@ -5451,15 +5465,15 @@ var _DefaultSocket = class _DefaultSocket {
5451
5465
  return response.custom_status_event;
5452
5466
  });
5453
5467
  }
5454
- checkDuplicateClanName(clan_name) {
5468
+ checkDuplicateName(name, condition_id, type) {
5455
5469
  return __async(this, null, function* () {
5456
- const response = yield this.send({ clan_name_existed_event: { clan_name } });
5457
- return response.clan_name_existed_event;
5470
+ const response = yield this.send({ check_name_existed_event: { name, condition_id, type } });
5471
+ return response.check_name_existed_event;
5458
5472
  });
5459
5473
  }
5460
- listClanEmojiByClanId(clan_id) {
5474
+ listClanEmojiByUserId() {
5461
5475
  return __async(this, null, function* () {
5462
- const response = yield this.send({ emojis_listed_event: { clan_id } });
5476
+ const response = yield this.send({ emojis_listed_event: {} });
5463
5477
  return response.emojis_listed_event;
5464
5478
  });
5465
5479
  }
@@ -4961,6 +4961,10 @@ 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);
4966
+ } else if (message.event_emoji) {
4967
+ this.oneventemoji(message.event_emoji);
4964
4968
  } else if (message.channel_deleted_event) {
4965
4969
  this.onchanneldeleted(message.channel_deleted_event);
4966
4970
  } else if (message.clan_deleted_event) {
@@ -5203,6 +5207,16 @@ var _DefaultSocket = class _DefaultSocket {
5203
5207
  console.log(channelCreated);
5204
5208
  }
5205
5209
  }
5210
+ onroleevent(roleEvent) {
5211
+ if (this.verbose && window && window.console) {
5212
+ console.log(roleEvent);
5213
+ }
5214
+ }
5215
+ oneventemoji(eventEmoji) {
5216
+ if (this.verbose && window && window.console) {
5217
+ console.log(eventEmoji);
5218
+ }
5219
+ }
5206
5220
  onchanneldeleted(channelDeleted) {
5207
5221
  if (this.verbose && window && window.console) {
5208
5222
  console.log(channelDeleted);
@@ -5422,15 +5436,15 @@ var _DefaultSocket = class _DefaultSocket {
5422
5436
  return response.custom_status_event;
5423
5437
  });
5424
5438
  }
5425
- checkDuplicateClanName(clan_name) {
5439
+ checkDuplicateName(name, condition_id, type) {
5426
5440
  return __async(this, null, function* () {
5427
- const response = yield this.send({ clan_name_existed_event: { clan_name } });
5428
- return response.clan_name_existed_event;
5441
+ const response = yield this.send({ check_name_existed_event: { name, condition_id, type } });
5442
+ return response.check_name_existed_event;
5429
5443
  });
5430
5444
  }
5431
- listClanEmojiByClanId(clan_id) {
5445
+ listClanEmojiByUserId() {
5432
5446
  return __async(this, null, function* () {
5433
- const response = yield this.send({ emojis_listed_event: { clan_id } });
5447
+ const response = yield this.send({ emojis_listed_event: {} });
5434
5448
  return response.emojis_listed_event;
5435
5449
  });
5436
5450
  }
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,25 @@ 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
+ }
471
+ export interface EventEmoji {
472
+ id: string;
473
+ clan_id: string;
474
+ short_name: string;
475
+ source: string;
476
+ category: string;
477
+ action: string;
478
+ }
459
479
  export interface UserPermissionInChannelListEvent {
460
480
  clan_id: string;
461
481
  channel_id: string;
@@ -468,6 +488,9 @@ export interface ClanEmoji {
468
488
  id?: string;
469
489
  shortname?: string;
470
490
  src?: string;
491
+ logo?: string;
492
+ clan_name?: string;
493
+ clan_id?: string;
471
494
  }
472
495
  /** */
473
496
  export interface ChannelDescListEvent {
@@ -647,6 +670,7 @@ export interface Socket {
647
670
  onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
648
671
  onvoiceleaved: (voiceParticipant: VoiceLeavedEvent) => void;
649
672
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
673
+ onroleevent: (roleEvent: RoleEvent) => void;
650
674
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
651
675
  onstickercreated: (stickerCreated: StickerCreateEvent) => void;
652
676
  onstickerupdated: (stickerUpdated: StickerUpdateEvent) => void;
@@ -657,8 +681,8 @@ export interface Socket {
657
681
  onclanupdated: (clan: ClanUpdatedEvent) => void;
658
682
  setHeartbeatTimeoutMs(ms: number): void;
659
683
  getHeartbeatTimeoutMs(): number;
660
- checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
661
- listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
684
+ checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
685
+ listClanEmojiByUserId(): Promise<EmojiListedEvent>;
662
686
  listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
663
687
  listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
664
688
  listStickersByUserId(): Promise<StrickerListedEvent>;
@@ -673,6 +697,7 @@ export interface Socket {
673
697
  getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
674
698
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
675
699
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
700
+ oneventemoji: (event_emoji: EventEmoji) => void;
676
701
  }
677
702
  /** Reports an error received from a socket message. */
678
703
  export interface SocketError {
@@ -721,6 +746,8 @@ export declare class DefaultSocket implements Socket {
721
746
  onvoicejoined(voiceParticipant: VoiceJoinedEvent): void;
722
747
  onvoiceleaved(voiceParticipant: VoiceLeavedEvent): void;
723
748
  onchannelcreated(channelCreated: ChannelCreatedEvent): void;
749
+ onroleevent(roleEvent: RoleEvent): void;
750
+ oneventemoji(eventEmoji: EventEmoji): void;
724
751
  onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
725
752
  onclandeleted(clanDeleted: ClanDeletedEvent): void;
726
753
  onstickercreated(stickerCreated: StickerCreateEvent): void;
@@ -753,8 +780,8 @@ export declare class DefaultSocket implements Socket {
753
780
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
754
781
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
755
782
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
756
- checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
757
- listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
783
+ checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
784
+ listClanEmojiByUserId(): Promise<EmojiListedEvent>;
758
785
  listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
759
786
  listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
760
787
  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.94",
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,27 @@ 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
+
681
+ export interface EventEmoji {
682
+ id : string
683
+ clan_id: string
684
+ short_name: string
685
+ source: string
686
+ category: string
687
+ action: string
688
+ }
689
+
669
690
  export interface UserPermissionInChannelListEvent {
670
691
  //
671
692
  clan_id: string;
@@ -687,6 +708,12 @@ export interface ClanEmoji {
687
708
  shortname?: string;
688
709
  //
689
710
  src?: string;
711
+ //
712
+ logo?: string;
713
+ //
714
+ clan_name?: string;
715
+ //
716
+ clan_id?: string;
690
717
  }
691
718
 
692
719
  /** */
@@ -977,6 +1004,8 @@ export interface Socket {
977
1004
  // when channel is created
978
1005
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
979
1006
 
1007
+ onroleevent: (roleEvent: RoleEvent) => void;
1008
+
980
1009
  // when channel is deleted
981
1010
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
982
1011
 
@@ -1007,9 +1036,9 @@ export interface Socket {
1007
1036
  /* Get the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
1008
1037
  getHeartbeatTimeoutMs() : number;
1009
1038
 
1010
- checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
1039
+ checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
1011
1040
 
1012
- listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
1041
+ listClanEmojiByUserId(): Promise<EmojiListedEvent>;
1013
1042
 
1014
1043
  listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
1015
1044
 
@@ -1039,6 +1068,8 @@ export interface Socket {
1039
1068
 
1040
1069
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
1041
1070
 
1071
+ oneventemoji: (event_emoji: EventEmoji) => void;
1072
+
1042
1073
  }
1043
1074
 
1044
1075
  /** Reports an error received from a socket message. */
@@ -1120,6 +1151,10 @@ export class DefaultSocket implements Socket {
1120
1151
  this.onvoiceleaved(message.voice_leaved_event)
1121
1152
  } else if (message.channel_created_event) {
1122
1153
  this.onchannelcreated(message.channel_created_event)
1154
+ } else if (message.role_event) {
1155
+ this.onroleevent(message.role_event)
1156
+ } else if(message.event_emoji){
1157
+ this.oneventemoji(message.event_emoji)
1123
1158
  } else if (message.channel_deleted_event) {
1124
1159
  this.onchanneldeleted(message.channel_deleted_event)
1125
1160
  } else if (message.clan_deleted_event) {
@@ -1395,6 +1430,18 @@ export class DefaultSocket implements Socket {
1395
1430
  }
1396
1431
  }
1397
1432
 
1433
+ onroleevent(roleEvent: RoleEvent) {
1434
+ if (this.verbose && window && window.console) {
1435
+ console.log(roleEvent);
1436
+ }
1437
+ }
1438
+
1439
+ oneventemoji(eventEmoji: EventEmoji) {
1440
+ if (this.verbose && window && window.console) {
1441
+ console.log(eventEmoji);
1442
+ }
1443
+ }
1444
+
1398
1445
  onchanneldeleted(channelDeleted: ChannelDeletedEvent) {
1399
1446
  if (this.verbose && window && window.console) {
1400
1447
  console.log(channelDeleted);
@@ -1629,13 +1676,13 @@ export class DefaultSocket implements Socket {
1629
1676
  return response.custom_status_event
1630
1677
  }
1631
1678
 
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
1679
+ async checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent> {
1680
+ const response = await this.send({check_name_existed_event: {name: name, condition_id: condition_id, type: type}});
1681
+ return response.check_name_existed_event
1635
1682
  }
1636
1683
 
1637
- async listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent> {
1638
- const response = await this.send({emojis_listed_event: {clan_id: clan_id}});
1684
+ async listClanEmojiByUserId(): Promise<EmojiListedEvent> {
1685
+ const response = await this.send({emojis_listed_event: {}});
1639
1686
  return response.emojis_listed_event
1640
1687
  }
1641
1688