From 9e42686b55c52f682254dddcf6a0aba5a113ac0e Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 9 Sep 2025 09:25:50 +0200 Subject: [PATCH] Documented the AmiiboClient enumeration and the AmiiboServiceError error in the library target. --- .../Public/Enumerations/AmiiboClient.swift | 21 +++++++++++++++++++ .../Public/Errors/AmiiboServiceError.swift | 7 +++++++ 2 files changed, 28 insertions(+) create mode 100644 Sources/Public/Enumerations/AmiiboClient.swift diff --git a/Sources/Public/Enumerations/AmiiboClient.swift b/Sources/Public/Enumerations/AmiiboClient.swift new file mode 100644 index 0000000..79efe29 --- /dev/null +++ b/Sources/Public/Enumerations/AmiiboClient.swift @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------=== +// +// This source file is part of the AmiiboService open source project +// +// Copyright (c) 2024-2025 Röck+Cöde VoF. and the AmiiboAPI project authors +// Licensed under the EUPL 1.2 or later. +// +// See LICENSE for license information +// See CONTRIBUTORS for the list of AmiiboAPI project authors +// +//===----------------------------------------------------------------------=== + +/// A concrete representation of the types of client that a ``AmiiboService`` service can utilize. +/// +/// > important: This enumeration has been defined as a way to avoid exposing the `APIClient` protocol outside the boundaries of this library. +public enum AmiiboClient { + /// A live Amiibo client to interact with the online service. + case live(AmiiboLiveClient = .init()) + ///A mock Amiibo client, for testing purposes. + case mock(AmiiboMockClient) +} diff --git a/Sources/Public/Errors/AmiiboServiceError.swift b/Sources/Public/Errors/AmiiboServiceError.swift index 57d32f4..1481674 100644 --- a/Sources/Public/Errors/AmiiboServiceError.swift +++ b/Sources/Public/Errors/AmiiboServiceError.swift @@ -10,12 +10,19 @@ // //===----------------------------------------------------------------------=== +/// A representation of all the possible errors that the ``AmiiboService`` service could throw. public enum AmiiboServiceError: Error { + /// A bad request has been given to the client. case badRequest + /// A response cannot be decoded. case decoding + /// An online service is not currently available. case notAvailable + /// A response cannot be found. case notFound + /// An undocumented/unsupported error. case undocumented(_ statusCode: Int) + /// An unknown error. case unknown }