mezon-js 2.7.91 → 2.7.93

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -29,6 +29,10 @@ export interface ClanUserListClanUser {
29
29
  }
30
30
 
31
31
  /** */
32
+ export interface MezonChangeChannelCategoryBody {
33
+ //
34
+ channel_id?: string;
35
+ }
32
36
 
33
37
 
34
38
  /** Update fields in a given channel. */
@@ -5367,6 +5371,47 @@ export class MezonApi {
5367
5371
  ]);
5368
5372
  }
5369
5373
 
5374
+ /** update the category of a channel */
5375
+ changeChannelCategory(bearerToken: string,
5376
+ newCategoryId:string,
5377
+ body:MezonChangeChannelCategoryBody,
5378
+ options: any = {}): Promise<any> {
5379
+
5380
+ if (newCategoryId === null || newCategoryId === undefined) {
5381
+ throw new Error("'newCategoryId' is a required parameter but is null or undefined.");
5382
+ }
5383
+ if (body === null || body === undefined) {
5384
+ throw new Error("'body' is a required parameter but is null or undefined.");
5385
+ }
5386
+ const urlPath = "/v2/rolechannel/category/{newCategoryId}"
5387
+ .replace("{newCategoryId}", encodeURIComponent(String(newCategoryId)));
5388
+ const queryParams = new Map<string, any>();
5389
+
5390
+ let bodyJson : string = "";
5391
+ bodyJson = JSON.stringify(body || {});
5392
+
5393
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5394
+ const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
5395
+ if (bearerToken) {
5396
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5397
+ }
5398
+
5399
+ return Promise.race([
5400
+ fetch(fullUrl, fetchOptions).then((response) => {
5401
+ if (response.status == 204) {
5402
+ return response;
5403
+ } else if (response.status >= 200 && response.status < 300) {
5404
+ return response.json();
5405
+ } else {
5406
+ throw response;
5407
+ }
5408
+ }),
5409
+ new Promise((_, reject) =>
5410
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5411
+ ),
5412
+ ]);
5413
+ }
5414
+
5370
5415
  /** Update a role when Delete a role by ID. */
5371
5416
  deleteRoleChannelDesc(bearerToken: string,
5372
5417
  body:ApiDeleteRoleRequest,
package/client.ts CHANGED
@@ -106,6 +106,7 @@ import {
106
106
  ApiClanStickerAddRequest,
107
107
  ApiClanStickerListByClanIdResponse,
108
108
  MezonUpdateClanStickerByIdBody,
109
+ MezonChangeChannelCategoryBody,
109
110
  } from "./api.gen";
110
111
 
111
112
  import { Session } from "./session";
@@ -1163,6 +1164,8 @@ export class Client {
1163
1164
  },
1164
1165
  role_id: gu!.role_id,
1165
1166
  thread_id: gu.thread_id,
1167
+ clan_avatar: gu.clan_avatar,
1168
+ clan_nick: gu.clan_nick,
1166
1169
  id: gu.id,
1167
1170
  })
1168
1171
  });
@@ -2403,7 +2406,19 @@ async updateClanStickerById(session: Session,id: string,request: MezonUpdateClan
2403
2406
  await this.sessionRefresh(session);
2404
2407
  }
2405
2408
 
2406
- return this.apiClient.updateClanStickerById(session.token, id,request).then((response: any) => {
2409
+ return this.apiClient.updateClanStickerById(session.token, id, request).then((response: any) => {
2410
+ return response !== undefined;
2411
+ })
2412
+ }
2413
+
2414
+ //** update the category of a channel */
2415
+ async changeChannelCategory(session: Session,id: string,request: MezonChangeChannelCategoryBody) {
2416
+ if (this.autoRefreshSession && session.refresh_token &&
2417
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2418
+ await this.sessionRefresh(session);
2419
+ }
2420
+
2421
+ return this.apiClient.changeChannelCategory(session.token, id, request).then((response: any) => {
2407
2422
  return response !== undefined;
2408
2423
  })
2409
2424
  }
package/dist/api.gen.d.ts CHANGED
@@ -13,6 +13,9 @@ export interface ClanUserListClanUser {
13
13
  user?: ApiUser;
14
14
  }
15
15
  /** */
16
+ export interface MezonChangeChannelCategoryBody {
17
+ channel_id?: string;
18
+ }
16
19
  /** Update fields in a given channel. */
17
20
  export interface MezonUpdateChannelDescBody {
18
21
  category_id?: string;
@@ -1144,6 +1147,8 @@ export declare class MezonApi {
1144
1147
  createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<any>;
1145
1148
  /** */
1146
1149
  addRolesChannelDesc(bearerToken: string, body: ApiAddRoleChannelDescRequest, options?: any): Promise<any>;
1150
+ /** update the category of a channel */
1151
+ changeChannelCategory(bearerToken: string, newCategoryId: string, body: MezonChangeChannelCategoryBody, options?: any): Promise<any>;
1147
1152
  /** Update a role when Delete a role by ID. */
1148
1153
  deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, options?: any): Promise<any>;
1149
1154
  /** List user roles */
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, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, ApiChannelVoiceList, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, ApiClanStickerListByClanIdResponse, MezonUpdateClanStickerByIdBody } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, ApiChannelVoiceList, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, ApiClanStickerListByClanIdResponse, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -596,4 +596,5 @@ export declare class Client {
596
596
  listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse>;
597
597
  deleteClanStickerById(session: Session, id: string): Promise<boolean>;
598
598
  updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
599
+ changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody): Promise<boolean>;
599
600
  }
