mezon-js 2.9.16 → 2.9.18

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -1496,6 +1496,8 @@ export interface ApiPinMessageRequest {
1496
1496
  //
1497
1497
  channel_id?: string;
1498
1498
  //
1499
+ clan_id?: string;
1500
+ //
1499
1501
  message_id?: string;
1500
1502
  }
1501
1503
 
@@ -6277,12 +6279,16 @@ export class MezonApi {
6277
6279
 
6278
6280
  /** */
6279
6281
  getPinMessagesList(bearerToken: string,
6282
+ messageId?:string,
6280
6283
  channelId?:string,
6284
+ clanId?:string,
6281
6285
  options: any = {}): Promise<ApiPinMessagesList> {
6282
6286
 
6283
6287
  const urlPath = "/v2/pinmessage/get";
6284
6288
  const queryParams = new Map<string, any>();
6289
+ queryParams.set("message_id", messageId);
6285
6290
  queryParams.set("channel_id", channelId);
6291
+ queryParams.set("clan_id", clanId);
6286
6292
 
6287
6293
  let bodyJson : string = "";
6288
6294
 
package/client.ts CHANGED
@@ -2994,7 +2994,9 @@ export class Client {
2994
2994
 
2995
2995
  async pinMessagesList(
2996
2996
  session: Session,
2997
- channelId: string
2997
+ messageId: string,
2998
+ channelId: string,
2999
+ clanId: string,
2998
3000
  ): Promise<ApiPinMessagesList> {
2999
3001
  if (
3000
3002
  this.autoRefreshSession &&
@@ -3005,7 +3007,7 @@ export class Client {
3005
3007
  }
3006
3008
 
3007
3009
  return this.apiClient
3008
- .getPinMessagesList(session.token, channelId)
3010
+ .getPinMessagesList(session.token, messageId, channelId, clanId)
3009
3011
  .then((response: ApiPinMessagesList) => {
3010
3012
  return Promise.resolve(response);
3011
3013
  });
package/dist/api.gen.d.ts CHANGED
@@ -866,6 +866,7 @@ export interface ApiPinMessage {
866
866
  /** */
867
867
  export interface ApiPinMessageRequest {
868
868
  channel_id?: string;
869
+ clan_id?: string;
869
870
  message_id?: string;
870
871
  }
871
872
  /** */
@@ -1420,7 +1421,7 @@ export declare class MezonApi {
1420
1421
  /** */
1421
1422
  deletePinMessage(bearerToken: string, messageId?: string, options?: any): Promise<any>;
1422
1423
  /** */
1423
- getPinMessagesList(bearerToken: string, channelId?: string, options?: any): Promise<ApiPinMessagesList>;
1424
+ getPinMessagesList(bearerToken: string, messageId?: string, channelId?: string, clanId?: string, options?: any): Promise<ApiPinMessagesList>;
1424
1425
  /** set notification user channel. */
1425
1426
  createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<any>;
1426
1427
  /** */
package/dist/client.d.ts CHANGED
@@ -525,7 +525,7 @@ export declare class Client {
525
525
  searchMessage(session: Session, request: ApiSearchMessageRequest): Promise<ApiSearchMessageResponse>;
526
526
  /** */
527
527
  createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean>;
528
- pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
528
+ pinMessagesList(session: Session, messageId: string, channelId: string, clanId: string): Promise<ApiPinMessagesList>;
529
529
  deletePinMessage(session: Session, message_id: string): Promise<boolean>;
530
530
  /** create clan emoji */
531
531
  createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
@@ -3997,10 +3997,12 @@ var MezonApi = class {
3997
3997
  ]);
3998
3998
  }
3999
3999
  /** */
4000
- getPinMessagesList(bearerToken, channelId, options = {}) {
4000
+ getPinMessagesList(bearerToken, messageId, channelId, clanId, options = {}) {
4001
4001
  const urlPath = "/v2/pinmessage/get";
4002
4002
  const queryParams = /* @__PURE__ */ new Map();
4003
+ queryParams.set("message_id", messageId);
4003
4004
  queryParams.set("channel_id", channelId);
4005
+ queryParams.set("clan_id", clanId);
4004
4006
  let bodyJson = "";
4005
4007
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4006
4008
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -5387,6 +5389,8 @@ var _DefaultSocket = class _DefaultSocket {
5387
5389
  this.onclanprofileupdated(message.clan_profile_updated_event);
5388
5390
  } else if (message.clan_updated_event) {
5389
5391
  this.onclanupdated(message.clan_updated_event);
5392
+ } else if (message.last_seen_message_event) {
5393
+ this.onlastseenupdated(message.last_seen_message_event);
5390
5394
  } else if (message.status_presence_event) {
5391
5395
  this.onstatuspresence(message.status_presence_event);
5392
5396
  } else if (message.stream_presence_event) {
@@ -5675,6 +5679,11 @@ var _DefaultSocket = class _DefaultSocket {
5675
5679
  console.log(clan);
5676
5680
  }
5677
5681
  }
5682
+ onlastseenupdated(event) {
5683
+ if (this.verbose && window && window.console) {
5684
+ console.log(event);
5685
+ }
5686
+ }
5678
5687
  onstreampresence(streamPresence) {
5679
5688
  if (this.verbose && window && window.console) {
5680
5689
  console.log(streamPresence);
@@ -7545,12 +7554,12 @@ var Client = class {
7545
7554
  });
7546
7555
  });
7547
7556
  }
7548
- pinMessagesList(session, channelId) {
7557
+ pinMessagesList(session, messageId, channelId, clanId) {
7549
7558
  return __async(this, null, function* () {
7550
7559
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7551
7560
  yield this.sessionRefresh(session);
7552
7561
  }
7553
- return this.apiClient.getPinMessagesList(session.token, channelId).then((response) => {
7562
+ return this.apiClient.getPinMessagesList(session.token, messageId, channelId, clanId).then((response) => {
7554
7563
  return Promise.resolve(response);
7555
7564
  });
7556
7565
  });
@@ -3968,10 +3968,12 @@ var MezonApi = class {
3968
3968
  ]);
3969
3969
  }
3970
3970
  /** */
3971
- getPinMessagesList(bearerToken, channelId, options = {}) {
3971
+ getPinMessagesList(bearerToken, messageId, channelId, clanId, options = {}) {
3972
3972
  const urlPath = "/v2/pinmessage/get";
3973
3973
  const queryParams = /* @__PURE__ */ new Map();
3974
+ queryParams.set("message_id", messageId);
3974
3975
  queryParams.set("channel_id", channelId);
3976
+ queryParams.set("clan_id", clanId);
3975
3977
  let bodyJson = "";
3976
3978
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3977
3979
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -5358,6 +5360,8 @@ var _DefaultSocket = class _DefaultSocket {
5358
5360
  this.onclanprofileupdated(message.clan_profile_updated_event);
5359
5361
  } else if (message.clan_updated_event) {
5360
5362
  this.onclanupdated(message.clan_updated_event);
5363
+ } else if (message.last_seen_message_event) {
5364
+ this.onlastseenupdated(message.last_seen_message_event);
5361
5365
  } else if (message.status_presence_event) {
5362
5366
  this.onstatuspresence(message.status_presence_event);
5363
5367
  } else if (message.stream_presence_event) {
@@ -5646,6 +5650,11 @@ var _DefaultSocket = class _DefaultSocket {
5646
5650
  console.log(clan);
5647
5651
  }
5648
5652
  }
5653
+ onlastseenupdated(event) {
5654
+ if (this.verbose && window && window.console) {
5655
+ console.log(event);
5656
+ }
5657
+ }
5649
5658
  onstreampresence(streamPresence) {
5650
5659
  if (this.verbose && window && window.console) {
5651
5660
  console.log(streamPresence);
@@ -7516,12 +7525,12 @@ var Client = class {
7516
7525
  });
7517
7526
  });
7518
7527
  }
7519
- pinMessagesList(session, channelId) {
7528
+ pinMessagesList(session, messageId, channelId, clanId) {
7520
7529
  return __async(this, null, function* () {
7521
7530
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7522
7531
  yield this.sessionRefresh(session);
7523
7532
  }
7524
- return this.apiClient.getPinMessagesList(session.token, channelId).then((response) => {
7533
+ return this.apiClient.getPinMessagesList(session.token, messageId, channelId, clanId).then((response) => {
7525
7534
  return Promise.resolve(response);
7526
7535
  });
7527
7536
  });
package/dist/socket.d.ts CHANGED
@@ -750,6 +750,7 @@ export interface Socket {
750
750
  onchannelupdated: (channelUpdated: ChannelUpdatedEvent) => void;
751
751
  onclanprofileupdated: (clanprofile: ClanProfileUpdatedEvent) => void;
752
752
  onclanupdated: (clan: ClanUpdatedEvent) => void;
753
+ onlastseenupdated: (event: LastSeenMessageEvent) => void;
753
754
  setHeartbeatTimeoutMs(ms: number): void;
754
755
  getHeartbeatTimeoutMs(): number;
755
756
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
@@ -834,6 +835,7 @@ export declare class DefaultSocket implements Socket {
834
835
  onchannelupdated(channelUpdated: ChannelUpdatedEvent): void;
835
836
  onclanprofileupdated(clanprofile: ClanProfileUpdatedEvent): void;
836
837
  onclanupdated(clan: ClanUpdatedEvent): void;
838
+ onlastseenupdated(event: LastSeenMessageEvent): void;
837
839
  onstreampresence(streamPresence: StreamPresenceEvent): void;
838
840
  onstreamdata(streamData: StreamData): void;
839
841
  onheartbeattimeout(): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.16",
4
+ "version": "2.9.18",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -1110,6 +1110,9 @@ export interface Socket {
1110
1110
  // when clan is updated
1111
1111
  onclanupdated: (clan: ClanUpdatedEvent) => void;
1112
1112
 
1113
+ // when user update last seen message
1114
+ onlastseenupdated: (event: LastSeenMessageEvent) => void;
1115
+
1113
1116
  /* Set the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
1114
1117
  setHeartbeatTimeoutMs(ms : number) : void;
1115
1118
 
@@ -1235,35 +1238,37 @@ export class DefaultSocket implements Socket {
1235
1238
  this.onnotification(n);
1236
1239
  });
1237
1240
  } else if (message.voice_started_event) {
1238
- this.onvoicestarted(message.voice_started_event)
1241
+ this.onvoicestarted(message.voice_started_event);
1239
1242
  } else if (message.voice_ended_event) {
1240
- this.onvoiceended(message.voice_ended_event)
1243
+ this.onvoiceended(message.voice_ended_event);
1241
1244
  } else if (message.voice_joined_event) {
1242
- this.onvoicejoined(message.voice_joined_event)
1245
+ this.onvoicejoined(message.voice_joined_event);
1243
1246
  } else if (message.voice_leaved_event) {
1244
- this.onvoiceleaved(message.voice_leaved_event)
1247
+ this.onvoiceleaved(message.voice_leaved_event);
1245
1248
  } else if (message.channel_created_event) {
1246
- this.onchannelcreated(message.channel_created_event)
1249
+ this.onchannelcreated(message.channel_created_event);
1247
1250
  } else if (message.role_event) {
1248
- this.onroleevent(message.role_event)
1249
- } else if(message.event_emoji){
1250
- this.oneventemoji(message.event_emoji)
1251
+ this.onroleevent(message.role_event);
1252
+ } else if(message.event_emoji) {
1253
+ this.oneventemoji(message.event_emoji);
1251
1254
  } else if (message.channel_deleted_event) {
1252
- this.onchanneldeleted(message.channel_deleted_event)
1255
+ this.onchanneldeleted(message.channel_deleted_event);
1253
1256
  } else if (message.clan_deleted_event) {
1254
- this.onclandeleted(message.clan_deleted_event)
1257
+ this.onclandeleted(message.clan_deleted_event);
1255
1258
  } else if (message.sticker_create_event) {
1256
- this.onstickercreated(message.sticker_create_event)
1259
+ this.onstickercreated(message.sticker_create_event);
1257
1260
  } else if (message.sticker_update_event) {
1258
- this.onstickerupdated(message.sticker_update_event)
1261
+ this.onstickerupdated(message.sticker_update_event);
1259
1262
  } else if (message.sticker_delete_event) {
1260
- this.onstickerdeleted(message.sticker_delete_event)
1263
+ this.onstickerdeleted(message.sticker_delete_event);
1261
1264
  } else if (message.channel_updated_event) {
1262
- this.onchannelupdated(message.channel_updated_event)
1265
+ this.onchannelupdated(message.channel_updated_event);
1263
1266
  } else if (message.clan_profile_updated_event) {
1264
- this.onclanprofileupdated(message.clan_profile_updated_event)
1267
+ this.onclanprofileupdated(message.clan_profile_updated_event);
1265
1268
  } else if (message.clan_updated_event) {
1266
- this.onclanupdated(message.clan_updated_event)
1269
+ this.onclanupdated(message.clan_updated_event);
1270
+ } else if (message.last_seen_message_event) {
1271
+ this.onlastseenupdated(message.last_seen_message_event);
1267
1272
  } else if (message.status_presence_event) {
1268
1273
  this.onstatuspresence(<StatusPresenceEvent>message.status_presence_event);
1269
1274
  } else if (message.stream_presence_event) {
@@ -1596,6 +1601,12 @@ export class DefaultSocket implements Socket {
1596
1601
  }
1597
1602
  }
1598
1603
 
1604
+ onlastseenupdated(event: LastSeenMessageEvent) {
1605
+ if (this.verbose && window && window.console) {
1606
+ console.log(event);
1607
+ }
1608
+ }
1609
+
1599
1610
  onstreampresence(streamPresence: StreamPresenceEvent) {
1600
1611
  if (this.verbose && window && window.console) {
1601
1612
  console.log(streamPresence);