addBookmark method

Future<void> addBookmark(
  1. int id, {
  2. List<String> tags = const [],
  3. Restrict restrict = Restrict.public,
  4. bool isNovel = false,
})

收藏作品
id - 作品ID
tags - 标签(自己添加的)
isNovel - 小说

Implementation

Future<void> addBookmark(int id, {List<String> tags = const [], Restrict restrict = Restrict.public, bool isNovel = false}) async {
  await _httpClient.post<String>(
    '/v2/${isNovel ? 'novel' : 'illust'}/bookmark/add',
    data: FormData.fromMap(
      {
        '${isNovel ? 'novel' : 'illust'}_id': id,
        'restrict': restrict.toPixivStringParameter(),
        'tags': tags,
      },
    ),
  );
}