Documented the functions for the AmiiboLiveClient and the AmiiboMockClients types in the library target.

This commit is contained in:
2025-09-10 21:28:26 +02:00
parent acd9d93964
commit ca75993c63
2 changed files with 58 additions and 10 deletions
@@ -37,11 +37,16 @@ public struct AmiiboLiveClient {
} }
// MARK: - APIClient // MARK: - APIClient
// TODO: Remove the documentation from the functions inside the following extension as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
extension AmiiboLiveClient: APIClient { extension AmiiboLiveClient: APIClient {
// MARK: Functions // MARK: Functions
/// Gets a list of amiibo items based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered amiibo items.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getAmiibos( public func getAmiibos(
by filter: AmiiboFilter by filter: AmiiboFilter
) async throws(AmiiboServiceError) -> [Amiibo] { ) async throws(AmiiboServiceError) -> [Amiibo] {
@@ -85,6 +90,10 @@ extension AmiiboLiveClient: APIClient {
} }
} }
/// Gets a list of amiibo series based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered amiibo series.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getAmiiboSeries( public func getAmiiboSeries(
by filter: AmiiboSeriesFilter by filter: AmiiboSeriesFilter
) async throws(AmiiboServiceError) -> [AmiiboSeries] { ) async throws(AmiiboServiceError) -> [AmiiboSeries] {
@@ -122,6 +131,10 @@ extension AmiiboLiveClient: APIClient {
} }
} }
/// Gets a list of amiibo types based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered amiibo types.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getAmiiboTypes( public func getAmiiboTypes(
by filter: AmiiboTypeFilter by filter: AmiiboTypeFilter
) async throws(AmiiboServiceError) -> [AmiiboType] { ) async throws(AmiiboServiceError) -> [AmiiboType] {
@@ -159,6 +172,10 @@ extension AmiiboLiveClient: APIClient {
} }
} }
/// Gets a list of game characters based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered game characters.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getGameCharacters( public func getGameCharacters(
by filter: GameCharacterFilter by filter: GameCharacterFilter
) async throws(AmiiboServiceError) -> [GameCharacter] { ) async throws(AmiiboServiceError) -> [GameCharacter] {
@@ -196,6 +213,10 @@ extension AmiiboLiveClient: APIClient {
} }
} }
/// Gets a list of game series based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered game series.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getGameSeries( public func getGameSeries(
by filter: GameSeriesFilter by filter: GameSeriesFilter
) async throws(AmiiboServiceError) -> [GameSeries] { ) async throws(AmiiboServiceError) -> [GameSeries] {
@@ -233,6 +254,9 @@ extension AmiiboLiveClient: APIClient {
} }
} }
/// Gets the date when the data was last updated.
/// - Returns: A last updated date.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getLastUpdated() async throws(AmiiboServiceError) -> Date { public func getLastUpdated() async throws(AmiiboServiceError) -> Date {
let response: Operations.getLastUpdated.Output let response: Operations.getLastUpdated.Output
@@ -70,11 +70,16 @@ public struct AmiiboMockClient {
} }
// MARK: - APIClient // MARK: - APIClient
// TODO: Remove the documentation from the functions inside the following extension as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
extension AmiiboMockClient: APIClient { extension AmiiboMockClient: APIClient {
// MARK: Functions // MARK: Functions
/// Gets a list of amiibo items based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered amiibo items.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getAmiibos(by filter: AmiiboFilter) async throws(AmiiboServiceError) -> [Amiibo] { public func getAmiibos(by filter: AmiiboFilter) async throws(AmiiboServiceError) -> [Amiibo] {
try throwErrorIfExists() try throwErrorIfExists()
@@ -85,6 +90,10 @@ extension AmiiboMockClient: APIClient {
return amiibos return amiibos
} }
/// Gets a list of amiibo series based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered amiibo series.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getAmiiboSeries(by filter: AmiiboSeriesFilter) async throws(AmiiboServiceError) -> [AmiiboSeries] { public func getAmiiboSeries(by filter: AmiiboSeriesFilter) async throws(AmiiboServiceError) -> [AmiiboSeries] {
try throwErrorIfExists() try throwErrorIfExists()
@@ -95,6 +104,10 @@ extension AmiiboMockClient: APIClient {
return amiiboSeries return amiiboSeries
} }
/// Gets a list of amiibo types based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered amiibo types.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getAmiiboTypes(by filter: AmiiboTypeFilter) async throws(AmiiboServiceError) -> [AmiiboType] { public func getAmiiboTypes(by filter: AmiiboTypeFilter) async throws(AmiiboServiceError) -> [AmiiboType] {
try throwErrorIfExists() try throwErrorIfExists()
@@ -105,6 +118,10 @@ extension AmiiboMockClient: APIClient {
return amiiboTypes return amiiboTypes
} }
/// Gets a list of game characters based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered game characters.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getGameCharacters(by filter: GameCharacterFilter) async throws(AmiiboServiceError) -> [GameCharacter] { public func getGameCharacters(by filter: GameCharacterFilter) async throws(AmiiboServiceError) -> [GameCharacter] {
try throwErrorIfExists() try throwErrorIfExists()
@@ -115,6 +132,10 @@ extension AmiiboMockClient: APIClient {
return gameCharacters return gameCharacters
} }
/// Gets a list of game series based on a given filter.
/// - Parameter filter: A filter to remove unwanted items from the result.
/// - Returns: A list of filtered game series.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getGameSeries(by filter: GameSeriesFilter) async throws(AmiiboServiceError) -> [GameSeries] { public func getGameSeries(by filter: GameSeriesFilter) async throws(AmiiboServiceError) -> [GameSeries] {
try throwErrorIfExists() try throwErrorIfExists()
@@ -125,6 +146,9 @@ extension AmiiboMockClient: APIClient {
return gameSeries return gameSeries
} }
/// Gets the date when the data was last updated.
/// - Returns: A last updated date.
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
public func getLastUpdated() async throws(AmiiboServiceError) -> Date { public func getLastUpdated() async throws(AmiiboServiceError) -> Date {
try throwErrorIfExists() try throwErrorIfExists()