mezon-js 2.9.32 → 2.9.33

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -7988,6 +7988,48 @@ export class MezonApi {
7988
7988
  ]);
7989
7989
  }
7990
7990
 
7991
+ /** List user channels */
7992
+ listThreadDescs(bearerToken: string,
7993
+ channelId:string,
7994
+ limit?:number,
7995
+ state?:number,
7996
+ clanId?:string,
7997
+ options: any = {}): Promise<ApiChannelDescList> {
7998
+
7999
+ if (channelId === null || channelId === undefined) {
8000
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
8001
+ }
8002
+ const urlPath = "/v2/thread/{channelId}"
8003
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
8004
+ const queryParams = new Map<string, any>();
8005
+ queryParams.set("limit", limit);
8006
+ queryParams.set("state", state);
8007
+ queryParams.set("clan_id", clanId);
8008
+
8009
+ let bodyJson : string = "";
8010
+
8011
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8012
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8013
+ if (bearerToken) {
8014
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8015
+ }
8016
+
8017
+ return Promise.race([
8018
+ fetch(fullUrl, fetchOptions).then((response) => {
8019
+ if (response.status == 204) {
8020
+ return response;
8021
+ } else if (response.status >= 200 && response.status < 300) {
8022
+ return response.json();
8023
+ } else {
8024
+ throw response;
8025
+ }
8026
+ }),
8027
+ new Promise((_, reject) =>
8028
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8029
+ ),
8030
+ ]);
8031
+ }
8032
+
7991
8033
  /** Update fields in a given category. */
7992
8034
  updateCategory(
7993
8035
  bearerToken: string,
package/client.ts CHANGED
@@ -3921,6 +3921,44 @@ export class Client {
3921
3921
  });
3922
3922
  }
3923
3923
 
3924
+ /** List Threads. */
3925
+ async listThreadDescs(
3926
+ session: Session,
3927
+ channelId:string,
3928
+ limit?:number,
3929
+ state?:number,
3930
+ clanId?:string,
3931
+ ): Promise<ApiChannelDescList> {
3932
+ if (
3933
+ this.autoRefreshSession &&
3934
+ session.refresh_token &&
3935
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3936
+ ) {
3937
+ await this.sessionRefresh(session);
3938
+ }
3939
+
3940
+ return this.apiClient
3941
+ .listThreadDescs(
3942
+ session.token,
3943
+ channelId,
3944
+ limit,
3945
+ state,
3946
+ clanId
3947
+ )
3948
+ .then((response: ApiChannelDescList) => {
3949
+ var result: ApiChannelDescList = {
3950
+ channeldesc: [],
3951
+ };
3952
+
3953
+ if (response.channeldesc == null) {
3954
+ return Promise.resolve(result);
3955
+ }
3956
+
3957
+ result.channeldesc = response.channeldesc;
3958
+ return Promise.resolve(result);
3959
+ });
3960
+ }
3961
+
3924
3962
  async getChannelSettingInClan(
3925
3963
  session: Session,
3926
3964
  clanId: string,
package/dist/api.gen.d.ts CHANGED
@@ -1532,6 +1532,8 @@ export declare class MezonApi {
1532
1532
  getSystemMessageByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiSystemMessage>;
1533
1533
  /** Update a system messages. */
1534
1534
  updateSystemMessage(bearerToken: string, clanId: string, body: MezonUpdateSystemMessageBody, options?: any): Promise<any>;
1535
+ /** List user channels */
1536
+ listThreadDescs(bearerToken: string, channelId: string, limit?: number, state?: number, clanId?: string, options?: any): Promise<ApiChannelDescList>;
1535
1537
  /** Update fields in a given category. */
1536
1538
  updateCategory(bearerToken: string, clanId: string, body: MezonUpdateCategoryBody, options?: any): Promise<any>;
1537
1539
  /** Update channel private. */
package/dist/client.d.ts CHANGED
@@ -577,5 +577,7 @@ export declare class Client {
577
577
  listUserPermissionInChannel(session: Session, clanId?: string, channelId?: string): Promise<ApiUserPermissionInChannelListResponse>;
578
578
  getPermissionByRoleIdChannelId(session: Session, roleId?: string, channelId?: string, userId?: string): Promise<ApiPermissionRoleChannelListEventResponse>;
579
579
  markAsRead(session: Session, request: ApiMarkAsReadRequest): Promise<any>;
580
+ /** List Threads. */
581
+ listThreadDescs(session: Session, channelId: string, limit?: number, state?: number, clanId?: string): Promise<ApiChannelDescList>;
580
582
  getChannelSettingInClan(session: Session, clanId: string, parentId?: string, categoryId?: string, privateChannel?: number, active?: number, status?: number, type?: number, limit?: number, page?: number): Promise<any>;
581
583
  }
@@ -5265,6 +5265,37 @@ var MezonApi = class {
5265
5265
  )
5266
5266
  ]);
5267
5267
  }
5268
+ /** List user channels */
5269
+ listThreadDescs(bearerToken, channelId, limit, state, clanId, options = {}) {
5270
+ if (channelId === null || channelId === void 0) {
5271
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
5272
+ }
5273
+ const urlPath = "/v2/thread/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
5274
+ const queryParams = /* @__PURE__ */ new Map();
5275
+ queryParams.set("limit", limit);
5276
+ queryParams.set("state", state);
5277
+ queryParams.set("clan_id", clanId);
5278
+ let bodyJson = "";
5279
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5280
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5281
+ if (bearerToken) {
5282
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5283
+ }
5284
+ return Promise.race([
5285
+ fetch(fullUrl, fetchOptions).then((response) => {
5286
+ if (response.status == 204) {
5287
+ return response;
5288
+ } else if (response.status >= 200 && response.status < 300) {
5289
+ return response.json();
5290
+ } else {
5291
+ throw response;
5292
+ }
5293
+ }),
5294
+ new Promise(
5295
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5296
+ )
5297
+ ]);
5298
+ }
5268
5299
  /** Update fields in a given category. */
5269
5300
  updateCategory(bearerToken, clanId, body, options = {}) {
5270
5301
  if (clanId === null || clanId === void 0) {
@@ -8508,6 +8539,30 @@ var Client = class {
8508
8539
  });
8509
8540
  });
8510
8541
  }
8542
+ /** List Threads. */
8543
+ listThreadDescs(session, channelId, limit, state, clanId) {
8544
+ return __async(this, null, function* () {
8545
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8546
+ yield this.sessionRefresh(session);
8547
+ }
8548
+ return this.apiClient.listThreadDescs(
8549
+ session.token,
8550
+ channelId,
8551
+ limit,
8552
+ state,
8553
+ clanId
8554
+ ).then((response) => {
8555
+ var result = {
8556
+ channeldesc: []
8557
+ };
8558
+ if (response.channeldesc == null) {
8559
+ return Promise.resolve(result);
8560
+ }
8561
+ result.channeldesc = response.channeldesc;
8562
+ return Promise.resolve(result);
8563
+ });
8564
+ });
8565
+ }
8511
8566
  getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
8512
8567
  return __async(this, null, function* () {
8513
8568
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
@@ -5236,6 +5236,37 @@ var MezonApi = class {
5236
5236
  )
5237
5237
  ]);
5238
5238
  }
5239
+ /** List user channels */
5240
+ listThreadDescs(bearerToken, channelId, limit, state, clanId, options = {}) {
5241
+ if (channelId === null || channelId === void 0) {
5242
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
5243
+ }
5244
+ const urlPath = "/v2/thread/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
5245
+ const queryParams = /* @__PURE__ */ new Map();
5246
+ queryParams.set("limit", limit);
5247
+ queryParams.set("state", state);
5248
+ queryParams.set("clan_id", clanId);
5249
+ let bodyJson = "";
5250
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5251
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5252
+ if (bearerToken) {
5253
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5254
+ }
5255
+ return Promise.race([
5256
+ fetch(fullUrl, fetchOptions).then((response) => {
5257
+ if (response.status == 204) {
5258
+ return response;
5259
+ } else if (response.status >= 200 && response.status < 300) {
5260
+ return response.json();
5261
+ } else {
5262
+ throw response;
5263
+ }
5264
+ }),
5265
+ new Promise(
5266
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5267
+ )
5268
+ ]);
5269
+ }
5239
5270
  /** Update fields in a given category. */
5240
5271
  updateCategory(bearerToken, clanId, body, options = {}) {
5241
5272
  if (clanId === null || clanId === void 0) {
@@ -8479,6 +8510,30 @@ var Client = class {
8479
8510
  });
8480
8511
  });
8481
8512
  }
8513
+ /** List Threads. */
8514
+ listThreadDescs(session, channelId, limit, state, clanId) {
8515
+ return __async(this, null, function* () {
8516
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8517
+ yield this.sessionRefresh(session);
8518
+ }
8519
+ return this.apiClient.listThreadDescs(
8520
+ session.token,
8521
+ channelId,
8522
+ limit,
8523
+ state,
8524
+ clanId
8525
+ ).then((response) => {
8526
+ var result = {
8527
+ channeldesc: []
8528
+ };
8529
+ if (response.channeldesc == null) {
8530
+ return Promise.resolve(result);
8531
+ }
8532
+ result.channeldesc = response.channeldesc;
8533
+ return Promise.resolve(result);
8534
+ });
8535
+ });
8536
+ }
8482
8537
  getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
8483
8538
  return __async(this, null, function* () {
8484
8539
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.32",
4
+ "version": "2.9.33",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"