Improvements on the AmiiboService service type initialization (#12)

This PR addresses the issue #10 as described in the *Possible Solution* section in that issue.

Reviewed-on: #12
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 #12.
This commit is contained in:
2025-09-12 00:13:58 +00:00
committed by Javier Cicchelli
parent 19583290be
commit 3d923982b1
7 changed files with 1341 additions and 283 deletions
@@ -18,17 +18,14 @@ public struct AmiiboService {
// MARK: Properties
/// A client to interact with the endpoints.
private let client: any APIClient
private let client: any AmiiboClient
// MARK: Initializers
/// Initializes this service with a specific client type.
/// - Parameter client: A representation of a client to use to interact with the endpoints.
public init(_ client: AmiiboClient) {
self.client = switch client {
case let .mock(mockClient): mockClient
case let .live(liveClient): liveClient
}
/// - Parameter client: A client to use to interact with the endpoints.
public init(client: some AmiiboClient = AmiiboLiveClient()) {
self.client = client
}
// MARK: Functions