getComments method
Future<List<MediaComment> >
getComments(
- String id, {
- CommentType? commentType,
- MediaType? mediaType,
- String? includeReplies,
- bool extendedFull = false,
- RequestPagination? pagination,
- bool useOAuth = false,
Returns the most recently written comments for the user.
You can optionally filter by the comment_type and media type to limit what gets returned.
By default, only top level comments are returned.
Set includeReplies
=true to return replies in addition to top level comments.
Set includeReplies
=only to return only replies and no top level comments.
id
- User slug
commentType
- Possible values: all , reviews , shouts .
mediaType
- Possible values: all , movies , shows , seasons , episodes , lists .
includeReplies
- include comment replies
useOAuth
- whether to make the request using OAuth header
🔓 OAuth Optional 📄 Pagination ✨ Extended Info
Implementation
Future<List<MediaComment>> getComments(String id,
{CommentType? commentType,
MediaType? mediaType,
String? includeReplies,
bool extendedFull = false,
RequestPagination? pagination,
bool useOAuth = false}) async {
Map<String, dynamic>? params;
assert(includeReplies == null || includeReplies == "true" || includeReplies == "false" || includeReplies == "only",
"Invalid includeReplies. Valid values are \"true\", \"false\", or \"only\"");
if (includeReplies != null) {
params = {"includeReplies": includeReplies};
}
var request = "";
if (commentType != null) {
request = "/${commentType.value}";
}
if (mediaType != null) {
request += "/${mediaType.value}";
}
if (useOAuth) {
return await _manager._authenticatedGetList<MediaComment>("users/$id/comments$request",
queryParamameters: params, pagination: pagination, extendedFull: extendedFull);
}
return await _manager._getList<MediaComment>("users/$id/comments$request",
queryParamameters: params, pagination: pagination, extendedFull: extendedFull);
}