mezon-js 2.7.17 → 2.7.19

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
@@ -2846,24 +2846,21 @@ return Promise.race([
2846
2846
  /** Update fields in a given clan. */
2847
2847
  updateClanDesc(bearerToken: string,
2848
2848
  clanId:string,
2849
- creatorId?:string,
2850
- clanName?:string,
2851
- logo?:string,
2852
- banner?:string,
2849
+ body: {},
2853
2850
  options: any = {}): Promise<any> {
2854
2851
 
2855
2852
  if (clanId === null || clanId === undefined) {
2856
2853
  throw new Error("'clanId' is a required parameter but is null or undefined.");
2854
+ }
2855
+ if (body === null || body === undefined) {
2856
+ throw new Error("'body' is a required parameter but is null or undefined.");
2857
2857
  }
2858
2858
  const urlPath = "/v2/clandesc/{clanId}"
2859
2859
  .replace("{clanId}", encodeURIComponent(String(clanId)));
2860
2860
  const queryParams = new Map<string, any>();
2861
- queryParams.set("creator_id", creatorId);
2862
- queryParams.set("clan_name", clanName);
2863
- queryParams.set("logo", logo);
2864
- queryParams.set("banner", banner);
2865
2861
 
2866
2862
  let bodyJson : string = "";
2863
+ bodyJson = JSON.stringify(body || {});
2867
2864
 
2868
2865
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2869
2866
  const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
@@ -3075,11 +3072,15 @@ return Promise.race([
3075
3072
  /** Immediately join an open group, or request to join a closed one. */
3076
3073
  registFCMDeviceToken(bearerToken: string,
3077
3074
  token?:string,
3075
+ deviceId?:string,
3076
+ platform?:string,
3078
3077
  options: any = {}): Promise<any> {
3079
3078
 
3080
3079
  const urlPath = "/v2/devicetoken";
3081
3080
  const queryParams = new Map<string, any>();
3082
3081
  queryParams.set("token", token);
3082
+ queryParams.set("device_id", deviceId);
3083
+ queryParams.set("platform", platform);
3083
3084
 
3084
3085
  let bodyJson : string = "";
3085
3086
 
@@ -3685,17 +3686,19 @@ return Promise.race([
3685
3686
  ]);
3686
3687
  }
3687
3688
 
3688
- /** */
3689
- getListPermission(bearerToken: string,
3690
- options: any = {}): Promise<ApiPermissionList> {
3689
+ /** Delete one or more notifications for the current user. */
3690
+ deleteNotifications(bearerToken: string,
3691
+ ids?:Array<string>,
3692
+ options: any = {}): Promise<any> {
3691
3693
 
3692
- const urlPath = "/v2/permissions";
3694
+ const urlPath = "/v2/notification";
3693
3695
  const queryParams = new Map<string, any>();
3696
+ queryParams.set("ids", ids);
3694
3697
 
3695
3698
  let bodyJson : string = "";
3696
3699
 
3697
3700
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3698
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3701
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3699
3702
  if (bearerToken) {
3700
3703
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3701
3704
  }
@@ -3716,19 +3719,21 @@ return Promise.race([
3716
3719
  ]);
3717
3720
  }
3718
3721
 
3719
- /** Delete one or more notifications for the current user. */
3720
- deleteNotifications(bearerToken: string,
3721
- ids?:Array<string>,
3722
- options: any = {}): Promise<any> {
3722
+ /** Fetch list of notifications. */
3723
+ listNotifications(bearerToken: string,
3724
+ limit?:number,
3725
+ cacheableCursor?:string,
3726
+ options: any = {}): Promise<ApiNotificationList> {
3723
3727
 
3724
3728
  const urlPath = "/v2/notification";
3725
3729
  const queryParams = new Map<string, any>();
3726
- queryParams.set("ids", ids);
3730
+ queryParams.set("limit", limit);
3731
+ queryParams.set("cacheable_cursor", cacheableCursor);
3727
3732
 
3728
3733
  let bodyJson : string = "";
3729
3734
 
3730
3735
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3731
- const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3736
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3732
3737
  if (bearerToken) {
3733
3738
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3734
3739
  }
@@ -3749,16 +3754,12 @@ return Promise.race([
3749
3754
  ]);
3750
3755
  }
3751
3756
 
3752
- /** Fetch list of notifications. */
3753
- listNotifications(bearerToken: string,
3754
- limit?:number,
3755
- cacheableCursor?:string,
3756
- options: any = {}): Promise<ApiNotificationList> {
3757
+ /** Get permission list */
3758
+ getListPermission(bearerToken: string,
3759
+ options: any = {}): Promise<ApiPermissionList> {
3757
3760
 
3758
- const urlPath = "/v2/notification";
3761
+ const urlPath = "/v2/permissions";
3759
3762
  const queryParams = new Map<string, any>();
3760
- queryParams.set("limit", limit);
3761
- queryParams.set("cacheable_cursor", cacheableCursor);
3762
3763
 
3763
3764
  let bodyJson : string = "";
3764
3765
 
package/client.ts CHANGED
@@ -1318,13 +1318,13 @@ export class Client {
1318
1318
  });
1319
1319
  }
1320
1320
 
1321
- async registFCMDeviceToken(session: Session, tokenId:string): Promise<boolean> {
1321
+ async registFCMDeviceToken(session: Session, tokenId:string, deviceId:string, platform:string): Promise<boolean> {
1322
1322
  if (this.autoRefreshSession && session.refresh_token &&
1323
1323
  session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1324
1324
  await this.sessionRefresh(session);
1325
1325
  }
1326
1326
 
1327
- return this.apiClient.registFCMDeviceToken(session.token, tokenId).then((response: any) => {
1327
+ return this.apiClient.registFCMDeviceToken(session.token, tokenId, deviceId, platform).then((response: any) => {
1328
1328
  return response !== undefined;
1329
1329
  });
1330
1330
  }
@@ -1803,7 +1803,7 @@ export class Client {
1803
1803
  await this.sessionRefresh(session);
1804
1804
  }
1805
1805
 
1806
- return this.apiClient.updateClanDesc(session.token, clanId, request?.creator_id, request?.clan_name, request?.logo, request?.banner).then((response: any) => {
1806
+ return this.apiClient.updateClanDesc(session.token, clanId, request).then((response: any) => {
1807
1807
  return response !== undefined;
1808
1808
  });
1809
1809
  }
package/dist/api.gen.d.ts CHANGED
@@ -708,7 +708,7 @@ export declare class MezonApi {
708
708
  /** Delete a clan desc by ID. */
709
709
  deleteClanDesc(bearerToken: string, clanDescId: string, options?: any): Promise<any>;
710
710
  /** Update fields in a given clan. */
711
- updateClanDesc(bearerToken: string, clanId: string, creatorId?: string, clanName?: string, logo?: string, banner?: string, options?: any): Promise<any>;
711
+ updateClanDesc(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
712
712
  /** List all users that are part of a clan. */
713
713
  listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
714
714
  /** Get a clan desc profile */
@@ -720,7 +720,7 @@ export declare class MezonApi {
720
720
  /** */
721
721
  deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
722
722
  /** Immediately join an open group, or request to join a closed one. */
723
- registFCMDeviceToken(bearerToken: string, token?: string, options?: any): Promise<any>;
723
+ registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
724
724
  /** Submit an event for processing in the server's registered runtime custom events handler. */
725
725
  event(bearerToken: string, body: ApiEvent, options?: any): Promise<any>;
726
726
  /** List user events */
@@ -753,12 +753,12 @@ export declare class MezonApi {
753
753
  getLinkInvite(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
754
754
  /** Add users to a channel. */
755
755
  inviteUser(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
756
- /** */
757
- getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
758
756
  /** Delete one or more notifications for the current user. */
759
757
  deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
760
758
  /** Fetch list of notifications. */
761
759
  listNotifications(bearerToken: string, limit?: number, cacheableCursor?: string, options?: any): Promise<ApiNotificationList>;
760
+ /** Get permission list */
761
+ getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
762
762
  /** */
763
763
  GetPermissionOfUserInTheClan(bearerToken: string, clanId: string, options?: any): Promise<ApiPermissionList>;
764
764
  /** */
package/dist/client.d.ts CHANGED
@@ -455,7 +455,7 @@ export declare class Client {
455
455
  listRolePermissions(session: Session, roleId: string): Promise<ApiPermissionList>;
456
456
  /** List user roles */
457
457
  listRoleUsers(session: Session, roleId: string, limit?: number, cursor?: string): Promise<ApiRoleUserList>;
458
- registFCMDeviceToken(session: Session, tokenId: string): Promise<boolean>;
458
+ registFCMDeviceToken(session: Session, tokenId: string, deviceId: string, platform: string): Promise<boolean>;
459
459
  /** Get a clan desc profile */
460
460
  getClanDescProfile(session: Session, clanId: string): Promise<ApiClanDescProfile>;
461
461
  getUserProfileOnClan(session: Session, clanId: string): Promise<ApiClanProfile>;
@@ -2057,17 +2057,17 @@ var MezonApi = class {
2057
2057
  ]);
2058
2058
  }
2059
2059
  /** Update fields in a given clan. */
2060
- updateClanDesc(bearerToken, clanId, creatorId, clanName, logo, banner, options = {}) {
2060
+ updateClanDesc(bearerToken, clanId, body, options = {}) {
2061
2061
  if (clanId === null || clanId === void 0) {
2062
2062
  throw new Error("'clanId' is a required parameter but is null or undefined.");
2063
2063
  }
2064
+ if (body === null || body === void 0) {
2065
+ throw new Error("'body' is a required parameter but is null or undefined.");
2066
+ }
2064
2067
  const urlPath = "/v2/clandesc/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2065
2068
  const queryParams = /* @__PURE__ */ new Map();
2066
- queryParams.set("creator_id", creatorId);
2067
- queryParams.set("clan_name", clanName);
2068
- queryParams.set("logo", logo);
2069
- queryParams.set("banner", banner);
2070
2069
  let bodyJson = "";
2070
+ bodyJson = JSON.stringify(body || {});
2071
2071
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2072
2072
  const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2073
2073
  if (bearerToken) {
@@ -2234,10 +2234,12 @@ var MezonApi = class {
2234
2234
  ]);
2235
2235
  }
2236
2236
  /** Immediately join an open group, or request to join a closed one. */
2237
- registFCMDeviceToken(bearerToken, token, options = {}) {
2237
+ registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
2238
2238
  const urlPath = "/v2/devicetoken";
2239
2239
  const queryParams = /* @__PURE__ */ new Map();
2240
2240
  queryParams.set("token", token);
2241
+ queryParams.set("device_id", deviceId);
2242
+ queryParams.set("platform", platform);
2241
2243
  let bodyJson = "";
2242
2244
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2243
2245
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
@@ -2714,13 +2716,14 @@ var MezonApi = class {
2714
2716
  )
2715
2717
  ]);
2716
2718
  }
2717
- /** */
2718
- getListPermission(bearerToken, options = {}) {
2719
- const urlPath = "/v2/permissions";
2719
+ /** Delete one or more notifications for the current user. */
2720
+ deleteNotifications(bearerToken, ids, options = {}) {
2721
+ const urlPath = "/v2/notification";
2720
2722
  const queryParams = /* @__PURE__ */ new Map();
2723
+ queryParams.set("ids", ids);
2721
2724
  let bodyJson = "";
2722
2725
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2723
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2726
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2724
2727
  if (bearerToken) {
2725
2728
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2726
2729
  }
@@ -2739,14 +2742,15 @@ var MezonApi = class {
2739
2742
  )
2740
2743
  ]);
2741
2744
  }
2742
- /** Delete one or more notifications for the current user. */
2743
- deleteNotifications(bearerToken, ids, options = {}) {
2745
+ /** Fetch list of notifications. */
2746
+ listNotifications(bearerToken, limit, cacheableCursor, options = {}) {
2744
2747
  const urlPath = "/v2/notification";
2745
2748
  const queryParams = /* @__PURE__ */ new Map();
2746
- queryParams.set("ids", ids);
2749
+ queryParams.set("limit", limit);
2750
+ queryParams.set("cacheable_cursor", cacheableCursor);
2747
2751
  let bodyJson = "";
2748
2752
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2749
- const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2753
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2750
2754
  if (bearerToken) {
2751
2755
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2752
2756
  }
@@ -2765,12 +2769,10 @@ var MezonApi = class {
2765
2769
  )
2766
2770
  ]);
2767
2771
  }
2768
- /** Fetch list of notifications. */
2769
- listNotifications(bearerToken, limit, cacheableCursor, options = {}) {
2770
- const urlPath = "/v2/notification";
2772
+ /** Get permission list */
2773
+ getListPermission(bearerToken, options = {}) {
2774
+ const urlPath = "/v2/permissions";
2771
2775
  const queryParams = /* @__PURE__ */ new Map();
2772
- queryParams.set("limit", limit);
2773
- queryParams.set("cacheable_cursor", cacheableCursor);
2774
2776
  let bodyJson = "";
2775
2777
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2776
2778
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -4904,12 +4906,12 @@ var Client = class {
4904
4906
  });
4905
4907
  });
4906
4908
  }
4907
- registFCMDeviceToken(session, tokenId) {
4909
+ registFCMDeviceToken(session, tokenId, deviceId, platform) {
4908
4910
  return __async(this, null, function* () {
4909
4911
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4910
4912
  yield this.sessionRefresh(session);
4911
4913
  }
4912
- return this.apiClient.registFCMDeviceToken(session.token, tokenId).then((response) => {
4914
+ return this.apiClient.registFCMDeviceToken(session.token, tokenId, deviceId, platform).then((response) => {
4913
4915
  return response !== void 0;
4914
4916
  });
4915
4917
  });
@@ -5346,7 +5348,7 @@ var Client = class {
5346
5348
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5347
5349
  yield this.sessionRefresh(session);
5348
5350
  }
5349
- return this.apiClient.updateClanDesc(session.token, clanId, request == null ? void 0 : request.creator_id, request == null ? void 0 : request.clan_name, request == null ? void 0 : request.logo, request == null ? void 0 : request.banner).then((response) => {
5351
+ return this.apiClient.updateClanDesc(session.token, clanId, request).then((response) => {
5350
5352
  return response !== void 0;
5351
5353
  });
5352
5354
  });
@@ -2029,17 +2029,17 @@ var MezonApi = class {
2029
2029
  ]);
2030
2030
  }
2031
2031
  /** Update fields in a given clan. */
2032
- updateClanDesc(bearerToken, clanId, creatorId, clanName, logo, banner, options = {}) {
2032
+ updateClanDesc(bearerToken, clanId, body, options = {}) {
2033
2033
  if (clanId === null || clanId === void 0) {
2034
2034
  throw new Error("'clanId' is a required parameter but is null or undefined.");
2035
2035
  }
2036
+ if (body === null || body === void 0) {
2037
+ throw new Error("'body' is a required parameter but is null or undefined.");
2038
+ }
2036
2039
  const urlPath = "/v2/clandesc/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
2037
2040
  const queryParams = /* @__PURE__ */ new Map();
2038
- queryParams.set("creator_id", creatorId);
2039
- queryParams.set("clan_name", clanName);
2040
- queryParams.set("logo", logo);
2041
- queryParams.set("banner", banner);
2042
2041
  let bodyJson = "";
2042
+ bodyJson = JSON.stringify(body || {});
2043
2043
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2044
2044
  const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2045
2045
  if (bearerToken) {
@@ -2206,10 +2206,12 @@ var MezonApi = class {
2206
2206
  ]);
2207
2207
  }
2208
2208
  /** Immediately join an open group, or request to join a closed one. */
2209
- registFCMDeviceToken(bearerToken, token, options = {}) {
2209
+ registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
2210
2210
  const urlPath = "/v2/devicetoken";
2211
2211
  const queryParams = /* @__PURE__ */ new Map();
2212
2212
  queryParams.set("token", token);
2213
+ queryParams.set("device_id", deviceId);
2214
+ queryParams.set("platform", platform);
2213
2215
  let bodyJson = "";
2214
2216
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2215
2217
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
@@ -2686,13 +2688,14 @@ var MezonApi = class {
2686
2688
  )
2687
2689
  ]);
2688
2690
  }
2689
- /** */
2690
- getListPermission(bearerToken, options = {}) {
2691
- const urlPath = "/v2/permissions";
2691
+ /** Delete one or more notifications for the current user. */
2692
+ deleteNotifications(bearerToken, ids, options = {}) {
2693
+ const urlPath = "/v2/notification";
2692
2694
  const queryParams = /* @__PURE__ */ new Map();
2695
+ queryParams.set("ids", ids);
2693
2696
  let bodyJson = "";
2694
2697
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2695
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2698
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2696
2699
  if (bearerToken) {
2697
2700
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2698
2701
  }
@@ -2711,14 +2714,15 @@ var MezonApi = class {
2711
2714
  )
2712
2715
  ]);
2713
2716
  }
2714
- /** Delete one or more notifications for the current user. */
2715
- deleteNotifications(bearerToken, ids, options = {}) {
2717
+ /** Fetch list of notifications. */
2718
+ listNotifications(bearerToken, limit, cacheableCursor, options = {}) {
2716
2719
  const urlPath = "/v2/notification";
2717
2720
  const queryParams = /* @__PURE__ */ new Map();
2718
- queryParams.set("ids", ids);
2721
+ queryParams.set("limit", limit);
2722
+ queryParams.set("cacheable_cursor", cacheableCursor);
2719
2723
  let bodyJson = "";
2720
2724
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2721
- const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2725
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2722
2726
  if (bearerToken) {
2723
2727
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2724
2728
  }
@@ -2737,12 +2741,10 @@ var MezonApi = class {
2737
2741
  )
2738
2742
  ]);
2739
2743
  }
2740
- /** Fetch list of notifications. */
2741
- listNotifications(bearerToken, limit, cacheableCursor, options = {}) {
2742
- const urlPath = "/v2/notification";
2744
+ /** Get permission list */
2745
+ getListPermission(bearerToken, options = {}) {
2746
+ const urlPath = "/v2/permissions";
2743
2747
  const queryParams = /* @__PURE__ */ new Map();
2744
- queryParams.set("limit", limit);
2745
- queryParams.set("cacheable_cursor", cacheableCursor);
2746
2748
  let bodyJson = "";
2747
2749
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2748
2750
  const fetchOptions = buildFetchOptions("GET", options, bodyJson);
@@ -4876,12 +4878,12 @@ var Client = class {
4876
4878
  });
4877
4879
  });
4878
4880
  }
4879
- registFCMDeviceToken(session, tokenId) {
4881
+ registFCMDeviceToken(session, tokenId, deviceId, platform) {
4880
4882
  return __async(this, null, function* () {
4881
4883
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4882
4884
  yield this.sessionRefresh(session);
4883
4885
  }
4884
- return this.apiClient.registFCMDeviceToken(session.token, tokenId).then((response) => {
4886
+ return this.apiClient.registFCMDeviceToken(session.token, tokenId, deviceId, platform).then((response) => {
4885
4887
  return response !== void 0;
4886
4888
  });
4887
4889
  });
@@ -5318,7 +5320,7 @@ var Client = class {
5318
5320
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5319
5321
  yield this.sessionRefresh(session);
5320
5322
  }
5321
- return this.apiClient.updateClanDesc(session.token, clanId, request == null ? void 0 : request.creator_id, request == null ? void 0 : request.clan_name, request == null ? void 0 : request.logo, request == null ? void 0 : request.banner).then((response) => {
5323
+ return this.apiClient.updateClanDesc(session.token, clanId, request).then((response) => {
5322
5324
  return response !== void 0;
5323
5325
  });
5324
5326
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.17",
3
+ "version": "2.7.19",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },