Fixed and updated the documentation for the package.

This commit is contained in:
2026-06-11 13:35:22 +02:00
parent 6ff274d992
commit 9acbc82297
3 changed files with 49 additions and 2 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ To use this library, add it as a dependency in the `Package.swift` file:
let package = Package( let package = Package(
// name, platforms, products, etc. // name, platforms, products, etc.
dependencies: [ dependencies: [
.package(url: "https://github.com/rock-n-code/amiibo-service", from: "1.4.1"), .package(url: "https://github.com/rock-n-code/amiibo-service", from: "1.4.2"),
// other dependencies // other dependencies
], ],
targets: [ targets: [
@@ -0,0 +1,22 @@
# ``AmiiboService/AmiiboService``
## Topics
### Initializers
- ``AmiiboService/AmiiboService/init(client:)``
### Amiibo endpoints
- ``AmiiboService/AmiiboService/getAmiibos(_:)``
- ``AmiiboService/AmiiboService/getAmiiboSeries(_:)``
- ``AmiiboService/AmiiboService/getAmiiboTypes(_:)``
### Game endpoints
- ``AmiiboService/AmiiboService/getGameCharacters(_:)``
- ``AmiiboService/AmiiboService/getGameSeries(_:)``
### System endpoints
- ``AmiiboService/AmiiboService/getLastUpdated()``
@@ -18,7 +18,7 @@ To use the `AmiiboService` library with your package, then add it as a dependenc
let package = Package( let package = Package(
// name, platforms, products, etc. // name, platforms, products, etc.
dependencies: [ dependencies: [
.package(url: "https://github.com/rock-n-code/amiibo-service", from: "1.4.1"), .package(url: "https://github.com/rock-n-code/amiibo-service", from: "1.4.2"),
// other dependencies // other dependencies
], ],
targets: [ targets: [
@@ -37,6 +37,31 @@ It is also possible to use the `AmiiboService` library with your app in Xcode, t
> important: Swift 5.10 or higher is required in order to compile this library. > important: Swift 5.10 or higher is required in order to compile this library.
## Usage
Create an ``AmiiboService`` instance and call any of its endpoints. Each endpoint accepts an optional filter and, when omitted, returns the full set of results:
```swift
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()
```
## Caching ## Caching
The [Amiibo API](https://www.amiiboapi.org) recommends that consumers who call the API regularly implement caching on their systems. This library does not include a built-in cache, leaving the choice of caching strategy to the consumer. The following examples show two common approaches. The [Amiibo API](https://www.amiiboapi.org) recommends that consumers who call the API regularly implement caching on their systems. This library does not include a built-in cache, leaving the choice of caching strategy to the consumer. The following examples show two common approaches.