searchIllust method
Future<SearchIllust>
searchIllust(
- String word,
- SearchSort sort,
- SearchTarget target, {
- String? startDate,
- String? endDate,
- int? bookmarkTotal,
- required CancelToken cancelToken,
搜索
word
- 关键字
sort
- 排序(SearchSort)
target
- 搜索目标(SearchTarget)
startDate
- 开始时间(必须跟endDate
一起填)
endDate
- 结束时间(必须跟startDate
一起填)
bookmarkTotal
- 收藏数量 100, 250, 500, 1000, 5000, 7500 , 10000, 20000, 30000, 50000
Implementation
Future<SearchIllust> searchIllust(
String word,
SearchSort sort,
SearchTarget target, {
String? startDate,
String? endDate,
int? bookmarkTotal,
required CancelToken cancelToken,
}) async {
final response = await _httpClient.get<String>(
'/v1/search/illust',
queryParameters: {
'filter': 'for_android',
'include_translated_tag_results': true,
'merge_plain_keyword_results': true,
'word': null != bookmarkTotal ? '$word ${bookmarkTotal}users入り' : word,
'sort': sort.toPixivStringParameter(),
'search_target': target.toPixivStringParameter(),
'start_date': startDate,
'end_date': endDate,
}..removeWhere((key, value) => null == value),
cancelToken: cancelToken,
);
final data = SearchIllust.fromJson(jsonDecode(response.data!));
return data;
}