mezon-js 2.9.66 → 2.9.67

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -65,10 +65,6 @@ export interface MezonChangeChannelCategoryBody {
65
65
  channel_id?: string;
66
66
  }
67
67
 
68
- /** */
69
- export interface MezonDeleteWebhookByIdBody {
70
- }
71
-
72
68
  /** */
73
69
  export interface MezonSetChanEncryptionMethodBody {
74
70
  //
@@ -76,7 +72,12 @@ export interface MezonSetChanEncryptionMethodBody {
76
72
  }
77
73
 
78
74
  /** */
79
- export interface MezonDeleteWebhookByIdBody {}
75
+ export interface MezonDeleteWebhookByIdBody {
76
+ //
77
+ channel_id?: string;
78
+ //
79
+ clan_id?: string;
80
+ }
80
81
 
81
82
  /** Update app information. */
82
83
  export interface MezonUpdateAppBody {
@@ -273,6 +274,10 @@ export interface MezonUpdateWebhookByIdBody {
273
274
  //
274
275
  channel_id?: string;
275
276
  //
277
+ channel_id_update?: string;
278
+ //
279
+ clan_id?: string;
280
+ //
276
281
  webhook_name?: string;
277
282
  }
278
283
 
@@ -2368,6 +2373,8 @@ export interface ApiWebhookCreateRequest {
2368
2373
  //
2369
2374
  channel_id?: string;
2370
2375
  //
2376
+ clan_id?: string;
2377
+ //
2371
2378
  webhook_name?: string;
2372
2379
  }
2373
2380
 
@@ -9365,45 +9372,46 @@ pushPubKey(bearerToken: string,
9365
9372
  }
9366
9373
 
9367
9374
  /** disabled webhook */
9368
- deleteWebhookById(
9369
- bearerToken: string,
9370
- id: string,
9371
- options: any = {}
9372
- ): Promise<any> {
9373
- if (id === null || id === undefined) {
9374
- throw new Error("'id' is a required parameter but is null or undefined.");
9375
- }
9376
-
9377
- const urlPath = "/v2/webhooks/{id}".replace(
9378
- "{id}",
9379
- encodeURIComponent(String(id))
9380
- );
9381
- const queryParams = new Map<string, any>();
9375
+ deleteWebhookById(bearerToken: string,
9376
+ id:string,
9377
+ body:MezonDeleteWebhookByIdBody,
9378
+ options: any = {}): Promise<any> {
9379
+
9380
+ if (id === null || id === undefined) {
9381
+ throw new Error("'id' is a required parameter but is null or undefined.");
9382
+ }
9383
+ if (body === null || body === undefined) {
9384
+ throw new Error("'body' is a required parameter but is null or undefined.");
9385
+ }
9386
+ const urlPath = "/v2/webhooks/{id}"
9387
+ .replace("{id}", encodeURIComponent(String(id)));
9388
+ const queryParams = new Map<string, any>();
9382
9389
 
9383
- let bodyJson: string = "";
9390
+ let bodyJson : string = "";
9391
+ bodyJson = JSON.stringify(body || {});
9384
9392
 
9385
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9386
- const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
9387
- if (bearerToken) {
9393
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9394
+ const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
9395
+ if (bearerToken) {
9388
9396
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9389
- }
9390
-
9391
- return Promise.race([
9392
- fetch(fullUrl, fetchOptions).then((response) => {
9393
- if (response.status == 204) {
9394
- return response;
9395
- } else if (response.status >= 200 && response.status < 300) {
9396
- return response.json();
9397
- } else {
9398
- throw response;
9399
- }
9400
- }),
9401
- new Promise((_, reject) =>
9402
- setTimeout(reject, this.timeoutMs, "Request timed out.")
9403
- ),
9404
- ]);
9405
9397
  }
9406
9398
 
9399
+ return Promise.race([
9400
+ fetch(fullUrl, fetchOptions).then((response) => {
9401
+ if (response.status == 204) {
9402
+ return response;
9403
+ } else if (response.status >= 200 && response.status < 300) {
9404
+ return response.json();
9405
+ } else {
9406
+ throw response;
9407
+ }
9408
+ }),
9409
+ new Promise((_, reject) =>
9410
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9411
+ ),
9412
+ ]);
9413
+ }
9414
+
9407
9415
  buildFullUrl(
9408
9416
  basePath: string,
9409
9417
  fragment: string,
package/client.ts CHANGED
@@ -138,6 +138,7 @@ import {
138
138
  ApiGetKeyServerResp,
139
139
  MezonapiListAuditLog,
140
140
  ApiTokenSentEvent,
141
+ MezonDeleteWebhookByIdBody,
141
142
  ApiWithdrawTokenRequest,
142
143
  } from "./api.gen";
143
144
 
@@ -3181,7 +3182,7 @@ export class Client {
3181
3182
  }
3182
3183
 
3183
3184
  //**disabled webhook by id */
3184
- async deleteWebhookById(session: Session, id: string) {
3185
+ async deleteWebhookById(session: Session, id: string, request: MezonDeleteWebhookByIdBody) {
3185
3186
  if (
3186
3187
  this.autoRefreshSession &&
3187
3188
  session.refresh_token &&
@@ -3191,7 +3192,7 @@ export class Client {
3191
3192
  }
3192
3193
 
3193
3194
  return this.apiClient
3194
- .deleteWebhookById(session.token, id)
3195
+ .deleteWebhookById(session.token, id, request)
3195
3196
  .then((response: any) => {
3196
3197
  return response !== undefined;
3197
3198
  });
@@ -3518,7 +3519,7 @@ export class Client {
3518
3519
  });
3519
3520
  }
3520
3521
 
3521
- async updateWallets(session: Session, request: ApiTokenSentEvent) {
3522
+ async sendToken(session: Session, request: ApiTokenSentEvent) {
3522
3523
  if (
3523
3524
  this.autoRefreshSession &&
3524
3525
  session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -35,14 +35,13 @@ export interface MezonChangeChannelCategoryBody {
35
35
  channel_id?: string;
36
36
  }
37
37
  /** */
38
- export interface MezonDeleteWebhookByIdBody {
39
- }
40
- /** */
41
38
  export interface MezonSetChanEncryptionMethodBody {
42
39
  method?: string;
43
40
  }
44
41
  /** */
45
42
  export interface MezonDeleteWebhookByIdBody {
43
+ channel_id?: string;
44
+ clan_id?: string;
46
45
  }
47
46
  /** Update app information. */
48
47
  export interface MezonUpdateAppBody {
@@ -160,6 +159,8 @@ export interface MezonUpdateUserProfileByClanBody {
160
159
  export interface MezonUpdateWebhookByIdBody {
161
160
  avatar?: string;
162
161
  channel_id?: string;
162
+ channel_id_update?: string;
163
+ clan_id?: string;
163
164
  webhook_name?: string;
164
165
  }
165
166
  /** A single user-role pair. */
@@ -1378,6 +1379,7 @@ export interface ApiWebhook {
1378
1379
  export interface ApiWebhookCreateRequest {
1379
1380
  avatar?: string;
1380
1381
  channel_id?: string;
1382
+ clan_id?: string;
1381
1383
  webhook_name?: string;
1382
1384
  }
1383
1385
  /** */
@@ -1774,7 +1776,7 @@ export declare class MezonApi {
1774
1776
  /** list webhook belong to the channel */
1775
1777
  listWebhookByChannelId(bearerToken: string, channelId: string, clanId?: string, options?: any): Promise<ApiWebhookListResponse>;
1776
1778
  /** disabled webhook */
1777
- deleteWebhookById(bearerToken: string, id: string, options?: any): Promise<any>;
1779
+ deleteWebhookById(bearerToken: string, id: string, body: MezonDeleteWebhookByIdBody, options?: any): Promise<any>;
1778
1780
  buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
1779
1781
  /** Channel canvas editor */
1780
1782
  editChannelCanvases(bearerToken: string, body: ApiEditChannelCanvasRequest, options?: any): Promise<ApiEditChannelCanvasResponse>;
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, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, ApiWithdrawTokenRequest } 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, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -539,7 +539,7 @@ export declare class Client {
539
539
  generateWebhookLink(session: Session, request: ApiWebhookCreateRequest): Promise<ApiWebhookGenerateResponse>;
540
540
  listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse>;
541
541
  updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
542
- deleteWebhookById(session: Session, id: string): Promise<boolean>;
542
+ deleteWebhookById(session: Session, id: string, request: MezonDeleteWebhookByIdBody): Promise<boolean>;
543
543
  checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
544
544
  addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
545
545
  deleteClanStickerById(session: Session, id: string, clan_id: string): Promise<boolean>;
@@ -559,7 +559,7 @@ export declare class Client {
559
559
  updateCategoryOrder(session: Session, request: ApiUpdateCategoryOrderRequest): Promise<any>;
560
560
  deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
561
561
  givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<boolean>;
562
- updateWallets(session: Session, request: ApiTokenSentEvent): Promise<ApiTokenSentEvent>;
562
+ sendToken(session: Session, request: ApiTokenSentEvent): Promise<ApiTokenSentEvent>;
563
563
  withdrawToken(session: Session, request: ApiWithdrawTokenRequest): Promise<ApiTokenSentEvent>;
564
564
  listStreamingChannels(session: Session, clanId: string): Promise<ApiListStreamingChannelsResponse>;
565
565
  /** List a channel's users. */
@@ -6107,16 +6107,17 @@ var MezonApi = class {
6107
6107
  ]);
6108
6108
  }
6109
6109
  /** disabled webhook */
6110
- deleteWebhookById(bearerToken, id, options = {}) {
6110
+ deleteWebhookById(bearerToken, id, body, options = {}) {
6111
6111
  if (id === null || id === void 0) {
6112
6112
  throw new Error("'id' is a required parameter but is null or undefined.");
6113
6113
  }
6114
- const urlPath = "/v2/webhooks/{id}".replace(
6115
- "{id}",
6116
- encodeURIComponent(String(id))
6117
- );
6114
+ if (body === null || body === void 0) {
6115
+ throw new Error("'body' is a required parameter but is null or undefined.");
6116
+ }
6117
+ const urlPath = "/v2/webhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
6118
6118
  const queryParams = /* @__PURE__ */ new Map();
6119
6119
  let bodyJson = "";
6120
+ bodyJson = JSON.stringify(body || {});
6120
6121
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6121
6122
  const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
6122
6123
  if (bearerToken) {
@@ -8721,12 +8722,12 @@ var Client = class {
8721
8722
  });
8722
8723
  }
8723
8724
  //**disabled webhook by id */
8724
- deleteWebhookById(session, id) {
8725
+ deleteWebhookById(session, id, request) {
8725
8726
  return __async(this, null, function* () {
8726
8727
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8727
8728
  yield this.sessionRefresh(session);
8728
8729
  }
8729
- return this.apiClient.deleteWebhookById(session.token, id).then((response) => {
8730
+ return this.apiClient.deleteWebhookById(session.token, id, request).then((response) => {
8730
8731
  return response !== void 0;
8731
8732
  });
8732
8733
  });
@@ -8917,7 +8918,7 @@ var Client = class {
8917
8918
  });
8918
8919
  });
8919
8920
  }
8920
- updateWallets(session, request) {
8921
+ sendToken(session, request) {
8921
8922
  return __async(this, null, function* () {
8922
8923
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8923
8924
  yield this.sessionRefresh(session);
@@ -6078,16 +6078,17 @@ var MezonApi = class {
6078
6078
  ]);
6079
6079
  }
6080
6080
  /** disabled webhook */
6081
- deleteWebhookById(bearerToken, id, options = {}) {
6081
+ deleteWebhookById(bearerToken, id, body, options = {}) {
6082
6082
  if (id === null || id === void 0) {
6083
6083
  throw new Error("'id' is a required parameter but is null or undefined.");
6084
6084
  }
6085
- const urlPath = "/v2/webhooks/{id}".replace(
6086
- "{id}",
6087
- encodeURIComponent(String(id))
6088
- );
6085
+ if (body === null || body === void 0) {
6086
+ throw new Error("'body' is a required parameter but is null or undefined.");
6087
+ }
6088
+ const urlPath = "/v2/webhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
6089
6089
  const queryParams = /* @__PURE__ */ new Map();
6090
6090
  let bodyJson = "";
6091
+ bodyJson = JSON.stringify(body || {});
6091
6092
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6092
6093
  const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
6093
6094
  if (bearerToken) {
@@ -8692,12 +8693,12 @@ var Client = class {
8692
8693
  });
8693
8694
  }
8694
8695
  //**disabled webhook by id */
8695
- deleteWebhookById(session, id) {
8696
+ deleteWebhookById(session, id, request) {
8696
8697
  return __async(this, null, function* () {
8697
8698
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8698
8699
  yield this.sessionRefresh(session);
8699
8700
  }
8700
- return this.apiClient.deleteWebhookById(session.token, id).then((response) => {
8701
+ return this.apiClient.deleteWebhookById(session.token, id, request).then((response) => {
8701
8702
  return response !== void 0;
8702
8703
  });
8703
8704
  });
@@ -8888,7 +8889,7 @@ var Client = class {
8888
8889
  });
8889
8890
  });
8890
8891
  }
8891
- updateWallets(session, request) {
8892
+ sendToken(session, request) {
8892
8893
  return __async(this, null, function* () {
8893
8894
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8894
8895
  yield this.sessionRefresh(session);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.66",
4
+ "version": "2.9.67",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"