mezon-js 2.8.65 → 2.8.66

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -5697,51 +5697,11 @@ export class MezonApi {
5697
5697
  ]);
5698
5698
  }
5699
5699
 
5700
- /** Update a role when Delete a role by ID. */
5701
- updateRoleDelete(bearerToken: string,
5702
- roleId:string,
5703
- body: MezonUpdateRoleDeleteBody,
5704
- options: any = {}): Promise<any> {
5705
-
5706
- if (roleId === null || roleId === undefined) {
5707
- throw new Error("'roleId' is a required parameter but is null or undefined.");
5708
- }
5709
- if (body === null || body === undefined) {
5710
- throw new Error("'body' is a required parameter but is null or undefined.");
5711
- }
5712
- const urlPath = "/v2/roles/delete/{roleId}"
5713
- .replace("{roleId}", encodeURIComponent(String(roleId)));
5714
- const queryParams = new Map<string, any>();
5715
-
5716
- let bodyJson : string = "";
5717
- bodyJson = JSON.stringify(body || {});
5718
-
5719
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5720
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
5721
- if (bearerToken) {
5722
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5723
- }
5724
-
5725
- return Promise.race([
5726
- fetch(fullUrl, fetchOptions).then((response) => {
5727
- if (response.status == 204) {
5728
- return response;
5729
- } else if (response.status >= 200 && response.status < 300) {
5730
- return response.json();
5731
- } else {
5732
- throw response;
5733
- }
5734
- }),
5735
- new Promise((_, reject) =>
5736
- setTimeout(reject, this.timeoutMs, "Request timed out.")
5737
- ),
5738
- ]);
5739
- }
5740
-
5741
5700
  /** Delete a role by ID. */
