mezon-js 2.9.32 → 2.9.34

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
@@ -7988,6 +7988,50 @@ 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
+ threadId?:string,
7998
+ options: any = {}): Promise<ApiChannelDescList> {
7999
+
8000
+ if (channelId === null || channelId === undefined) {
8001
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
8002
+ }
8003
+ const urlPath = "/v2/thread/{channelId}"
8004
+ .replace("{channelId}", encodeURIComponent(String(channelId)));
8005
+ const queryParams = new Map<string, any>();
8006
+ queryParams.set("limit", limit);
8007
+ queryParams.set("state", state);
8008
+ queryParams.set("clan_id", clanId);
8009
+ queryParams.set("thread_id", threadId);
8010
+
8011
+ let bodyJson : string = "";
8012
+
8013
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8014
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8015
+ if (bearerToken) {
8016
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8017
+ }
8018
+
8019
+ return Promise.race([
8020
+ fetch(fullUrl, fetchOptions).then((response) => {
8021
+ if (response.status == 204) {
8022
+ return response;
8023
+ } else if (response.status >= 200 && response.status < 300) {
8024
+ return response.json();
8025
+ } else {
8026
+ throw response;
8027
+ }
8028
+ }),
8029
+ new Promise((_, reject) =>
8030
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
8031
+ ),
8032
+ ]);
8033
+ }
8034
+
7991
8035
  /** Update fields in a given category. */
7992
8036
  updateCategory(
7993
8037
  bearerToken: string,
package/client.ts CHANGED
@@ -3921,6 +3921,46 @@ 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
+ threadId?: string,
3932
+ ): Promise<ApiChannelDescList> {
3933
+ if (
3934
+ this.autoRefreshSession &&
3935
+ session.refresh_token &&
3936
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3937
+ ) {
3938
+ await this.sessionRefresh(session);
3939
+ }
3940
+
3941
+ return this.apiClient
3942
+ .listThreadDescs(
3943
+ session.token,
3944
+ channelId,
3945
+ limit,
3946
+ state,
3947
+ clanId,
3948
+ threadId
3949
+ )
3950
+ .then((response: ApiChannelDescList) => {
3951
+ var result: ApiChannelDescList = {
3952
+ channeldesc: [],
3953
+ };
3954
+
3955
+ if (response.channeldesc == null) {
3956
+ return Promise.resolve(result);
3957
+ }
3958
+
3959
+ result.channeldesc = response.channeldesc;
3960
+ return Promise.resolve(result);
3961
+ });
3962
+ }
3963
+
3924
3964
  async getChannelSettingInClan(
3925
3965
  session: Session,
3926
3966
  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, threadId?: 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, threadId?: 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,38 @@ var MezonApi = class {
5265
5265
  )
5266
5266
  ]);
5267
5267
  }
5268
+ /** List user channels */
5269
+ listThreadDescs(bearerToken, channelId, limit, state, clanId, threadId, 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
+ queryParams.set("thread_id", threadId);
5279
+ let bodyJson = "";
5280
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5281
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5282
+ if (bearerToken) {
5283
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5284
+ }
5285
+ return Promise.race([
5286
+ fetch(fullUrl, fetchOptions).then((response) => {
5287
+ if (response.status == 204) {
5288
+ return response;
5289
+ } else if (response.status >= 200 && response.status < 300) {
5290
+ return response.json();
5291
+ } else {
5292
+ throw response;
5293
+ }
5294
+ }),
5295
+ new Promise(
5296
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5297
+ )
5298
+ ]);
5299
+ }
5268
5300
  /** Update fields in a given category. */
5269
5301
  updateCategory(bearerToken, clanId, body, options = {}) {
5270
5302
  if (clanId === null || clanId === void 0) {
@@ -8508,6 +8540,31 @@ var Client = class {
8508
8540
  });
8509
8541
  });
8510
8542
  }
8543
+ /** List Threads. */
8544
+ listThreadDescs(session, channelId, limit, state, clanId, threadId) {
8545
+ return __async(this, null, function* () {
8546
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8547
+ yield this.sessionRefresh(session);
8548
+ }
8549
+ return this.apiClient.listThreadDescs(
8550
+ session.token,
8551
+ channelId,
8552
+ limit,
8553
+ state,
8554
+ clanId,
8555
+ threadId
8556
+ ).then((response) => {
8557
+ var result = {
8558
+ channeldesc: []
8559
+ };
8560
+ if (response.channeldesc == null) {
8561
+ return Promise.resolve(result);
8562
+ }
8563
+ result.channeldesc = response.channeldesc;
8564
+ return Promise.resolve(result);
8565
+ });
8566
+ });
8567
+ }
8511
8568
  getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
8512
8569
  return __async(this, null, function* () {
8513
8570
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
@@ -5236,6 +5236,38 @@ var MezonApi = class {
5236
5236
  )
5237
5237
  ]);
5238
5238
  }
5239
+ /** List user channels */
5240
+ listThreadDescs(bearerToken, channelId, limit, state, clanId, threadId, 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
+ queryParams.set("thread_id", threadId);
5250
+ let bodyJson = "";
5251
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5252
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5253
+ if (bearerToken) {
5254
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5255
+ }
5256
+ return Promise.race([
5257
+ fetch(fullUrl, fetchOptions).then((response) => {
5258
+ if (response.status == 204) {
5259
+ return response;
5260
+ } else if (response.status >= 200 && response.status < 300) {
5261
+ return response.json();
5262
+ } else {
5263
+ throw response;
5264
+ }
5265
+ }),
5266
+ new Promise(
5267
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5268
+ )
5269
+ ]);
5270
+ }
5239
5271
  /** Update fields in a given category. */
5240
5272
  updateCategory(bearerToken, clanId, body, options = {}) {
5241
5273
  if (clanId === null || clanId === void 0) {
@@ -8479,6 +8511,31 @@ var Client = class {
8479
8511
  });
8480
8512
  });
8481
8513
  }
8514
+ /** List Threads. */
8515
+ listThreadDescs(session, channelId, limit, state, clanId, threadId) {
8516
+ return __async(this, null, function* () {
8517
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8518
+ yield this.sessionRefresh(session);
8519
+ }
8520
+ return this.apiClient.listThreadDescs(
8521
+ session.token,
8522
+ channelId,
8523
+ limit,
8524
+ state,
8525
+ clanId,
8526
+ threadId
8527
+ ).then((response) => {
8528
+ var result = {
8529
+ channeldesc: []
8530
+ };
8531
+ if (response.channeldesc == null) {
8532
+ return Promise.resolve(result);
8533
+ }
8534
+ result.channeldesc = response.channeldesc;
8535
+ return Promise.resolve(result);
8536
+ });
8537
+ });
8538
+ }
8482
8539
  getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
8483
8540
  return __async(this, null, function* () {
8484
8541
  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.34",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"