addComment method

Future<Comment> addComment(
  1. int illustId, {
  2. String comment = '',
  3. int? stampId,
  4. int? parentCommentId,
})

添加评论(评论一个插画)
illustId - 插画ID
comment - 评论内容
stampId - 表情包ID
parentCommentId - 父评论ID(用来回复)

Implementation

Future<Comment> addComment(
  int illustId, {
  String comment = '',
  int? stampId,
  int? parentCommentId,
}) async {
  final response = await _httpClient.post<String>(
    '/v1/illust/comment/add',
    data: FormData.fromMap(
      {
        'illust_id': illustId,
        'comment': comment,
        'stamp_id': stampId,
        'parent_comment_id': parentCommentId,
      }..removeWhere((key, value) => null == value),
    ),
  );
  final data = Comment.fromJson(jsonDecode(response.data!)['comment']);
  return data;
}