검색 UI 추가
This commit is contained in:
61
SodaLive/Sources/Search/SearchRepository.swift
Normal file
61
SodaLive/Sources/Search/SearchRepository.swift
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// SearchRepository.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 3/27/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CombineMoya
|
||||
import Combine
|
||||
import Moya
|
||||
|
||||
final class SearchRepository {
|
||||
private let api = MoyaProvider<SearchApi>()
|
||||
|
||||
func searchUnified(keyword: String) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(
|
||||
.searchUnified(
|
||||
keyword: keyword,
|
||||
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
||||
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
func searchCreatorList(keyword: String, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(
|
||||
.searchCreatorList(
|
||||
keyword: keyword,
|
||||
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
||||
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL,
|
||||
page: page,
|
||||
size: size
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
func searchContentList(keyword: String, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(
|
||||
.searchContentList(
|
||||
keyword: keyword,
|
||||
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
||||
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL,
|
||||
page: page,
|
||||
size: size
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
func searchSeriesList(keyword: String, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
|
||||
return api.requestPublisher(
|
||||
.searchSeriesList(
|
||||
keyword: keyword,
|
||||
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
||||
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL,
|
||||
page: page,
|
||||
size: size
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user