56 lines
1.9 KiB
Swift
56 lines
1.9 KiB
Swift
//
|
|
// ContentMainTabSeriesRepository.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2/20/25.
|
|
//
|
|
|
|
import Foundation
|
|
import CombineMoya
|
|
import Combine
|
|
import Moya
|
|
|
|
final class ContentMainTabSeriesRepository {
|
|
private let api = MoyaProvider<ContentApi>()
|
|
|
|
func getContentMainSeries() -> AnyPublisher<Response, MoyaError> {
|
|
return api.requestPublisher(
|
|
.getContentMainSeries(
|
|
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
|
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL
|
|
)
|
|
)
|
|
}
|
|
|
|
func getRecommendSeriesListByGenre(genreId: Int) -> AnyPublisher<Response, MoyaError> {
|
|
return api.requestPublisher(
|
|
.getRecommendSeriesListByGenre(
|
|
genreId: genreId,
|
|
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
|
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL
|
|
)
|
|
)
|
|
}
|
|
|
|
func getRecommendSeriesByCreator(creatorId: Int) -> AnyPublisher<Response, MoyaError> {
|
|
return api.requestPublisher(
|
|
.getRecommendSeriesByCreator(
|
|
creatorId: creatorId,
|
|
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
|
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL
|
|
)
|
|
)
|
|
}
|
|
|
|
func getCompletedSeries(page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
|
|
return api.requestPublisher(
|
|
.getCompletedSeries(
|
|
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
|
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL,
|
|
page: page,
|
|
size: size
|
|
)
|
|
)
|
|
}
|
|
}
|