mezon-js 2.13.24 → 2.13.25
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 +86 -0
- package/client.ts +47 -1
- package/dist/api.gen.d.ts +5 -0
- package/dist/client.d.ts +4 -0
- package/dist/mezon-js.cjs.js +93 -1
- package/dist/mezon-js.esm.mjs +93 -1
- package/dist/socket.d.ts +7 -0
- package/package.json +1 -1
- package/socket.ts +16 -0
package/api.gen.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface ChannelUserListChannelUser {
|
|
|
22
22
|
user_id?: string;
|
|
23
23
|
//Added by
|
|
24
24
|
added_by?: string;
|
|
25
|
+
// is banned
|
|
26
|
+
is_banned?: boolean;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
/** A single user-role pair. */
|
|
@@ -5761,6 +5763,90 @@ export class MezonApi {
|
|
|
5761
5763
|
]);
|
|
5762
5764
|
}
|
|
5763
5765
|
|
|
5766
|
+
/** Ban a set of users from a channel. */
|
|
5767
|
+
unbanClanUsers(bearerToken: string,
|
|
5768
|
+
clanId:string,
|
|
5769
|
+
channelId?:string,
|
|
5770
|
+
userIds?:Array<string>,
|
|
5771
|
+
banTime?:number,
|
|
5772
|
+
options: any = {}): Promise<any> {
|
|
5773
|
+
|
|
5774
|
+
if (clanId === null || clanId === undefined) {
|
|
5775
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
5776
|
+
}
|
|
5777
|
+
const urlPath = "/v2/clandesc/{clanId}/unban"
|
|
5778
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
5779
|
+
const queryParams = new Map<string, any>();
|
|
5780
|
+
queryParams.set("channel_id", channelId);
|
|
5781
|
+
queryParams.set("user_ids", userIds);
|
|
5782
|
+
queryParams.set("ban_time", banTime);
|
|
5783
|
+
|
|
5784
|
+
let bodyJson : string = "";
|
|
5785
|
+
|
|
5786
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5787
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
5788
|
+
if (bearerToken) {
|
|
5789
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5792
|
+
return Promise.race([
|
|
5793
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5794
|
+
if (response.status == 204) {
|
|
5795
|
+
return response;
|
|
5796
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5797
|
+
return response.json();
|
|
5798
|
+
} else {
|
|
5799
|
+
throw response;
|
|
5800
|
+
}
|
|
5801
|
+
}),
|
|
5802
|
+
new Promise((_, reject) =>
|
|
5803
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5804
|
+
),
|
|
5805
|
+
]);
|
|
5806
|
+
}
|
|
5807
|
+
|
|
5808
|
+
/** Ban a set of users from a channel. */
|
|
5809
|
+
banClanUsers(bearerToken: string,
|
|
5810
|
+
clanId:string,
|
|
5811
|
+
channelId?:string,
|
|
5812
|
+
userIds?:Array<string>,
|
|
5813
|
+
banTime?:number,
|
|
5814
|
+
options: any = {}): Promise<any> {
|
|
5815
|
+
|
|
5816
|
+
if (clanId === null || clanId === undefined) {
|
|
5817
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
5818
|
+
}
|
|
5819
|
+
const urlPath = "/v2/clandesc/{clanId}/ban"
|
|
5820
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
5821
|
+
const queryParams = new Map<string, any>();
|
|
5822
|
+
queryParams.set("channel_id", channelId);
|
|
5823
|
+
queryParams.set("user_ids", userIds);
|
|
5824
|
+
queryParams.set("ban_time", banTime);
|
|
5825
|
+
|
|
5826
|
+
let bodyJson : string = "";
|
|
5827
|
+
|
|
5828
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5829
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
5830
|
+
if (bearerToken) {
|
|
5831
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5832
|
+
}
|
|
5833
|
+
|
|
5834
|
+
return Promise.race([
|
|
5835
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5836
|
+
if (response.status == 204) {
|
|
5837
|
+
return response;
|
|
5838
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5839
|
+
return response.json();
|
|
5840
|
+
} else {
|
|
5841
|
+
throw response;
|
|
5842
|
+
}
|
|
5843
|
+
}),
|
|
5844
|
+
new Promise((_, reject) =>
|
|
5845
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5846
|
+
),
|
|
5847
|
+
]);
|
|
5848
|
+
}
|
|
5849
|
+
|
|
5764
5850
|
/** List all users that are part of a clan. */
|
|
5765
5851
|
listClanUsers(
|
|
5766
5852
|
bearerToken: string,
|
package/client.ts
CHANGED
|
@@ -1128,6 +1128,51 @@ export class Client {
|
|
|
1128
1128
|
});
|
|
1129
1129
|
}
|
|
1130
1130
|
|
|
1131
|
+
/** Ban a set of users from a clan. */
|
|
1132
|
+
async unbanClanUsers(
|
|
1133
|
+
session: Session,
|
|
1134
|
+
clanId:string,
|
|
1135
|
+
channelId?:string,
|
|
1136
|
+
userIds?:Array<string>
|
|
1137
|
+
): Promise<boolean> {
|
|
1138
|
+
if (
|
|
1139
|
+
this.autoRefreshSession &&
|
|
1140
|
+
session.refresh_token &&
|
|
1141
|
+
session.isexpired(Date.now() / 1000)
|
|
1142
|
+
) {
|
|
1143
|
+
await this.sessionRefresh(session);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
return this.apiClient
|
|
1147
|
+
.unbanClanUsers(session.token, clanId, channelId, userIds)
|
|
1148
|
+
.then((response: any) => {
|
|
1149
|
+
return Promise.resolve(response != undefined);
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/** Ban a set of users from a clan. */
|
|
1154
|
+
async banClanUsers(
|
|
1155
|
+
session: Session,
|
|
1156
|
+
clanId:string,
|
|
1157
|
+
channelId?:string,
|
|
1158
|
+
userIds?:Array<string>,
|
|
1159
|
+
banTime?:number
|
|
1160
|
+
): Promise<boolean> {
|
|
1161
|
+
if (
|
|
1162
|
+
this.autoRefreshSession &&
|
|
1163
|
+
session.refresh_token &&
|
|
1164
|
+
session.isexpired(Date.now() / 1000)
|
|
1165
|
+
) {
|
|
1166
|
+
await this.sessionRefresh(session);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
return this.apiClient
|
|
1170
|
+
.banClanUsers(session.token, clanId, channelId, userIds, banTime)
|
|
1171
|
+
.then((response: any) => {
|
|
1172
|
+
return Promise.resolve(response != undefined);
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1131
1176
|
/** Kick users from a channel, or decline their join requests. */
|
|
1132
1177
|
async removeChannelUsers(
|
|
1133
1178
|
session: Session,
|
|
@@ -1341,7 +1386,8 @@ export class Client {
|
|
|
1341
1386
|
clan_nick: gu.clan_nick,
|
|
1342
1387
|
id: gu.id,
|
|
1343
1388
|
clan_id: gu.clan_id,
|
|
1344
|
-
added_by: gu.added_by
|
|
1389
|
+
added_by: gu.added_by,
|
|
1390
|
+
is_banned: gu.is_banned
|
|
1345
1391
|
});
|
|
1346
1392
|
});
|
|
1347
1393
|
return Promise.resolve(result);
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface ChannelUserListChannelUser {
|
|
|
8
8
|
thread_id?: string;
|
|
9
9
|
user_id?: string;
|
|
10
10
|
added_by?: string;
|
|
11
|
+
is_banned?: boolean;
|
|
11
12
|
}
|
|
12
13
|
/** A single user-role pair. */
|
|
13
14
|
export interface ClanUserListClanUser {
|
|
@@ -2081,6 +2082,10 @@ export declare class MezonApi {
|
|
|
2081
2082
|
updateClanDesc(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
|
|
2082
2083
|
/** Kick a set of users from a clan. */
|
|
2083
2084
|
removeClanUsers(bearerToken: string, clanId: string, userIds?: Array<string>, options?: any): Promise<any>;
|
|
2085
|
+
/** Ban a set of users from a channel. */
|
|
2086
|
+
unbanClanUsers(bearerToken: string, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number, options?: any): Promise<any>;
|
|
2087
|
+
/** Ban a set of users from a channel. */
|
|
2088
|
+
banClanUsers(bearerToken: string, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number, options?: any): Promise<any>;
|
|
2084
2089
|
/** List all users that are part of a clan. */
|
|
2085
2090
|
listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
|
|
2086
2091
|
/** check duplicate clan name */
|
package/dist/client.d.ts
CHANGED
|
@@ -300,6 +300,10 @@ export declare class Client {
|
|
|
300
300
|
getAccount(session: Session): Promise<ApiAccount>;
|
|
301
301
|
/** Kick a set of users from a clan. */
|
|
302
302
|
removeClanUsers(session: Session, clanId: string, ids?: Array<string>): Promise<boolean>;
|
|
303
|
+
/** Ban a set of users from a clan. */
|
|
304
|
+
unbanClanUsers(session: Session, clanId: string, channelId?: string, userIds?: Array<string>): Promise<boolean>;
|
|
305
|
+
/** Ban a set of users from a clan. */
|
|
306
|
+
banClanUsers(session: Session, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number): Promise<boolean>;
|
|
303
307
|
/** Kick users from a channel, or decline their join requests. */
|
|
304
308
|
removeChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean>;
|
|
305
309
|
/** List a channel's message history. */
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -2549,6 +2549,68 @@ var MezonApi = class {
|
|
|
2549
2549
|
)
|
|
2550
2550
|
]);
|
|
2551
2551
|
}
|
|
2552
|
+
/** Ban a set of users from a channel. */
|
|
2553
|
+
unbanClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2554
|
+
if (clanId === null || clanId === void 0) {
|
|
2555
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2556
|
+
}
|
|
2557
|
+
const urlPath = "/v2/clandesc/{clanId}/unban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2558
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2559
|
+
queryParams.set("channel_id", channelId);
|
|
2560
|
+
queryParams.set("user_ids", userIds);
|
|
2561
|
+
queryParams.set("ban_time", banTime);
|
|
2562
|
+
let bodyJson = "";
|
|
2563
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2564
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2565
|
+
if (bearerToken) {
|
|
2566
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2567
|
+
}
|
|
2568
|
+
return Promise.race([
|
|
2569
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2570
|
+
if (response.status == 204) {
|
|
2571
|
+
return response;
|
|
2572
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2573
|
+
return response.json();
|
|
2574
|
+
} else {
|
|
2575
|
+
throw response;
|
|
2576
|
+
}
|
|
2577
|
+
}),
|
|
2578
|
+
new Promise(
|
|
2579
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2580
|
+
)
|
|
2581
|
+
]);
|
|
2582
|
+
}
|
|
2583
|
+
/** Ban a set of users from a channel. */
|
|
2584
|
+
banClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2585
|
+
if (clanId === null || clanId === void 0) {
|
|
2586
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2587
|
+
}
|
|
2588
|
+
const urlPath = "/v2/clandesc/{clanId}/ban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2589
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2590
|
+
queryParams.set("channel_id", channelId);
|
|
2591
|
+
queryParams.set("user_ids", userIds);
|
|
2592
|
+
queryParams.set("ban_time", banTime);
|
|
2593
|
+
let bodyJson = "";
|
|
2594
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2595
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2596
|
+
if (bearerToken) {
|
|
2597
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2598
|
+
}
|
|
2599
|
+
return Promise.race([
|
|
2600
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2601
|
+
if (response.status == 204) {
|
|
2602
|
+
return response;
|
|
2603
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2604
|
+
return response.json();
|
|
2605
|
+
} else {
|
|
2606
|
+
throw response;
|
|
2607
|
+
}
|
|
2608
|
+
}),
|
|
2609
|
+
new Promise(
|
|
2610
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2611
|
+
)
|
|
2612
|
+
]);
|
|
2613
|
+
}
|
|
2552
2614
|
/** List all users that are part of a clan. */
|
|
2553
2615
|
listClanUsers(bearerToken, clanId, options = {}) {
|
|
2554
2616
|
if (clanId === null || clanId === void 0) {
|
|
@@ -7534,6 +7596,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7534
7596
|
this.onmeetparticipantevent(message.meet_participant_event);
|
|
7535
7597
|
} else if (message.transfer_ownership_event) {
|
|
7536
7598
|
this.ontransferownership(message.transfer_ownership_event);
|
|
7599
|
+
} else if (message.ban_user_event) {
|
|
7600
|
+
this.onbanneduser(message.ban_user_event);
|
|
7537
7601
|
} else {
|
|
7538
7602
|
if (this.verbose && window && window.console) {
|
|
7539
7603
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -7921,6 +7985,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7921
7985
|
console.log(event);
|
|
7922
7986
|
}
|
|
7923
7987
|
}
|
|
7988
|
+
onbanneduser(event) {
|
|
7989
|
+
if (this.verbose && window && window.console) {
|
|
7990
|
+
console.log(event);
|
|
7991
|
+
}
|
|
7992
|
+
}
|
|
7924
7993
|
onmeetparticipantevent(event) {
|
|
7925
7994
|
if (this.verbose && window && window.console) {
|
|
7926
7995
|
console.log(event);
|
|
@@ -8809,6 +8878,28 @@ var Client = class {
|
|
|
8809
8878
|
});
|
|
8810
8879
|
});
|
|
8811
8880
|
}
|
|
8881
|
+
/** Ban a set of users from a clan. */
|
|
8882
|
+
unbanClanUsers(session, clanId, channelId, userIds) {
|
|
8883
|
+
return __async(this, null, function* () {
|
|
8884
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8885
|
+
yield this.sessionRefresh(session);
|
|
8886
|
+
}
|
|
8887
|
+
return this.apiClient.unbanClanUsers(session.token, clanId, channelId, userIds).then((response) => {
|
|
8888
|
+
return Promise.resolve(response != void 0);
|
|
8889
|
+
});
|
|
8890
|
+
});
|
|
8891
|
+
}
|
|
8892
|
+
/** Ban a set of users from a clan. */
|
|
8893
|
+
banClanUsers(session, clanId, channelId, userIds, banTime) {
|
|
8894
|
+
return __async(this, null, function* () {
|
|
8895
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8896
|
+
yield this.sessionRefresh(session);
|
|
8897
|
+
}
|
|
8898
|
+
return this.apiClient.banClanUsers(session.token, clanId, channelId, userIds, banTime).then((response) => {
|
|
8899
|
+
return Promise.resolve(response != void 0);
|
|
8900
|
+
});
|
|
8901
|
+
});
|
|
8902
|
+
}
|
|
8812
8903
|
/** Kick users from a channel, or decline their join requests. */
|
|
8813
8904
|
removeChannelUsers(session, channelId, ids) {
|
|
8814
8905
|
return __async(this, null, function* () {
|
|
@@ -8965,7 +9056,8 @@ var Client = class {
|
|
|
8965
9056
|
clan_nick: gu.clan_nick,
|
|
8966
9057
|
id: gu.id,
|
|
8967
9058
|
clan_id: gu.clan_id,
|
|
8968
|
-
added_by: gu.added_by
|
|
9059
|
+
added_by: gu.added_by,
|
|
9060
|
+
is_banned: gu.is_banned
|
|
8969
9061
|
});
|
|
8970
9062
|
});
|
|
8971
9063
|
return Promise.resolve(result);
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -2515,6 +2515,68 @@ var MezonApi = class {
|
|
|
2515
2515
|
)
|
|
2516
2516
|
]);
|
|
2517
2517
|
}
|
|
2518
|
+
/** Ban a set of users from a channel. */
|
|
2519
|
+
unbanClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2520
|
+
if (clanId === null || clanId === void 0) {
|
|
2521
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2522
|
+
}
|
|
2523
|
+
const urlPath = "/v2/clandesc/{clanId}/unban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2524
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2525
|
+
queryParams.set("channel_id", channelId);
|
|
2526
|
+
queryParams.set("user_ids", userIds);
|
|
2527
|
+
queryParams.set("ban_time", banTime);
|
|
2528
|
+
let bodyJson = "";
|
|
2529
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2530
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2531
|
+
if (bearerToken) {
|
|
2532
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2533
|
+
}
|
|
2534
|
+
return Promise.race([
|
|
2535
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2536
|
+
if (response.status == 204) {
|
|
2537
|
+
return response;
|
|
2538
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2539
|
+
return response.json();
|
|
2540
|
+
} else {
|
|
2541
|
+
throw response;
|
|
2542
|
+
}
|
|
2543
|
+
}),
|
|
2544
|
+
new Promise(
|
|
2545
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2546
|
+
)
|
|
2547
|
+
]);
|
|
2548
|
+
}
|
|
2549
|
+
/** Ban a set of users from a channel. */
|
|
2550
|
+
banClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2551
|
+
if (clanId === null || clanId === void 0) {
|
|
2552
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2553
|
+
}
|
|
2554
|
+
const urlPath = "/v2/clandesc/{clanId}/ban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2555
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2556
|
+
queryParams.set("channel_id", channelId);
|
|
2557
|
+
queryParams.set("user_ids", userIds);
|
|
2558
|
+
queryParams.set("ban_time", banTime);
|
|
2559
|
+
let bodyJson = "";
|
|
2560
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2561
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2562
|
+
if (bearerToken) {
|
|
2563
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2564
|
+
}
|
|
2565
|
+
return Promise.race([
|
|
2566
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2567
|
+
if (response.status == 204) {
|
|
2568
|
+
return response;
|
|
2569
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2570
|
+
return response.json();
|
|
2571
|
+
} else {
|
|
2572
|
+
throw response;
|
|
2573
|
+
}
|
|
2574
|
+
}),
|
|
2575
|
+
new Promise(
|
|
2576
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2577
|
+
)
|
|
2578
|
+
]);
|
|
2579
|
+
}
|
|
2518
2580
|
/** List all users that are part of a clan. */
|
|
2519
2581
|
listClanUsers(bearerToken, clanId, options = {}) {
|
|
2520
2582
|
if (clanId === null || clanId === void 0) {
|
|
@@ -7500,6 +7562,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7500
7562
|
this.onmeetparticipantevent(message.meet_participant_event);
|
|
7501
7563
|
} else if (message.transfer_ownership_event) {
|
|
7502
7564
|
this.ontransferownership(message.transfer_ownership_event);
|
|
7565
|
+
} else if (message.ban_user_event) {
|
|
7566
|
+
this.onbanneduser(message.ban_user_event);
|
|
7503
7567
|
} else {
|
|
7504
7568
|
if (this.verbose && window && window.console) {
|
|
7505
7569
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -7887,6 +7951,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7887
7951
|
console.log(event);
|
|
7888
7952
|
}
|
|
7889
7953
|
}
|
|
7954
|
+
onbanneduser(event) {
|
|
7955
|
+
if (this.verbose && window && window.console) {
|
|
7956
|
+
console.log(event);
|
|
7957
|
+
}
|
|
7958
|
+
}
|
|
7890
7959
|
onmeetparticipantevent(event) {
|
|
7891
7960
|
if (this.verbose && window && window.console) {
|
|
7892
7961
|
console.log(event);
|
|
@@ -8775,6 +8844,28 @@ var Client = class {
|
|
|
8775
8844
|
});
|
|
8776
8845
|
});
|
|
8777
8846
|
}
|
|
8847
|
+
/** Ban a set of users from a clan. */
|
|
8848
|
+
unbanClanUsers(session, clanId, channelId, userIds) {
|
|
8849
|
+
return __async(this, null, function* () {
|
|
8850
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8851
|
+
yield this.sessionRefresh(session);
|
|
8852
|
+
}
|
|
8853
|
+
return this.apiClient.unbanClanUsers(session.token, clanId, channelId, userIds).then((response) => {
|
|
8854
|
+
return Promise.resolve(response != void 0);
|
|
8855
|
+
});
|
|
8856
|
+
});
|
|
8857
|
+
}
|
|
8858
|
+
/** Ban a set of users from a clan. */
|
|
8859
|
+
banClanUsers(session, clanId, channelId, userIds, banTime) {
|
|
8860
|
+
return __async(this, null, function* () {
|
|
8861
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8862
|
+
yield this.sessionRefresh(session);
|
|
8863
|
+
}
|
|
8864
|
+
return this.apiClient.banClanUsers(session.token, clanId, channelId, userIds, banTime).then((response) => {
|
|
8865
|
+
return Promise.resolve(response != void 0);
|
|
8866
|
+
});
|
|
8867
|
+
});
|
|
8868
|
+
}
|
|
8778
8869
|
/** Kick users from a channel, or decline their join requests. */
|
|
8779
8870
|
removeChannelUsers(session, channelId, ids) {
|
|
8780
8871
|
return __async(this, null, function* () {
|
|
@@ -8931,7 +9022,8 @@ var Client = class {
|
|
|
8931
9022
|
clan_nick: gu.clan_nick,
|
|
8932
9023
|
id: gu.id,
|
|
8933
9024
|
clan_id: gu.clan_id,
|
|
8934
|
-
added_by: gu.added_by
|
|
9025
|
+
added_by: gu.added_by,
|
|
9026
|
+
is_banned: gu.is_banned
|
|
8935
9027
|
});
|
|
8936
9028
|
});
|
|
8937
9029
|
return Promise.resolve(result);
|
package/dist/socket.d.ts
CHANGED
|
@@ -100,6 +100,11 @@ export interface AddClanUserEvent {
|
|
|
100
100
|
user: UserProfileRedis;
|
|
101
101
|
invitor: string;
|
|
102
102
|
}
|
|
103
|
+
export interface BannedUserEvent {
|
|
104
|
+
user_ids: Array<string>;
|
|
105
|
+
action: number;
|
|
106
|
+
banner_id: string;
|
|
107
|
+
}
|
|
103
108
|
export interface UserProfileRedis {
|
|
104
109
|
/** User IDs to follow. */
|
|
105
110
|
user_id: string;
|
|
@@ -1053,6 +1058,7 @@ export interface Socket {
|
|
|
1053
1058
|
onunpinmessageevent: (unpin_message_event: UnpinMessageEvent) => void;
|
|
1054
1059
|
onquickmenuevent: (event: QuickMenuEvent) => void;
|
|
1055
1060
|
ontransferownership: (event: TransferOwnershipEvent) => void;
|
|
1061
|
+
onbanneduser: (event: BannedUserEvent) => void;
|
|
1056
1062
|
}
|
|
1057
1063
|
/** Reports an error received from a socket message. */
|
|
1058
1064
|
export interface SocketError {
|
|
@@ -1149,6 +1155,7 @@ export declare class DefaultSocket implements Socket {
|
|
|
1149
1155
|
onunpinmessageevent(unpin_message_event: UnpinMessageEvent): void;
|
|
1150
1156
|
onquickmenuevent(event: QuickMenuEvent): void;
|
|
1151
1157
|
ontransferownership(event: TransferOwnershipEvent): void;
|
|
1158
|
+
onbanneduser(event: BannedUserEvent): void;
|
|
1152
1159
|
onmeetparticipantevent(event: MeetParticipantEvent): void;
|
|
1153
1160
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | IncomingCallPush | MessageButtonClicked | DropdownBoxSelected | ChannelAppEvent | EphemeralMessageSend | VoiceReactionSend | ListDataSocket | QuickMenuEvent, sendTimeout?: number): Promise<any>;
|
|
1154
1161
|
followUsers(userIds: string[]): Promise<Status>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -178,6 +178,12 @@ export interface AddClanUserEvent {
|
|
|
178
178
|
invitor: string;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
export interface BannedUserEvent {
|
|
182
|
+
user_ids: Array<string>;
|
|
183
|
+
action: number;
|
|
184
|
+
banner_id: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
export interface UserProfileRedis {
|
|
182
188
|
/** User IDs to follow. */
|
|
183
189
|
user_id: string;
|
|
@@ -1825,6 +1831,8 @@ export interface Socket {
|
|
|
1825
1831
|
onquickmenuevent: (event: QuickMenuEvent) => void;
|
|
1826
1832
|
|
|
1827
1833
|
ontransferownership: (event: TransferOwnershipEvent) => void;
|
|
1834
|
+
|
|
1835
|
+
onbanneduser: (event: BannedUserEvent) => void;
|
|
1828
1836
|
}
|
|
1829
1837
|
|
|
1830
1838
|
/** Reports an error received from a socket message. */
|
|
@@ -2078,6 +2086,8 @@ export class DefaultSocket implements Socket {
|
|
|
2078
2086
|
this.onmeetparticipantevent(<MeetParticipantEvent>message.meet_participant_event);
|
|
2079
2087
|
} else if (message.transfer_ownership_event) {
|
|
2080
2088
|
this.ontransferownership(<TransferOwnershipEvent>message.transfer_ownership_event);
|
|
2089
|
+
} else if (message.ban_user_event) {
|
|
2090
|
+
this.onbanneduser(<BannedUserEvent>message.ban_user_event);
|
|
2081
2091
|
} else {
|
|
2082
2092
|
if (this.verbose && window && window.console) {
|
|
2083
2093
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -2541,6 +2551,12 @@ export class DefaultSocket implements Socket {
|
|
|
2541
2551
|
}
|
|
2542
2552
|
}
|
|
2543
2553
|
|
|
2554
|
+
onbanneduser(event: BannedUserEvent) {
|
|
2555
|
+
if (this.verbose && window && window.console) {
|
|
2556
|
+
console.log(event)
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2544
2560
|
onmeetparticipantevent(event: MeetParticipantEvent) {
|
|
2545
2561
|
if (this.verbose && window && window.console) {
|
|
2546
2562
|
console.log(event);
|