mezon-js 2.13.13 → 2.13.15

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
@@ -676,6 +676,10 @@ export interface ApiChannelCanvasItem {
676
676
  is_default?: boolean;
677
677
  //
678
678
  title?: string;
679
+ // update time
680
+ update_time?: string;
681
+ // create time
682
+ create_time?: string;
679
683
  }
680
684
 
681
685
  /** */
@@ -9497,6 +9501,42 @@ export class MezonApi {
9497
9501
  ]);
9498
9502
  }
9499
9503
 
9504
+ /** Upload attachment */
9505
+ uploadOauthFile(bearerToken: string,
9506
+ body:ApiUploadAttachmentRequest,
9507
+ options: any = {}): Promise<ApiUploadAttachment> {
9508
+
9509
+ if (body === null || body === undefined) {
9510
+ throw new Error("'body' is a required parameter but is null or undefined.");
9511
+ }
9512
+ const urlPath = "/v2/uploadoauthfile";
9513
+ const queryParams = new Map<string, any>();
9514
+
9515
+ let bodyJson : string = "";
9516
+ bodyJson = JSON.stringify(body || {});
9517
+
9518
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9519
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
9520
+ if (bearerToken) {
9521
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9522
+ }
9523
+
9524
+ return Promise.race([
9525
+ fetch(fullUrl, fetchOptions).then((response) => {
9526
+ if (response.status == 204) {
9527
+ return response;
9528
+ } else if (response.status >= 200 && response.status < 300) {
9529
+ return response.json();
9530
+ } else {
9531
+ throw response;
9532
+ }
9533
+ }),
9534
+ new Promise((_, reject) =>
9535
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9536
+ ),
9537
+ ]);
9538
+ }
9539
+
9500
9540
  /** Upload attachment */
9501
9541
  uploadAttachmentFile(
9502
9542
  bearerToken: string,
package/client.ts CHANGED
@@ -699,6 +699,22 @@ export class Client {
699
699
  });
700
700
  }
701
701
 
702
+ /** Create a new group with the current user as the creator and superadmin. */
703
+ async uploadOauthFile(
704
+ session: Session,
705
+ request: ApiUploadAttachmentRequest
706
+ ): Promise<ApiUploadAttachment> {
707
+ if (
708
+ this.autoRefreshSession &&
709
+ session.refresh_token &&
710
+ session.isexpired(Date.now() / 1000)
711
+ ) {
712
+ await this.sessionRefresh(session);
713
+ }
714
+
715
+ return this.apiClient.uploadOauthFile(session.token, request);
716
+ }
717
+
702
718
  /** Create a new group with the current user as the creator and superadmin. */
703
719
  async uploadAttachmentFile(
704
720
  session: Session,
package/dist/api.gen.d.ts CHANGED
@@ -389,6 +389,8 @@ export interface ApiChannelCanvasItem {
389
389
  id?: string;
390
390
  is_default?: boolean;
391
391
  title?: string;
392
+ update_time?: string;
393
+ create_time?: string;
392
394
  }
393
395
  /** */
394
396
  export interface ApiChannelCanvasListResponse {
@@ -2263,6 +2265,8 @@ export declare class MezonApi {
2263
2265
  /** */
2264
2266
  updateUserProfileByClan(bearerToken: string, clanId: string, body: MezonUpdateUserProfileByClanBody, options?: any): Promise<any>;
2265
2267
  /** Upload attachment */
2268
+ uploadOauthFile(bearerToken: string, body: ApiUploadAttachmentRequest, options?: any): Promise<ApiUploadAttachment>;
2269
+ /** Upload attachment */
2266
2270
  uploadAttachmentFile(bearerToken: string, body: ApiUploadAttachmentRequest, options?: any): Promise<ApiUploadAttachment>;
2267
2271
  /** */
2268
2272
  updateUser(bearerToken: string, body: ApiUpdateUsersRequest, options?: any): Promise<any>;
package/dist/client.d.ts CHANGED
@@ -258,6 +258,8 @@ export declare class Client {
258
258
  /** Block one or more users by ID or username. */
259
259
  unblockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
260
260
  /** Create a new group with the current user as the creator and superadmin. */
261
+ uploadOauthFile(session: Session, request: ApiUploadAttachmentRequest): Promise<ApiUploadAttachment>;
262
+ /** Create a new group with the current user as the creator and superadmin. */
261
263
  uploadAttachmentFile(session: Session, request: ApiUploadAttachmentRequest): Promise<ApiUploadAttachment>;
262
264
  /** Create a channel within clan */
263
265
  createChannelDesc(session: Session, request: ApiCreateChannelDescRequest): Promise<ApiChannelDescription>;
@@ -5479,6 +5479,35 @@ var MezonApi = class {
5479
5479
  ]);
5480
5480
  }
5481
5481
  /** Upload attachment */
5482
+ uploadOauthFile(bearerToken, body, options = {}) {
5483
+ if (body === null || body === void 0) {
5484
+ throw new Error("'body' is a required parameter but is null or undefined.");
5485
+ }
5486
+ const urlPath = "/v2/uploadoauthfile";
5487
+ const queryParams = /* @__PURE__ */ new Map();
5488
+ let bodyJson = "";
5489
+ bodyJson = JSON.stringify(body || {});
5490
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5491
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5492
+ if (bearerToken) {
5493
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5494
+ }
5495
+ return Promise.race([
5496
+ fetch(fullUrl, fetchOptions).then((response) => {
5497
+ if (response.status == 204) {
5498
+ return response;
5499
+ } else if (response.status >= 200 && response.status < 300) {
5500
+ return response.json();
5501
+ } else {
5502
+ throw response;
5503
+ }
5504
+ }),
5505
+ new Promise(
5506
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5507
+ )
5508
+ ]);
5509
+ }
5510
+ /** Upload attachment */
5482
5511
  uploadAttachmentFile(bearerToken, body, options = {}) {
5483
5512
  if (body === null || body === void 0) {
5484
5513
  throw new Error(
@@ -8512,6 +8541,15 @@ var Client = class {
8512
8541
  });
8513
8542
  }
8514
8543
  /** Create a new group with the current user as the creator and superadmin. */
8544
+ uploadOauthFile(session, request) {
8545
+ return __async(this, null, function* () {
8546
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8547
+ yield this.sessionRefresh(session);
8548
+ }
8549
+ return this.apiClient.uploadOauthFile(session.token, request);
8550
+ });
8551
+ }
8552
+ /** Create a new group with the current user as the creator and superadmin. */
8515
8553
  uploadAttachmentFile(session, request) {
8516
8554
  return __async(this, null, function* () {
8517
8555
  if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
@@ -5445,6 +5445,35 @@ var MezonApi = class {
5445
5445
  ]);
5446
5446
  }
5447
5447
  /** Upload attachment */
5448
+ uploadOauthFile(bearerToken, body, options = {}) {
5449
+ if (body === null || body === void 0) {
5450
+ throw new Error("'body' is a required parameter but is null or undefined.");
5451
+ }
5452
+ const urlPath = "/v2/uploadoauthfile";
5453
+ const queryParams = /* @__PURE__ */ new Map();
5454
+ let bodyJson = "";
5455
+ bodyJson = JSON.stringify(body || {});
5456
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5457
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5458
+ if (bearerToken) {
5459
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5460
+ }
5461
+ return Promise.race([
5462
+ fetch(fullUrl, fetchOptions).then((response) => {
5463
+ if (response.status == 204) {
5464
+ return response;
5465
+ } else if (response.status >= 200 && response.status < 300) {
5466
+ return response.json();
5467
+ } else {
5468
+ throw response;
5469
+ }
5470
+ }),
5471
+ new Promise(
5472
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5473
+ )
5474
+ ]);
5475
+ }
5476
+ /** Upload attachment */
5448
5477
  uploadAttachmentFile(bearerToken, body, options = {}) {
5449
5478
  if (body === null || body === void 0) {
5450
5479
  throw new Error(
@@ -8478,6 +8507,15 @@ var Client = class {
8478
8507
  });
8479
8508
  }
8480
8509
  /** Create a new group with the current user as the creator and superadmin. */
8510
+ uploadOauthFile(session, request) {
8511
+ return __async(this, null, function* () {
8512
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
8513
+ yield this.sessionRefresh(session);
8514
+ }
8515
+ return this.apiClient.uploadOauthFile(session.token, request);
8516
+ });
8517
+ }
8518
+ /** Create a new group with the current user as the creator and superadmin. */
8481
8519
  uploadAttachmentFile(session, request) {
8482
8520
  return __async(this, null, function* () {
8483
8521
  if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.13.13",
3
+ "version": "2.13.15",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },