mezon-js 2.7.39 → 2.7.41

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
@@ -552,6 +552,8 @@ export interface ApiEventManagement {
552
552
  title?: string;
553
553
  //
554
554
  user_ids?: Array<string>;
555
+ //
556
+ create_time?: string;
555
557
  }
556
558
 
557
559
  /** */
@@ -3081,6 +3083,44 @@ export class MezonApi {
3081
3083
  ]);
3082
3084
  }
3083
3085
 
3086
+ /** Kick a set of users from a clan. */
3087
+ removeClanUsers(bearerToken: string,
3088
+ clanId:string,
3089
+ userIds?:Array<string>,
3090
+ options: any = {}): Promise<any> {
3091
+
3092
+ if (clanId === null || clanId === undefined) {
3093
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
3094
+ }
3095
+ const urlPath = "/v2/clandesc/{clanId}/kick"
3096
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
3097
+ const queryParams = new Map<string, any>();
3098
+ queryParams.set("user_ids", userIds);
3099
+
3100
+ let bodyJson : string = "";
3101
+
3102
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3103
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3104
+ if (bearerToken) {
3105
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3106
+ }
3107
+
3108
+ return Promise.race([
3109
+ fetch(fullUrl, fetchOptions).then((response) => {
3110
+ if (response.status == 204) {
3111
+ return response;
3112
+ } else if (response.status >= 200 && response.status < 300) {
3113
+ return response.json();
3114
+ } else {
3115
+ throw response;
3116
+ }
3117
+ }),
3118
+ new Promise((_, reject) =>
3119
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3120
+ ),
3121
+ ]);
3122
+ }
3123
+
3084
3124
  /** List all users that are part of a clan. */
3085
3125
  listClanUsers(bearerToken: string,
3086
3126
  clanId:string,
package/client.ts CHANGED
@@ -992,6 +992,18 @@ export class Client {
992
992
  });
993
993
  }
994
994
 
995
+ /** Kick a set of users from a clan. */
996
+ async removeClanUsers(session: Session, clanId: string, ids?: Array<string>): Promise<boolean> {
997
+ if (this.autoRefreshSession && session.refresh_token &&
998
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
999
+ await this.sessionRefresh(session);
1000
+ }
1001
+
1002
+ return this.apiClient.removeClanUsers(session.token, clanId, ids).then((response: any) => {
1003
+ return Promise.resolve(response != undefined);
1004
+ });
1005
+ }
1006
+
995
1007
  /** Kick users from a channel, or decline their join requests. */
