This PR contains the work done to implement the `AmiiboClient` struct that conforms to the `Client` protocol coming from the **Communications** library of the [SwiftLibs package](https://github.com/rock-n-code/swift-libs) To provide further detailks about the work done: - [x] added the `parameters` property to all the existing endpoints; - [x] implemented the `AmiiboClient` client and the `AmiiboClientError` error; - [x] implemented some static formatters in the `DateFormatter+Formatter` extension; - [x] updated the `SwiftLibs` package to its latest version. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: #3
36 lines
731 B
Swift
36 lines
731 B
Swift
import Core
|
|
import Foundation
|
|
|
|
extension DateFormatter {
|
|
|
|
// MARK: Formatters
|
|
|
|
static let dateOnly = {
|
|
let formatter = DateFormatter()
|
|
|
|
formatter.timeZone = .gmt
|
|
formatter.dateFormat = .Format.yearMonthDay
|
|
|
|
return formatter
|
|
}()
|
|
|
|
static let dateAndTime = {
|
|
let formatter = DateFormatter()
|
|
|
|
formatter.timeZone = .gmt
|
|
formatter.dateFormat = .Format.dateAndTimeWithMicroseconds
|
|
|
|
return formatter
|
|
}()
|
|
|
|
}
|
|
|
|
// MARK: - String+Format
|
|
|
|
private extension String {
|
|
enum Format {
|
|
static let yearMonthDay = "yyyy-MM-dd"
|
|
static let dateAndTimeWithMicroseconds = "yyyy-MM-dd'T'HH:mm:ss.SSS"
|
|
}
|
|
}
|