getDiscussionsBy method
Return a discussion with the given parameters. Throws a NotFoundFailure if a post could not be found.
Implementation
Future<List<DiscussionBy>> getDiscussionsBy(
DiscussionBySort sort, {
required String tag,
int? limit,
List<String>? filterTags,
List<String>? selectAuthors,
List<String>? selectTags,
int? truncateBody,
}) async {
final params = _buildParamsObj(<String, dynamic>{
'tag': tag,
'limit': limit,
'filter_tags': filterTags,
'select_authors': selectAuthors,
'select_tags': selectTags
});
final bodyJson = await _fetchPostData(
method: 'condenser_api.get_discussions_by_${sort.name}',
params: [params],
);
final list = bodyJson['result'] as List<dynamic>;
return [
for (final f in list) DiscussionBy.fromJson(f as Map<String, dynamic>),
];
}