mezon-js 2.7.95 → 2.7.97

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
@@ -958,6 +958,10 @@ export interface ApiMessageMention {
958
958
  user_id?: string;
959
959
  //
960
960
  username?: string;
961
+ // role id
962
+ role_id?: string;
963
+ // role name
964
+ rolename?: string;
961
965
  }
962
966
 
963
967
  /** */
@@ -1004,6 +1008,14 @@ export interface ApiMessageRef {
1004
1008
 
1005
1009
  /** A notification in the server. */
1006
1010
  export interface ApiNotification {
1011
+ //
1012
+ avatar_url?: string;
1013
+ //
1014
+ channel_id?: string;
1015
+ //
1016
+ channel_type?: string;
1017
+ //
1018
+ clan_id?: string;
1007
1019
  //Category code for this notification.
1008
1020
  code?: number;
1009
1021
  //Content of the notification in JSON.
@@ -4726,12 +4738,14 @@ export class MezonApi {
4726
4738
  /** Fetch list of notifications. */
4727
4739
  listNotifications(bearerToken: string,
4728
4740
  limit?:number,
4741
+ clanId?:string,
4729
4742
  cacheableCursor?:string,
4730
4743
  options: any = {}): Promise<ApiNotificationList> {
4731
4744
 
4732
4745
  const urlPath = "/v2/notification";
4733
4746
  const queryParams = new Map<string, any>();
4734
4747
  queryParams.set("limit", limit);
4748
+ queryParams.set("clan_id", clanId);
4735
4749
  queryParams.set("cacheable_cursor", cacheableCursor);
4736
4750
 
4737
4751
  let bodyJson : string = "";
package/dist/api.gen.d.ts CHANGED
@@ -551,6 +551,8 @@ export interface ApiMessageMention {
551
551
  id?: string;
552
552
  user_id?: string;
553
553
  username?: string;
554
+ role_id?: string;
555
+ rolename?: string;
554
556
  }
555
557
  /** */
556
558
  export interface ApiMessageReaction {
@@ -577,6 +579,10 @@ export interface ApiMessageRef {
577
579
  }
578
580
  /** A notification in the server. */
579
581
  export interface ApiNotification {
582
+ avatar_url?: string;
583
+ channel_id?: string;
584
+ channel_type?: string;
585
+ clan_id?: string;
580
586
  code?: number;
581
587
  content?: string;
582
588
  create_time?: string;
@@ -1110,7 +1116,7 @@ export declare class MezonApi {
1110
1116
  /** Delete one or more notifications for the current user. */
1111
1117
  deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
1112
1118
  /** Fetch list of notifications. */
1113
- listNotifications(bearerToken: string, limit?: number, cacheableCursor?: string, options?: any): Promise<ApiNotificationList>;
1119
+ listNotifications(bearerToken: string, limit?: number, clanId?: string, cacheableCursor?: string, options?: any): Promise<ApiNotificationList>;
1114
1120
  /** notification selected */
1115
1121
  getNotificationChannelSetting(bearerToken: string, channelId?: string, options?: any): Promise<ApiNotificationUserChannel>;
1116
1122
  /** set notification user channel. */
@@ -3072,10 +3072,11 @@ var MezonApi = class {
3072
3072
  ]);
3073
3073
  }
3074
3074
  /** Fetch list of notifications. */
3075
- listNotifications(bearerToken, limit, cacheableCursor, options = {}) {
3075
+ listNotifications(bearerToken, limit, clanId, cacheableCursor, options = {}) {
3076
3076
  const urlPath = "/v2/notification";
3077
3077
  const queryParams = /* @__PURE__ */ new Map();
3078
3078
  queryParams.set("limit", limit);
3079
+ queryParams.set("clan_id", clanId);
3079
3080
  queryParams.set("cacheable_cursor", cacheableCursor);
3080
3081
  let bodyJson = "";
3081
3082
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
@@ -4765,6 +4766,10 @@ var _DefaultSocket = class _DefaultSocket {
4765
4766
  this.onchanneldeleted(message.channel_deleted_event);
4766
4767
  } else if (message.channel_updated_event) {
4767
4768
  this.onchannelupdated(message.channel_updated_event);
4769
+ } else if (message.clan_profile_updated_event) {
4770
+ this.onclanprofileupdated(message.clan_profile_updated_event);
4771
+ } else if (message.clan_updated_event) {
4772
+ this.onclanupdated(message.clan_updated_event);
4768
4773
  } else if (message.status_presence_event) {
4769
4774
  this.onstatuspresence(message.status_presence_event);
4770
4775
  } else if (message.stream_presence_event) {
@@ -4968,6 +4973,16 @@ var _DefaultSocket = class _DefaultSocket {
4968
4973
  console.log(channelUpdated);
4969
4974
  }
4970
4975
  }
4976
+ onclanprofileupdated(clanprofile) {
4977
+ if (this.verbose && window && window.console) {
4978
+ console.log(clanprofile);
4979
+ }
4980
+ }
4981
+ onclanupdated(clan) {
4982
+ if (this.verbose && window && window.console) {
4983
+ console.log(clan);
4984
+ }
4985
+ }
4971
4986
  onstreampresence(streamPresence) {
4972
4987
  if (this.verbose && window && window.console) {
4973
4988
  console.log(streamPresence);
@@ -3043,10 +3043,11 @@ var MezonApi = class {
3043
3043
  ]);
3044
3044
  }
3045
3045
  /** Fetch list of notifications. */
3046
- listNotifications(bearerToken, limit, cacheableCursor, options = {}) {
3046
+ listNotifications(bearerToken, limit, clanId, cacheableCursor, options = {}) {
3047
3047
  const urlPath = "/v2/notification";
3048
3048
  const queryParams = /* @__PURE__ */ new Map();
3049
3049
  queryParams.set("limit", limit);
3050
+ queryParams.set("clan_id", clanId);
3050
3051
  queryParams.set("cacheable_cursor", cacheableCursor);
3051
3052
  let bodyJson = "";
3052
3053
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
@@ -4736,6 +4737,10 @@ var _DefaultSocket = class _DefaultSocket {
4736
4737
  this.onchanneldeleted(message.channel_deleted_event);
4737
4738
  } else if (message.channel_updated_event) {
4738
4739
  this.onchannelupdated(message.channel_updated_event);
4740
+ } else if (message.clan_profile_updated_event) {
4741
+ this.onclanprofileupdated(message.clan_profile_updated_event);
4742
+ } else if (message.clan_updated_event) {
4743
+ this.onclanupdated(message.clan_updated_event);
4739
4744
  } else if (message.status_presence_event) {
4740
4745
  this.onstatuspresence(message.status_presence_event);
4741
4746
  } else if (message.stream_presence_event) {
@@ -4939,6 +4944,16 @@ var _DefaultSocket = class _DefaultSocket {
4939
4944
  console.log(channelUpdated);
4940
4945
  }
4941
4946
  }
4947
+ onclanprofileupdated(clanprofile) {
4948
+ if (this.verbose && window && window.console) {
4949
+ console.log(clanprofile);
4950
+ }
4951
+ }
4952
+ onclanupdated(clan) {
4953
+ if (this.verbose && window && window.console) {
4954
+ console.log(clan);
4955
+ }
4956
+ }
4942
4957
  onstreampresence(streamPresence) {
4943
4958
  if (this.verbose && window && window.console) {
4944
4959
  console.log(streamPresence);
package/dist/socket.d.ts CHANGED
@@ -342,6 +342,16 @@ export interface ChannelDeletedEvent {
342
342
  channel_id: string;
343
343
  deletor: string;
344
344
  }
345
+ export interface ClanUpdatedEvent {
346
+ clan_id: string;
347
+ clan_name: string;
348
+ clan_logo: string;
349
+ }
350
+ export interface ClanProfileUpdatedEvent {
351
+ user_id: string;
352
+ clan_nick: string;
353
+ clan_avatar: string;
354
+ }
345
355
  /** Stream identifier */
346
356
  export interface StreamId {
347
357
  /** The type of stream (e.g. chat). */
@@ -498,6 +508,8 @@ export interface Socket {
498
508
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
499
509
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
500
510
  onchannelupdated: (channelUpdated: ChannelUpdatedEvent) => void;
511
+ onclanprofileupdated: (clanprofile: ClanProfileUpdatedEvent) => void;
512
+ onclanupdated: (clan: ClanUpdatedEvent) => void;
501
513
  setHeartbeatTimeoutMs(ms: number): void;
502
514
  getHeartbeatTimeoutMs(): number;
503
515
  }
@@ -548,6 +560,8 @@ export declare class DefaultSocket implements Socket {
548
560
  onchannelcreated(channelCreated: ChannelCreatedEvent): void;
549
561
  onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
550
562
  onchannelupdated(channelUpdated: ChannelUpdatedEvent): void;
563
+ onclanprofileupdated(clanprofile: ClanProfileUpdatedEvent): void;
564
+ onclanupdated(clan: ClanUpdatedEvent): void;
551
565
  onstreampresence(streamPresence: StreamPresenceEvent): void;
552
566
  onstreamdata(streamData: StreamData): void;
553
567
  onheartbeattimeout(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.95",
3
+ "version": "2.7.97",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -500,6 +500,24 @@ export interface ChannelDeletedEvent {
500
500
  deletor: string;
501
501
  }
502
502
 
503
+ // clan updated event
504
+ export interface ClanUpdatedEvent {
505
+ // the clan id
506
+ clan_id: string;
507
+ // the clan name
508
+ clan_name: string;
509
+ // the clan logo
510
+ clan_logo: string;
511
+ }
512
+
513
+ export interface ClanProfileUpdatedEvent {
514
+ // the user id
515
+ user_id: string;
516
+ // the clan_nick
517
+ clan_nick: string;
518
+ // the avatar
519
+ clan_avatar: string;
520
+ }
503
521
 
504
522
  /** Stream identifier */
505
523
  export interface StreamId {
@@ -706,12 +724,18 @@ export interface Socket {
706
724
  // when channel is created
707
725
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
708
726
 
709
- // when channel is created
727
+ // when channel is deleted
710
728
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
711
729
 
712
- // when channel is created
730
+ // when channel is updated
713
731
  onchannelupdated: (channelUpdated: ChannelUpdatedEvent) => void;
714
732
 
733
+ // when clan profile is updated
734
+ onclanprofileupdated: (clanprofile: ClanProfileUpdatedEvent) => void;
735
+
736
+ // when clan is updated
737
+ onclanupdated: (clan: ClanUpdatedEvent) => void;
738
+
715
739
  /* Set the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
716
740
  setHeartbeatTimeoutMs(ms : number) : void;
717
741
 
@@ -802,6 +826,10 @@ export class DefaultSocket implements Socket {
802
826
  this.onchanneldeleted(message.channel_deleted_event)
803
827
  } else if (message.channel_updated_event) {
804
828
  this.onchannelupdated(message.channel_updated_event)
829
+ } else if (message.clan_profile_updated_event) {
830
+ this.onclanprofileupdated(message.clan_profile_updated_event)
831
+ } else if (message.clan_updated_event) {
832
+ this.onclanupdated(message.clan_updated_event)
805
833
  } else if (message.status_presence_event) {
806
834
  this.onstatuspresence(<StatusPresenceEvent>message.status_presence_event);
807
835
  } else if (message.stream_presence_event) {
@@ -1034,6 +1062,18 @@ export class DefaultSocket implements Socket {
1034
1062
  }
1035
1063
  }
1036
1064
 
1065
+ onclanprofileupdated(clanprofile: ClanProfileUpdatedEvent) {
1066
+ if (this.verbose && window && window.console) {
1067
+ console.log(clanprofile);
1068
+ }
1069
+ }
1070
+
1071
+ onclanupdated(clan: ClanUpdatedEvent) {
1072
+ if (this.verbose && window && window.console) {
1073
+ console.log(clan);
1074
+ }
1075
+ }
1076
+
1037
1077
  onstreampresence(streamPresence: StreamPresenceEvent) {
1038
1078
  if (this.verbose && window && window.console) {
1039
1079
  console.log(streamPresence);