mezon-js 2.7.40 → 2.7.42

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -3083,6 +3083,44 @@ export class MezonApi {
3083
3083
  ]);
3084
3084
  }
3085
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
+
3086
3124
  /** List all users that are part of a clan. */
3087
3125
  listClanUsers(bearerToken: string,
3088
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 &&
@@ -1144,7 +1156,8 @@ export class Client {
1144
1156
  filetype: at.filetype,
1145
1157
  id: at.id,
1146
1158
  uploader: at.uploader,
1147
- url: at.url
1159
+ url: at.url,
1160
+ create_time: at.create_time
1148
1161
  })
1149
1162
  });
1150
1163
  return Promise.resolve(result);
package/dist/api.gen.d.ts CHANGED
@@ -826,6 +826,8 @@ export declare class MezonApi {
826
826
  deleteClanDesc(bearerToken: string, clanDescId: string, options?: any): Promise<any>;
827
827
  /** Update fields in a given clan. */
828
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>;
829
831
  /** List all users that are part of a clan. */
830
832
  listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
831
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) {
@@ -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* () {
@@ -5227,7 +5267,8 @@ var Client = class {
5227
5267
  filetype: at.filetype,
5228
5268
  id: at.id,
5229
5269
  uploader: at.uploader,
5230
- url: at.url
5270
+ url: at.url,
5271
+ create_time: at.create_time
5231
5272
  });
5232
5273
  });
5233
5274
  return Promise.resolve(result);
@@ -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) {
@@ -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* () {
@@ -5198,7 +5238,8 @@ var Client = class {
5198
5238
  filetype: at.filetype,
5199
5239
  id: at.id,
5200
5240
  uploader: at.uploader,
5201
- url: at.url
5241
+ url: at.url,
5242
+ create_time: at.create_time
5202
5243
  });
5203
5244
  });
5204
5245
  return Promise.resolve(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.40",
3
+ "version": "2.7.42",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },