크리에이터 채널 페이지 추가

This commit is contained in:
Yu Sung
2023-08-11 18:33:48 +09:00
parent a167840162
commit a8338e6fea
69 changed files with 4087 additions and 10 deletions

View File

@@ -11,6 +11,12 @@ import Moya
enum ExplorerApi {
case getExplorer
case searchChannel(channel: String)
case getCreatorProfile(userId: Int)
case getFollowerList(userId: Int, page: Int, size: Int)
case getCreatorProfileCheers(userId: Int, page: Int, size: Int)
case writeCheers(parentCheersId: Int?, creatorId: Int, content: String)
case modifyCheers(cheersId: Int, content: String)
case writeCreatorNotice(request: PostCreatorNoticeRequest)
}
extension ExplorerApi: TargetType {
@@ -25,13 +31,37 @@ extension ExplorerApi: TargetType {
case .searchChannel:
return "/explorer/search/channel"
case .getCreatorProfile(let userId):
return "/explorer/profile/\(userId)"
case .getFollowerList(let userId, _, _):
return "/explorer/profile/\(userId)/follower-list"
case .getCreatorProfileCheers(let userId, _, _):
return "/explorer/profile/\(userId)/cheers"
case .writeCheers:
return "/explorer/profile/cheers"
case .modifyCheers:
return "/explorer/profile/cheers"
case .writeCreatorNotice:
return "/explorer/profile/notice"
}
}
var method: Moya.Method {
switch self {
case .getExplorer, .searchChannel:
case .getExplorer, .searchChannel, .getCreatorProfile, .getFollowerList, .getCreatorProfileCheers:
return .get
case .writeCheers, .writeCreatorNotice:
return .post
case .modifyCheers:
return .put
}
}
@@ -42,6 +72,38 @@ extension ExplorerApi: TargetType {
case .searchChannel(let channel):
return .requestParameters(parameters: ["channel" : channel], encoding: URLEncoding.queryString)
case .getCreatorProfile:
let parameters = ["timezone": TimeZone.current.identifier] as [String: Any]
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
case .getFollowerList(_, let page, let size):
let parameters = [
"page": page - 1,
"size": size
] as [String : Any]
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
case .getCreatorProfileCheers(_, let page, let size):
let parameters = [
"page": page - 1,
"size": size,
"timezone": TimeZone.current.identifier,
] as [String : Any]
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
case .writeCheers(let parentCheersId, let creatorId, let content):
let request = PostWriteCheersRequest(parentId: parentCheersId, creatorId: creatorId, content: content)
return .requestJSONEncodable(request)
case .modifyCheers(let cheersId, let content):
let request = PutModifyCheersRequest(cheersId: cheersId, content: content)
return .requestJSONEncodable(request)
case .writeCreatorNotice(let request):
return .requestJSONEncodable(request)
}
}