-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
1,917 additions
and
362 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// SearchAPI.swift | ||
// Drink-EG | ||
// | ||
// Created by 이현주 on 8/16/24. | ||
// | ||
|
||
import Foundation | ||
import Moya | ||
|
||
// JWT 토큰을 받을 수 있도록 BasicAPI 정의 | ||
/// 기능 하나 당 API 1개씩 만들기 | ||
/// - API 명세서 기준으로 1 명세서 당 1 API enum 정의하기 | ||
/// - 변경을 한 번 더 해보자. | ||
|
||
enum SearchAPI { | ||
case getWineName(wineName: String) | ||
case getWineInfo(wineId: Int) | ||
case getWineReview(wineId: Int) | ||
} | ||
|
||
extension SearchAPI: TargetType { | ||
var baseURL: URL { | ||
/// 기본 URL 작성 | ||
return URL(string: "https://drinkeg.com/")! | ||
|
||
} | ||
|
||
var path: String { | ||
/// 기본 URL + path 로 URL 구성 | ||
switch self { | ||
/// 동일한 path는 한 case로 처리 가능 | ||
case .getWineName: | ||
return "wine" | ||
case .getWineInfo(let wineId): | ||
return "wine/\(wineId)" | ||
case .getWineReview(let wineId): | ||
return "wine/review/\(wineId)" | ||
} | ||
} | ||
|
||
var method: Moya.Method { | ||
/// 각 case 별로 적합한 method 배정 | ||
switch self { | ||
case .getWineName, .getWineInfo, .getWineReview: | ||
return .get | ||
} | ||
} | ||
|
||
var task: Task { | ||
switch self { | ||
case .getWineName(let wineName): | ||
return .requestParameters(parameters: ["searchName": wineName], encoding: URLEncoding.queryString) | ||
case .getWineInfo, .getWineReview: | ||
return .requestPlain | ||
} | ||
} | ||
|
||
// API 호출 시, header에 token 넣어서 전달 | ||
var headers: [String : String]? { | ||
let jwtToken = "jwt_token_here" | ||
return [ | ||
"Authorization": "Bearer \(jwtToken)", | ||
"Content-type": "application/json" | ||
] | ||
} | ||
|
||
var validationType: ValidationType { | ||
return .successCodes | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-1.03 MB
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/1.imageset/1.png
Binary file not shown.
Binary file removed
BIN
-1.03 MB
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/2.imageset/1 2.png
Binary file not shown.
21 changes: 0 additions & 21 deletions
21
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/2.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
4 changes: 3 additions & 1 deletion
4
...ts/AdSampleImage/1.imageset/Contents.json → .../AdSampleImage/ad1.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "1.png", | ||
"filename" : "Group 415.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Group [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Group [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
|
Binary file added
BIN
+122 KB
...-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/ad1.imageset/Group 415.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+389 KB
.../Drink-EG/Resources/Assets.xcassets/AdSampleImage/ad1.imageset/Group [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+730 KB
.../Drink-EG/Resources/Assets.xcassets/AdSampleImage/ad1.imageset/Group [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion
4
...dSampleImage/green.imageset/Contents.json → .../AdSampleImage/ad2.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "green.png", | ||
"filename" : "Group 415.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Group [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Group [email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
|
Binary file added
BIN
+122 KB
...-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/ad2.imageset/Group 415.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+389 KB
.../Drink-EG/Resources/Assets.xcassets/AdSampleImage/ad2.imageset/Group [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+730 KB
.../Drink-EG/Resources/Assets.xcassets/AdSampleImage/ad2.imageset/Group [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.57 MB
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/blue.imageset/blue.png
Binary file not shown.
Binary file removed
BIN
-1.57 MB
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/green.imageset/green.png
Binary file not shown.
21 changes: 0 additions & 21 deletions
21
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/orange.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-1.57 MB
...-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/orange.imageset/orange.png
Binary file not shown.
21 changes: 0 additions & 21 deletions
21
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/red.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-1.57 MB
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/red.imageset/red.png
Binary file not shown.
21 changes: 0 additions & 21 deletions
21
Drink-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/yellow.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-1.57 MB
...-EG/Drink-EG/Resources/Assets.xcassets/AdSampleImage/yellow.imageset/yellow.png
Binary file not shown.
4 changes: 3 additions & 1 deletion
4
...AdSampleImage/blue.imageset/Contents.json → ...Icon/icon_location.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "blue.png", | ||
"filename" : "Vector.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
|
Binary file added
BIN
+348 Bytes
Drink-EG/Drink-EG/Resources/Assets.xcassets/Icon/icon_location.imageset/Vector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+583 Bytes
...EG/Drink-EG/Resources/Assets.xcassets/Icon/icon_location.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+811 Bytes
...EG/Drink-EG/Resources/Assets.xcassets/Icon/icon_location.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// NoteResponse.swift | ||
// Drink-EG | ||
// | ||
// Created by 김도연 on 8/16/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct NoteResponse : Codable { | ||
let noteId : Int | ||
let wineId : Int | ||
let name : String | ||
let picture : String | ||
let color : String | ||
let sugarContent : Int | ||
let acidity : Int | ||
let tannin : Int | ||
let body : Int | ||
let alcohol : Int | ||
let scentAroma : [String] | ||
let scentTaste : [String] | ||
let scentFinish : [String] | ||
let satisfaction : Double | ||
let review : String? | ||
} | ||
|
||
struct ResponseWrap: Codable { | ||
let result: NoteResponse | ||
} |
Oops, something went wrong.