-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from lee-yeonwoo/#81CourseUploadAPI
[Feat] #81 - 코스업로드하기 API 연결 완료
- Loading branch information
Showing
6 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -17,7 +17,6 @@ extension Encodable { | |
as? [String: Any] else { | ||
throw NSError() | ||
} | ||
|
||
return dictionary | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...iOS/Runnect-iOS/Network/Dto/CourseDiscoveryDto/RequestDto/CourseUploadingRequestDto.swift
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,15 @@ | ||
// | ||
// CourseUploadingRequestDto.swift | ||
// Runnect-iOS | ||
// | ||
// Created by YEONOO on 2023/01/11. | ||
// | ||
|
||
import Foundation | ||
|
||
// MARK: - CourseUploadingRequestDto | ||
|
||
struct CourseUploadingRequestDto: Codable { | ||
let courseId: Int | ||
let title, description: String | ||
} |
53 changes: 53 additions & 0 deletions
53
Runnect-iOS/Runnect-iOS/Network/Router/CourseDiscoveryRouter/CourseUploadingRouter.swift
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,53 @@ | ||
// | ||
// CourseUploadingRouter.swift | ||
// Runnect-iOS | ||
// | ||
// Created by YEONOO on 2023/01/11. | ||
// | ||
|
||
import Foundation | ||
|
||
import Moya | ||
|
||
enum CourseUploadingRouter { | ||
case courseUploadingData(param: CourseUploadingRequestDto) | ||
} | ||
|
||
extension CourseUploadingRouter: TargetType { | ||
var baseURL: URL { | ||
guard let url = URL(string: Config.baseURL) else { | ||
fatalError("baseURL could not be configured") | ||
} | ||
|
||
return url | ||
} | ||
|
||
var path: String { | ||
switch self { | ||
case .courseUploadingData: | ||
return "/public-course" | ||
} | ||
} | ||
|
||
var method: Moya.Method { | ||
switch self { | ||
case .courseUploadingData: | ||
return .post | ||
} | ||
} | ||
|
||
var task: Moya.Task { | ||
switch self { | ||
case .courseUploadingData(param: let param): | ||
return .requestParameters(parameters: try! param.asParameter(), encoding: JSONEncoding.default) | ||
} | ||
} | ||
|
||
var headers: [String: String]? { | ||
switch self { | ||
case .courseUploadingData: | ||
return Config.headerWithDeviceId | ||
} | ||
} | ||
|
||
} |
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