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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user