996
1008
  async removeChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean> {
997
1009
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -315,6 +315,7 @@ export interface ApiEventManagement {
315
315
  start_time?: string;
316
316
  title?: string;
317
317
  user_ids?: Array<string>;
318
+ create_time?: string;
318
319
  }
319
320
  /** */
320
321
  export interface ApiFilterParam {
@@ -825,6 +826,8 @@ export declare class MezonApi {
825
826
  deleteClanDesc(bearerToken: string, clanDescId: string, options?: any): Promise<any>;
826
827
  /** Update fields in a given clan. */
827
828
  updateClanDesc(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
829
+ /** Kick a set of users from a clan. */
830
+ removeClanUsers(bearerToken: string, clanId: string, userIds?: Array<string>, options?: any): Promise<any>;
828
831
  /** List all users that are part of a clan. */
829
832
  listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
830
833
  /** Get a clan desc profile */
package/dist/client.d.ts CHANGED
@@ -430,6 +430,8 @@ export declare class Client {
430
430
  importSteamFriends(session: Session, request: ApiAccountSteam, reset: boolean): Promise<boolean>;
431
431
  /** Fetch zero or more users by ID and/or username. */
432
432
  getUsers(session: Session, ids?: Array<string>, usernames?: Array<string>, facebookIds?: Array<string>): Promise<Users>;
433
+ /** Kick a set of users from a clan. */
434
+ removeClanUsers(session: Session, clanId: string, ids?: Array<string>): Promise<boolean>;
433
435
  /** Kick users from a channel, or decline their join requests. */
434
436
  removeChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean>;
435
437
  /** List a channel's message history. */
@@ -2089,6 +2089,35 @@ var MezonApi = class {
2089
2089
  )
2090
2090
  ]);
2091
2091
  }
2092
+ /** Kick a set of users from a clan. */
2093
+ removeClanUsers(bearerToken, clanId, userIds, options = {}) {
2094
+ if (clanId === null || clanId === void 0) {
2095
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2096
+ }
2097
+ const urlPath = "/v2/clandesc/{clanId}/kick".replace("{clanId}", encodeURIComponent(String(clanId)));
2098
+ const queryParams = /* @__PURE__ */ new Map();
2099
+ queryParams.set("user_ids", userIds);
2100
+ let bodyJson = "";
2101
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2102
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2103
+ if (bearerToken) {
2104
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2105
+ }
2106
+ return Promise.race([
2107
+ fetch(fullUrl, fetchOptions).then((response) => {
2108
+ if (response.status == 204) {
2109
+ return response;
2110
+ } else if (response.status >= 200 && response.status < 300) {
2111
+ return response.json();
2112
+ } else {
2113
+ throw response;
2114
+ }
2115
+ }),
2116
+ new Promise(
2117
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2118
+ )
2119
+ ]);
2120
+ }
2092
2121
  /** List all users that are part of a clan. */
2093
2122
  listClanUsers(bearerToken, clanId, options = {}) {
2094
2123
  if (clanId === null || clanId === void 0) {
@@ -4551,9 +4580,9 @@ var _DefaultSocket = class _DefaultSocket {
4551
4580
  updateStatus(status) {
4552
4581
  return this.send({ status_update: { status } });
4553
4582
  }
4554
- writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone) {
4583
+ writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
4555
4584
  return __async(this, null, function* () {
4556
- const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone } });
4585
+ const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
4557
4586
  return response.channel_message_ack;
4558
4587
  });
4559
4588
  }
@@ -5087,6 +5116,17 @@ var Client = class {
5087
5116
  });
5088
5117
  });
5089
5118
  }
5119
+ /** Kick a set of users from a clan. */
5120
+ removeClanUsers(session, clanId, ids) {
5121
+ return __async(this, null, function* () {
5122
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5123
+ yield this.sessionRefresh(session);
5124
+ }
5125
+ return this.apiClient.removeClanUsers(session.token, clanId, ids).then((response) => {
5126
+ return Promise.resolve(response != void 0);
5127
+ });
5128
+ });
5129
+ }
5090
5130
  /** Kick users from a channel, or decline their join requests. */
5091
5131
  removeChannelUsers(session, channelId, ids) {
5092
5132
  return __async(this, null, function* () {
@@ -2060,6 +2060,35 @@ var MezonApi = class {
2060
2060
  )
2061
2061
  ]);
2062
2062
  }
2063
+ /** Kick a set of users from a clan. */
2064
+ removeClanUsers(bearerToken, clanId, userIds, options = {}) {
2065
+ if (clanId === null || clanId === void 0) {
2066
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
2067
+ }
2068
+ const urlPath = "/v2/clandesc/{clanId}/kick".replace("{clanId}", encodeURIComponent(String(clanId)));
2069
+ const queryParams = /* @__PURE__ */ new Map();
2070
+ queryParams.set("user_ids", userIds);
2071
+ let bodyJson = "";
2072
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2073
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2074
+ if (bearerToken) {
2075
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2076
+ }
2077
+ return Promise.race([
2078
+ fetch(fullUrl, fetchOptions).then((response) => {
2079
+ if (response.status == 204) {
2080
+ return response;
2081
+ } else if (response.status >= 200 && response.status < 300) {
2082
+ return response.json();
2083
+ } else {
2084
+ throw response;
2085
+ }
2086
+ }),
2087
+ new Promise(
2088
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2089
+ )
2090
+ ]);
2091
+ }
2063
2092
  /** List all users that are part of a clan. */
2064
2093
  listClanUsers(bearerToken, clanId, options = {}) {
2065
2094
  if (clanId === null || clanId === void 0) {
@@ -4522,9 +4551,9 @@ var _DefaultSocket = class _DefaultSocket {
4522
4551
  updateStatus(status) {
4523
4552
  return this.send({ status_update: { status } });
4524
4553
  }
4525
- writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone) {
4554
+ writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
4526
4555
  return __async(this, null, function* () {
4527
- const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone } });
4556
+ const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
4528
4557
  return response.channel_message_ack;
4529
4558
  });
4530
4559
  }
@@ -5058,6 +5087,17 @@ var Client = class {
5058
5087
  });
5059
5088
  });
5060
5089
  }
5090
+ /** Kick a set of users from a clan. */
5091
+ removeClanUsers(session, clanId, ids) {
5092
+ return __async(this, null, function* () {
5093
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5094
+ yield this.sessionRefresh(session);
5095
+ }
5096
+ return this.apiClient.removeClanUsers(session.token, clanId, ids).then((response) => {
5097
+ return Promise.resolve(response != void 0);
5098
+ });
5099
+ });
5100
+ }
5061
5101
  /** Kick users from a channel, or decline their join requests. */
5062
5102
  removeChannelUsers(session, channelId, ids) {
5063
5103
  return __async(this, null, function* () {
package/dist/socket.d.ts CHANGED
@@ -199,6 +199,7 @@ interface ChannelMessageSend {
199
199
  attachments?: Array<MessageAttachmentEvent>;
200
200
  anonymous_message?: boolean;
201
201
  mention_everyone?: boolean;
202
+ notifi_content: any;
202
203
  };
203
204
  }
204
205
  /** Update a message previously sent to a realtime chat channel. */
@@ -562,7 +563,7 @@ export interface Socket {
562
563
  /** Update the status for the current user online. */
563
564
  updateStatus(status?: string): Promise<void>;
564
565
  /** Send a chat message to a chat channel on the server. */
565
- writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean): Promise<ChannelMessageAck>;
566
+ writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, notifi_content?: any): Promise<ChannelMessageAck>;
566
567
  /** Send message typing */
567
568
  writeMessageTyping(channel_id: string, channel_label: string, mode: number): Promise<MessageTypingEvent>;
568
569
  /** Send message reaction */
@@ -693,7 +694,7 @@ export declare class DefaultSocket implements Socket {
693
694
  unfollowUsers(user_ids: string[]): Promise<void>;
694
695
  updateChatMessage(channel_id: string, channel_label: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
695
696
  updateStatus(status?: string): Promise<void>;
696
- writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean): Promise<ChannelMessageAck>;
697
+ writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, notifi_content?: any): Promise<ChannelMessageAck>;
697
698
  writeMessageReaction(id: string, channel_id: string, channel_label: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
698
699
  writeMessageTyping(channel_id: string, channel_label: string, mode: number): Promise<MessageTypingEvent>;
699
700
  writeLastSeenMessage(channel_id: string, channel_label: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.39",
3
+ "version": "2.7.41",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -276,6 +276,8 @@ interface ChannelMessageSend {
276
276
  anonymous_message?: boolean;
277
277
  //
278
278
  mention_everyone?: boolean;
279
+ //
280
+ notifi_content: any;
279
281
  };
280
282
  }
281
283
 
@@ -735,7 +737,7 @@ export interface Socket {
735
737
  updateStatus(status? : string) : Promise<void>;
736
738
 
737
739
  /** Send a chat message to a chat channel on the server. */
738
- writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:boolean) : Promise<ChannelMessageAck>;
740
+ writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:boolean, notifi_content?: any) : Promise<ChannelMessageAck>;
739
741
 
740
742
  /** Send message typing */
741
743
  writeMessageTyping(channel_id: string, channel_label: string, mode: number) : Promise<MessageTypingEvent>;
@@ -1346,8 +1348,8 @@ export class DefaultSocket implements Socket {
1346
1348
  return this.send({status_update: {status: status}});
1347
1349
  }
1348
1350
 
1349
- async writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:Boolean ): Promise<ChannelMessageAck> {
1350
- const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, channel_label:channel_label, mode:mode, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message, mention_everyone:mention_everyone}});
1351
+ async writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:Boolean, notifi_content?: any ): Promise<ChannelMessageAck> {
1352
+ const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, channel_label:channel_label, mode:mode, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message, mention_everyone:mention_everyone, notifi_content:notifi_content}});
1351
1353
  return response.channel_message_ack;
1352
1354
  }
1353
1355