mezon-js 2.7.17 → 2.7.18

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -3075,11 +3075,15 @@ return Promise.race([
3075
3075
  /** Immediately join an open group, or request to join a closed one. */
3076
3076
  registFCMDeviceToken(bearerToken: string,
3077
3077
  token?:string,
3078
+ deviceId?:string,
3079
+ platform?:string,
3078
3080
  options: any = {}): Promise<any> {
3079
3081
 
3080
3082
  const urlPath = "/v2/devicetoken";
3081
3083
  const queryParams = new Map<string, any>();
3082
3084
  queryParams.set("token", token);
3085
+ queryParams.set("device_id", deviceId);
3086
+ queryParams.set("platform", platform);
3083
3087
 
3084
3088
  let bodyJson : string = "";
3085
3089
 
@@ -3685,17 +3689,19 @@ return Promise.race([
3685
3689
  ]);
3686
3690
  }
3687
3691
 
3688
- /** */
3689
- getListPermission(bearerToken: string,
3690
- options: any = {}): Promise<ApiPermissionList> {
3692
+ /** Delete one or more notifications for the current user. */
3693
+ deleteNotifications(bearerToken: string,
3694
+ ids?:Array<string>,
3695
+ options: any = {}): Promise<any> {
3691
3696
 
3692
- const urlPath = "/v2/permissions";
3697
+ const urlPath = "/v2/notification";
3693
3698
  const queryParams = new Map<string, any>();
3699
+ queryParams.set("ids", ids);
3694
3700
 
3695
3701
  let bodyJson : string = "";
3696
3702
 
3697
3703
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3698
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3704
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3699
3705
  if (bearerToken) {
3700
3706
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3701
3707
  }
@@ -3716,19 +3722,21 @@ return Promise.race([
3716
3722
  ]);
3717
3723
  }
3718
3724
 
3719
- /** Delete one or more notifications for the current user. */
3720
- deleteNotifications(bearerToken: string,
3721
- ids?:Array<string>,
3722
- options: any = {}): Promise<any> {
3725
+ /** Fetch list of notifications. */
3726
+ listNotifications(bearerToken: string,
3727
+ limit?:number,
3728
+ cacheableCursor?:string,
3729
+ options: any = {}): Promise<ApiNotificationList> {
3723
3730
 
3724
3731
  const urlPath = "/v2/notification";
3725
3732
  const queryParams = new Map<string, any>();
3726
- queryParams.set("ids", ids);
3733
+ queryParams.set("limit", limit);
3734
+ queryParams.set("cacheable_cursor", cacheableCursor);
3727
3735
 
3728
3736
  let bodyJson : string = "";
3729
3737
 
3730
3738
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3731
- const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3739
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3732
3740
  if (bearerToken) {
3733
3741
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3734
3742
  }
@@ -3749,16 +3757,12 @@ return Promise.race([
3749
3757
  ]);
3750
3758
  }
3751
3759
 
3752
- /** Fetch list of notifications. */
3753
- listNotifications(bearerToken: string,
3754
- limit?:number,
3755
- cacheableCursor?:string,
3756
- options: any = {}): Promise<ApiNotificationList> {
3760
+ /** Get permission list */
3761
+ getListPermission(bearerToken: string,
3762
+ options: any = {}): Promise<ApiPermissionList> {
3757
3763
 
3758
- const urlPath = "/v2/notification";
3764
+ const urlPath = "/v2/permissions";
3759
3765
  const queryParams = new Map<string, any>();
3760
- queryParams.set("limit", limit);
3761
- queryParams.set("cacheable_cursor", cacheableCursor);
3762
3766
 
3763
3767
  let bodyJson : string = "";
3764
3768
 
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
  }
package/dist/api.gen.d.ts CHANGED
@@ -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>;
@@ -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
  });
@@ -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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.17",
3
+ "version": "2.7.18",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },