mezon-js 2.13.65 → 2.13.66
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 +19 -0
- package/dist/api.gen.d.ts +2 -0
- package/dist/client.d.ts +1 -0
- package/dist/mezon-js.cjs.js +37 -0
- package/dist/mezon-js.esm.mjs +37 -0
- 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
|
@@ -4987,4 +4987,23 @@ export class Client {
|
|
|
4987
4987
|
return Promise.resolve(response);
|
|
4988
4988
|
});
|
|
4989
4989
|
}
|
|
4990
|
+
|
|
4991
|
+
async reportMessageAbuse(session: Session,
|
|
4992
|
+
messageId?:string,
|
|
4993
|
+
abuseType?:string
|
|
4994
|
+
) : Promise<any> {
|
|
4995
|
+
if (
|
|
4996
|
+
this.autoRefreshSession &&
|
|
4997
|
+
session.refresh_token &&
|
|
4998
|
+
session.isexpired(Date.now() / 1000)
|
|
4999
|
+
) {
|
|
5000
|
+
await this.sessionRefresh(session);
|
|
5001
|
+
}
|
|
5002
|
+
|
|
5003
|
+
return this.apiClient
|
|
5004
|
+
.reportMessageAbuse(session.token, messageId, abuseType)
|
|
5005
|
+
.then((response: any) => {
|
|
5006
|
+
return response !== undefined;
|
|
5007
|
+
});
|
|
5008
|
+
}
|
|
4990
5009
|
}
|
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
|
|
@@ -11279,4 +11306,14 @@ var Client = class {
|
|
|
11279
11306
|
});
|
|
11280
11307
|
});
|
|
11281
11308
|
}
|
|
11309
|
+
reportMessageAbuse(session, messageId, abuseType) {
|
|
11310
|
+
return __async(this, null, function* () {
|
|
11311
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
11312
|
+
yield this.sessionRefresh(session);
|
|
11313
|
+
}
|
|
11314
|
+
return this.apiClient.reportMessageAbuse(session.token, messageId, abuseType).then((response) => {
|
|
11315
|
+
return response !== void 0;
|
|
11316
|
+
});
|
|
11317
|
+
});
|
|
11318
|
+
}
|
|
11282
11319
|
};
|
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
|
|
@@ -11244,6 +11271,16 @@ var Client = class {
|
|
|
11244
11271
|
});
|
|
11245
11272
|
});
|
|
11246
11273
|
}
|
|
11274
|
+
reportMessageAbuse(session, messageId, abuseType) {
|
|
11275
|
+
return __async(this, null, function* () {
|
|
11276
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
11277
|
+
yield this.sessionRefresh(session);
|
|
11278
|
+
}
|
|
11279
|
+
return this.apiClient.reportMessageAbuse(session.token, messageId, abuseType).then((response) => {
|
|
11280
|
+
return response !== void 0;
|
|
11281
|
+
});
|
|
11282
|
+
});
|
|
11283
|
+
}
|
|
11247
11284
|
};
|
|
11248
11285
|
export {
|
|
11249
11286
|
ChannelStreamMode,
|