mezon-js 2.9.36 → 2.9.37

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
@@ -4109,11 +4109,10 @@ export class MezonApi {
4109
4109
  }
4110
4110
 
4111
4111
  /** Leave a channel the user is a member of. */
4112
- leaveChannel(
4113
- bearerToken: string,
4114
- channelId: string,
4115
- options: any = {}
4116
- ): Promise<any> {
4112
+ leaveThread(bearerToken: string,
4113
+ channelId:string,
4114
+ options: any = {}): Promise<any> {
4115
+
4117
4116
  if (channelId === null || channelId === undefined) {
4118
4117
  throw new Error(
4119
4118
  "'channelId' is a required parameter but is null or undefined."
package/client.ts CHANGED
@@ -3963,6 +3963,25 @@ export class Client {
3963
3963
  });
3964
3964
  }
3965
3965
 
3966
+ async leaveThread(
3967
+ session: Session,
3968
+ channelId: string
3969
+ ) : Promise<any> {
3970
+ if (
3971
+ this.autoRefreshSession &&
3972
+ session.refresh_token &&
3973
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3974
+ ) {
3975
+ await this.sessionRefresh(session);
3976
+ }
3977
+
3978
+ return this.apiClient
3979
+ .leaveThread(session.token, channelId)
3980
+ .then((response: any) => {
3981
+ return Promise.resolve(response);
3982
+ });
3983
+ }
3984
+
3966
3985
  async getChannelSettingInClan(
3967
3986
  session: Session,
3968
3987
  clanId: string,
package/dist/api.gen.d.ts CHANGED
@@ -1380,7 +1380,7 @@ export declare class MezonApi {
1380
1380
  /** List all attachment that are part of a channel. */
1381
1381
  listChannelAttachment(bearerToken: string, channelId: string, clanId?: string, fileType?: string, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiChannelAttachmentList>;
1382
1382
  /** Leave a channel the user is a member of. */
1383
- leaveChannel(bearerToken: string, channelId: string, options?: any): Promise<any>;
1383
+ leaveThread(bearerToken: string, channelId: string, options?: any): Promise<any>;
1384
1384
  /** Kick a set of users from a channel. */
1385
1385
  removeChannelUsers(bearerToken: string, channelId: string, userIds?: Array<string>, options?: any): Promise<any>;
1386
1386
  /** List all users that are part of a channel. */
package/dist/client.d.ts CHANGED
@@ -579,6 +579,7 @@ export declare class Client {
579
579
  markAsRead(session: Session, request: ApiMarkAsReadRequest): Promise<any>;
580
580
  /** List Threads. */
581
581
  listThreadDescs(session: Session, channelId: string, limit?: number, state?: number, clanId?: string, threadId?: string): Promise<ApiChannelDescList>;
582
+ leaveThread(session: Session, channelId: string): Promise<any>;
582
583
  getChannelSettingInClan(session: Session, clanId: string, parentId?: string, categoryId?: string, privateChannel?: number, active?: number, status?: number, type?: number, limit?: number, page?: number): Promise<any>;
583
584
  getChannelCanvasList(session: Session, channelId: string, clanId?: string, limit?: number, page?: number): Promise<any>;
584
585
  getChannelCanvasDetail(session: Session, id: string, clanId?: string, channelId?: string): Promise<any>;
@@ -2172,7 +2172,7 @@ var MezonApi = class {
2172
2172
  ]);
2173
2173
  }
2174
2174
  /** Leave a channel the user is a member of. */
2175
- leaveChannel(bearerToken, channelId, options = {}) {
2175
+ leaveThread(bearerToken, channelId, options = {}) {
2176
2176
  if (channelId === null || channelId === void 0) {
2177
2177
  throw new Error(
2178
2178
  "'channelId' is a required parameter but is null or undefined."
@@ -8655,6 +8655,16 @@ var Client = class {
8655
8655
  });
8656
8656
  });
8657
8657
  }
8658
+ leaveThread(session, channelId) {
8659
+ return __async(this, null, function* () {
8660
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8661
+ yield this.sessionRefresh(session);
8662
+ }
8663
+ return this.apiClient.leaveThread(session.token, channelId).then((response) => {
8664
+ return Promise.resolve(response);
8665
+ });
8666
+ });
8667
+ }
8658
8668
  getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
8659
8669
  return __async(this, null, function* () {
8660
8670
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
@@ -2143,7 +2143,7 @@ var MezonApi = class {
2143
2143
  ]);
2144
2144
  }
2145
2145
  /** Leave a channel the user is a member of. */
2146
- leaveChannel(bearerToken, channelId, options = {}) {
2146
+ leaveThread(bearerToken, channelId, options = {}) {
2147
2147
  if (channelId === null || channelId === void 0) {
2148
2148
  throw new Error(
2149
2149
  "'channelId' is a required parameter but is null or undefined."
@@ -8626,6 +8626,16 @@ var Client = class {
8626
8626
  });
8627
8627
  });
8628
8628
  }
8629
+ leaveThread(session, channelId) {
8630
+ return __async(this, null, function* () {
8631
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8632
+ yield this.sessionRefresh(session);
8633
+ }
8634
+ return this.apiClient.leaveThread(session.token, channelId).then((response) => {
8635
+ return Promise.resolve(response);
8636
+ });
8637
+ });
8638
+ }
8629
8639
  getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
8630
8640
  return __async(this, null, function* () {
8631
8641
  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.36",
4
+ "version": "2.9.37",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"