Move the AmiiboMockClient client type to an internal scope #10

Closed
opened 2025-09-11 09:13:37 +00:00 by javier · 1 comment
Owner

Summary

After careful consideration, it is required to move the AmiiboMockClient client type out of the public scope of the library, as this is a type that only should be used for testing purposes by the SPM package.

Explanation

It was assumed that exposing the APIClient protocol publicly would be an anti-pattern, so for that reason the AmiiboClient enumeration type that provides both a mock and a live client, each case representing either a AmiiboMockClient and a AmiiboLiveClient client types, is being expose by the library. After a review of this particular decision, the conclusion is that the AmiiboClient enumeration and the AmiiboMockClient should not be exposed at all.

Posible solution

To improve the API design of the public interface, the following actions should be done:

  1. Rename the APIClient protocol as AmiiboClient;
  2. Expose the AmiiboClient protocol publicly;
  3. Remove the AmiiboClient enumeration from the library;
  4. Move the AmiiboMockClient client type to the tests target;
  5. Update the initializer for the AmiiboService service type.
# Summary After careful consideration, it is required to move the `AmiiboMockClient` client type out of the public scope of the library, as this is a type that only should be used for testing purposes by the SPM package. # Explanation It was assumed that exposing the `APIClient` protocol publicly would be an anti-pattern, so for that reason the `AmiiboClient` enumeration type that provides both a `mock` and a `live` client, each case representing either a `AmiiboMockClient` and a `AmiiboLiveClient` client types, is being expose by the library. After a review of this particular decision, the conclusion is that the `AmiiboClient` enumeration and the `AmiiboMockClient` should not be exposed at all. # Posible solution To improve the API design of the public interface, the following actions should be done: 1. Rename the `APIClient` protocol as `AmiiboClient`; 2. Expose the `AmiiboClient` protocol publicly; 3. Remove the `AmiiboClient` enumeration from the library; 4. Move the `AmiiboMockClient` client type to the tests target; 5. Update the initializer for the `AmiiboService` service type.
javier added the Kind/Enhancement
Priority
High
labels 2025-09-11 09:13:37 +00:00
javier self-assigned this 2025-09-11 09:13:37 +00:00
Author
Owner

Merged in PR #12.

Merged in PR #12.
Sign in to join this conversation.