Post Report
The postReport() function is used to report a post. It takes a PostReportRequest as input, including the tagId, reason, entityId, entityCreatorId, and entityType. The function returns a PostReportResponse as a Future.
Steps to Report a Post
- Create an instance of
PostReportRequestusingPostReportRequestBuilderclass. - Call the
postReport()function using the instance of theLMFeedClientclass, passing the request as a parameter. - Use the response as per your requirement.
// Create an instance of PostReportRequest
final PostReportRequest postReportRequest = (PostReportRequestBuilder()
..tagId(1)
..reason('Inappropriate content')
..entityId('post_id_to_report')
..entityCreatorId(creator_id)
..entityType(0)) // Assuming 0 represents a post type
.build();
// Get the response from calling the function
final PostReportResponse postReportResponse = await lmFeedClient.postReport(postReportRequest);
// Process the response, as per requirement
if (postReportResponse.success) {
// your function to handle successful post reporting
handlePostReportSuccess();
} else {
// your function to handle error message
handlePostReportError(postReportResponse.errorMessage);
}
Models
PostReportRequest
List of parameters for the PostReportRequest class
| Variable | Type | Description | Optional |
|---|---|---|---|
| tagId | int | ID of the tag used for reporting | |
| reason | String | Reason for reporting the post | ✔ |
| entityId | String | ID of the post to be reported | |
| entityCreatorId | String | ID of the creator of the post | |
| entityType | int | Type identifier for the post |
PostReportResponse
List of parameters for the PostReportResponse class
| Variable | Type | Description | Optional |
|---|---|---|---|
| success | bool | API success status | |
| errorMessage | String | Error message in case of failure | ✔ |