Improvements on the AmiiboService service type initialization #12

Merged
javier merged 6 commits from improvement/api-client into main 2025-09-12 00:13:59 +00:00
2 changed files with 5 additions and 8 deletions
Showing only changes of commit e5a541206a - Show all commits
@@ -18,17 +18,14 @@ public struct AmiiboService {
// MARK: Properties // MARK: Properties
/// A client to interact with the endpoints. /// A client to interact with the endpoints.
private let client: any APIClient private let client: any AmiiboClient
// MARK: Initializers // MARK: Initializers
/// Initializes this service with a specific client type. /// Initializes this service with a specific client type.
/// - Parameter client: A representation of a client to use to interact with the endpoints. /// - Parameter client: A client to use to interact with the endpoints.
public init(_ client: AmiiboClient) { public init(client: some AmiiboClient = AmiiboLiveClient()) {
self.client = switch client { self.client = client
case let .mock(mockClient): mockClient
case let .live(liveClient): liveClient
}
} }
// MARK: Functions // MARK: Functions
@@ -24,7 +24,7 @@ struct AmiiboServiceLiveTests {
// MARK: Initializers // MARK: Initializers
init() { init() {
self.service = .init(.live()) self.service = .init()
} }
// MARK: Functions tests // MARK: Functions tests