postBookmarkAdd method

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

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

Implementation

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