Tests updates and other fixes (#27)
This PR contains the work done to update the live test data to its latest version. Plus other improvements have been made: * conformed the `AmiiboServiceError` error to the `LocalizableError` protocol, * improved the `ISODateTimeTranscoder` transcoder to handle the decoding of both ISO dates and timestamps, * removed a force-unwrapped from the `AmiiboLiveClient` type. Reviewed-on: #27 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #27.
This commit is contained in:
@@ -29,10 +29,13 @@ public struct AmiiboLiveClient: Sendable {
|
||||
/// Initializes this client with a transport for performing HTTP operations.
|
||||
/// - Parameter transport: A transport that performs HTTP operations. Defaults to a `URLSessionTransport` using the shared session.
|
||||
public init(transport: any ClientTransport = URLSessionTransport()) {
|
||||
guard let serverURL = try? Servers.Server1.url() else {
|
||||
fatalError("The server URL defined in the OpenAPI specification could not be resolved. Verify that the 'openapi.yaml' server definition is valid.")
|
||||
}
|
||||
|
||||
self.client = .init(
|
||||
// The force unwrapping implemented below assumes that the server definition from the OpenAPI specification is correct.
|
||||
serverURL: try! Servers.Server1.url(),
|
||||
configuration: .init(dateTranscoder: ISOTimestampTranscoder()),
|
||||
serverURL: serverURL,
|
||||
configuration: .init(dateTranscoder: ISODateTimeTranscoder()),
|
||||
transport: transport
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user