kyodo.dorks
Version:
TypeScript API wrapper for Kyodo: Communities & Chats
47 lines (46 loc) • 1.8 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.DorksCircleManager = void 0;
const basic_1 = require("../schemas/responses/basic");
const circle_1 = require("../schemas/responses/circle");
const exceptions_1 = require("../utils/exceptions");
class DorksCircleManager {
constructor(config, httpWorkflow) {
this.get = async (id) => {
return (await this.httpWorkflow.sendGet({
path: `/v1/${id || this.config.enviroment.circleId}/s/circles`
}, circle_1.GetCircleResponseSchema)).circle;
};
this.join = async () => {
return await this.httpWorkflow.sendXSigPost({
path: `${this.endpoint}/circles/join`,
body: JSON.stringify({})
}, basic_1.BasicResponseSchema);
};
this.leave = async () => {
return await this.httpWorkflow.sendXSigPost({
path: `${this.endpoint}/circles/leave`,
body: JSON.stringify({})
}, basic_1.BasicResponseSchema);
};
this.report = async (reason) => {
return await this.httpWorkflow.sendXSigPost({
path: `${this.endpoint}/reports/content`,
body: JSON.stringify({
contentId: this.config.enviroment.circleId,
contentType: 0,
type: 2,
reason
})
}, basic_1.BasicResponseSchema);
};
if (!config.enviroment.circleId)
exceptions_1.KyodoDorksAPIError.throw(1);
this.endpoint = `/v1/${config.enviroment.circleId}/s`;
this.config = config;
this.httpWorkflow = httpWorkflow;
}
;
}
exports.DorksCircleManager = DorksCircleManager;
;
;