@iflow-mcp/claudeus-wp-mcp
Version:
The most comprehensive WordPress MCP server - 145 production-ready tools for complete WordPress management with AI
72 lines • 1.98 kB
JavaScript
/**
* WordPress Comments API Client
* Handles comments, moderation, and replies
*/
import { BaseApiClient } from './base-client.js';
export class CommentsApiClient extends BaseApiClient {
// ==========================================
// COMMENTS CRUD
// ==========================================
/**
* Get a list of comments with pagination metadata
*/
async getComments(filters) {
return this.getPaginated('/comments', filters);
}
/**
* Get a single comment by ID
*/
async getComment(id, password) {
const params = password ? { password } : undefined;
return this.get(`/comments/${id}`, params);
}
/**
* Create a new comment
*/
async createComment(data) {
return this.post('/comments', data);
}
/**
* Update an existing comment
*/
async updateComment(id, data) {
return this.put(`/comments/${id}`, data);
}
/**
* Delete a comment
* @param id Comment ID
* @param force Whether to bypass trash and force deletion
*/
async deleteComment(id, force = false) {
const queryString = force ? '?force=true' : '';
return this.delete(`/comments/${id}${queryString}`);
}
// ==========================================
// MODERATION HELPERS
// ==========================================
/**
* Approve a comment
*/
async approveComment(id) {
return this.updateComment(id, { status: 'approve' });
}
/**
* Hold a comment for moderation
*/
async holdComment(id) {
return this.updateComment(id, { status: 'hold' });
}
/**
* Mark a comment as spam
*/
async spamComment(id) {
return this.updateComment(id, { status: 'spam' });
}
/**
* Move a comment to trash
*/
async trashComment(id) {
return this.updateComment(id, { status: 'trash' });
}
}
//# sourceMappingURL=comments.js.map