feat(creator): 커뮤니티 탭을 추가한다

This commit is contained in:
Yu Sung
2026-07-05 22:25:07 +09:00
parent 130b8eee40
commit f3b7d01a3f
20 changed files with 1706 additions and 2 deletions

View File

@@ -0,0 +1,41 @@
import Foundation
import Moya
enum CreatorChannelCommunityApi {
case getCommunity(creatorId: Int, page: Int, size: Int)
}
extension CreatorChannelCommunityApi: TargetType {
var baseURL: URL {
return URL(string: BASE_URL)!
}
var path: String {
switch self {
case .getCommunity(let creatorId, _, _):
return "/api/v2/creator-channels/\(creatorId)/community"
}
}
var method: Moya.Method {
switch self {
case .getCommunity:
return .get
}
}
var task: Moya.Task {
switch self {
case .getCommunity(_, let page, let size):
return .requestParameters(
parameters: ["page": page, "size": size],
encoding: URLEncoding.queryString
)
}
}
var headers: [String: String]? {
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
}
}

View File

@@ -0,0 +1,13 @@
import Foundation
import Combine
import CombineMoya
import Moya
final class CreatorChannelCommunityRepository {
private let api = MoyaProvider<CreatorChannelCommunityApi>()
func getCommunity(creatorId: Int, page: Int, size: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getCommunity(creatorId: creatorId, page: page, size: size))
}
}