osu-api-extended
Version:
Advanced osu! api wrapper for v1 and v2, with extra stuff
66 lines • 1.91 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.description = void 0;
const request_1 = require("../../../../../utility/request");
const request = (0, request_1.namespace)('https://osu.ppy.sh/api/v2/');
exports.description = {
auth: 0,
title: __filename,
method: 'GET',
description: 'Edit your topic and post from the forum',
params: [
{
type: 'number',
name: 'topic_id',
optional: false,
description: 'Topic id',
},
{
name: 'object',
params: [
{
type: 'string',
name: 'title',
optional: true,
description: 'New title',
},
{
type: 'string',
name: 'body',
optional: true,
description: 'New body',
},
],
},
],
return: 'response',
};
const name = async (topic_id, object) => {
const post = await request(`forums/topics/${topic_id}`, {
method: 'GET',
});
const response = {};
if (object.title) {
const data = await request(`forums/topics/${topic_id}`, {
method: 'PUT',
data: JSON.stringify({
"forum_topic[topic_title]": post.topic.title,
}),
});
response.title = data;
}
;
if (object.body) {
const data = await request(`forums/posts/${post.topic.first_post_id}`, {
method: 'PUT',
data: JSON.stringify({
body: post.posts[0].body.raw,
})
});
response.body = data;
}
;
return response;
};
exports.default = name;
//# sourceMappingURL=edit.js.map
;