mezon-js 2.8.44 → 2.8.46
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 +9 -51
- package/client.ts +2 -14
- package/dist/api.gen.d.ts +5 -15
- package/dist/client.d.ts +2 -3
- package/dist/mezon-js.cjs.js +10 -39
- package/dist/mezon-js.esm.mjs +10 -39
- package/dist/socket.d.ts +12 -0
- package/package.json +2 -1
- package/socket.ts +25 -0
package/api.gen.ts
CHANGED
@@ -147,6 +147,8 @@ export interface MezonUpdateEventBody {
|
|
147
147
|
//
|
148
148
|
channel_id?: string;
|
149
149
|
//
|
150
|
+
clan_id?: string;
|
151
|
+
//
|
150
152
|
description?: string;
|
151
153
|
//
|
152
154
|
end_time?: string;
|
@@ -752,6 +754,8 @@ export interface ApiUpdateEventRequest {
|
|
752
754
|
start_time?: string;
|
753
755
|
//
|
754
756
|
title?: string;
|
757
|
+
//
|
758
|
+
clan_id?: string;
|
755
759
|
}
|
756
760
|
|
757
761
|
/** Create a role within clan. */
|
@@ -784,6 +788,8 @@ export interface ApiDeleteChannelDescRequest {
|
|
784
788
|
|
785
789
|
/** */
|
786
790
|
export interface ApiDeleteEventRequest {
|
791
|
+
//
|
792
|
+
clan_id?: string;
|
787
793
|
//The id of a event.
|
788
794
|
event_id?: string;
|
789
795
|
}
|
@@ -1105,24 +1111,6 @@ export interface ApiNotificationChannel {
|
|
1105
1111
|
channel_id?: string;
|
1106
1112
|
}
|
1107
1113
|
|
1108
|
-
/** */
|
1109
|
-
export interface ApiNotificationChannelCategoySetting {
|
1110
|
-
//
|
1111
|
-
channel_category_label?: string;
|
1112
|
-
//
|
1113
|
-
channel_category_title?: string;
|
1114
|
-
//
|
1115
|
-
id?: string;
|
1116
|
-
//
|
1117
|
-
notification_setting_type?: number;
|
1118
|
-
}
|
1119
|
-
|
1120
|
-
/** */
|
1121
|
-
export interface ApiNotificationChannelCategoySettingsList {
|
1122
|
-
//
|
1123
|
-
noti_channel_categoy_setting?: Array<ApiNotificationChannelCategoySetting>;
|
1124
|
-
}
|
1125
|
-
|
1126
1114
|
/** A collection of zero or more notifications. */
|
1127
1115
|
export interface ApiNotificationList {
|
1128
1116
|
//Use this cursor to paginate notifications. Cache this to catch up to new notifications.
|
@@ -4518,6 +4506,7 @@ export class MezonApi {
|
|
4518
4506
|
/** Delete a event by ID. */
|
4519
4507
|
deleteEvent(bearerToken: string,
|
4520
4508
|
eventId:string,
|
4509
|
+
clanId?:string,
|
4521
4510
|
options: any = {}): Promise<any> {
|
4522
4511
|
|
4523
4512
|
if (eventId === null || eventId === undefined) {
|
@@ -4526,6 +4515,7 @@ export class MezonApi {
|
|
4526
4515
|
const urlPath = "/v2/eventmanagement/{eventId}"
|
4527
4516
|
.replace("{eventId}", encodeURIComponent(String(eventId)));
|
4528
4517
|
const queryParams = new Map<string, any>();
|
4518
|
+
queryParams.set("clan_id", clanId);
|
4529
4519
|
|
4530
4520
|
let bodyJson : string = "";
|
4531
4521
|
|
@@ -4554,7 +4544,7 @@ export class MezonApi {
|
|
4554
4544
|
/** Update fields in a given event. */
|
4555
4545
|
updateEvent(bearerToken: string,
|
4556
4546
|
eventId:string,
|
4557
|
-
body:
|
4547
|
+
body:MezonUpdateEventBody,
|
4558
4548
|
options: any = {}): Promise<any> {
|
4559
4549
|
|
4560
4550
|
if (eventId === null || eventId === undefined) {
|
@@ -5270,38 +5260,6 @@ export class MezonApi {
|
|
5270
5260
|
]);
|
5271
5261
|
}
|
5272
5262
|
|
5273
|
-
/** notification category, channel selected */
|
5274
|
-
getChannelCategoryNotiSettingsList(bearerToken: string,
|
5275
|
-
clanId?:string,
|
5276
|
-
options: any = {}): Promise<ApiNotificationChannelCategoySettingsList> {
|
5277
|
-
|
5278
|
-
const urlPath = "/v2/notifichannelcategory/get";
|
5279
|
-
const queryParams = new Map<string, any>();
|
5280
|
-
queryParams.set("clan_id", clanId);
|
5281
|
-
|
5282
|
-
let bodyJson : string = "";
|
5283
|
-
|
5284
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5285
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
5286
|
-
if (bearerToken) {
|
5287
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5288
|
-
}
|
5289
|
-
|
5290
|
-
return Promise.race([
|
5291
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
5292
|
-
if (response.status == 204) {
|
5293
|
-
return response;
|
5294
|
-
} else if (response.status >= 200 && response.status < 300) {
|
5295
|
-
return response.json();
|
5296
|
-
} else {
|
5297
|
-
throw response;
|
5298
|
-
}
|
5299
|
-
}),
|
5300
|
-
new Promise((_, reject) =>
|
5301
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5302
|
-
),
|
5303
|
-
]);
|
5304
|
-
}
|
5305
5263
|
/** */
|
5306
5264
|
deleteNotiReactMessage(bearerToken: string,
|
5307
5265
|
channelId?:string,
|
package/client.ts
CHANGED
@@ -73,7 +73,6 @@ import {
|
|
73
73
|
ApiEventManagement,
|
74
74
|
ApiEventList,
|
75
75
|
ApiDeleteEventRequest,
|
76
|
-
ApiNotificationChannelCategoySettingsList,
|
77
76
|
ApiSetDefaultNotificationRequest,
|
78
77
|
ApiSetNotificationRequest,
|
79
78
|
ApiSetMuteNotificationRequest,
|
@@ -847,13 +846,13 @@ export class Client {
|
|
847
846
|
}
|
848
847
|
|
849
848
|
/** Delete a event by ID. */
|
850
|
-
async deleteEvent(session: Session,
|
849
|
+
async deleteEvent(session: Session, eventId: 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.deleteEvent(session.token,
|
855
|
+
return this.apiClient.deleteEvent(session.token, eventId, clanId).then((response: any) => {
|
857
856
|
return response !== undefined;
|
858
857
|
});
|
859
858
|
}
|
@@ -1991,17 +1990,6 @@ async deleteNotificationCategory(session: Session, category_id: string): Promise
|
|
1991
1990
|
});
|
1992
1991
|
}
|
1993
1992
|
|
1994
|
-
async getChannelCategoryNotiSettingsList(session: Session, clan_id: string): Promise<ApiNotificationChannelCategoySettingsList> {
|
1995
|
-
if (this.autoRefreshSession && session.refresh_token &&
|
1996
|
-
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
1997
|
-
await this.sessionRefresh(session);
|
1998
|
-
}
|
1999
|
-
|
2000
|
-
return this.apiClient.getChannelCategoryNotiSettingsList(session.token, clan_id).then((response: ApiNotificationChannelCategoySettingsList) => {
|
2001
|
-
return Promise.resolve(response);
|
2002
|
-
});
|
2003
|
-
}
|
2004
|
-
|
2005
1993
|
async deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean> {
|
2006
1994
|
if (this.autoRefreshSession && session.refresh_token &&
|
2007
1995
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
package/dist/api.gen.d.ts
CHANGED
@@ -84,6 +84,7 @@ export interface MezonUpdateClanStickerByIdBody {
|
|
84
84
|
export interface MezonUpdateEventBody {
|
85
85
|
address?: string;
|
86
86
|
channel_id?: string;
|
87
|
+
clan_id?: string;
|
87
88
|
description?: string;
|
88
89
|
end_time?: string;
|
89
90
|
logo?: string;
|
@@ -430,6 +431,7 @@ export interface ApiUpdateEventRequest {
|
|
430
431
|
logo?: string;
|
431
432
|
start_time?: string;
|
432
433
|
title?: string;
|
434
|
+
clan_id?: string;
|
433
435
|
}
|
434
436
|
/** Create a role within clan. */
|
435
437
|
export interface ApiCreateRoleRequest {
|
@@ -449,6 +451,7 @@ export interface ApiDeleteChannelDescRequest {
|
|
449
451
|
}
|
450
452
|
/** */
|
451
453
|
export interface ApiDeleteEventRequest {
|
454
|
+
clan_id?: string;
|
452
455
|
event_id?: string;
|
453
456
|
}
|
454
457
|
/** Delete a role the user has access to. */
|
@@ -639,17 +642,6 @@ export interface ApiNotification {
|
|
639
642
|
export interface ApiNotificationChannel {
|
640
643
|
channel_id?: string;
|
641
644
|
}
|
642
|
-
/** */
|
643
|
-
export interface ApiNotificationChannelCategoySetting {
|
644
|
-
channel_category_label?: string;
|
645
|
-
channel_category_title?: string;
|
646
|
-
id?: string;
|
647
|
-
notification_setting_type?: number;
|
648
|
-
}
|
649
|
-
/** */
|
650
|
-
export interface ApiNotificationChannelCategoySettingsList {
|
651
|
-
noti_channel_categoy_setting?: Array<ApiNotificationChannelCategoySetting>;
|
652
|
-
}
|
653
645
|
/** A collection of zero or more notifications. */
|
654
646
|
export interface ApiNotificationList {
|
655
647
|
cacheable_cursor?: string;
|
@@ -1137,9 +1129,9 @@ export declare class MezonApi {
|
|
1137
1129
|
/** Update fields in a given event. */
|
1138
1130
|
updateEventUser(bearerToken: string, body: ApiDeleteEventRequest, options?: any): Promise<any>;
|
1139
1131
|
/** Delete a event by ID. */
|
1140
|
-
deleteEvent(bearerToken: string, eventId: string, options?: any): Promise<any>;
|
1132
|
+
deleteEvent(bearerToken: string, eventId: string, clanId?: string, options?: any): Promise<any>;
|
1141
1133
|
/** Update fields in a given event. */
|
1142
|
-
updateEvent(bearerToken: string, eventId: string, body:
|
1134
|
+
updateEvent(bearerToken: string, eventId: string, body: MezonUpdateEventBody, options?: any): Promise<any>;
|
1143
1135
|
/** Delete one or more users by ID or username. */
|
1144
1136
|
deleteFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
|
1145
1137
|
/** List all friends for the current user. */
|
@@ -1178,8 +1170,6 @@ export declare class MezonApi {
|
|
1178
1170
|
deleteNotificationCategorySetting(bearerToken: string, categoryId?: string, options?: any): Promise<any>;
|
1179
1171
|
/** */
|
1180
1172
|
deleteNotificationChannel(bearerToken: string, channelId?: string, options?: any): Promise<any>;
|
1181
|
-
/** notification category, channel selected */
|
1182
|
-
getChannelCategoryNotiSettingsList(bearerToken: string, clanId?: string, options?: any): Promise<ApiNotificationChannelCategoySettingsList>;
|
1183
1173
|
/** */
|
1184
1174
|
deleteNotiReactMessage(bearerToken: string, channelId?: string, options?: any): Promise<any>;
|
1185
1175
|
/** */
|
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, 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,
|
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, 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 } 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 a role by ID. */
|
380
380
|
deleteRole(session: Session, roleId: string): Promise<boolean>;
|
381
381
|
/** Delete a event by ID. */
|
382
|
-
deleteEvent(session: Session,
|
382
|
+
deleteEvent(session: Session, eventId: string, clanId: string): Promise<boolean>;
|
383
383
|
/** update user a event by ID. */
|
384
384
|
updateEventUser(session: Session, request: ApiDeleteEventRequest): Promise<boolean>;
|
385
385
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
@@ -514,7 +514,6 @@ export declare class Client {
|
|
514
514
|
/** Set default notification category*/
|
515
515
|
setNotificationCategory(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
|
516
516
|
deleteNotificationCategory(session: Session, category_id: string): Promise<boolean>;
|
517
|
-
getChannelCategoryNotiSettingsList(session: Session, clan_id: string): Promise<ApiNotificationChannelCategoySettingsList>;
|
518
517
|
deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean>;
|
519
518
|
/** */
|
520
519
|
setNotificationReactMessage(session: Session, channel_id: string): Promise<boolean>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2855,12 +2855,13 @@ var MezonApi = class {
|
|
2855
2855
|
]);
|
2856
2856
|
}
|
2857
2857
|
/** Delete a event by ID. */
|
2858
|
-
deleteEvent(bearerToken, eventId, options = {}) {
|
2858
|
+
deleteEvent(bearerToken, eventId, clanId, options = {}) {
|
2859
2859
|
if (eventId === null || eventId === void 0) {
|
2860
2860
|
throw new Error("'eventId' is a required parameter but is null or undefined.");
|
2861
2861
|
}
|
2862
2862
|
const urlPath = "/v2/eventmanagement/{eventId}".replace("{eventId}", encodeURIComponent(String(eventId)));
|
2863
2863
|
const queryParams = /* @__PURE__ */ new Map();
|
2864
|
+
queryParams.set("clan_id", clanId);
|
2864
2865
|
let bodyJson = "";
|
2865
2866
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2866
2867
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -3447,32 +3448,6 @@ var MezonApi = class {
|
|
3447
3448
|
)
|
3448
3449
|
]);
|
3449
3450
|
}
|
3450
|
-
/** notification category, channel selected */
|
3451
|
-
getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
|
3452
|
-
const urlPath = "/v2/notifichannelcategory/get";
|
3453
|
-
const queryParams = /* @__PURE__ */ new Map();
|
3454
|
-
queryParams.set("clan_id", clanId);
|
3455
|
-
let bodyJson = "";
|
3456
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3457
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3458
|
-
if (bearerToken) {
|
3459
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3460
|
-
}
|
3461
|
-
return Promise.race([
|
3462
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3463
|
-
if (response.status == 204) {
|
3464
|
-
return response;
|
3465
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3466
|
-
return response.json();
|
3467
|
-
} else {
|
3468
|
-
throw response;
|
3469
|
-
}
|
3470
|
-
}),
|
3471
|
-
new Promise(
|
3472
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3473
|
-
)
|
3474
|
-
]);
|
3475
|
-
}
|
3476
3451
|
/** */
|
3477
3452
|
deleteNotiReactMessage(bearerToken, channelId, options = {}) {
|
3478
3453
|
const urlPath = "/v2/notifireactmessage/delete";
|
@@ -5166,6 +5141,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5166
5141
|
return response.notifi_react_message_event;
|
5167
5142
|
});
|
5168
5143
|
}
|
5144
|
+
getNotificationChannelCategorySetting(clan_id) {
|
5145
|
+
return __async(this, null, function* () {
|
5146
|
+
const response = yield this.send({ notification_channel_category_setting_event: { clan_id } });
|
5147
|
+
return response.notification_channel_category_setting_event;
|
5148
|
+
});
|
5149
|
+
}
|
5169
5150
|
pingPong() {
|
5170
5151
|
return __async(this, null, function* () {
|
5171
5152
|
if (!this.adapter.isOpen()) {
|
@@ -5556,12 +5537,12 @@ var Client = class {
|
|
5556
5537
|
});
|
5557
5538
|
}
|
5558
5539
|
/** Delete a event by ID. */
|
5559
|
-
deleteEvent(session,
|
5540
|
+
deleteEvent(session, eventId, clanId) {
|
5560
5541
|
return __async(this, null, function* () {
|
5561
5542
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5562
5543
|
yield this.sessionRefresh(session);
|
5563
5544
|
}
|
5564
|
-
return this.apiClient.deleteEvent(session.token,
|
5545
|
+
return this.apiClient.deleteEvent(session.token, eventId, clanId).then((response) => {
|
5565
5546
|
return response !== void 0;
|
5566
5547
|
});
|
5567
5548
|
});
|
@@ -6597,16 +6578,6 @@ var Client = class {
|
|
6597
6578
|
});
|
6598
6579
|
});
|
6599
6580
|
}
|
6600
|
-
getChannelCategoryNotiSettingsList(session, clan_id) {
|
6601
|
-
return __async(this, null, function* () {
|
6602
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6603
|
-
yield this.sessionRefresh(session);
|
6604
|
-
}
|
6605
|
-
return this.apiClient.getChannelCategoryNotiSettingsList(session.token, clan_id).then((response) => {
|
6606
|
-
return Promise.resolve(response);
|
6607
|
-
});
|
6608
|
-
});
|
6609
|
-
}
|
6610
6581
|
deleteNotificationChannel(session, channel_id) {
|
6611
6582
|
return __async(this, null, function* () {
|
6612
6583
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2826,12 +2826,13 @@ var MezonApi = class {
|
|
2826
2826
|
]);
|
2827
2827
|
}
|
2828
2828
|
/** Delete a event by ID. */
|
2829
|
-
deleteEvent(bearerToken, eventId, options = {}) {
|
2829
|
+
deleteEvent(bearerToken, eventId, clanId, options = {}) {
|
2830
2830
|
if (eventId === null || eventId === void 0) {
|
2831
2831
|
throw new Error("'eventId' is a required parameter but is null or undefined.");
|
2832
2832
|
}
|
2833
2833
|
const urlPath = "/v2/eventmanagement/{eventId}".replace("{eventId}", encodeURIComponent(String(eventId)));
|
2834
2834
|
const queryParams = /* @__PURE__ */ new Map();
|
2835
|
+
queryParams.set("clan_id", clanId);
|
2835
2836
|
let bodyJson = "";
|
2836
2837
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2837
2838
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -3418,32 +3419,6 @@ var MezonApi = class {
|
|
3418
3419
|
)
|
3419
3420
|
]);
|
3420
3421
|
}
|
3421
|
-
/** notification category, channel selected */
|
3422
|
-
getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
|
3423
|
-
const urlPath = "/v2/notifichannelcategory/get";
|
3424
|
-
const queryParams = /* @__PURE__ */ new Map();
|
3425
|
-
queryParams.set("clan_id", clanId);
|
3426
|
-
let bodyJson = "";
|
3427
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3428
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3429
|
-
if (bearerToken) {
|
3430
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3431
|
-
}
|
3432
|
-
return Promise.race([
|
3433
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3434
|
-
if (response.status == 204) {
|
3435
|
-
return response;
|
3436
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3437
|
-
return response.json();
|
3438
|
-
} else {
|
3439
|
-
throw response;
|
3440
|
-
}
|
3441
|
-
}),
|
3442
|
-
new Promise(
|
3443
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3444
|
-
)
|
3445
|
-
]);
|
3446
|
-
}
|
3447
3422
|
/** */
|
3448
3423
|
deleteNotiReactMessage(bearerToken, channelId, options = {}) {
|
3449
3424
|
const urlPath = "/v2/notifireactmessage/delete";
|
@@ -5137,6 +5112,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5137
5112
|
return response.notifi_react_message_event;
|
5138
5113
|
});
|
5139
5114
|
}
|
5115
|
+
getNotificationChannelCategorySetting(clan_id) {
|
5116
|
+
return __async(this, null, function* () {
|
5117
|
+
const response = yield this.send({ notification_channel_category_setting_event: { clan_id } });
|
5118
|
+
return response.notification_channel_category_setting_event;
|
5119
|
+
});
|
5120
|
+
}
|
5140
5121
|
pingPong() {
|
5141
5122
|
return __async(this, null, function* () {
|
5142
5123
|
if (!this.adapter.isOpen()) {
|
@@ -5527,12 +5508,12 @@ var Client = class {
|
|
5527
5508
|
});
|
5528
5509
|
}
|
5529
5510
|
/** Delete a event by ID. */
|
5530
|
-
deleteEvent(session,
|
5511
|
+
deleteEvent(session, eventId, clanId) {
|
5531
5512
|
return __async(this, null, function* () {
|
5532
5513
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5533
5514
|
yield this.sessionRefresh(session);
|
5534
5515
|
}
|
5535
|
-
return this.apiClient.deleteEvent(session.token,
|
5516
|
+
return this.apiClient.deleteEvent(session.token, eventId, clanId).then((response) => {
|
5536
5517
|
return response !== void 0;
|
5537
5518
|
});
|
5538
5519
|
});
|
@@ -6568,16 +6549,6 @@ var Client = class {
|
|
6568
6549
|
});
|
6569
6550
|
});
|
6570
6551
|
}
|
6571
|
-
getChannelCategoryNotiSettingsList(session, clan_id) {
|
6572
|
-
return __async(this, null, function* () {
|
6573
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6574
|
-
yield this.sessionRefresh(session);
|
6575
|
-
}
|
6576
|
-
return this.apiClient.getChannelCategoryNotiSettingsList(session.token, clan_id).then((response) => {
|
6577
|
-
return Promise.resolve(response);
|
6578
|
-
});
|
6579
|
-
});
|
6580
|
-
}
|
6581
6552
|
deleteNotificationChannel(session, channel_id) {
|
6582
6553
|
return __async(this, null, function* () {
|
6583
6554
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
package/dist/socket.d.ts
CHANGED
@@ -451,6 +451,16 @@ export interface NotifiReactMessage {
|
|
451
451
|
user_id?: string;
|
452
452
|
channel_id_req?: string;
|
453
453
|
}
|
454
|
+
export interface NotificationChannelCategorySetting {
|
455
|
+
id: string;
|
456
|
+
channel_category_label: string;
|
457
|
+
notification_setting_type: number;
|
458
|
+
channel_category_title: string;
|
459
|
+
}
|
460
|
+
export interface NotificationChannelCategorySettingEvent {
|
461
|
+
clan_id?: string;
|
462
|
+
notification_channel_category_settings_list?: NotificationChannelCategorySetting[];
|
463
|
+
}
|
454
464
|
/** A socket connection to Mezon server. */
|
455
465
|
export interface Socket {
|
456
466
|
/** Connection is Open */
|
@@ -552,6 +562,7 @@ export interface Socket {
|
|
552
562
|
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
553
563
|
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
554
564
|
GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
565
|
+
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
555
566
|
}
|
556
567
|
/** Reports an error received from a socket message. */
|
557
568
|
export interface SocketError {
|
@@ -637,6 +648,7 @@ export declare class DefaultSocket implements Socket {
|
|
637
648
|
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
638
649
|
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
639
650
|
getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent>;
|
651
|
+
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
640
652
|
private pingPong;
|
641
653
|
}
|
642
654
|
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mezon-js",
|
3
|
-
"version": "2.8.
|
3
|
+
"version": "2.8.46",
|
4
4
|
"scripts": {
|
5
5
|
"build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
|
6
6
|
},
|
@@ -38,6 +38,7 @@
|
|
38
38
|
"base64-arraybuffer": "^1.0.2",
|
39
39
|
"esbuild": "^0.19.11",
|
40
40
|
"js-base64": "^3.7.4",
|
41
|
+
"mezon-js": "file:",
|
41
42
|
"whatwg-fetch": "^3.6.2"
|
42
43
|
},
|
43
44
|
"devDependencies": {
|
package/socket.ts
CHANGED
@@ -664,6 +664,23 @@ export interface NotifiReactMessage {
|
|
664
664
|
channel_id_req?: string;
|
665
665
|
}
|
666
666
|
|
667
|
+
export interface NotificationChannelCategorySetting {
|
668
|
+
// Notification id
|
669
|
+
id: string;
|
670
|
+
//
|
671
|
+
channel_category_label :string;
|
672
|
+
// Notification title
|
673
|
+
notification_setting_type :number;
|
674
|
+
//
|
675
|
+
channel_category_title : string;
|
676
|
+
}
|
677
|
+
|
678
|
+
export interface NotificationChannelCategorySettingEvent {
|
679
|
+
clan_id? : string;
|
680
|
+
notification_channel_category_settings_list?: NotificationChannelCategorySetting[]
|
681
|
+
}
|
682
|
+
|
683
|
+
|
667
684
|
/** A socket connection to Mezon server. */
|
668
685
|
export interface Socket {
|
669
686
|
/** Connection is Open */
|
@@ -833,6 +850,8 @@ export interface Socket {
|
|
833
850
|
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
834
851
|
|
835
852
|
GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
853
|
+
|
854
|
+
getNotificationChannelCategorySetting(clan_id : string): Promise<NotificationChannelCategorySettingEvent>;
|
836
855
|
}
|
837
856
|
|
838
857
|
/** Reports an error received from a socket message. */
|
@@ -1420,6 +1439,12 @@ export class DefaultSocket implements Socket {
|
|
1420
1439
|
return response.notifi_react_message_event
|
1421
1440
|
}
|
1422
1441
|
|
1442
|
+
async getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent> {
|
1443
|
+
const response = await this.send({notification_channel_category_setting_event: {clan_id : clan_id}})
|
1444
|
+
return response.notification_channel_category_setting_event
|
1445
|
+
}
|
1446
|
+
|
1447
|
+
|
1423
1448
|
private async pingPong(): Promise<void> {
|
1424
1449
|
if (!this.adapter.isOpen()) {
|
1425
1450
|
return;
|