forked from DO-NOTTO-DO/NotToDo-iOS
-
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
53 changed files
with
142 additions
and
74 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
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
41 changes: 41 additions & 0 deletions
41
NotToDo/NotToDo/Network/API/Achieve/MissionStatisticsAPI.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,41 @@ | ||
// | ||
// MissionStatisticsAPI.swift | ||
// NotToDo | ||
// | ||
// Created by JEONGEUN KIM on 2023/01/12. | ||
// | ||
|
||
import Foundation | ||
|
||
import Moya | ||
|
||
final class MissionStatisticsAPI { | ||
|
||
static let shared: MissionStatisticsAPI = MissionStatisticsAPI() | ||
|
||
private let missionStatisticsProvider = MoyaProvider<AchieveService>(plugins: [MoyaLoggingPlugin()]) | ||
|
||
private init() { } | ||
|
||
public private(set) var missionStatisticsData: GeneralArrayResponse<MissionStatistcsResponse>? | ||
|
||
// MARK: - GET | ||
|
||
func getMissionStatistics(completion: @escaping (GeneralArrayResponse<MissionStatistcsResponse>?) -> Void) { | ||
missionStatisticsProvider.request(.missionStatistics) { result in | ||
switch result { | ||
case .success(let response): | ||
do { | ||
self.missionStatisticsData = try response.map(GeneralArrayResponse<MissionStatistcsResponse>?.self) | ||
guard self.missionStatisticsData != nil else { return } | ||
completion(self.missionStatisticsData) | ||
} catch let err { | ||
print(err.localizedDescription, 500) | ||
} | ||
case .failure(let err): | ||
print(err.localizedDescription) | ||
completion(nil) | ||
} | ||
} | ||
} | ||
} |
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
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
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
14 changes: 14 additions & 0 deletions
14
NotToDo/NotToDo/Network/DataModel/Achieve/AchieveCalendarResponseDTO.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,14 @@ | ||
// | ||
// AchieveCalendarResponse.swift | ||
// NotToDo | ||
// | ||
// Created by JEONGEUN KIM on 2023/01/13. | ||
// | ||
|
||
import Foundation | ||
|
||
// MARK: - AchieveCalendarResponse | ||
struct AchieveCalendarResponse: Codable { | ||
let actionDate: String | ||
let count: Int | ||
} |
File renamed without changes.
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
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
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
Oops, something went wrong.