Added the "head" and "tail" properties to the AmiiboFilter type in the library target.

This commit is contained in:
2025-10-07 23:56:47 +02:00
parent 9fe5a74206
commit 2c66c3940c
3 changed files with 34 additions and 14 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 {
@@ -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?
/// An amiibo identifier to return, if any.
/// A first part of an identifier to filter the result, if any.
public let head: String?
/// 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.
@@ -36,22 +39,29 @@ public struct AmiiboFilter: Sendable {
/// A flag indicating whether to include amiibo usages in games in the response, if any.
public let showUsage: Bool?
/// An amiibo type to return, if any.
/// A last part of an identifier to filter the result, if any.
public let tail: String?
/// 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
}
@@ -545,6 +545,10 @@ enum Input {
/// A list of amiibo filters to input to the `assertAmiibos` assertion.
static let amiibos: [AmiiboFilter] = [
.init(),
.init(head: "00000000"),
.init(head: "0000"),
.init(tail: "00000002"),
.init(tail: "0002"),
.init(identifier: "0000000000000002"),
.init(name: "zelda"),
.init(name: "Something"),
@@ -579,6 +583,8 @@ enum Input {
]
/// A list of amiibo series filters to input to the `assertAmiibosThrows` assertion.
static let amiibosThrows: [AmiiboFilter] = [
.init(head: .empty),
.init(tail: .empty),
.init(identifier: "0000000000000000"),
.init(identifier: "0000000"),
.init(identifier: .empty),
@@ -651,9 +657,9 @@ enum Input {
enum Output {
/// A list of number of items that are expected from the `assertAmiibos` assertion.
static let amiibos: [Int] = [.totalAmiibos, 1, 5, .zero, 7, .totalAmiibos, 235, 235, .zero, .zero, .zero, .zero, 96, 26, .zero, .zero, 25, .totalAmiibos, 12, 6, .zero, .zero, .zero, .totalAmiibos, 49, 32, .zero, .zero, 147, .totalAmiibos, .totalAmiibos, .totalAmiibos]
static let amiibos: [Int] = [.totalAmiibos, 7, 7, 1, 1, 1, 5, .zero, 7, .totalAmiibos, 235, 235, .zero, .zero, .zero, .zero, 96, 26, .zero, .zero, 25, .totalAmiibos, 12, 6, .zero, .zero, .zero, .totalAmiibos, 49, 32, .zero, .zero, 147, .totalAmiibos, .totalAmiibos, .totalAmiibos]
/// A list of errors are expected to be thrown from the `assertAmiibosThrows` assertion.
static let amiibosThrows: [AmiiboServiceError] = [.decoding, .decoding, .badRequest, .badRequest, .badRequest, .badRequest, .badRequest]
static let amiibosThrows: [AmiiboServiceError] = [.badRequest, .badRequest, .decoding, .decoding, .badRequest, .badRequest, .badRequest, .badRequest, .badRequest]
/// A list of number of items that are expected from the `assertAmiiboSeries` assertion.
static let amiiboSeries: [Int] = [.totalAmiiboSeries, 1, 1, 1, .totalAmiiboSeries]
/// A list of errors are expected to be thrown from the `assertAmiiboSeriesThrows` assertion.