@@ -3585,6 +3585,38 @@ var MezonApi = class {
3585
3585
  )
3586
3586
  ]);
3587
3587
  }
3588
+ /** update the category of a channel */
3589
+ changeChannelCategory(bearerToken, newCategoryId, body, options = {}) {
3590
+ if (newCategoryId === null || newCategoryId === void 0) {
3591
+ throw new Error("'newCategoryId' is a required parameter but is null or undefined.");
3592
+ }
3593
+ if (body === null || body === void 0) {
3594
+ throw new Error("'body' is a required parameter but is null or undefined.");
3595
+ }
3596
+ const urlPath = "/v2/rolechannel/category/{newCategoryId}".replace("{newCategoryId}", encodeURIComponent(String(newCategoryId)));
3597
+ const queryParams = /* @__PURE__ */ new Map();
3598
+ let bodyJson = "";
3599
+ bodyJson = JSON.stringify(body || {});
3600
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3601
+ const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
3602
+ if (bearerToken) {
3603
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3604
+ }
3605
+ return Promise.race([
3606
+ fetch(fullUrl, fetchOptions).then((response) => {
3607
+ if (response.status == 204) {
3608
+ return response;
3609
+ } else if (response.status >= 200 && response.status < 300) {
3610
+ return response.json();
3611
+ } else {
3612
+ throw response;
3613
+ }
3614
+ }),
3615
+ new Promise(
3616
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3617
+ )
3618
+ ]);
3619
+ }
3588
3620
  /** Update a role when Delete a role by ID. */
3589
3621
  deleteRoleChannelDesc(bearerToken, body, options = {}) {
3590
3622
  if (body === null || body === void 0) {
@@ -5748,6 +5780,8 @@ var Client = class {
5748
5780
  },
5749
5781
  role_id: gu.role_id,
5750
5782
  thread_id: gu.thread_id,
5783
+ clan_avatar: gu.clan_avatar,
5784
+ clan_nick: gu.clan_nick,
5751
5785
  id: gu.id
5752
5786
  });
5753
5787
  });
@@ -6882,4 +6916,15 @@ var Client = class {
6882
6916
  });
6883
6917
  });
6884
6918
  }
6919
+ //** update the category of a channel */
6920
+ changeChannelCategory(session, id, request) {
6921
+ return __async(this, null, function* () {
6922
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6923
+ yield this.sessionRefresh(session);
6924
+ }
6925
+ return this.apiClient.changeChannelCategory(session.token, id, request).then((response) => {
6926
+ return response !== void 0;
6927
+ });
6928
+ });
6929
+ }
6885
6930
  };
@@ -3556,6 +3556,38 @@ var MezonApi = class {
3556
3556
  )
3557
3557
  ]);
3558
3558
  }
3559
+ /** update the category of a channel */
3560
+ changeChannelCategory(bearerToken, newCategoryId, body, options = {}) {
3561
+ if (newCategoryId === null || newCategoryId === void 0) {
3562
+ throw new Error("'newCategoryId' is a required parameter but is null or undefined.");
3563
+ }
3564
+ if (body === null || body === void 0) {
3565
+ throw new Error("'body' is a required parameter but is null or undefined.");
3566
+ }
3567
+ const urlPath = "/v2/rolechannel/category/{newCategoryId}".replace("{newCategoryId}", encodeURIComponent(String(newCategoryId)));
3568
+ const queryParams = /* @__PURE__ */ new Map();
3569
+ let bodyJson = "";
3570
+ bodyJson = JSON.stringify(body || {});
3571
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3572
+ const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
3573
+ if (bearerToken) {
3574
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3575
+ }
3576
+ return Promise.race([
3577
+ fetch(fullUrl, fetchOptions).then((response) => {
3578
+ if (response.status == 204) {
3579
+ return response;
3580
+ } else if (response.status >= 200 && response.status < 300) {
3581
+ return response.json();
3582
+ } else {
3583
+ throw response;
3584
+ }
3585
+ }),
3586
+ new Promise(
3587
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3588
+ )
3589
+ ]);
3590
+ }
3559
3591
  /** Update a role when Delete a role by ID. */
3560
3592
  deleteRoleChannelDesc(bearerToken, body, options = {}) {
3561
3593
  if (body === null || body === void 0) {
@@ -5719,6 +5751,8 @@ var Client = class {
5719
5751
  },
5720
5752
  role_id: gu.role_id,
5721
5753
  thread_id: gu.thread_id,
5754
+ clan_avatar: gu.clan_avatar,
5755
+ clan_nick: gu.clan_nick,
5722
5756
  id: gu.id
5723
5757
  });
5724
5758
  });
@@ -6853,6 +6887,17 @@ var Client = class {
6853
6887
  });
6854
6888
  });
6855
6889
  }
6890
+ //** update the category of a channel */
6891
+ changeChannelCategory(session, id, request) {
6892
+ return __async(this, null, function* () {
6893
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6894
+ yield this.sessionRefresh(session);
6895
+ }
6896
+ return this.apiClient.changeChannelCategory(session.token, id, request).then((response) => {
6897
+ return response !== void 0;
6898
+ });
6899
+ });
6900
+ }
6856
6901
  };
6857
6902
  export {
6858
6903
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.91",
3
+ "version": "2.7.93",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },