Class CommentApiClientModule
- All Implemented Interfaces:
CommentAPIs
CommentAPIs.
Provides access to WordPress comment resources through the /wp/v2/comments endpoint, including support
for password-protected content and comment trashing.
-
Constructor Summary
ConstructorsConstructorDescriptionCommentApiClientModule(@NonNull String apiUrl, @NonNull org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, @NonNull com.fasterxml.jackson.databind.ObjectMapper mapper) -
Method Summary
Modifier and TypeMethodDescriptioncreate(@NonNull WpCommentCreateUpdateRequest creationRequest) Creates a new comment.delete(long id) Permanently deletes a comment by its unique identifier.Retrieves a comment by its unique identifier using the given context.Retrieves a comment by its unique identifier using the given context and optional password.list(@NonNull WpPagingQuery pageQuery, WpCommentQuery commentQuery) Retrieves a paginated list of comments using optional filtering and sorting criteria.trash(long id) Moves a comment to the trash by its unique identifier.update(long id, @NonNull WpCommentCreateUpdateRequest updateRequest) Updates an existing comment.
-
Constructor Details
-
CommentApiClientModule
public CommentApiClientModule(@NonNull @NonNull String apiUrl, @NonNull @NonNull org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient, @NonNull @NonNull com.fasterxml.jackson.databind.ObjectMapper mapper)
-
-
Method Details
-
create
Description copied from interface:CommentAPIsCreates a new comment.Creates a comment in WordPress using the provided request payload.
- Specified by:
createin interfaceCommentAPIs- Parameters:
creationRequest- the comment creation request; must not benull- Returns:
- the created
WpComment
-
delete
Description copied from interface:CommentAPIsPermanently deletes a comment by its unique identifier.- Specified by:
deletein interfaceCommentAPIs- Parameters:
id- the ID of the comment to delete- Returns:
- the comment deletion response
-
get
Description copied from interface:CommentAPIsRetrieves a comment by its unique identifier using the given context.The context determines which fields are included in the response, for example
WpContext.VIEW,WpContext.EDIT, orWpContext.EMBED.- Specified by:
getin interfaceCommentAPIs- Parameters:
id- the ID of the comment to retrievecontext- the retrieval context; may benull, in which caseWpContext.VIEWis used- Returns:
- the matching
WpComment
-
get
Description copied from interface:CommentAPIsRetrieves a comment by its unique identifier using the given context and optional password.The context determines which fields are included in the response, for example
WpContext.VIEW,WpContext.EDIT, orWpContext.EMBED.If the comment is password protected, the provided password is used to access protected content. If the password is missing or incorrect, protected fields such as content may be omitted or flagged as protected in the response.
- Specified by:
getin interfaceCommentAPIs- Parameters:
id- the ID of the comment to retrievecontext- the retrieval context; may benull, in which caseWpContext.VIEWis usedpassword- the password for protected content; may benullwhen not required- Returns:
- the matching
WpComment
-
list
public WpPagedResponse<WpComment> list(@NonNull @NonNull WpPagingQuery pageQuery, WpCommentQuery commentQuery) Description copied from interface:CommentAPIsRetrieves a paginated list of comments using optional filtering and sorting criteria.The result set can be refined using
WpCommentQuery, for example by filtering on search criteria, include or exclude lists, or sort order.- Specified by:
listin interfaceCommentAPIs- Parameters:
pageQuery- the pagination settings, including page number and page size; must not benullcommentQuery- additional comment query parameters; may benullwhen no extra filtering is needed- Returns:
- a paginated response containing
WpCommentitems
-
trash
Description copied from interface:CommentAPIsMoves a comment to the trash by its unique identifier.- Specified by:
trashin interfaceCommentAPIs- Parameters:
id- the ID of the comment to trash- Returns:
- the trashed
WpComment
-
update
Description copied from interface:CommentAPIsUpdates an existing comment.Updates a comment in WordPress using the provided request payload.
- Specified by:
updatein interfaceCommentAPIs- Parameters:
id- the ID of the comment to updateupdateRequest- the comment update request; must not benull- Returns:
- the updated
WpComment
-