feat(content-all): theme, 정렬(최신순/인기순) 추가
This commit is contained in:
@@ -68,7 +68,8 @@ enum ContentApi {
|
||||
case getNewFreeContentOfTheme(theme: String, isAdultContentVisible: Bool, contentType: ContentType, page: Int, size: Int)
|
||||
case getPopularFreeContentByCreator(creatorId: Int, isAdultContentVisible: Bool, contentType: ContentType)
|
||||
|
||||
case getAllAudioContents(isAdultContentVisible: Bool, contentType: ContentType, page: Int, size: Int, isFree: Bool?, isPointAvailableOnly: Bool?)
|
||||
case getAllAudioContents(isAdultContentVisible: Bool, contentType: ContentType, page: Int, size: Int, isFree: Bool?, isPointAvailableOnly: Bool?, sortType: ContentAllViewModel.Sort = .NEWEST, theme: String? = nil)
|
||||
case getAudioContentActiveThemeList(isAdultContentVisible: Bool, contentType: ContentType, isFree: Bool?, isPointAvailableOnly: Bool?)
|
||||
}
|
||||
|
||||
extension ContentApi: TargetType {
|
||||
@@ -233,6 +234,9 @@ extension ContentApi: TargetType {
|
||||
|
||||
case .getAllAudioContents:
|
||||
return "/audio-content/all"
|
||||
|
||||
case .getAudioContentActiveThemeList:
|
||||
return "/audio-content/theme/active"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +263,7 @@ extension ContentApi: TargetType {
|
||||
case .registerComment, .orderAudioContent, .addAllPlaybackTracking, .uploadAudioContent, .donation, .pinContent:
|
||||
return .post
|
||||
|
||||
case .getAllAudioContents:
|
||||
case .getAllAudioContents, .getAudioContentActiveThemeList:
|
||||
return .get
|
||||
|
||||
case .deleteAudioContent:
|
||||
@@ -550,10 +554,11 @@ extension ContentApi: TargetType {
|
||||
|
||||
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
|
||||
|
||||
case .getAllAudioContents(let isAdultContentVisible, let contentType, let page, let size, let isFree, let isPointAvailableOnly):
|
||||
case .getAllAudioContents(let isAdultContentVisible, let contentType, let page, let size, let isFree, let isPointAvailableOnly, let sortType, let theme):
|
||||
var parameters = [
|
||||
"isAdultContentVisible": isAdultContentVisible,
|
||||
"contentType": contentType,
|
||||
"sort-type": sortType,
|
||||
"page": page - 1,
|
||||
"size": size
|
||||
] as [String : Any]
|
||||
@@ -566,6 +571,26 @@ extension ContentApi: TargetType {
|
||||
parameters["isPointAvailableOnly"] = isPointAvailableOnly
|
||||
}
|
||||
|
||||
if let theme = theme {
|
||||
parameters["theme"] = theme
|
||||
}
|
||||
|
||||
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
|
||||
|
||||
case .getAudioContentActiveThemeList(let isAdultContentVisible, let contentType, let isFree, let isPointAvailableOnly):
|
||||
var parameters = [
|
||||
"isAdultContentVisible": isAdultContentVisible,
|
||||
"contentType": contentType,
|
||||
] as [String : Any]
|
||||
|
||||
if let isFree = isFree {
|
||||
parameters["isFree"] = isFree
|
||||
}
|
||||
|
||||
if let isPointAvailableOnly = isPointAvailableOnly {
|
||||
parameters["isPointAvailableOnly"] = isPointAvailableOnly
|
||||
}
|
||||
|
||||
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user