콘텐츠 메인 - Api 분리

This commit is contained in:
Yu Sung
2023-12-11 20:01:26 +09:00
parent 77a145d61c
commit c09920942c
25 changed files with 886 additions and 590 deletions

View File

@@ -22,8 +22,11 @@ enum ContentApi {
case getAudioContentCommentReplyList(commentId: Int, page: Int, size: Int)
case deleteAudioContent(audioContentId: Int)
case modifyAudioContent(parameters: [MultipartFormData])
case getMain
case getNewContentUploadCreatorList
case getMainBannerList
case getMainOrderList
case getNewContentOfTheme(theme: String)
case getCurationList(page: Int, size: Int)
case donation(request: AudioContentDonationRequest)
case modifyComment(request: ModifyCommentRequest)
case getNewContentThemeList
@@ -79,12 +82,21 @@ extension ContentApi: TargetType {
case .modifyAudioContent:
return "/audio-content"
case .getMain:
return "/audio-content/main"
case .getNewContentUploadCreatorList:
return "/audio-content/main/new-content-upload-creator"
case .getMainBannerList:
return "/audio-content/main/banner-list"
case .getMainOrderList:
return "/audio-content/main/order-list"
case .getNewContentOfTheme:
return "/audio-content/main/new"
case .getCurationList:
return "/audio-content/main/curation-list"
case .donation:
return "/audio-content/donation"
@@ -111,11 +123,14 @@ extension ContentApi: TargetType {
var method: Moya.Method {
switch self {
case .getAudioContentList, .getAudioContentDetail, .getOrderList, .getAudioContentThemeList,
.getAudioContentCommentList, .getAudioContentCommentReplyList, .getMain, .getNewContentOfTheme,
.getAudioContentCommentList, .getAudioContentCommentReplyList, .getNewContentOfTheme,
.getNewContentThemeList, .getNewContentAllOfTheme, .getAudioContentListByCurationId, .getContentRanking,
.getContentRankingSortType:
return .get
case .getMainBannerList, .getMainOrderList, .getNewContentUploadCreatorList, .getCurationList:
return .get
case .likeContent, .modifyAudioContent, .modifyComment:
return .put
@@ -163,7 +178,7 @@ extension ContentApi: TargetType {
case .addAllPlaybackTracking(let request):
return .requestJSONEncodable(request)
case .getAudioContentThemeList, .getMain:
case .getAudioContentThemeList, .getMainBannerList, .getMainOrderList, .getNewContentUploadCreatorList:
return .requestPlain
case .uploadAudioContent(let parameters):
@@ -236,6 +251,14 @@ extension ContentApi: TargetType {
case .getContentRankingSortType:
return .requestPlain
case .getCurationList(let page, let size):
let parameters = [
"page": page - 1,
"size": size
] as [String : Any]
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
}
}