45 lines
913 B
Swift
45 lines
913 B
Swift
//
|
|
// CreatorCommunityApi.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2023/12/19.
|
|
//
|
|
|
|
import Foundation
|
|
import Moya
|
|
|
|
enum CreatorCommunityApi {
|
|
case createCommunityPost(parameters: [MultipartFormData])
|
|
}
|
|
|
|
extension CreatorCommunityApi: TargetType {
|
|
var baseURL: URL {
|
|
return URL(string: BASE_URL)!
|
|
}
|
|
|
|
var path: String {
|
|
switch self {
|
|
case .createCommunityPost:
|
|
return "/creator-community"
|
|
}
|
|
}
|
|
|
|
var method: Moya.Method {
|
|
switch self {
|
|
case .createCommunityPost:
|
|
return .post
|
|
}
|
|
}
|
|
|
|
var task: Moya.Task {
|
|
switch self {
|
|
case .createCommunityPost(let parameters):
|
|
return .uploadMultipart(parameters)
|
|
}
|
|
}
|
|
|
|
var headers: [String : String]? {
|
|
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
|
|
}
|
|
}
|