-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmotionEndpoint.swift
More file actions
64 lines (56 loc) · 1.38 KB
/
EmotionEndpoint.swift
File metadata and controls
64 lines (56 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// EmotionEndpoint.swift
// DataSource
//
// Created by 최정인 on 7/28/25.
//
enum EmotionEndpoint {
case fetchEmotions
case fetchEmotion(date: String)
case registerEmotion(emotion: String)
}
extension EmotionEndpoint: Endpoint {
var baseURL: String {
return AppProperties.baseURL + "/api/v1/emotion-marbles"
}
var path: String {
switch self {
case .fetchEmotions:
return baseURL
case .fetchEmotion(let date):
return baseURL + "/\(date)"
case .registerEmotion(let emotion):
return baseURL
}
}
var method: HTTPMethod {
switch self {
case .fetchEmotions: .get
case .fetchEmotion: .get
case .registerEmotion: .post
}
}
var headers: [String : String] {
let headers: [String: String] = [
"Content-Type": "application/json",
"accept": "*/*"
]
return headers
}
var queryParameters: [String : String] {
return [:]
}
var bodyParameters: [String : Any] {
switch self {
case .fetchEmotions:
return [:]
case .fetchEmotion:
return [:]
case .registerEmotion(let emotion):
return ["emotionMarbleType": emotion]
}
}
var isAuthorized: Bool {
return true
}
}