@akomalabs/kemono
Version:
A production-grade TypeScript API wrapper for the Kemono/Coomer platforms
49 lines • 1.43 kB
JavaScript
/**
* Posts API endpoints
*/
export class PostsApi {
client;
constructor(client) {
this.client = client;
}
/**
* List recent posts with optional search parameters
* @param params Search parameters
* @returns Array of posts
*/
async listRecent(params) {
return this.client.get('/posts', { params });
}
/**
* Get posts by creator
* @param service Platform service
* @param creatorId Creator's ID
* @param params Search parameters
* @returns Array of posts
*/
async getByCreator(service, creatorId, params) {
return this.client.get(`/${service}/user/${creatorId}/posts`, { params });
}
/**
* Get a specific post
* @param service Platform service
* @param creatorId Creator's ID
* @param postId Post ID
* @returns Post details
*/
async getPost(service, creatorId, postId) {
return this.client.get(`/${service}/user/${creatorId}/post/${postId}`);
}
/**
* Get post attachments
* @param service Platform service
* @param creatorId Creator's ID
* @param postId Post ID
* @returns Array of attachment URLs
*/
async getAttachments(service, creatorId, postId) {
const post = await this.getPost(service, creatorId, postId);
return post.attachments.map(attachment => attachment.path);
}
}
//# sourceMappingURL=posts.js.map