콘텐츠 메인, 콘텐츠 업로드 페이지 추가
This commit is contained in:
79
SodaLive/Sources/Content/ContentRepository.swift
Normal file
79
SodaLive/Sources/Content/ContentRepository.swift
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ContentRepository.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/11.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CombineMoya
|
||||
import Combine
|
||||
import Moya
|
||||
|
||||
final class ContentRepository {
|
||||
private let api = MoyaProvider<ContentApi>()
|
||||
|
||||
func getAudioContentList(userId: Int, page: Int, size: Int, sort: ContentListViewModel.Sort) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getAudioContentList(userId: userId, page: page, size: size, sort: sort))
|
||||
}
|
||||
|
||||
func getAudioContentDetail(audioContentId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getAudioContentDetail(audioContentId: audioContentId))
|
||||
}
|
||||
|
||||
func likeContent(audioContentId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.likeContent(request: PutAudioContentLikeRequest(audioContentId: audioContentId)))
|
||||
}
|
||||
|
||||
func registerComment(audioContentId: Int, comment: String, parentId: Int? = nil) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.registerComment(request: RegisterAudioContentCommentRequest(comment: comment, audioContentId: audioContentId, parentId: parentId)))
|
||||
}
|
||||
|
||||
func orderAudioContent(audioContentId: Int, orderType: OrderType) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.orderAudioContent(request: OrderRequest(audioContentId: audioContentId, orderType: orderType)))
|
||||
}
|
||||
|
||||
func getOrderList(page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getOrderList(page: page, size: size))
|
||||
}
|
||||
|
||||
func addAllPlaybackTracking(request: AddAllPlaybackTrackingRequest) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.addAllPlaybackTracking(request: request))
|
||||
}
|
||||
|
||||
func getAudioContentThemeList() -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getAudioContentThemeList)
|
||||
}
|
||||
|
||||
func uploadAudioContent(parameters: [MultipartFormData]) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.uploadAudioContent(parameters: parameters))
|
||||
}
|
||||
|
||||
func getAudioContentCommentList(audioContentId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getAudioContentCommentList(audioContentId: audioContentId, page: page, size: size))
|
||||
}
|
||||
|
||||
func getAudioContentCommentReplyList(commentId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getAudioContentCommentReplyList(commentId: commentId, page: page, size: size))
|
||||
}
|
||||
|
||||
func deleteAudioContent(audioContentId: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.deleteAudioContent(audioContentId: audioContentId))
|
||||
}
|
||||
|
||||
func modifyAudioContent(parameters: [MultipartFormData]) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.modifyAudioContent(parameters: parameters))
|
||||
}
|
||||
|
||||
func getMain() -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getMain)
|
||||
}
|
||||
|
||||
func getNewContentOfTheme(theme: String) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.getNewContentOfTheme(theme: theme))
|
||||
}
|
||||
|
||||
func donation(contentId: Int, coin: Int, comment: String) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(.donation(request: AudioContentDonationRequest(audioContentId: contentId, donationCoin: coin, comment: comment)))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user