mezon-js 2.13.65 → 2.13.67
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 +35 -0
- package/client.ts +21 -1
- package/dist/api.gen.d.ts +2 -0
- package/dist/client.d.ts +1 -0
- package/dist/mezon-js.cjs.js +39 -1
- package/dist/mezon-js.esm.mjs +39 -1
- package/package.json +1 -1
package/api.gen.ts
CHANGED
|
@@ -11757,5 +11757,40 @@ export class MezonApi {
|
|
|
11757
11757
|
]);
|
|
11758
11758
|
}
|
|
11759
11759
|
|
|
11760
|
+
/** */
|
|
11761
|
+
reportMessageAbuse(bearerToken: string,
|
|
11762
|
+
messageId?:string,
|
|
11763
|
+
abuseType?:string,
|
|
11764
|
+
options: any = {}): Promise<any> {
|
|
11765
|
+
|
|
11766
|
+
const urlPath = "/v2/message/report";
|
|
11767
|
+
const queryParams = new Map<string, any>();
|
|
11768
|
+
queryParams.set("message_id", messageId);
|
|
11769
|
+
queryParams.set("abuse_type", abuseType);
|
|
11770
|
+
|
|
11771
|
+
let bodyJson : string = "";
|
|
11772
|
+
|
|
11773
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
11774
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
11775
|
+
if (bearerToken) {
|
|
11776
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
11777
|
+
}
|
|
11778
|
+
|
|
11779
|
+
return Promise.race([
|
|
11780
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
11781
|
+
if (response.status == 204) {
|
|
11782
|
+
return response;
|
|
11783
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
11784
|
+
return response.json();
|
|
11785
|
+
} else {
|
|
11786
|
+
throw response;
|
|
11787
|
+
}
|
|
11788
|
+
}),
|
|
11789
|
+
new Promise((_, reject) =>
|
|
11790
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
11791
|
+
),
|
|
11792
|
+
]);
|
|
11793
|
+
}
|
|
11794
|
+
|
|
11760
11795
|
}
|
|
11761
11796
|
|
package/client.ts
CHANGED
|
@@ -1521,7 +1521,8 @@ export class Client {
|
|
|
1521
1521
|
update_time: gu.user!.update_time,
|
|
1522
1522
|
username: gu.user!.username,
|
|
1523
1523
|
user_status: gu.user!.user_status,
|
|
1524
|
-
status: gu.user!.status
|
|
1524
|
+
status: gu.user!.status,
|
|
1525
|
+
about_me: gu.user!.about_me
|
|
1525
1526
|
},
|
|
1526
1527
|
role_id: gu!.role_id,
|
|
1527
1528
|
clan_nick: gu!.clan_nick,
|
|
@@ -4987,4 +4988,23 @@ export class Client {
|
|
|
4987
4988
|
return Promise.resolve(response);
|
|
4988
4989
|
});
|
|
4989
4990
|
}
|
|
4991
|
+
|
|
4992
|
+
async reportMessageAbuse(session: Session,
|
|
4993
|
+
messageId?:string,
|
|
4994
|
+
abuseType?:string
|
|
4995
|
+
) : Promise<any> {
|
|
4996
|
+
if (
|
|
4997
|
+
this.autoRefreshSession &&
|
|
4998
|
+
session.refresh_token &&
|
|
4999
|
+
session.isexpired(Date.now() / 1000)
|
|
5000
|
+
) {
|
|
5001
|
+
await this.sessionRefresh(session);
|
|
5002
|
+
}
|
|
5003
|
+
|
|
5004
|
+
return this.apiClient
|
|
5005
|
+
.reportMessageAbuse(session.token, messageId, abuseType)
|
|
5006
|
+
.then((response: any) => {
|
|
5007
|
+
return response !== undefined;
|
|
5008
|
+
});
|
|
5009
|
+
}
|
|
4990
5010
|
}
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -2405,4 +2405,6 @@ export declare class MezonApi {
|
|
|
2405
2405
|
updateUsername(bearerToken: string, body: ApiUpdateUsernameRequest, options?: any): Promise<ApiSession>;
|
|
2406
2406
|
/** Ban a set of users from a channel. */
|
|
2407
2407
|
isBanned(bearerToken: string, channelId: string, options?: any): Promise<ApiIsBannedResponse>;
|
|
2408
|
+
/** */
|
|
2409
|
+
reportMessageAbuse(bearerToken: string, messageId?: string, abuseType?: string, options?: any): Promise<any>;
|
|
2408
2410
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -533,4 +533,5 @@ export declare class Client {
|
|
|
533
533
|
isFollower(session: Session, req: ApiIsFollowerRequest): Promise<ApiIsFollowerResponse>;
|
|
534
534
|
transferOwnership(session: Session, req: ApiTransferOwnershipRequest): Promise<any>;
|
|
535
535
|
isBanned(session: Session, channelId: string): Promise<ApiIsBannedResponse>;
|
|
536
|
+
reportMessageAbuse(session: Session, messageId?: string, abuseType?: string): Promise<any>;
|
|
536
537
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -7208,6 +7208,33 @@ var MezonApi = class {
|
|
|
7208
7208
|
)
|
|
7209
7209
|
]);
|
|
7210
7210
|
}
|
|
7211
|
+
/** */
|
|
7212
|
+
reportMessageAbuse(bearerToken, messageId, abuseType, options = {}) {
|
|
7213
|
+
const urlPath = "/v2/message/report";
|
|
7214
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
7215
|
+
queryParams.set("message_id", messageId);
|
|
7216
|
+
queryParams.set("abuse_type", abuseType);
|
|
7217
|
+
let bodyJson = "";
|
|
7218
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
7219
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
7220
|
+
if (bearerToken) {
|
|
7221
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
7222
|
+
}
|
|
7223
|
+
return Promise.race([
|
|
7224
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
7225
|
+
if (response.status == 204) {
|
|
7226
|
+
return response;
|
|
7227
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
7228
|
+
return response.json();
|
|
7229
|
+
} else {
|
|
7230
|
+
throw response;
|
|
7231
|
+
}
|
|
7232
|
+
}),
|
|
7233
|
+
new Promise(
|
|
7234
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
7235
|
+
)
|
|
7236
|
+
]);
|
|
7237
|
+
}
|
|
7211
7238
|
};
|
|
7212
7239
|
|
|
7213
7240
|
// session.ts
|
|
@@ -9303,7 +9330,8 @@ var Client = class {
|
|
|
9303
9330
|
update_time: gu.user.update_time,
|
|
9304
9331
|
username: gu.user.username,
|
|
9305
9332
|
user_status: gu.user.user_status,
|
|
9306
|
-
status: gu.user.status
|
|
9333
|
+
status: gu.user.status,
|
|
9334
|
+
about_me: gu.user.about_me
|
|
9307
9335
|
},
|
|
9308
9336
|
role_id: gu.role_id,
|
|
9309
9337
|
clan_nick: gu.clan_nick,
|
|
@@ -11279,4 +11307,14 @@ var Client = class {
|
|
|
11279
11307
|
});
|
|
11280
11308
|
});
|
|
11281
11309
|
}
|
|
11310
|
+
reportMessageAbuse(session, messageId, abuseType) {
|
|
11311
|
+
return __async(this, null, function* () {
|
|
11312
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
11313
|
+
yield this.sessionRefresh(session);
|
|
11314
|
+
}
|
|
11315
|
+
return this.apiClient.reportMessageAbuse(session.token, messageId, abuseType).then((response) => {
|
|
11316
|
+
return response !== void 0;
|
|
11317
|
+
});
|
|
11318
|
+
});
|
|
11319
|
+
}
|
|
11282
11320
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -7173,6 +7173,33 @@ var MezonApi = class {
|
|
|
7173
7173
|
)
|
|
7174
7174
|
]);
|
|
7175
7175
|
}
|
|
7176
|
+
/** */
|
|
7177
|
+
reportMessageAbuse(bearerToken, messageId, abuseType, options = {}) {
|
|
7178
|
+
const urlPath = "/v2/message/report";
|
|
7179
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
7180
|
+
queryParams.set("message_id", messageId);
|
|
7181
|
+
queryParams.set("abuse_type", abuseType);
|
|
7182
|
+
let bodyJson = "";
|
|
7183
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
7184
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
7185
|
+
if (bearerToken) {
|
|
7186
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
7187
|
+
}
|
|
7188
|
+
return Promise.race([
|
|
7189
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
7190
|
+
if (response.status == 204) {
|
|
7191
|
+
return response;
|
|
7192
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
7193
|
+
return response.json();
|
|
7194
|
+
} else {
|
|
7195
|
+
throw response;
|
|
7196
|
+
}
|
|
7197
|
+
}),
|
|
7198
|
+
new Promise(
|
|
7199
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
7200
|
+
)
|
|
7201
|
+
]);
|
|
7202
|
+
}
|
|
7176
7203
|
};
|
|
7177
7204
|
|
|
7178
7205
|
// session.ts
|
|
@@ -9268,7 +9295,8 @@ var Client = class {
|
|
|
9268
9295
|
update_time: gu.user.update_time,
|
|
9269
9296
|
username: gu.user.username,
|
|
9270
9297
|
user_status: gu.user.user_status,
|
|
9271
|
-
status: gu.user.status
|
|
9298
|
+
status: gu.user.status,
|
|
9299
|
+
about_me: gu.user.about_me
|
|
9272
9300
|
},
|
|
9273
9301
|
role_id: gu.role_id,
|
|
9274
9302
|
clan_nick: gu.clan_nick,
|
|
@@ -11244,6 +11272,16 @@ var Client = class {
|
|
|
11244
11272
|
});
|
|
11245
11273
|
});
|
|
11246
11274
|
}
|
|
11275
|
+
reportMessageAbuse(session, messageId, abuseType) {
|
|
11276
|
+
return __async(this, null, function* () {
|
|
11277
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
11278
|
+
yield this.sessionRefresh(session);
|
|
11279
|
+
}
|
|
11280
|
+
return this.apiClient.reportMessageAbuse(session.token, messageId, abuseType).then((response) => {
|
|
11281
|
+
return response !== void 0;
|
|
11282
|
+
});
|
|
11283
|
+
});
|
|
11284
|
+
}
|
|
11247
11285
|
};
|
|
11248
11286
|
export {
|
|
11249
11287
|
ChannelStreamMode,
|