mezon-js 2.7.89 → 2.7.92
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 +55 -0
- package/client.ts +14 -1
- package/dist/api.gen.d.ts +10 -0
- package/dist/client.d.ts +2 -1
- package/dist/mezon-js.cjs.js +43 -0
- package/dist/mezon-js.esm.mjs +43 -0
- package/dist/socket.d.ts +1 -0
- package/package.json +1 -1
- package/socket.ts +2 -0
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. */
|
|
@@ -143,6 +147,10 @@ export interface MezonUpdateUserProfileByClanBody {
|
|
|
143
147
|
|
|
144
148
|
/** */
|
|
145
149
|
export interface MezonUpdateWebhookByIdBody {
|
|
150
|
+
//
|
|
151
|
+
avatar?: string;
|
|
152
|
+
//
|
|
153
|
+
channel_id?: string;
|
|
146
154
|
//
|
|
147
155
|
webhook_name?: string;
|
|
148
156
|
}
|
|
@@ -1521,6 +1529,8 @@ export interface ApiWebhook {
|
|
|
1521
1529
|
//
|
|
1522
1530
|
active?: number;
|
|
1523
1531
|
//
|
|
1532
|
+
avatar?: string;
|
|
1533
|
+
//
|
|
1524
1534
|
channel_id?: string;
|
|
1525
1535
|
//
|
|
1526
1536
|
create_time?: string;
|
|
@@ -1538,6 +1548,8 @@ export interface ApiWebhook {
|
|
|
1538
1548
|
|
|
1539
1549
|
/** */
|
|
1540
1550
|
export interface ApiWebhookCreateRequest {
|
|
1551
|
+
//
|
|
1552
|
+
avatar?: string;
|
|
1541
1553
|
//
|
|
1542
1554
|
channel_id?: string;
|
|
1543
1555
|
//
|
|
@@ -1546,6 +1558,8 @@ export interface ApiWebhookCreateRequest {
|
|
|
1546
1558
|
|
|
1547
1559
|
/** */
|
|
1548
1560
|
export interface ApiWebhookGenerateResponse {
|
|
1561
|
+
//
|
|
1562
|
+
avatar?: string;
|
|
1549
1563
|
//
|
|
1550
1564
|
channel_id?: string;
|
|
1551
1565
|
//
|
|
@@ -5357,6 +5371,47 @@ export class MezonApi {
|
|
|
5357
5371
|
]);
|
|
5358
5372
|
}
|
|
5359
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
|
+
|
|
5360
5415
|
/** Update a role when Delete a role by ID. */
|
|
5361
5416
|
deleteRoleChannelDesc(bearerToken: string,
|
|
5362
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";
|
|
@@ -2403,7 +2404,19 @@ async updateClanStickerById(session: Session,id: string,request: MezonUpdateClan
|
|
|
2403
2404
|
await this.sessionRefresh(session);
|
|
2404
2405
|
}
|
|
2405
2406
|
|
|
2406
|
-
return this.apiClient.updateClanStickerById(session.token, id,request).then((response: any) => {
|
|
2407
|
+
return this.apiClient.updateClanStickerById(session.token, id, request).then((response: any) => {
|
|
2408
|
+
return response !== undefined;
|
|
2409
|
+
})
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
//** update the category of a channel */
|
|
2413
|
+
async changeChannelCategory(session: Session,id: string,request: MezonChangeChannelCategoryBody) {
|
|
2414
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2415
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2416
|
+
await this.sessionRefresh(session);
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
return this.apiClient.changeChannelCategory(session.token, id, request).then((response: any) => {
|
|
2407
2420
|
return response !== undefined;
|
|
2408
2421
|
})
|
|
2409
2422
|
}
|
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;
|
|
@@ -79,6 +82,8 @@ export interface MezonUpdateUserProfileByClanBody {
|
|
|
79
82
|
}
|
|
80
83
|
/** */
|
|
81
84
|
export interface MezonUpdateWebhookByIdBody {
|
|
85
|
+
avatar?: string;
|
|
86
|
+
channel_id?: string;
|
|
82
87
|
webhook_name?: string;
|
|
83
88
|
}
|
|
84
89
|
/** A single user-role pair. */
|
|
@@ -877,6 +882,7 @@ export interface ApiVoiceChannelUserList {
|
|
|
877
882
|
/** */
|
|
878
883
|
export interface ApiWebhook {
|
|
879
884
|
active?: number;
|
|
885
|
+
avatar?: string;
|
|
880
886
|
channel_id?: string;
|
|
881
887
|
create_time?: string;
|
|
882
888
|
creator_id?: string;
|
|
@@ -887,11 +893,13 @@ export interface ApiWebhook {
|
|
|
887
893
|
}
|
|
888
894
|
/** */
|
|
889
895
|
export interface ApiWebhookCreateRequest {
|
|
896
|
+
avatar?: string;
|
|
890
897
|
channel_id?: string;
|
|
891
898
|
webhook_name?: string;
|
|
892
899
|
}
|
|
893
900
|
/** */
|
|
894
901
|
export interface ApiWebhookGenerateResponse {
|
|
902
|
+
avatar?: string;
|
|
895
903
|
channel_id?: string;
|
|
896
904
|
hook_name?: string;
|
|
897
905
|
url?: string;
|
|
@@ -1139,6 +1147,8 @@ export declare class MezonApi {
|
|
|
1139
1147
|
createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<any>;
|
|
1140
1148
|
/** */
|
|
1141
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>;
|
|
1142
1152
|
/** Update a role when Delete a role by ID. */
|
|
1143
1153
|
deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, options?: any): Promise<any>;
|
|
1144
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
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -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) {
|
|
@@ -6882,4 +6914,15 @@ var Client = class {
|
|
|
6882
6914
|
});
|
|
6883
6915
|
});
|
|
6884
6916
|
}
|
|
6917
|
+
//** update the category of a channel */
|
|
6918
|
+
changeChannelCategory(session, id, request) {
|
|
6919
|
+
return __async(this, null, function* () {
|
|
6920
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6921
|
+
yield this.sessionRefresh(session);
|
|
6922
|
+
}
|
|
6923
|
+
return this.apiClient.changeChannelCategory(session.token, id, request).then((response) => {
|
|
6924
|
+
return response !== void 0;
|
|
6925
|
+
});
|
|
6926
|
+
});
|
|
6927
|
+
}
|
|
6885
6928
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -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) {
|
|
@@ -6853,6 +6885,17 @@ var Client = class {
|
|
|
6853
6885
|
});
|
|
6854
6886
|
});
|
|
6855
6887
|
}
|
|
6888
|
+
//** update the category of a channel */
|
|
6889
|
+
changeChannelCategory(session, id, request) {
|
|
6890
|
+
return __async(this, null, function* () {
|
|
6891
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6892
|
+
yield this.sessionRefresh(session);
|
|
6893
|
+
}
|
|
6894
|
+
return this.apiClient.changeChannelCategory(session.token, id, request).then((response) => {
|
|
6895
|
+
return response !== void 0;
|
|
6896
|
+
});
|
|
6897
|
+
});
|
|
6898
|
+
}
|
|
6856
6899
|
};
|
|
6857
6900
|
export {
|
|
6858
6901
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
package/package.json
CHANGED