5742
5701
  deleteRole(bearerToken: string,
5743
5702
  roleId:string,
5744
5703
  channelId?:string,
5704
+ clanId?:string,
5745
5705
  options: any = {}): Promise<any> {
5746
5706
 
5747
5707
  if (roleId === null || roleId === undefined) {
@@ -5751,6 +5711,7 @@ export class MezonApi {
5751
5711
  .replace("{roleId}", encodeURIComponent(String(roleId)));
5752
5712
  const queryParams = new Map<string, any>();
5753
5713
  queryParams.set("channel_id", channelId);
5714
+ queryParams.set("clan_id", clanId);
5754
5715
 
5755
5716
  let bodyJson : string = "";
5756
5717
 
package/client.ts CHANGED
@@ -95,7 +95,6 @@ import {
95
95
  ApiAddAppRequest,
96
96
  ApiAppList,
97
97
  ApiApp,
98
- MezonUpdateRoleDeleteBody,
99
98
  MezonUpdateAppBody,
100
99
  } from "./api.gen";
101
100
 
@@ -847,13 +846,13 @@ export class Client {
847
846
  }
848
847
 
849
848
  /** Delete a role by ID. */
850
- async deleteRole(session: Session, roleId: string): Promise<boolean> {
849
+ async deleteRole(session: Session, roleId: string, clanId: string): Promise<boolean> {
851
850
  if (this.autoRefreshSession && session.refresh_token &&
852
851
  session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
853
852
  await this.sessionRefresh(session);
854
853
  }
855
854
 
856
- return this.apiClient.deleteRole(session.token, roleId).then((response: any) => {
855
+ return this.apiClient.deleteRole(session.token, roleId, "", clanId).then((response: any) => {
857
856
  return response !== undefined;
858
857
  });
859
858
  }
@@ -1313,18 +1312,6 @@ export class Client {
1313
1312
  });
1314
1313
  }
1315
1314
 
1316
- /** Update action role when delete role */
1317
- async updateRoleDelete(session: Session, roleId:string, request:MezonUpdateRoleDeleteBody): Promise<boolean> {
1318
- if (this.autoRefreshSession && session.refresh_token &&
1319
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1320
- await this.sessionRefresh(session);
1321
- }
1322
-
1323
- return this.apiClient.updateRoleDelete(session.token, roleId, request).then((response: any) => {
1324
- return response !== undefined;
1325
- });
1326
- }
1327
-
1328
1315
  /** List user roles */
1329
1316
  async listRolePermissions(session: Session, roleId:string): Promise<ApiPermissionList> {
1330
1317
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -1201,10 +1201,8 @@ export declare class MezonApi {
1201
1201
  deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, options?: any): Promise<any>;
1202
1202
  /** Create a new role for clan. */
1203
1203
  createRole(bearerToken: string, body: ApiCreateRoleRequest, options?: any): Promise<ApiRole>;
1204
- /** Update a role when Delete a role by ID. */
1205
- updateRoleDelete(bearerToken: string, roleId: string, body: MezonUpdateRoleDeleteBody, options?: any): Promise<any>;
1206
1204
  /** Delete a role by ID. */
1207
- deleteRole(bearerToken: string, roleId: string, channelId?: string, options?: any): Promise<any>;
1205
+ deleteRole(bearerToken: string, roleId: string, channelId?: string, clanId?: string, options?: any): Promise<any>;
1208
1206
  /** Update fields in a given role. */
1209
1207
  updateRole(bearerToken: string, roleId: string, body: MezonUpdateRoleBody, options?: any): Promise<any>;
1210
1208
  /** List role permissions */
package/dist/client.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateRoleDeleteBody, MezonUpdateAppBody } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -379,7 +379,7 @@ export declare class Client {
379
379
  /** Delete one or more notifications */
380
380
  deleteNotifications(session: Session, ids?: Array<string>): Promise<boolean>;
381
381
  /** Delete a role by ID. */
382
- deleteRole(session: Session, roleId: string): Promise<boolean>;
382
+ deleteRole(session: Session, roleId: string, clanId: string): Promise<boolean>;
383
383
  /** Delete a event by ID. */
384
384
  deleteEvent(session: Session, eventId: string, clanId: string): Promise<boolean>;
385
385
  /** update user a event by ID. */
@@ -418,8 +418,6 @@ export declare class Client {
418
418
  listEvents(session: Session, clanId?: string): Promise<ApiEventList>;
419
419
  /** List permission */
420
420
  getListPermission(session: Session): Promise<ApiPermissionList>;
421
- /** Update action role when delete role */
422
- updateRoleDelete(session: Session, roleId: string, request: MezonUpdateRoleDeleteBody): Promise<boolean>;
423
421
  /** List user roles */
424
422
  listRolePermissions(session: Session, roleId: string): Promise<ApiPermissionList>;
425
423
  /** List user roles */
@@ -3785,46 +3785,15 @@ var MezonApi = class {
3785
3785
  )
3786
3786
  ]);
3787
3787
  }
3788
- /** Update a role when Delete a role by ID. */
3789
- updateRoleDelete(bearerToken, roleId, body, options = {}) {
3790
- if (roleId === null || roleId === void 0) {
3791
- throw new Error("'roleId' is a required parameter but is null or undefined.");
3792
- }
3793
- if (body === null || body === void 0) {
3794
- throw new Error("'body' is a required parameter but is null or undefined.");
3795
- }
3796
- const urlPath = "/v2/roles/delete/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
3797
- const queryParams = /* @__PURE__ */ new Map();
3798
- let bodyJson = "";
3799
- bodyJson = JSON.stringify(body || {});
3800
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3801
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3802
- if (bearerToken) {
3803
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3804
- }
3805
- return Promise.race([
3806
- fetch(fullUrl, fetchOptions).then((response) => {
3807
- if (response.status == 204) {
3808
- return response;
3809
- } else if (response.status >= 200 && response.status < 300) {
3810
- return response.json();
3811
- } else {
3812
- throw response;
3813
- }
3814
- }),
3815
- new Promise(
3816
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3817
- )
3818
- ]);
3819
- }
3820
3788
  /** Delete a role by ID. */
3821
- deleteRole(bearerToken, roleId, channelId, options = {}) {
3789
+ deleteRole(bearerToken, roleId, channelId, clanId, options = {}) {
3822
3790
  if (roleId === null || roleId === void 0) {
3823
3791
  throw new Error("'roleId' is a required parameter but is null or undefined.");
3824
3792
  }
3825
3793
  const urlPath = "/v2/roles/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
3826
3794
  const queryParams = /* @__PURE__ */ new Map();
3827
3795
  queryParams.set("channel_id", channelId);
3796
+ queryParams.set("clan_id", clanId);
3828
3797
  let bodyJson = "";
3829
3798
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3830
3799
  const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
@@ -5542,12 +5511,12 @@ var Client = class {
5542
5511
  });
5543
5512
  }
5544
5513
  /** Delete a role by ID. */
5545
- deleteRole(session, roleId) {
5514
+ deleteRole(session, roleId, clanId) {
5546
5515
  return __async(this, null, function* () {
5547
5516
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5548
5517
  yield this.sessionRefresh(session);
5549
5518
  }
5550
- return this.apiClient.deleteRole(session.token, roleId).then((response) => {
5519
+ return this.apiClient.deleteRole(session.token, roleId, "", clanId).then((response) => {
5551
5520
  return response !== void 0;
5552
5521
  });
5553
5522
  });
@@ -5966,17 +5935,6 @@ var Client = class {
5966
5935
  });
5967
5936
  });
5968
5937
  }
5969
- /** Update action role when delete role */
5970
- updateRoleDelete(session, roleId, request) {
5971
- return __async(this, null, function* () {
5972
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5973
- yield this.sessionRefresh(session);
5974
- }
5975
- return this.apiClient.updateRoleDelete(session.token, roleId, request).then((response) => {
5976
- return response !== void 0;
5977
- });
5978
- });
5979
- }
5980
5938
  /** List user roles */
5981
5939
  listRolePermissions(session, roleId) {
5982
5940
  return __async(this, null, function* () {
@@ -3756,46 +3756,15 @@ var MezonApi = class {
3756
3756
  )
3757
3757
  ]);
3758
3758
  }
3759
- /** Update a role when Delete a role by ID. */
3760
- updateRoleDelete(bearerToken, roleId, body, options = {}) {
3761
- if (roleId === null || roleId === void 0) {
3762
- throw new Error("'roleId' is a required parameter but is null or undefined.");
3763
- }
3764
- if (body === null || body === void 0) {
3765
- throw new Error("'body' is a required parameter but is null or undefined.");
3766
- }
3767
- const urlPath = "/v2/roles/delete/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
3768
- const queryParams = /* @__PURE__ */ new Map();
3769
- let bodyJson = "";
3770
- bodyJson = JSON.stringify(body || {});
3771
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3772
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3773
- if (bearerToken) {
3774
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3775
- }
3776
- return Promise.race([
3777
- fetch(fullUrl, fetchOptions).then((response) => {
3778
- if (response.status == 204) {
3779
- return response;
3780
- } else if (response.status >= 200 && response.status < 300) {
3781
- return response.json();
3782
- } else {
3783
- throw response;
3784
- }
3785
- }),
3786
- new Promise(
3787
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3788
- )
3789
- ]);
3790
- }
3791
3759
  /** Delete a role by ID. */
3792
- deleteRole(bearerToken, roleId, channelId, options = {}) {
3760
+ deleteRole(bearerToken, roleId, channelId, clanId, options = {}) {
3793
3761
  if (roleId === null || roleId === void 0) {
3794
3762
  throw new Error("'roleId' is a required parameter but is null or undefined.");
3795
3763
  }
3796
3764
  const urlPath = "/v2/roles/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
3797
3765
  const queryParams = /* @__PURE__ */ new Map();
3798
3766
  queryParams.set("channel_id", channelId);
3767
+ queryParams.set("clan_id", clanId);
3799
3768
  let bodyJson = "";
3800
3769
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3801
3770
  const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
@@ -5513,12 +5482,12 @@ var Client = class {
5513
5482
  });
5514
5483
  }
5515
5484
  /** Delete a role by ID. */
5516
- deleteRole(session, roleId) {
5485
+ deleteRole(session, roleId, clanId) {
5517
5486
  return __async(this, null, function* () {
5518
5487
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5519
5488
  yield this.sessionRefresh(session);
5520
5489
  }
5521
- return this.apiClient.deleteRole(session.token, roleId).then((response) => {
5490
+ return this.apiClient.deleteRole(session.token, roleId, "", clanId).then((response) => {
5522
5491
  return response !== void 0;
5523
5492
  });
5524
5493
  });
@@ -5937,17 +5906,6 @@ var Client = class {
5937
5906
  });
5938
5907
  });
5939
5908
  }
5940
- /** Update action role when delete role */
5941
- updateRoleDelete(session, roleId, request) {
5942
- return __async(this, null, function* () {
5943
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5944
- yield this.sessionRefresh(session);
5945
- }
5946
- return this.apiClient.updateRoleDelete(session.token, roleId, request).then((response) => {
5947
- return response !== void 0;
5948
- });
5949
- });
5950
- }
5951
5909
  /** List user roles */
5952
5910
  listRolePermissions(session, roleId) {
5953
5911
  return __async(this, null, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.65",
3
+ "version": "2.8.66",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },