mezon-js 2.12.61 → 2.12.62

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
@@ -6531,6 +6531,41 @@ export class MezonApi {
6531
6531
  ]);
6532
6532
  }
6533
6533
 
6534
+ /** Block one or more users by ID or username. */
6535
+ unblockFriends(bearerToken: string,
6536
+ ids?:Array<string>,
6537
+ usernames?:Array<string>,
6538
+ options: any = {}): Promise<any> {
6539
+
6540
+ const urlPath = "/v2/friend/unblock";
6541
+ const queryParams = new Map<string, any>();
6542
+ queryParams.set("ids", ids);
6543
+ queryParams.set("usernames", usernames);
6544
+
6545
+ let bodyJson : string = "";
6546
+
6547
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6548
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
6549
+ if (bearerToken) {
6550
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6551
+ }
6552
+
6553
+ return Promise.race([
6554
+ fetch(fullUrl, fetchOptions).then((response) => {
6555
+ if (response.status == 204) {
6556
+ return response;
6557
+ } else if (response.status >= 200 && response.status < 300) {
6558
+ return response.json();
6559
+ } else {
6560
+ throw response;
6561
+ }
6562
+ }),
6563
+ new Promise((_, reject) =>
6564
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
6565
+ ),
6566
+ ]);
6567
+ }
6568
+
6534
6569
  /** List GetChannelCategoryNotiSettingsList */
6535
6570
  getChannelCategoryNotiSettingsList(
6536
6571
  bearerToken: string,
package/client.ts CHANGED
@@ -722,6 +722,27 @@ export class Client {
722
722
  });
723
723
  }
724
724
 
725
+ /** Block one or more users by ID or username. */
726
+ async unblockFriends(
727
+ session: Session,
728
+ ids?: Array<string>,
729
+ usernames?: Array<string>
730
+ ): Promise<boolean> {
731
+ if (
732
+ this.autoRefreshSession &&
733
+ session.refresh_token &&
734
+ session.isexpired(Date.now() / 1000)
735
+ ) {
736
+ await this.sessionRefresh(session);
737
+ }
738
+
739
+ return this.apiClient
740
+ .unblockFriends(session.token, ids, usernames)
741
+ .then((response: any) => {
742
+ return Promise.resolve(response != undefined);
743
+ });
744
+ }
745
+
725
746
  /** Create a new group with the current user as the creator and superadmin. */
726
747
  async uploadAttachmentFile(
727
748
  session: Session,
package/dist/api.gen.d.ts CHANGED
@@ -2064,6 +2064,8 @@ export declare class MezonApi {
2064
2064
  addFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
2065
2065
  /** Block one or more users by ID or username. */
2066
2066
  blockFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
2067
+ /** Block one or more users by ID or username. */
2068
+ unblockFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
2067
2069
  /** List GetChannelCategoryNotiSettingsList */
2068
2070
  getChannelCategoryNotiSettingsList(bearerToken: string, clanId?: string, options?: any): Promise<ApiNotificationChannelCategorySettingList>;
2069
2071
  /** */
package/dist/client.d.ts CHANGED
@@ -355,6 +355,8 @@ export declare class Client {
355
355
  addFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
356
356
  /** Block one or more users by ID or username. */
357
357
  blockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
358
+ /** Block one or more users by ID or username. */
359
+ unblockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
358
360
  /** Create a new group with the current user as the creator and superadmin. */
359
361
  uploadAttachmentFile(session: Session, request: ApiUploadAttachmentRequest): Promise<ApiUploadAttachment>;
360
362
  /** Create a channel within clan */
@@ -3242,6 +3242,33 @@ var MezonApi = class {
3242
3242
  )
3243
3243
  ]);
3244
3244
  }
3245
+ /** Block one or more users by ID or username. */
3246
+ unblockFriends(bearerToken, ids, usernames, options = {}) {
3247
+ const urlPath = "/v2/friend/unblock";
3248
+ const queryParams = /* @__PURE__ */ new Map();
3249
+ queryParams.set("ids", ids);
3250
+ queryParams.set("usernames", usernames);
3251
+ let bodyJson = "";
3252
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3253
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3254
+ if (bearerToken) {
3255
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3256
+ }
3257
+ return Promise.race([
3258
+ fetch(fullUrl, fetchOptions).then((response) => {
3259
+ if (response.status == 204) {
3260
+ return response;
3261
+ } else if (response.status >= 200 && response.status < 300) {
3262
+ return response.json();
3263
+ } else {
3264
+ throw response;
3265
+ }
3266
+ }),
3267
+ new Promise(
3268
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3269
+ )
3270
+ ]);
3271
+ }
3245
3272
  /** List GetChannelCategoryNotiSettingsList */
3246
3273
  getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
3247
3274
  const urlPath = "/v2/getchannelcategorynotisettingslist";
@@ -8258,6 +8285,17 @@ var Client = class {
8258
8285
  });
8259
8286
  });
8260
8287
  }
8288
+ /** Block one or more users by ID or username. */
8289
+ unblockFriends(session, ids, usernames) {
8290
+ return __async(this, null, function* () {
8291
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8292
+ yield this.sessionRefresh(session);
8293
+ }
8294
+ return this.apiClient.unblockFriends(session.token, ids, usernames).then((response) => {
8295
+ return Promise.resolve(response != void 0);
8296
+ });
8297
+ });
8298
+ }
8261
8299
  /** Create a new group with the current user as the creator and superadmin. */
8262
8300
  uploadAttachmentFile(session, request) {
8263
8301
  return __async(this, null, function* () {
@@ -3208,6 +3208,33 @@ var MezonApi = class {
3208
3208
  )
3209
3209
  ]);
3210
3210
  }
3211
+ /** Block one or more users by ID or username. */
3212
+ unblockFriends(bearerToken, ids, usernames, options = {}) {
3213
+ const urlPath = "/v2/friend/unblock";
3214
+ const queryParams = /* @__PURE__ */ new Map();
3215
+ queryParams.set("ids", ids);
3216
+ queryParams.set("usernames", usernames);
3217
+ let bodyJson = "";
3218
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3219
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3220
+ if (bearerToken) {
3221
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3222
+ }
3223
+ return Promise.race([
3224
+ fetch(fullUrl, fetchOptions).then((response) => {
3225
+ if (response.status == 204) {
3226
+ return response;
3227
+ } else if (response.status >= 200 && response.status < 300) {
3228
+ return response.json();
3229
+ } else {
3230
+ throw response;
3231
+ }
3232
+ }),
3233
+ new Promise(
3234
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3235
+ )
3236
+ ]);
3237
+ }
3211
3238
  /** List GetChannelCategoryNotiSettingsList */
3212
3239
  getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
3213
3240
  const urlPath = "/v2/getchannelcategorynotisettingslist";
@@ -8224,6 +8251,17 @@ var Client = class {
8224
8251
  });
8225
8252
  });
8226
8253
  }
8254
+ /** Block one or more users by ID or username. */
8255
+ unblockFriends(session, ids, usernames) {
8256
+ return __async(this, null, function* () {
8257
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8258
+ yield this.sessionRefresh(session);
8259
+ }
8260
+ return this.apiClient.unblockFriends(session.token, ids, usernames).then((response) => {
8261
+ return Promise.resolve(response != void 0);
8262
+ });
8263
+ });
8264
+ }
8227
8265
  /** Create a new group with the current user as the creator and superadmin. */
8228
8266
  uploadAttachmentFile(session, request) {
8229
8267
  return __async(this, null, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.12.61",
3
+ "version": "2.12.62",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },