Files
amiibo-service/docs/data/documentation/amiiboservice.json
T

1 line
20 KiB
JSON
Raw Normal View History

{"sections":[],"primaryContentSections":[{"content":[{"type":"heading","text":"Overview","anchor":"Overview","level":2},{"type":"paragraph","inlineContent":[{"text":"The ","type":"text"},{"code":"amiibo-service","type":"codeVoice"},{"text":" library is a package that allows the developer to interact with the ","type":"text"},{"type":"reference","identifier":"https:\/\/www.amiiboapi.org","isActive":true},{"text":" backend service seamlessly, by not only providing the ","type":"text"},{"inlineContent":[{"type":"text","text":"service"}],"type":"emphasis"},{"text":" type but also any possible ","type":"text"},{"inlineContent":[{"type":"text","text":"models"}],"type":"emphasis"},{"text":", ","type":"text"},{"inlineContent":[{"type":"text","text":"filters"}],"type":"emphasis"},{"text":", ","type":"text"},{"inlineContent":[{"type":"text","text":"errors"}],"type":"emphasis"},{"text":" and ","type":"text"},{"inlineContent":[{"type":"text","text":"interfaces"}],"type":"emphasis"},{"text":" types that might be needed during implementation.","type":"text"}]},{"type":"heading","text":"Design","anchor":"Design","level":2},{"type":"paragraph","inlineContent":[{"text":"Although it could have been possible to generate a one-to-one RESTful client based on the Open API specification document that describe the available endpoints of the backend service, it was decided to design a ","type":"text"},{"code":"AmiiboService","type":"codeVoice"},{"text":" service type that removes the complexities of the API design imposed by the backend service, and provides the developer with a simple interface, and a seamless experience.","type":"text"}]},{"type":"heading","text":"Installation","anchor":"Installation","level":2},{"type":"paragraph","inlineContent":[{"text":"To use the ","type":"text"},{"code":"AmiiboService","type":"codeVoice"},{"text":" library with your package, then add it as a dependency in the ","type":"text"},{"code":"Package.swift","type":"codeVoice"},{"text":" file:","type":"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\"),"," \/\/ other dependencies"," ],"," targets: ["," .target("," name: \"SomeTarget\", "," dependencies: ["," .product(name: \"AmiiboService\", package: \"amiibo-service\"),"," ]"," )"," \/\/ other targets"," ]",")"]},{"type":"paragraph","inlineContent":[{"text":"It is also possible to use the ","type":"text"},{"code":"AmiiboService","type":"codeVoice"},{"text":" library with your app in Xcode, then add it as a dependency in your Xcode project.","type":"text"}]},{"type":"aside","style":"important","name":"Important","content":[{"inlineContent":[{"type":"text","text":"Swift 6.2 or higher is required in order to compile this library."}],"type":"paragraph"}]},{"type":"heading","text":"Usage","anchor":"Usage","level":2},{"type":"paragraph","inlineContent":[{"text":"Create an ","type":"text"},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/AmiiboService","isActive":true},{"text":" instance and call any of its endpoints. Each endpoint accepts an optional filter and, when omitted, returns the full set of results:","type":"text"}]},{"type":"codeListing","syntax":"swift","code":["import AmiiboService","","let service = AmiiboService()","","\/\/ Fetch all amiibos","let amiibos = try await service.getAmiibos()","","\/\/ Fetch amiibos filtered by name","let zeldaAmiibos = try await service.getAmiibos(.init(name: \"zelda\"))","","\/\/ Fetch 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()","","\/\/ Fetch the last updated timestamp","let lastUpdated = try await service.getLastUpdated()"]},{"type":"heading","te