sodalive-ios/SodaLive/Sources/Explorer/ExplorerRepository.swift

48 lines
1.7 KiB
Swift

//
// ExplorerRepository.swift
// SodaLive
//
// Created by klaus on 2023/08/10.
//
import Foundation
import CombineMoya
import Combine
import Moya
final class ExplorerRepository {
private let api = MoyaProvider<ExplorerApi>()
func getExplorer() -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getExplorer)
}
func searchChannel(channel: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.searchChannel(channel: channel))
}
func getCreatorProfile(id: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getCreatorProfile(userId: id))
}
func getFollowerList(userId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getFollowerList(userId: userId, page: page, size: size))
}
func getCreatorProfileCheers(userId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getCreatorProfileCheers(userId: userId, page: page, size: size))
}
func writeCheers(parentCheersId: Int?, creatorId: Int, content: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.writeCheers(parentCheersId: parentCheersId, creatorId: creatorId, content: content))
}
func modifyCheers(cheersId: Int, content: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.modifyCheers(cheersId: cheersId, content: content))
}
func writeCreatorNotice(notice: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.writeCreatorNotice(request: PostCreatorNoticeRequest(notice: notice)))
}
}