커뮤니티 댓글, 답글 추가 APi 적용

This commit is contained in:
Yu Sung
2023-12-20 21:17:24 +09:00
parent 02764f5fe8
commit cb3a564a29
10 changed files with 838 additions and 5 deletions

View File

@@ -13,6 +13,8 @@ enum CreatorCommunityApi {
case getCommunityPostList(creatorId: Int, page: Int, size: Int)
case communityPostLike(postId: Int)
case createCommunityPostComment(comment: String, postId: Int, parentId: Int?)
case getCommunityPostCommentList(postId: Int, page: Int, size: Int)
case getCommentReplyList(commentId: Int, page: Int, size: Int)
}
extension CreatorCommunityApi: TargetType {
@@ -30,6 +32,12 @@ extension CreatorCommunityApi: TargetType {
case .createCommunityPostComment:
return "/creator-community/comment"
case .getCommunityPostCommentList(let postId, _, _):
return "/creator-community/\(postId)/comment"
case .getCommentReplyList(let commentId, _, _):
return "/creator-community/comment/\(commentId)"
}
}
@@ -38,7 +46,7 @@ extension CreatorCommunityApi: TargetType {
case .createCommunityPost, .communityPostLike, .createCommunityPostComment:
return .post
case .getCommunityPostList:
case .getCommunityPostList, .getCommunityPostCommentList, .getCommentReplyList:
return .get
}
}
@@ -64,6 +72,22 @@ extension CreatorCommunityApi: TargetType {
case .createCommunityPostComment(let comment, let postId, let parentId):
let request = CreateCommunityPostCommentRequest(comment: comment, postId: postId, parentId: parentId)
return .requestJSONEncodable(request)
case .getCommunityPostCommentList(_, let page, let size):
let parameters = [
"page": page - 1,
"size": size,
"timezone": TimeZone.current.identifier
] as [String: Any]
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
case .getCommentReplyList(_, let page, let size):
let parameters = [
"page": page - 1,
"size": size,
"timezone": TimeZone.current.identifier
] as [String: Any]
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
}
}