Open API specification improvements and License update (#17)

This PR contains the work done to:
* improve the overall `OpenAPI` specification documentation describing the `Amiibo API` service;
* update the `AmiiboFilter` type to include the `head` and `tail` properties;
* update the error handling of the errors coming up from the service;
* update its license to Apache v2.0;
* regenerate the Github Pages documentation.

Reviewed-on: #17
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 #17.
This commit is contained in:
2025-10-07 22:07:55 +00:00
committed by Javier Cicchelli
parent c303e1f8f3
commit 40afefed15
127 changed files with 676 additions and 583 deletions
@@ -182,10 +182,12 @@ private extension AmiiboLiveClient {
amiiboSeries: filter.series,
character: filter.gameCharacter,
gameseries: filter.gameSeries,
head: filter.head,
id: filter.identifier,
name: filter.name,
showgames: filter.showGames,
showusage: filter.showUsage,
tail: filter.tail,
_type: filter.type
)))
} catch {
@@ -200,6 +202,10 @@ private extension AmiiboLiveClient {
}
case .badRequest:
throw AmiiboServiceError.badRequest
case .notFound:
throw AmiiboServiceError.notFound
case .internalServerError:
throw AmiiboServiceError.notAvailable
case let .undocumented(statusCode, _):
throw AmiiboServiceError.undocumented(statusCode)
}
@@ -363,6 +369,12 @@ private extension AmiiboLiveClient {
case let .json(output):
return output.lastUpdated
}
case .badRequest:
throw AmiiboServiceError.badRequest
case .notFound:
throw AmiiboServiceError.notFound
case .internalServerError:
throw AmiiboServiceError.notAvailable
case let .undocumented(statusCode, _):
throw AmiiboServiceError.undocumented(statusCode)
}
@@ -15,19 +15,22 @@ public struct AmiiboFilter: Sendable {
// MARK: Properties
/// A game character to return, if any.
/// A game character to filter the result, if any.
public let gameCharacter: String?
/// A game series to return, if any.
/// A game series to filter the result, if any.
public let gameSeries: String?
/// A first part of an identifier to filter the result, if any.
public let head: String?
/// An amiibo identifier to return, if any.
/// An amiibo identifier to filter the result, if any.
public let identifier: String?
/// An amiibo name to return, if any.
/// An amiibo name to filter the result, if any.
public let name: String?
/// An amiibo series to return, if any.
/// An amiibo series to filter the result, if any.
public let series: String?
/// A flag indicating whether to include games in the response, if any.
@@ -35,23 +38,30 @@ public struct AmiiboFilter: Sendable {
/// A flag indicating whether to include amiibo usages in games in the response, if any.
public let showUsage: Bool?
/// A last part of an identifier to filter the result, if any.
public let tail: String?
/// An amiibo type to return, if any.
/// An amiibo type to filter the result, if any.
public let type: String?
// MARK: Initializers
/// Initializes this filter.
/// - Parameters:
/// - identifier: An amiibo identifier to return, if any.
/// - name: An amiibo name to return, if any.
/// - type: An amiibo type to return, if any.
/// - series: An amiibo series to return, if any.
/// - gameCharacter: A game character to return, if any.
/// - gameSeries: A game series to return, if any.
/// - head: A first part of an identifier to filter the result, if any.
/// - tail: A last part of an identifier to filter the result, if any.
/// - identifier: An amiibo identifier to filter the result, if any.
/// - name: An amiibo name to filter the result, if any.
/// - type: An amiibo type to filter the result, if any.
/// - series: An amiibo series to filter the result, if any.
/// - gameCharacter: A game character to filter the result, if any.
/// - gameSeries: A game series to filter the result, if any.
/// - showGames: A flag indicating whether to include games in the response, if any.
/// - showUsage: A flag indicating whether to include amiibo usages in games in the response, if any.
public init(
head: String? = nil,
tail: String? = nil,
identifier: String? = nil,
name: String? = nil,
type: String? = nil,
@@ -63,11 +73,13 @@ public struct AmiiboFilter: Sendable {
) {
self.gameCharacter = gameCharacter
self.gameSeries = gameSeries
self.head = head
self.identifier = identifier
self.name = name
self.series = series
self.showGames = showGames
self.showUsage = showUsage
self.tail = tail
self.type = type
}