{"primaryContentSections":[{"kind":"content","content":[{"level":2,"type":"heading","anchor":"Overview","text":"Overview"},{"type":"paragraph","inlineContent":[{"type":"codeVoice","code":"AmiiboService"},{"type":"text","text":" fetches data from the "},{"type":"reference","identifier":"https:\/\/www.amiiboapi.org","isActive":true},{"type":"text","text":" and returns it as Swift models."}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"The library does not expose a generated client that maps one-to-one to the REST endpoints. Instead, "},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/AmiiboService","isActive":true},{"type":"text","text":" offers one method per resource, takes a typed filter, returns sorted models, and throws a single "},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/AmiiboServiceError","isActive":true},{"type":"text","text":" type."}]},{"level":2,"type":"heading","anchor":"Installation","text":"Installation"},{"type":"paragraph","inlineContent":[{"type":"text","text":"Add the package and the "},{"type":"codeVoice","code":"AmiiboService"},{"type":"text","text":" product to "},{"type":"codeVoice","code":"Package.swift"},{"type":"text","text":":"}]},{"type":"codeListing","syntax":"swift","code":["let package = Package("," \/\/ name, platforms, products, etc."," dependencies: ["," .package(url: \"https:\/\/github.com\/rock-n-code\/amiibo-service\", from: \"2.0.0\"),"," ],"," targets: ["," .target("," name: \"SomeTarget\","," dependencies: ["," .product(name: \"AmiiboService\", package: \"amiibo-service\"),"," ]"," ),"," ]",")"]},{"type":"paragraph","inlineContent":[{"type":"text","text":"In Xcode, add the package URL under "},{"inlineContent":[{"type":"text","text":"File › Add Package Dependencies…"}],"type":"strong"},{"type":"text","text":"."}]},{"name":"Important","type":"aside","content":[{"inlineContent":[{"type":"text","text":"Requires Swift 6.2 or later, and iOS 13, macOS 10.15, tvOS 13, visionOS 1, or watchOS 6 or later."}],"type":"paragraph"}],"style":"important"},{"level":2,"type":"heading","anchor":"Usage","text":"Usage"},{"type":"paragraph","inlineContent":[{"type":"text","text":"Create an "},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/AmiiboService","isActive":true},{"type":"text","text":" and call its methods. When you omit the filter, the method returns every item:"}]},{"type":"codeListing","syntax":"swift","code":["import AmiiboService","","let service = AmiiboService()","","\/\/ All amiibos","let amiibos = try await service.getAmiibos()","","\/\/ Amiibos whose name contains \"zelda\"","let zeldaAmiibos = try await service.getAmiibos(.init(name: \"zelda\"))","","\/\/ Amiibo series, types, game characters, and game series","let series = try await service.getAmiiboSeries()","let types = try await service.getAmiiboTypes()","let characters = try await service.getGameCharacters()","let gameSeries = try await service.getGameSeries()","","\/\/ Date of the last data update (UTC)","let lastUpdated = try await service.getLastUpdated()"]},{"type":"paragraph","inlineContent":[{"type":"text","text":"Results are sorted in ascending order by "},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/identifier","isActive":true},{"type":"text","text":" or by "},{"type":"codeVoice","code":"key"},{"type":"text","text":"."}]},{"level":2,"type":"heading","anchor":"Error-handling","text":"Error handling"},{"type":"paragraph","inlineContent":[{"type":"text","text":"Every method throws "},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/AmiiboServiceError","isActive":true},{"type":"text","text":". When nothing matches, "},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/AmiiboService\/getAmiibos(_:)","isActive":true},{"type":"text","text":"returnsanemptyarray,whiletheotherlis