mezon-js 2.7.96 → 2.7.98

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
  /** */
@@ -4733,8 +4737,8 @@ export class MezonApi {
4733
4737
 
4734
4738
  /** Fetch list of notifications. */
4735
4739
  listNotifications(bearerToken: string,
4740
+ clanId:string,
4736
4741
  limit?:number,
4737
- clanId?:string,
4738
4742
  cacheableCursor?:string,
4739
4743
  options: any = {}): Promise<ApiNotificationList> {
4740
4744
 
package/client.ts CHANGED
@@ -1598,13 +1598,13 @@ export class Client {
1598
1598
  }
1599
1599
 
1600
1600
  /** Fetch list of notifications. */
1601
- async listNotifications(session: Session, limit?: number, cacheableCursor?: string): Promise<NotificationList> {
1601
+ async listNotifications(session: Session, clanId: string, limit?: number, cacheableCursor?: string): Promise<NotificationList> {
1602
1602
  if (this.autoRefreshSession && session.refresh_token &&
1603
1603
  session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1604
1604
  await this.sessionRefresh(session);
1605
1605
  }
1606
1606
 
1607
- return this.apiClient.listNotifications(session.token, limit, cacheableCursor).then((response: ApiNotificationList) => {
1607
+ return this.apiClient.listNotifications(session.token, clanId, limit, cacheableCursor).then((response: ApiNotificationList) => {
1608
1608
  var result: NotificationList = {
1609
1609
  cacheable_cursor: response.cacheable_cursor,
1610
1610
  notifications: [],
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 {
@@ -1114,7 +1116,7 @@ export declare class MezonApi {
1114
1116
  /** Delete one or more notifications for the current user. */
1115
1117
  deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
1116
1118
  /** Fetch list of notifications. */
1117
- listNotifications(bearerToken: string, limit?: number, clanId?: string, cacheableCursor?: string, options?: any): Promise<ApiNotificationList>;
1119
+ listNotifications(bearerToken: string, clanId: string, limit?: number, cacheableCursor?: string, options?: any): Promise<ApiNotificationList>;
1118
1120
  /** notification selected */
1119
1121
  getNotificationChannelSetting(bearerToken: string, channelId?: string, options?: any): Promise<ApiNotificationUserChannel>;
1120
1122
  /** set notification user channel. */
package/dist/client.d.ts CHANGED
@@ -494,7 +494,7 @@ export declare class Client {
494
494
  /** List all friends for the current user. */
495
495
  listFriends(session: Session, state?: number, limit?: number, cursor?: string): Promise<Friends>;
496
496
  /** Fetch list of notifications. */
497
- listNotifications(session: Session, limit?: number, cacheableCursor?: string): Promise<NotificationList>;
497
+ listNotifications(session: Session, clanId: string, limit?: number, cacheableCursor?: string): Promise<NotificationList>;
498
498
  /** List storage objects. */
499
499
  listStorageObjects(session: Session, collection: string, userId?: string, limit?: number, cursor?: string): Promise<StorageObjectList>;
500
500
  /** Fetch storage objects. */
@@ -3072,7 +3072,7 @@ var MezonApi = class {
3072
3072
  ]);
3073
3073
  }
3074
3074
  /** Fetch list of notifications. */
3075
- listNotifications(bearerToken, limit, clanId, cacheableCursor, options = {}) {
3075
+ listNotifications(bearerToken, clanId, limit, cacheableCursor, options = {}) {
3076
3076
  const urlPath = "/v2/notification";
3077
3077
  const queryParams = /* @__PURE__ */ new Map();
3078
3078
  queryParams.set("limit", limit);
@@ -4766,6 +4766,10 @@ var _DefaultSocket = class _DefaultSocket {
4766
4766
  this.onchanneldeleted(message.channel_deleted_event);
4767
4767
  } else if (message.channel_updated_event) {
4768
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);
4769
4773
  } else if (message.status_presence_event) {
4770
4774
  this.onstatuspresence(message.status_presence_event);
4771
4775
  } else if (message.stream_presence_event) {
@@ -4969,6 +4973,16 @@ var _DefaultSocket = class _DefaultSocket {
4969
4973
  console.log(channelUpdated);
4970
4974
  }
4971
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
+ }
4972
4986
  onstreampresence(streamPresence) {
4973
4987
  if (this.verbose && window && window.console) {
4974
4988
  console.log(streamPresence);
@@ -6177,12 +6191,12 @@ var Client = class {
6177
6191
  });
6178
6192
  }
6179
6193
  /** Fetch list of notifications. */
6180
- listNotifications(session, limit, cacheableCursor) {
6194
+ listNotifications(session, clanId, limit, cacheableCursor) {
6181
6195
  return __async(this, null, function* () {
6182
6196
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6183
6197
  yield this.sessionRefresh(session);
6184
6198
  }
6185
- return this.apiClient.listNotifications(session.token, limit, cacheableCursor).then((response) => {
6199
+ return this.apiClient.listNotifications(session.token, clanId, limit, cacheableCursor).then((response) => {
6186
6200
  var result = {
6187
6201
  cacheable_cursor: response.cacheable_cursor,
6188
6202
  notifications: []
@@ -3043,7 +3043,7 @@ var MezonApi = class {
3043
3043
  ]);
3044
3044
  }
3045
3045
  /** Fetch list of notifications. */
3046
- listNotifications(bearerToken, limit, clanId, cacheableCursor, options = {}) {
3046
+ listNotifications(bearerToken, clanId, limit, cacheableCursor, options = {}) {
3047
3047
  const urlPath = "/v2/notification";
3048
3048
  const queryParams = /* @__PURE__ */ new Map();
3049
3049
  queryParams.set("limit", limit);
@@ -4737,6 +4737,10 @@ var _DefaultSocket = class _DefaultSocket {
4737
4737
  this.onchanneldeleted(message.channel_deleted_event);
4738
4738
  } else if (message.channel_updated_event) {
4739
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);
4740
4744
  } else if (message.status_presence_event) {
4741
4745
  this.onstatuspresence(message.status_presence_event);
4742
4746
  } else if (message.stream_presence_event) {
@@ -4940,6 +4944,16 @@ var _DefaultSocket = class _DefaultSocket {
4940
4944
  console.log(channelUpdated);
4941
4945
  }
4942
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
+ }
4943
4957
  onstreampresence(streamPresence) {
4944
4958
  if (this.verbose && window && window.console) {
4945
4959
  console.log(streamPresence);
@@ -6148,12 +6162,12 @@ var Client = class {
6148
6162
  });
6149
6163
  }
6150
6164
  /** Fetch list of notifications. */
6151
- listNotifications(session, limit, cacheableCursor) {
6165
+ listNotifications(session, clanId, limit, cacheableCursor) {
6152
6166
  return __async(this, null, function* () {
6153
6167
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6154
6168
  yield this.sessionRefresh(session);
6155
6169
  }
6156
- return this.apiClient.listNotifications(session.token, limit, cacheableCursor).then((response) => {
6170
+ return this.apiClient.listNotifications(session.token, clanId, limit, cacheableCursor).then((response) => {
6157
6171
  var result = {
6158
6172
  cacheable_cursor: response.cacheable_cursor,
6159
6173
  notifications: []
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.96",
3
+ "version": "2.7.98",
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);