feat: 라이브 30분 연속 청취시 트래킹 API 호출 기능 추가
This commit is contained in:
46
SodaLive/Sources/UserAction/UserActionApi.swift
Normal file
46
SodaLive/Sources/UserAction/UserActionApi.swift
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// UserActionApi.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 5/17/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Moya
|
||||
|
||||
enum UserActionApi {
|
||||
case trackEvent(request: UserActionRequest)
|
||||
}
|
||||
|
||||
extension UserActionApi: TargetType {
|
||||
var baseURL: URL {
|
||||
return URL(string: BASE_URL)!
|
||||
}
|
||||
|
||||
var path: String {
|
||||
switch self {
|
||||
case .trackEvent:
|
||||
return "/user-action"
|
||||
}
|
||||
}
|
||||
|
||||
var method: Moya.Method {
|
||||
switch self {
|
||||
case .trackEvent:
|
||||
return .post
|
||||
}
|
||||
}
|
||||
|
||||
var task: Moya.Task {
|
||||
switch self {
|
||||
case .trackEvent(let request):
|
||||
return .requestJSONEncodable(request)
|
||||
}
|
||||
}
|
||||
|
||||
var headers: [String : String]? {
|
||||
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user