mezon-js 2.7.18 → 2.7.20

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -2846,24 +2846,21 @@ return Promise.race([
2846
2846
  /** Update fields in a given clan. */
2847
2847
  updateClanDesc(bearerToken: string,
2848
2848
  clanId:string,
2849
- creatorId?:string,
2850
- clanName?:string,
2851
- logo?:string,
2852
- banner?:string,
2849
+ body: {},
2853
2850
  options: any = {}): Promise<any> {
2854
2851
 
2855
2852
  if (clanId === null || clanId === undefined) {
2856
2853
  throw new Error("'clanId' is a required parameter but is null or undefined.");
2854
+ }
2855
+ if (body === null || body === undefined) {
2856
+ throw new Error("'body' is a required parameter but is null or undefined.");
2857
2857
  }
2858
2858
  const urlPath = "/v2/clandesc/{clanId}"
2859
2859
  .replace("{clanId}", encodeURIComponent(String(clanId)));
2860
2860
  const queryParams = new Map<string, any>();
2861
- queryParams.set("creator_id", creatorId);
2862
- queryParams.set("clan_name", clanName);
2863
- queryParams.set("logo", logo);
2864
- queryParams.set("banner", banner);
2865
2861
 
2866
2862
  let bodyJson : string = "";
2863
+ bodyJson = JSON.stringify(body || {});
2867
2864
 
2868
2865
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2869
2866
  const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
package/client.ts CHANGED
@@ -1803,7 +1803,7 @@ export class Client {
1803
1803
  await this.sessionRefresh(session);
1804
1804
  }
1805
1805
 
1806
- return this.apiClient.updateClanDesc(session.token, clanId, request?.creator_id, request?.clan_name, request?.logo, request?.banner).then((response: any) => {
1806
+ return this.apiClient.updateClanDesc(session.token, clanId, request).then((response: any) => {
1807
1807
  return response !== undefined;
1808
1808
  });
1809
1809
  }
package/dist/api.gen.d.ts CHANGED
@@ -708,7 +708,7 @@ export declare class MezonApi {
708
708
  /** Delete a clan desc by ID. */
709
709
  deleteClanDesc(bearerToken: string, clanDescId: string, options?: any): Promise<any>;
710
710
  /** Update fields in a given clan. */
711
- updateClanDesc(bearerToken: string, clanId: string, creatorId?: string, clanName?: string, logo?: string, banner?: string, options?: any): Promise<any>;
711
+ updateClanDesc(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
712
712
  /** List all users that are part of a clan. */
713
713
  listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
714
714
  /** Get a clan desc profile */
@@ -2057,17 +2057,17 @@ var MezonApi = class {
2057
2057
  ]);
2058
2058
  }
2059
2059
  /** Update fields in a given clan. */
2060
- updateClanDesc(bearerToken, clanId, creatorId, clanName, logo, banner, options = {}) {
2060
+ updateClanDesc(bearerToken, clanId, body, options = {}) {
2061
2061
  if (clanId === null || clanId === void 0) {
2062
2062
  throw new Error("'clanId' is a required parameter but is null or undefined.");
2063
2063
  }
2064
+ if (body === null || body === void 0) {
2065
+ throw new Error("'body' is a required parameter but is null or undefined.");
2066
+ }
2064
2067
  const urlPath = "/v2/clandesc/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2065
2068
  const queryParams = /* @__PURE__ */ new Map();
2066
- queryParams.set("creator_id", creatorId);
2067
- queryParams.set("clan_name", clanName);
2068
- queryParams.set("logo", logo);
2069
- queryParams.set("banner", banner);
2070
2069
  let bodyJson = "";
2070
+ bodyJson = JSON.stringify(body || {});
2071
2071
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2072
2072
  const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2073
2073
  if (bearerToken) {
@@ -3697,6 +3697,8 @@ var _DefaultSocket = class _DefaultSocket {
3697
3697
  this.onchannelcreated(message.channel_created_event);
3698
3698
  } else if (message.channel_deleted_event) {
3699
3699
  this.onchanneldeleted(message.channel_deleted_event);
3700
+ } else if (message.channel_updated_event) {
3701
+ this.onchannelupdated(message.channel_updated_event);
3700
3702
  } else if (message.status_presence_event) {
3701
3703
  this.onstatuspresence(message.status_presence_event);
3702
3704
  } else if (message.stream_presence_event) {
@@ -3900,6 +3902,11 @@ var _DefaultSocket = class _DefaultSocket {
3900
3902
  console.log(channelDeleted);
3901
3903
  }
3902
3904
  }
3905
+ onchannelupdated(channelUpdated) {
3906
+ if (this.verbose && window && window.console) {
3907
+ console.log(channelUpdated);
3908
+ }
3909
+ }
3903
3910
  onstreampresence(streamPresence) {
3904
3911
  if (this.verbose && window && window.console) {
3905
3912
  console.log(streamPresence);
@@ -5348,7 +5355,7 @@ var Client = class {
5348
5355
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5349
5356
  yield this.sessionRefresh(session);
5350
5357
  }
5351
- return this.apiClient.updateClanDesc(session.token, clanId, request == null ? void 0 : request.creator_id, request == null ? void 0 : request.clan_name, request == null ? void 0 : request.logo, request == null ? void 0 : request.banner).then((response) => {
5358
+ return this.apiClient.updateClanDesc(session.token, clanId, request).then((response) => {
5352
5359
  return response !== void 0;
5353
5360
  });
5354
5361
  });
@@ -2029,17 +2029,17 @@ var MezonApi = class {
2029
2029
  ]);
2030
2030
  }
2031
2031
  /** Update fields in a given clan. */
2032
- updateClanDesc(bearerToken, clanId, creatorId, clanName, logo, banner, options = {}) {
2032
+ updateClanDesc(bearerToken, clanId, body, options = {}) {
2033
2033
  if (clanId === null || clanId === void 0) {
2034
2034
  throw new Error("'clanId' is a required parameter but is null or undefined.");
2035
2035
  }
2036
+ if (body === null || body === void 0) {
2037
+ throw new Error("'body' is a required parameter but is null or undefined.");
2038
+ }
2036
2039
  const urlPath = "/v2/clandesc/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2037
2040
  const queryParams = /* @__PURE__ */ new Map();
2038
- queryParams.set("creator_id", creatorId);
2039
- queryParams.set("clan_name", clanName);
2040
- queryParams.set("logo", logo);
2041
- queryParams.set("banner", banner);
2042
2041
  let bodyJson = "";
2042
+ bodyJson = JSON.stringify(body || {});
2043
2043
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2044
2044
  const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2045
2045
  if (bearerToken) {
@@ -3669,6 +3669,8 @@ var _DefaultSocket = class _DefaultSocket {
3669
3669
  this.onchannelcreated(message.channel_created_event);
3670
3670
  } else if (message.channel_deleted_event) {
3671
3671
  this.onchanneldeleted(message.channel_deleted_event);
3672
+ } else if (message.channel_updated_event) {
3673
+ this.onchannelupdated(message.channel_updated_event);
3672
3674
  } else if (message.status_presence_event) {
3673
3675
  this.onstatuspresence(message.status_presence_event);
3674
3676
  } else if (message.stream_presence_event) {
@@ -3872,6 +3874,11 @@ var _DefaultSocket = class _DefaultSocket {
3872
3874
  console.log(channelDeleted);
3873
3875
  }
3874
3876
  }
3877
+ onchannelupdated(channelUpdated) {
3878
+ if (this.verbose && window && window.console) {
3879
+ console.log(channelUpdated);
3880
+ }
3881
+ }
3875
3882
  onstreampresence(streamPresence) {
3876
3883
  if (this.verbose && window && window.console) {
3877
3884
  console.log(streamPresence);
@@ -5320,7 +5327,7 @@ var Client = class {
5320
5327
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5321
5328
  yield this.sessionRefresh(session);
5322
5329
  }
5323
- return this.apiClient.updateClanDesc(session.token, clanId, request == null ? void 0 : request.creator_id, request == null ? void 0 : request.clan_name, request == null ? void 0 : request.logo, request == null ? void 0 : request.banner).then((response) => {
5330
+ return this.apiClient.updateClanDesc(session.token, clanId, request).then((response) => {
5324
5331
  return response !== void 0;
5325
5332
  });
5326
5333
  });
package/dist/socket.d.ts CHANGED
@@ -254,6 +254,15 @@ export interface VoiceJoinedEvent {
254
254
  voice_channel_id: string;
255
255
  last_screenshot: string;
256
256
  }
257
+ export interface ChannelUpdatedEvent {
258
+ clan_id: string;
259
+ category_id: string;
260
+ creator_id: string;
261
+ parrent_id: string;
262
+ channel_id: string;
263
+ channel_label: string;
264
+ channel_type: number;
265
+ }
257
266
  export interface ChannelCreatedEvent {
258
267
  clan_id: string;
259
268
  category_id: string;
@@ -594,6 +603,7 @@ export interface Socket {
594
603
  onvoiceleaved: (voiceParticipant: VoiceLeavedEvent) => void;
595
604
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
596
605
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
606
+ onchannelupdated: (channelUpdated: ChannelUpdatedEvent) => void;
597
607
  setHeartbeatTimeoutMs(ms: number): void;
598
608
  getHeartbeatTimeoutMs(): number;
599
609
  }
@@ -643,6 +653,7 @@ export declare class DefaultSocket implements Socket {
643
653
  onvoiceleaved(voiceParticipant: VoiceLeavedEvent): void;
644
654
  onchannelcreated(channelCreated: ChannelCreatedEvent): void;
645
655
  onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
656
+ onchannelupdated(channelUpdated: ChannelUpdatedEvent): void;
646
657
  onstreampresence(streamPresence: StreamPresenceEvent): void;
647
658
  onstreamdata(streamData: StreamData): void;
648
659
  onheartbeattimeout(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.18",
3
+ "version": "2.7.20",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -352,6 +352,23 @@ export interface VoiceJoinedEvent {
352
352
  }
353
353
 
354
354
 
355
+ export interface ChannelUpdatedEvent {
356
+ // clan id
357
+ clan_id: string;
358
+ // category
359
+ category_id: string;
360
+ // creator
361
+ creator_id: string;
362
+ // parrent_id
363
+ parrent_id: string;
364
+ // channel id
365
+ channel_id: string;
366
+ // channel label
367
+ channel_label: string;
368
+ // channel type
369
+ channel_type: number;
370
+ }
371
+
355
372
  export interface ChannelCreatedEvent {
356
373
  // clan id
357
374
  clan_id: string;
@@ -779,6 +796,9 @@ export interface Socket {
779
796
  // when channel is created
780
797
  onchanneldeleted: (channelDeleted: ChannelDeletedEvent) => void;
781
798
 
799
+ // when channel is created
800
+ onchannelupdated: (channelUpdated: ChannelUpdatedEvent) => void;
801
+
782
802
  /* Set the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
783
803
  setHeartbeatTimeoutMs(ms : number) : void;
784
804
 
@@ -859,6 +879,8 @@ export class DefaultSocket implements Socket {
859
879
  this.onchannelcreated(message.channel_created_event)
860
880
  } else if (message.channel_deleted_event) {
861
881
  this.onchanneldeleted(message.channel_deleted_event)
882
+ } else if (message.channel_updated_event) {
883
+ this.onchannelupdated(message.channel_updated_event)
862
884
  } else if (message.status_presence_event) {
863
885
  this.onstatuspresence(<StatusPresenceEvent>message.status_presence_event);
864
886
  } else if (message.stream_presence_event) {
@@ -1093,6 +1115,12 @@ export class DefaultSocket implements Socket {
1093
1115
  }
1094
1116
  }
1095
1117
 
1118
+ onchannelupdated(channelUpdated: ChannelUpdatedEvent) {
1119
+ if (this.verbose && window && window.console) {
1120
+ console.log(channelUpdated);
1121
+ }
1122
+ }
1123
+
1096
1124
  onstreampresence(streamPresence: StreamPresenceEvent) {
1097
1125
  if (this.verbose && window && window.console) {
1098
1126
  console.log(streamPresence);