mezon-js 2.12.61 → 2.12.63
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 +37 -0
- package/client.ts +21 -0
- package/dist/api.gen.d.ts +3 -0
- package/dist/client.d.ts +2 -0
- package/dist/mezon-js.cjs.js +45 -0
- package/dist/mezon-js.esm.mjs +45 -0
- package/dist/socket.d.ts +5 -0
- package/package.json +1 -1
- package/socket.ts +15 -0
package/api.gen.ts
CHANGED
@@ -2840,6 +2840,8 @@ export interface ApiWebhook {
|
|
2840
2840
|
url?: string;
|
2841
2841
|
//
|
2842
2842
|
webhook_name?: string;
|
2843
|
+
//
|
2844
|
+
clan_id?: string;
|
2843
2845
|
}
|
2844
2846
|
|
2845
2847
|
/** */
|
@@ -6531,6 +6533,41 @@ export class MezonApi {
|
|
6531
6533
|
]);
|
6532
6534
|
}
|
6533
6535
|
|
6536
|
+
/** Block one or more users by ID or username. */
|
6537
|
+
unblockFriends(bearerToken: string,
|
6538
|
+
ids?:Array<string>,
|
6539
|
+
usernames?:Array<string>,
|
6540
|
+
options: any = {}): Promise<any> {
|
6541
|
+
|
6542
|
+
const urlPath = "/v2/friend/unblock";
|
6543
|
+
const queryParams = new Map<string, any>();
|
6544
|
+
queryParams.set("ids", ids);
|
6545
|
+
queryParams.set("usernames", usernames);
|
6546
|
+
|
6547
|
+
let bodyJson : string = "";
|
6548
|
+
|
6549
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6550
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6551
|
+
if (bearerToken) {
|
6552
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6553
|
+
}
|
6554
|
+
|
6555
|
+
return Promise.race([
|
6556
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6557
|
+
if (response.status == 204) {
|
6558
|
+
return response;
|
6559
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6560
|
+
return response.json();
|
6561
|
+
} else {
|
6562
|
+
throw response;
|
6563
|
+
}
|
6564
|
+
}),
|
6565
|
+
new Promise((_, reject) =>
|
6566
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6567
|
+
),
|
6568
|
+
]);
|
6569
|
+
}
|
6570
|
+
|
6534
6571
|
/** List GetChannelCategoryNotiSettingsList */
|
6535
6572
|
getChannelCategoryNotiSettingsList(
|
6536
6573
|
bearerToken: string,
|
package/client.ts
CHANGED
@@ -722,6 +722,27 @@ export class Client {
|
|
722
722
|
});
|
723
723
|
}
|
724
724
|
|
725
|
+
/** Block one or more users by ID or username. */
|
726
|
+
async unblockFriends(
|
727
|
+
session: Session,
|
728
|
+
ids?: Array<string>,
|
729
|
+
usernames?: Array<string>
|
730
|
+
): Promise<boolean> {
|
731
|
+
if (
|
732
|
+
this.autoRefreshSession &&
|
733
|
+
session.refresh_token &&
|
734
|
+
session.isexpired(Date.now() / 1000)
|
735
|
+
) {
|
736
|
+
await this.sessionRefresh(session);
|
737
|
+
}
|
738
|
+
|
739
|
+
return this.apiClient
|
740
|
+
.unblockFriends(session.token, ids, usernames)
|
741
|
+
.then((response: any) => {
|
742
|
+
return Promise.resolve(response != undefined);
|
743
|
+
});
|
744
|
+
}
|
745
|
+
|
725
746
|
/** Create a new group with the current user as the creator and superadmin. */
|
726
747
|
async uploadAttachmentFile(
|
727
748
|
session: Session,
|
package/dist/api.gen.d.ts
CHANGED
@@ -1624,6 +1624,7 @@ export interface ApiWebhook {
|
|
1624
1624
|
update_time?: string;
|
1625
1625
|
url?: string;
|
1626
1626
|
webhook_name?: string;
|
1627
|
+
clan_id?: string;
|
1627
1628
|
}
|
1628
1629
|
/** */
|
1629
1630
|
export interface ApiWebhookCreateRequest {
|
@@ -2064,6 +2065,8 @@ export declare class MezonApi {
|
|
2064
2065
|
addFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
|
2065
2066
|
/** Block one or more users by ID or username. */
|
2066
2067
|
blockFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
|
2068
|
+
/** Block one or more users by ID or username. */
|
2069
|
+
unblockFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
|
2067
2070
|
/** List GetChannelCategoryNotiSettingsList */
|
2068
2071
|
getChannelCategoryNotiSettingsList(bearerToken: string, clanId?: string, options?: any): Promise<ApiNotificationChannelCategorySettingList>;
|
2069
2072
|
/** */
|
package/dist/client.d.ts
CHANGED
@@ -355,6 +355,8 @@ export declare class Client {
|
|
355
355
|
addFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
356
356
|
/** Block one or more users by ID or username. */
|
357
357
|
blockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
358
|
+
/** Block one or more users by ID or username. */
|
359
|
+
unblockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
358
360
|
/** Create a new group with the current user as the creator and superadmin. */
|
359
361
|
uploadAttachmentFile(session: Session, request: ApiUploadAttachmentRequest): Promise<ApiUploadAttachment>;
|
360
362
|
/** Create a channel within clan */
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -3242,6 +3242,33 @@ var MezonApi = class {
|
|
3242
3242
|
)
|
3243
3243
|
]);
|
3244
3244
|
}
|
3245
|
+
/** Block one or more users by ID or username. */
|
3246
|
+
unblockFriends(bearerToken, ids, usernames, options = {}) {
|
3247
|
+
const urlPath = "/v2/friend/unblock";
|
3248
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3249
|
+
queryParams.set("ids", ids);
|
3250
|
+
queryParams.set("usernames", usernames);
|
3251
|
+
let bodyJson = "";
|
3252
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3253
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3254
|
+
if (bearerToken) {
|
3255
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3256
|
+
}
|
3257
|
+
return Promise.race([
|
3258
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3259
|
+
if (response.status == 204) {
|
3260
|
+
return response;
|
3261
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3262
|
+
return response.json();
|
3263
|
+
} else {
|
3264
|
+
throw response;
|
3265
|
+
}
|
3266
|
+
}),
|
3267
|
+
new Promise(
|
3268
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3269
|
+
)
|
3270
|
+
]);
|
3271
|
+
}
|
3245
3272
|
/** List GetChannelCategoryNotiSettingsList */
|
3246
3273
|
getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
|
3247
3274
|
const urlPath = "/v2/getchannelcategorynotisettingslist";
|
@@ -7230,6 +7257,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7230
7257
|
);
|
7231
7258
|
} else if (message.block_friend) {
|
7232
7259
|
this.onblockfriend(message.block_friend);
|
7260
|
+
} else if (message.un_block_friend) {
|
7261
|
+
this.onblockfriend(message.block_friend);
|
7233
7262
|
} else if (message.remove_friend) {
|
7234
7263
|
this.onremovefriend(message.remove_friend);
|
7235
7264
|
} else if (message.user_clan_removed_event) {
|
@@ -7414,6 +7443,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7414
7443
|
console.log(user);
|
7415
7444
|
}
|
7416
7445
|
}
|
7446
|
+
onunblockfriend(user) {
|
7447
|
+
if (this.verbose && window && window.console) {
|
7448
|
+
console.log(user);
|
7449
|
+
}
|
7450
|
+
}
|
7417
7451
|
onuserclanremoved(user) {
|
7418
7452
|
if (this.verbose && window && window.console) {
|
7419
7453
|
console.log(user);
|
@@ -8258,6 +8292,17 @@ var Client = class {
|
|
8258
8292
|
});
|
8259
8293
|
});
|
8260
8294
|
}
|
8295
|
+
/** Block one or more users by ID or username. */
|
8296
|
+
unblockFriends(session, ids, usernames) {
|
8297
|
+
return __async(this, null, function* () {
|
8298
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8299
|
+
yield this.sessionRefresh(session);
|
8300
|
+
}
|
8301
|
+
return this.apiClient.unblockFriends(session.token, ids, usernames).then((response) => {
|
8302
|
+
return Promise.resolve(response != void 0);
|
8303
|
+
});
|
8304
|
+
});
|
8305
|
+
}
|
8261
8306
|
/** Create a new group with the current user as the creator and superadmin. */
|
8262
8307
|
uploadAttachmentFile(session, request) {
|
8263
8308
|
return __async(this, null, function* () {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -3208,6 +3208,33 @@ var MezonApi = class {
|
|
3208
3208
|
)
|
3209
3209
|
]);
|
3210
3210
|
}
|
3211
|
+
/** Block one or more users by ID or username. */
|
3212
|
+
unblockFriends(bearerToken, ids, usernames, options = {}) {
|
3213
|
+
const urlPath = "/v2/friend/unblock";
|
3214
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3215
|
+
queryParams.set("ids", ids);
|
3216
|
+
queryParams.set("usernames", usernames);
|
3217
|
+
let bodyJson = "";
|
3218
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3219
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3220
|
+
if (bearerToken) {
|
3221
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3222
|
+
}
|
3223
|
+
return Promise.race([
|
3224
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3225
|
+
if (response.status == 204) {
|
3226
|
+
return response;
|
3227
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3228
|
+
return response.json();
|
3229
|
+
} else {
|
3230
|
+
throw response;
|
3231
|
+
}
|
3232
|
+
}),
|
3233
|
+
new Promise(
|
3234
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3235
|
+
)
|
3236
|
+
]);
|
3237
|
+
}
|
3211
3238
|
/** List GetChannelCategoryNotiSettingsList */
|
3212
3239
|
getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
|
3213
3240
|
const urlPath = "/v2/getchannelcategorynotisettingslist";
|
@@ -7196,6 +7223,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7196
7223
|
);
|
7197
7224
|
} else if (message.block_friend) {
|
7198
7225
|
this.onblockfriend(message.block_friend);
|
7226
|
+
} else if (message.un_block_friend) {
|
7227
|
+
this.onblockfriend(message.block_friend);
|
7199
7228
|
} else if (message.remove_friend) {
|
7200
7229
|
this.onremovefriend(message.remove_friend);
|
7201
7230
|
} else if (message.user_clan_removed_event) {
|
@@ -7380,6 +7409,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7380
7409
|
console.log(user);
|
7381
7410
|
}
|
7382
7411
|
}
|
7412
|
+
onunblockfriend(user) {
|
7413
|
+
if (this.verbose && window && window.console) {
|
7414
|
+
console.log(user);
|
7415
|
+
}
|
7416
|
+
}
|
7383
7417
|
onuserclanremoved(user) {
|
7384
7418
|
if (this.verbose && window && window.console) {
|
7385
7419
|
console.log(user);
|
@@ -8224,6 +8258,17 @@ var Client = class {
|
|
8224
8258
|
});
|
8225
8259
|
});
|
8226
8260
|
}
|
8261
|
+
/** Block one or more users by ID or username. */
|
8262
|
+
unblockFriends(session, ids, usernames) {
|
8263
|
+
return __async(this, null, function* () {
|
8264
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
8265
|
+
yield this.sessionRefresh(session);
|
8266
|
+
}
|
8267
|
+
return this.apiClient.unblockFriends(session.token, ids, usernames).then((response) => {
|
8268
|
+
return Promise.resolve(response != void 0);
|
8269
|
+
});
|
8270
|
+
});
|
8271
|
+
}
|
8227
8272
|
/** Create a new group with the current user as the creator and superadmin. */
|
8228
8273
|
uploadAttachmentFile(session, request) {
|
8229
8274
|
return __async(this, null, function* () {
|
package/dist/socket.d.ts
CHANGED
@@ -642,6 +642,9 @@ export interface RemoveFriend {
|
|
642
642
|
export interface BlockFriend {
|
643
643
|
user_id: string;
|
644
644
|
}
|
645
|
+
export interface UnblockFriend {
|
646
|
+
user_id: string;
|
647
|
+
}
|
645
648
|
export interface AddUserEmojiUsageEvent {
|
646
649
|
emoji_id: string;
|
647
650
|
clan_id: string;
|
@@ -971,6 +974,7 @@ export interface Socket {
|
|
971
974
|
onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
|
972
975
|
onremovefriend: (user: RemoveFriend) => void;
|
973
976
|
onblockfriend: (user: BlockFriend) => void;
|
977
|
+
onunblockfriend: (user: UnblockFriend) => void;
|
974
978
|
/** Receive clan removed user event */
|
975
979
|
onuserclanremoved: (user: UserClanRemovedEvent) => void;
|
976
980
|
onvoicestarted: (voice: VoiceStartedEvent) => void;
|
@@ -1057,6 +1061,7 @@ export declare class DefaultSocket implements Socket {
|
|
1057
1061
|
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
1058
1062
|
onremovefriend(user: RemoveFriend): void;
|
1059
1063
|
onblockfriend(user: BlockFriend): void;
|
1064
|
+
onunblockfriend(user: UnblockFriend): void;
|
1060
1065
|
onuserclanremoved(user: UserClanRemovedEvent): void;
|
1061
1066
|
onnotification(notification: ApiNotification): void;
|
1062
1067
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -994,6 +994,11 @@ export interface BlockFriend {
|
|
994
994
|
user_id: string;
|
995
995
|
}
|
996
996
|
|
997
|
+
export interface UnblockFriend {
|
998
|
+
//
|
999
|
+
user_id: string;
|
1000
|
+
}
|
1001
|
+
|
997
1002
|
export interface AddUserEmojiUsageEvent {
|
998
1003
|
emoji_id: string;
|
999
1004
|
clan_id: string;
|
@@ -1654,6 +1659,8 @@ export interface Socket {
|
|
1654
1659
|
|
1655
1660
|
onblockfriend: (user: BlockFriend) => void;
|
1656
1661
|
|
1662
|
+
onunblockfriend: (user: UnblockFriend) => void;
|
1663
|
+
|
1657
1664
|
/** Receive clan removed user event */
|
1658
1665
|
onuserclanremoved: (user: UserClanRemovedEvent) => void;
|
1659
1666
|
|
@@ -1937,6 +1944,8 @@ export class DefaultSocket implements Socket {
|
|
1937
1944
|
);
|
1938
1945
|
} else if (message.block_friend) {
|
1939
1946
|
this.onblockfriend(<BlockFriend>message.block_friend);
|
1947
|
+
} else if (message.un_block_friend) {
|
1948
|
+
this.onblockfriend(<BlockFriend>message.block_friend);
|
1940
1949
|
} else if (message.remove_friend) {
|
1941
1950
|
this.onremovefriend(<RemoveFriend>message.remove_friend);
|
1942
1951
|
} else if (message.user_clan_removed_event) {
|
@@ -2142,6 +2151,12 @@ export class DefaultSocket implements Socket {
|
|
2142
2151
|
}
|
2143
2152
|
}
|
2144
2153
|
|
2154
|
+
onunblockfriend(user: UnblockFriend) {
|
2155
|
+
if (this.verbose && window && window.console) {
|
2156
|
+
console.log(user);
|
2157
|
+
}
|
2158
|
+
}
|
2159
|
+
|
2145
2160
|
onuserclanremoved(user: UserClanRemovedEvent) {
|
2146
2161
|
if (this.verbose && window && window.console) {
|
2147
2162
|
console.log(user);
|