Compare commits
22 Commits
v1.0.0-rc.1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1488aa151e | |||
| 2442ada4b6 | |||
| b8c0878ca3 | |||
| 61695af072 | |||
| 7e7e194abc | |||
| 2b01ec14bf | |||
| fae4b44698 | |||
| 0d9c9e22a4 | |||
| 4623c13c24 | |||
| 34627840db | |||
| 40afefed15 | |||
| c303e1f8f3 | |||
| 463d15975c | |||
| 8760ff6e12 | |||
| bc0ae63719 | |||
| 3d923982b1 | |||
| 19583290be | |||
| 0af0e3056d | |||
| b39fd8533b | |||
| 410a200661 | |||
| 37c0f3e322 | |||
| 39c6d6e8d6 |
@@ -0,0 +1,24 @@
|
|||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
##
|
||||||
|
## This source file is part of the Amiibo Service open source project
|
||||||
|
##
|
||||||
|
## Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
## Licensed under Apache license v2.0
|
||||||
|
##
|
||||||
|
## See LICENSE for license information
|
||||||
|
## See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0
|
||||||
|
##
|
||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
# --- DOCUMENTATION ---
|
||||||
|
|
||||||
|
DOCC_ARCHIVE_OUTPUT=./${SPM_LIBRARY_TARGET}.doccarchive
|
||||||
|
DOCC_GITHUB_OUTPUT=./docs
|
||||||
|
DOCC_GITHUB_BASE_PATH=amiibo-service
|
||||||
|
DOCC_PREVIEW_URL=http://localhost:8080/documentation/amiiboservice
|
||||||
|
|
||||||
|
# -- SWIFT PACKAGE MANAGER ---
|
||||||
|
|
||||||
|
SPM_LIBRARY_TARGET=AmiiboService
|
||||||
+21
-4
@@ -1,10 +1,21 @@
|
|||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
##
|
||||||
|
## This source file is part of the Amiibo Service open source project
|
||||||
|
##
|
||||||
|
## Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
## Licensed under Apache license v2.0
|
||||||
|
##
|
||||||
|
## See LICENSE for license information
|
||||||
|
## See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0
|
||||||
|
##
|
||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
# Mac OS
|
# Mac OS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.netrc
|
.netrc
|
||||||
|
|
||||||
# Visual Studio Code
|
|
||||||
.vscode
|
|
||||||
|
|
||||||
# Xcode
|
# Xcode
|
||||||
DerivedData/
|
DerivedData/
|
||||||
|
|
||||||
@@ -31,4 +42,10 @@ Packages/
|
|||||||
# hence it is not needed unless you have added a package configuration file to your project
|
# hence it is not needed unless you have added a package configuration file to your project
|
||||||
.swiftpm
|
.swiftpm
|
||||||
.swiftpm/configuration/registries.json
|
.swiftpm/configuration/registries.json
|
||||||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
# DocC documentation
|
||||||
|
*.doccarchive
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
##
|
||||||
|
## This source file is part of the Amiibo Service open source project
|
||||||
|
##
|
||||||
|
## Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
## Licensed under Apache license v2.0
|
||||||
|
##
|
||||||
|
## See LICENSE for license information
|
||||||
|
## See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0
|
||||||
|
##
|
||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
version: 1
|
||||||
|
external_links:
|
||||||
|
documentation: "https://rock-n-code.github.io/amiibo-service/documentation/amiiboservice/"
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
For the purpose of tracking copyright, this is the list of individuals and
|
For the purpose of tracking copyright, this is the list of individuals and
|
||||||
organizations who have contributed source code to this Swift package.
|
organizations who have contributed source code to amiibo-service.
|
||||||
|
|
||||||
For employees of an organization/company where the copyright of work done
|
For employees of an organization/company where the copyright of work done
|
||||||
by employees of that company is held by the company itself, only the company
|
by employees of that company is held by the company itself, only the company
|
||||||
|
|||||||
@@ -1,287 +1,201 @@
|
|||||||
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
Apache License
|
||||||
EUPL © the European Union 2007, 2016
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
|
|
||||||
below) which is provided under the terms of this Licence. Any use of the Work,
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
other than as authorised under this Licence is prohibited (to the extent such
|
|
||||||
use is covered by a right of the copyright holder of the Work).
|
1. Definitions.
|
||||||
|
|
||||||
The Work is provided under the terms of this Licence when the Licensor (as
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
defined below) has placed the following notice immediately following the
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
copyright notice for the Work:
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
Licensed under the EUPL
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
or has expressed by any other means his willingness to license under the EUPL.
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
1. Definitions
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
In this Licence, the following terms have the following meaning:
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
- ‘The Licence’: this Licence.
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
- ‘The Original Work’: the work or software distributed or communicated by the
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
Licensor under this Licence, available as Source Code and also as Executable
|
exercising permissions granted by this License.
|
||||||
Code as the case may be.
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
- ‘Derivative Works’: the works or software that could be created by the
|
including but not limited to software source code, documentation
|
||||||
Licensee, based upon the Original Work or modifications thereof. This Licence
|
source, and configuration files.
|
||||||
does not define the extent of modification or dependence on the Original Work
|
|
||||||
required in order to classify a work as a Derivative Work; this extent is
|
"Object" form shall mean any form resulting from mechanical
|
||||||
determined by copyright law applicable in the country mentioned in Article 15.
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
- ‘The Work’: the Original Work or its Derivative Works.
|
and conversions to other media types.
|
||||||
|
|
||||||
- ‘The Source Code’: the human-readable form of the Work which is the most
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
convenient for people to study and modify.
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
- ‘The Executable Code’: any code which has generally been compiled and which is
|
(an example is provided in the Appendix below).
|
||||||
meant to be interpreted by a computer as a program.
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
- ‘The Licensor’: the natural or legal person that distributes or communicates
|
form, that is based on (or derived from) the Work and for which the
|
||||||
the Work under the Licence.
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
- ‘Contributor(s)’: any natural or legal person who modifies the Work under the
|
of this License, Derivative Works shall not include works that remain
|
||||||
Licence, or otherwise contributes to the creation of a Derivative Work.
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
|
|
||||||
the Work under the terms of the Licence.
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
renting, distributing, communicating, transmitting, or otherwise making
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
available, online or offline, copies of the Work or providing access to its
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
essential functionalities at the disposal of any other natural or legal
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
person.
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
2. Scope of the rights granted by the Licence
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
sublicensable licence to do the following, for the duration of copyright vested
|
excluding communication that is conspicuously marked or otherwise
|
||||||
in the Original Work:
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
- use the Work in any circumstance and for all usage,
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
- reproduce the Work,
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
- modify the Work, and make Derivative Works based upon the Work,
|
subsequently incorporated within the Work.
|
||||||
- communicate to the public, including the right to make available or display
|
|
||||||
the Work or copies thereof to the public and perform publicly, as the case may
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
be, the Work,
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
- distribute the Work or copies thereof,
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
- lend and rent the Work or copies thereof,
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
- sublicense rights in the Work or copies thereof.
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
Those rights can be exercised on any media, supports and formats, whether now
|
|
||||||
known or later invented, as far as the applicable law permits so.
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
In the countries where moral rights apply, the Licensor waives his right to
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
exercise his moral right to the extent allowed by law in order to make effective
|
(except as stated in this section) patent license to make, have made,
|
||||||
the licence of the economic rights here above listed.
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
|
by such Contributor that are necessarily infringed by their
|
||||||
any patents held by the Licensor, to the extent necessary to make use of the
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
rights granted on the Work under this Licence.
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
3. Communication of the Source Code
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
The Licensor may provide the Work either in its Source Code form, or as
|
or contributory patent infringement, then any patent licenses
|
||||||
Executable Code. If the Work is provided as Executable Code, the Licensor
|
granted to You under this License for that Work shall terminate
|
||||||
provides in addition a machine-readable copy of the Source Code of the Work
|
as of the date such litigation is filed.
|
||||||
along with each copy of the Work that the Licensor distributes or indicates, in
|
|
||||||
a notice following the copyright notice attached to the Work, a repository where
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
the Source Code is easily and freely accessible for as long as the Licensor
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
continues to distribute or communicate the Work.
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
4. Limitations on copyright
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
Nothing in this Licence is intended to deprive the Licensee of the benefits from
|
Derivative Works a copy of this License; and
|
||||||
any exception or limitation to the exclusive rights of the rights owners in the
|
|
||||||
Work, of the exhaustion of those rights or of other applicable limitations
|
(b) You must cause any modified files to carry prominent notices
|
||||||
thereto.
|
stating that You changed the files; and
|
||||||
|
|
||||||
5. Obligations of the Licensee
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
The grant of the rights mentioned above is subject to some restrictions and
|
attribution notices from the Source form of the Work,
|
||||||
obligations imposed on the Licensee. Those obligations are the following:
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
Attribution right: The Licensee shall keep intact all copyright, patent or
|
|
||||||
trademarks notices and all notices that refer to the Licence and to the
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
disclaimer of warranties. The Licensee must include a copy of such notices and a
|
distribution, then any Derivative Works that You distribute must
|
||||||
copy of the Licence with every copy of the Work he/she distributes or
|
include a readable copy of the attribution notices contained
|
||||||
communicates. The Licensee must cause any Derivative Work to carry prominent
|
within such NOTICE file, excluding those notices that do not
|
||||||
notices stating that the Work has been modified and the date of modification.
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
Copyleft clause: If the Licensee distributes or communicates copies of the
|
as part of the Derivative Works; within the Source form or
|
||||||
Original Works or Derivative Works, this Distribution or Communication will be
|
documentation, if provided along with the Derivative Works; or,
|
||||||
done under the terms of this Licence or of a later version of this Licence
|
within a display generated by the Derivative Works, if and
|
||||||
unless the Original Work is expressly distributed only under this version of the
|
wherever such third-party notices normally appear. The contents
|
||||||
Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
|
of the NOTICE file are for informational purposes only and
|
||||||
(becoming Licensor) cannot offer or impose any additional terms or conditions on
|
do not modify the License. You may add Your own attribution
|
||||||
the Work or Derivative Work that alter or restrict the terms of the Licence.
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
Compatibility clause: If the Licensee Distributes or Communicates Derivative
|
that such additional attribution notices cannot be construed
|
||||||
Works or copies thereof based upon both the Work and another work licensed under
|
as modifying the License.
|
||||||
a Compatible Licence, this Distribution or Communication can be done under the
|
|
||||||
terms of this Compatible Licence. For the sake of this clause, ‘Compatible
|
You may add Your own copyright statement to Your modifications and
|
||||||
Licence’ refers to the licences listed in the appendix attached to this Licence.
|
may provide additional or different license terms and conditions
|
||||||
Should the Licensee's obligations under the Compatible Licence conflict with
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
his/her obligations under this Licence, the obligations of the Compatible
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
Licence shall prevail.
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
Provision of Source Code: When distributing or communicating copies of the Work,
|
|
||||||
the Licensee will provide a machine-readable copy of the Source Code or indicate
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
a repository where this Source will be easily and freely available for as long
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
as the Licensee continues to distribute or communicate the Work.
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
Legal Protection: This Licence does not grant permission to use the trade names,
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
trademarks, service marks, or names of the Licensor, except as required for
|
the terms of any separate license agreement you may have executed
|
||||||
reasonable and customary use in describing the origin of the Work and
|
with Licensor regarding such Contributions.
|
||||||
reproducing the content of the copyright notice.
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
6. Chain of Authorship
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
The original Licensor warrants that the copyright in the Original Work granted
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
hereunder is owned by him/her or licensed to him/her and that he/she has the
|
|
||||||
power and authority to grant the Licence.
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
Each Contributor warrants that the copyright in the modifications he/she brings
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
to the Work are owned by him/her or licensed to him/her and that he/she has the
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
power and authority to grant the Licence.
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
Each time You accept the Licence, the original Licensor and subsequent
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
Contributors grant You a licence to their contributions to the Work, under the
|
appropriateness of using or redistributing the Work and assume any
|
||||||
terms of this Licence.
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
7. Disclaimer of Warranty
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
The Work is a work in progress, which is continuously improved by numerous
|
unless required by applicable law (such as deliberate and grossly
|
||||||
Contributors. It is not a finished work and may therefore contain defects or
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
‘bugs’ inherent to this type of development.
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
For the above reason, the Work is provided under the Licence on an ‘as is’ basis
|
result of this License or out of the use or inability to use the
|
||||||
and without warranties of any kind concerning the Work, including without
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
limitation merchantability, fitness for a particular purpose, absence of defects
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
or errors, accuracy, non-infringement of intellectual property rights other than
|
other commercial damages or losses), even if such Contributor
|
||||||
copyright as stated in Article 6 of this Licence.
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
This disclaimer of warranty is an essential part of the Licence and a condition
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
for the grant of any rights to the Work.
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
8. Disclaimer of Liability
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
Except in the cases of wilful misconduct or damages directly caused to natural
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
persons, the Licensor will in no event be liable for any direct or indirect,
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
material or moral, damages of any kind, arising out of the Licence or of the use
|
defend, and hold each Contributor harmless for any liability
|
||||||
of the Work, including without limitation, damages for loss of goodwill, work
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
stoppage, computer failure or malfunction, loss of data or any commercial
|
of your accepting any such warranty or additional liability.
|
||||||
damage, even if the Licensor has been advised of the possibility of such damage.
|
|
||||||
However, the Licensor will be liable under statutory product liability laws as
|
END OF TERMS AND CONDITIONS
|
||||||
far such laws apply to the Work.
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
9. Additional agreements
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
While distributing the Work, You may choose to conclude an additional agreement,
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
defining obligations or services consistent with this Licence. However, if
|
replaced with your own identifying information. (Don't include
|
||||||
accepting obligations, You may act only on your own behalf and on your sole
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
responsibility, not on behalf of the original Licensor or any other Contributor,
|
comment syntax for the file format. We also recommend that a
|
||||||
and only if You agree to indemnify, defend, and hold each Contributor harmless
|
file or class name and description of purpose be included on the
|
||||||
for any liability incurred by, or claims asserted against such Contributor by
|
same "printed page" as the copyright notice for easier
|
||||||
the fact You have accepted any warranty or additional liability.
|
identification within third-party archives.
|
||||||
|
|
||||||
10. Acceptance of the Licence
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
The provisions of this Licence can be accepted by clicking on an icon ‘I agree’
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
placed under the bottom of a window displaying the text of this Licence or by
|
you may not use this file except in compliance with the License.
|
||||||
affirming consent in any other similar way, in accordance with the rules of
|
You may obtain a copy of the License at
|
||||||
applicable law. Clicking on that icon indicates your clear and irrevocable
|
|
||||||
acceptance of this Licence and all of its terms and conditions.
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Similarly, you irrevocably accept this Licence and all of its terms and
|
Unless required by applicable law or agreed to in writing, software
|
||||||
conditions by exercising any rights granted to You by Article 2 of this Licence,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
such as the use of the Work, the creation by You of a Derivative Work or the
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
Distribution or Communication by You of the Work or copies thereof.
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
11. Information to the public
|
|
||||||
|
|
||||||
In case of any Distribution or Communication of the Work by means of electronic
|
|
||||||
communication by You (for example, by offering to download the Work from a
|
|
||||||
remote location) the distribution channel or media (for example, a website) must
|
|
||||||
at least provide to the public the information requested by the applicable law
|
|
||||||
regarding the Licensor, the Licence and the way it may be accessible, concluded,
|
|
||||||
stored and reproduced by the Licensee.
|
|
||||||
|
|
||||||
12. Termination of the Licence
|
|
||||||
|
|
||||||
The Licence and the rights granted hereunder will terminate automatically upon
|
|
||||||
any breach by the Licensee of the terms of the Licence.
|
|
||||||
|
|
||||||
Such a termination will not terminate the licences of any person who has
|
|
||||||
received the Work from the Licensee under the Licence, provided such persons
|
|
||||||
remain in full compliance with the Licence.
|
|
||||||
|
|
||||||
13. Miscellaneous
|
|
||||||
|
|
||||||
Without prejudice of Article 9 above, the Licence represents the complete
|
|
||||||
agreement between the Parties as to the Work.
|
|
||||||
|
|
||||||
If any provision of the Licence is invalid or unenforceable under applicable
|
|
||||||
law, this will not affect the validity or enforceability of the Licence as a
|
|
||||||
whole. Such provision will be construed or reformed so as necessary to make it
|
|
||||||
valid and enforceable.
|
|
||||||
|
|
||||||
The European Commission may publish other linguistic versions or new versions of
|
|
||||||
this Licence or updated versions of the Appendix, so far this is required and
|
|
||||||
reasonable, without reducing the scope of the rights granted by the Licence. New
|
|
||||||
versions of the Licence will be published with a unique version number.
|
|
||||||
|
|
||||||
All linguistic versions of this Licence, approved by the European Commission,
|
|
||||||
have identical value. Parties can take advantage of the linguistic version of
|
|
||||||
their choice.
|
|
||||||
|
|
||||||
14. Jurisdiction
|
|
||||||
|
|
||||||
Without prejudice to specific agreement between parties,
|
|
||||||
|
|
||||||
- any litigation resulting from the interpretation of this License, arising
|
|
||||||
between the European Union institutions, bodies, offices or agencies, as a
|
|
||||||
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
|
|
||||||
of Justice of the European Union, as laid down in article 272 of the Treaty on
|
|
||||||
the Functioning of the European Union,
|
|
||||||
|
|
||||||
- any litigation arising between other parties and resulting from the
|
|
||||||
interpretation of this License, will be subject to the exclusive jurisdiction
|
|
||||||
of the competent court where the Licensor resides or conducts its primary
|
|
||||||
business.
|
|
||||||
|
|
||||||
15. Applicable Law
|
|
||||||
|
|
||||||
Without prejudice to specific agreement between parties,
|
|
||||||
|
|
||||||
- this Licence shall be governed by the law of the European Union Member State
|
|
||||||
where the Licensor has his seat, resides or has his registered office,
|
|
||||||
|
|
||||||
- this licence shall be governed by Belgian law if the Licensor has no seat,
|
|
||||||
residence or registered office inside a European Union Member State.
|
|
||||||
|
|
||||||
Appendix
|
|
||||||
|
|
||||||
‘Compatible Licences’ according to Article 5 EUPL are:
|
|
||||||
|
|
||||||
- GNU General Public License (GPL) v. 2, v. 3
|
|
||||||
- GNU Affero General Public License (AGPL) v. 3
|
|
||||||
- Open Software License (OSL) v. 2.1, v. 3.0
|
|
||||||
- Eclipse Public License (EPL) v. 1.0
|
|
||||||
- CeCILL v. 2.0, v. 2.1
|
|
||||||
- Mozilla Public Licence (MPL) v. 2
|
|
||||||
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
|
||||||
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
|
|
||||||
works other than software
|
|
||||||
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
|
||||||
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
|
|
||||||
Reciprocity (LiLiQ-R+).
|
|
||||||
|
|
||||||
The European Commission may update this Appendix to later versions of the above
|
|
||||||
licences without producing a new version of the EUPL, as long as they provide
|
|
||||||
the rights granted in Article 2 of this Licence and protect the covered Source
|
|
||||||
Code from exclusive appropriation.
|
|
||||||
|
|
||||||
All other changes or additions to this Appendix require the production of a new
|
|
||||||
EUPL version.
|
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
# ===----------------------------------------------------------------------===
|
## ===----------------------------------------------------------------------===
|
||||||
#
|
##
|
||||||
# This source file is part of the AmiiboAPI open source project
|
## This source file is part of the Amiibo Service open source project
|
||||||
#
|
##
|
||||||
# Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
## Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
# Licensed under the EUPL 1.2 or later.
|
## Licensed under Apache license v2.0
|
||||||
#
|
##
|
||||||
# See LICENSE for license information
|
## See LICENSE for license information
|
||||||
# See CONTRIBUTORS for the list of AmiiboAPI project authors
|
## See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
#
|
##
|
||||||
# ===----------------------------------------------------------------------===
|
## SPDX-License-Identifier: Apache-2.0
|
||||||
|
##
|
||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
# ENVIRONMENT VARIABLES
|
# ENVIRONMENT VARIABLES
|
||||||
|
|
||||||
@@ -17,30 +19,80 @@ environment ?= .env
|
|||||||
include $(environment)
|
include $(environment)
|
||||||
export $(shell sed 's/=.*//' $(environment))
|
export $(shell sed 's/=.*//' $(environment))
|
||||||
|
|
||||||
# IDE
|
# LIBRARY
|
||||||
|
|
||||||
open-in-xcode: ## Opens this package with Xcode
|
lib-build: ## Builds the library
|
||||||
@open -a Xcode Package.swift
|
@swift build
|
||||||
|
|
||||||
open-in-vscode: ## Opens this package with Visual Studio Code
|
lib-release: ## Releases the library
|
||||||
@code .
|
@swift build -c release
|
||||||
|
|
||||||
|
lib-test: ## Runs the unit tests for the library
|
||||||
|
@swift test \
|
||||||
|
--disable-xctest \
|
||||||
|
--enable-code-coverage \
|
||||||
|
--enable-swift-testing \
|
||||||
|
--parallel
|
||||||
|
|
||||||
# SWIFT PACKAGE MANAGER
|
# SWIFT PACKAGE MANAGER
|
||||||
|
|
||||||
package-build: ## Builds the project locally
|
pkg-clean: ## Deletes built SPM artifacts of the package
|
||||||
@swift build
|
|
||||||
|
|
||||||
package-clean: ## Deletes built SPM artifacts from the package
|
|
||||||
@swift package clean
|
@swift package clean
|
||||||
|
|
||||||
package-outdated: ## Lists the SPM package dependencies that can be updated
|
pkg-reset: ## Resets the complete SPM cache/build folder of the package
|
||||||
@swift package update --dry-run
|
|
||||||
|
|
||||||
package-reset: ## Resets the complete SPM cache/build folder from the package
|
|
||||||
@swift package reset
|
@swift package reset
|
||||||
|
|
||||||
package-update: ## Updates the SPM package dependencies
|
pkg-pristine: pkg-clean pkg-reset ## Deletes all built artifacts, caches, and documentations of the package
|
||||||
|
@rm -drf $(DOCC_ARCHIVE_OUTPUT)
|
||||||
|
@rm -drf $(DOCC_GITHUB_OUTPUT)
|
||||||
|
|
||||||
|
pkg-outdated: ## Lists the SPM package dependencies that can be updated
|
||||||
|
@swift package update --dry-run
|
||||||
|
|
||||||
|
pkg-update: ## Updates the SPM package dependencies
|
||||||
@swift package update
|
@swift package update
|
||||||
|
|
||||||
|
# DOCUMENTATION
|
||||||
|
|
||||||
|
doc-generate: doc-generate-archive doc-generate-github ## Generates the library documentation for both Github and Xcode
|
||||||
|
|
||||||
|
doc-generate-archive: ## Generates the library documentation archive for Xcode
|
||||||
|
@swift package \
|
||||||
|
--allow-writing-to-directory $(DOCC_ARCHIVE_OUTPUT) \
|
||||||
|
generate-documentation \
|
||||||
|
--target $(SPM_LIBRARY_TARGET) \
|
||||||
|
--include-extended-types \
|
||||||
|
--enable-inherited-docs \
|
||||||
|
--output-path $(DOCC_ARCHIVE_OUTPUT)
|
||||||
|
|
||||||
|
doc-generate-github: ## Generates the library documentation for Github
|
||||||
|
@swift package \
|
||||||
|
--allow-writing-to-directory $(DOCC_GITHUB_OUTPUT) \
|
||||||
|
generate-documentation \
|
||||||
|
--target $(SPM_LIBRARY_TARGET) \
|
||||||
|
--disable-indexing \
|
||||||
|
--transform-for-static-hosting \
|
||||||
|
--include-extended-types \
|
||||||
|
--enable-inherited-docs \
|
||||||
|
--hosting-base-path $(DOCC_GITHUB_BASE_PATH) \
|
||||||
|
--output-path $(DOCC_GITHUB_OUTPUT)
|
||||||
|
|
||||||
|
doc-preview: ## Previews the library documentation in Safari
|
||||||
|
@open -a safari $(DOCC_PREVIEW_URL)
|
||||||
|
@swift package \
|
||||||
|
--disable-sandbox \
|
||||||
|
preview-documentation \
|
||||||
|
--target $(SPM_LIBRARY_TARGET) \
|
||||||
|
--include-extended-types \
|
||||||
|
--enable-inherited-docs
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
|
||||||
|
ide-xcode: ## Opens this package with Xcode
|
||||||
|
@open -a Xcode Package.swift
|
||||||
|
|
||||||
|
ide-vscode: ## Opens this package with Visual Studio Code
|
||||||
|
@code .
|
||||||
|
|
||||||
# HELP
|
# HELP
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Amiibo Service Project
|
||||||
|
======================
|
||||||
|
|
||||||
|
Please visit the Amiibo Service web site for more information:
|
||||||
|
|
||||||
|
* https://github.com/rock-n-code/amiibo-service
|
||||||
|
|
||||||
|
Copyright 2026 Röck+Cöde VoF
|
||||||
|
|
||||||
|
The Amiibo Service Project licenses this file to you under the Apache License,
|
||||||
|
version 2.0 (the "License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at:
|
||||||
|
|
||||||
|
https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
+31
-48
@@ -1,21 +1,23 @@
|
|||||||
// swift-tools-version: 5.9
|
// swift-tools-version: 5.10
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===
|
// ===----------------------------------------------------------------------===
|
||||||
//
|
//
|
||||||
// This source file is part of the AmiiboAPI open source project
|
// This source file is part of the Amiibo Service open source project
|
||||||
//
|
//
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
// Licensed under the EUPL 1.2 or later.
|
// Licensed under Apache license v2.0
|
||||||
//
|
//
|
||||||
// See LICENSE for license information
|
// See LICENSE for license information
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: AmiiboAPI.package,
|
name: AmiiboService.package,
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v13),
|
.iOS(.v13),
|
||||||
.macOS(.v10_15),
|
.macOS(.v10_15),
|
||||||
@@ -25,61 +27,42 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
.library(
|
.library(
|
||||||
name: AmiiboAPI.package,
|
name: AmiiboService.package,
|
||||||
targets: [
|
targets: [AmiiboService.target]
|
||||||
AmiiboAPI.target
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(
|
.package(url: "https://github.com/apple/swift-openapi-generator.git", exact: "1.11.0"),
|
||||||
url: "https://github.com/apple/swift-openapi-generator.git",
|
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.5.0"),
|
||||||
from: "1.3.0"
|
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.2"),
|
||||||
),
|
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
|
||||||
.package(
|
|
||||||
url: "https://github.com/apple/swift-openapi-runtime",
|
|
||||||
from: "1.5.0"
|
|
||||||
),
|
|
||||||
.package(
|
|
||||||
url: "https://github.com/apple/swift-openapi-urlsession",
|
|
||||||
from: "1.0.2"
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
name: AmiiboAPI.target,
|
name: AmiiboService.target,
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.product(
|
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
|
||||||
name: "OpenAPIRuntime",
|
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession")
|
||||||
package: "swift-openapi-runtime"
|
|
||||||
),
|
|
||||||
.product(
|
|
||||||
name: "OpenAPIURLSession",
|
|
||||||
package: "swift-openapi-urlsession"
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
path: "Sources",
|
path: "Sources/AmiiboService",
|
||||||
plugins: [
|
plugins: [
|
||||||
.plugin(
|
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
|
||||||
name: "OpenAPIGenerator",
|
|
||||||
package: "swift-openapi-generator"
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
.testTarget(
|
.testTarget(
|
||||||
name: AmiiboAPI.test,
|
name: AmiiboService.test,
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.byName(name: AmiiboAPI.target)
|
.byName(name: AmiiboService.target)
|
||||||
],
|
],
|
||||||
path: "Tests"
|
path: "Tests/AmiiboService"
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
// MARK: - Constants
|
// MARK: - Constants
|
||||||
|
|
||||||
enum AmiiboAPI {
|
enum AmiiboService {
|
||||||
static let package = "amiibo-api"
|
static let package = "amiibo-service"
|
||||||
static let target = "AmiiboAPI"
|
static let target = "AmiiboService"
|
||||||
static let test = "\(AmiiboAPI.target)Tests"
|
static let test = "\(AmiiboService.target)Tests"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,109 @@
|
|||||||
# Amiibo API
|
[](https://swiftpackageindex.com/rock-n-code/amiibo-service)
|
||||||
|
[](https://swiftpackageindex.com/rock-n-code/amiibo-service)
|
||||||
|
|
||||||
|
# Amiibo Service
|
||||||
|
|
||||||
|
A library written entirely with [Swift](https://www.swift.org) that provides everything the developer needs to interact with the [Amiibo API](https://www.amiiboapi.org) backend service.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To use this library, add it as a dependency in the `Package.swift` file:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
let package = Package(
|
||||||
|
// name, platforms, products, etc.
|
||||||
|
dependencies: [
|
||||||
|
.package(url: "https://github.com/rock-n-code/amiibo-service", from: "1.4.1"),
|
||||||
|
// other dependencies
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "SomeTarget",
|
||||||
|
dependencies: [
|
||||||
|
.product(name: "AmiiboService", package: "amiibo-service"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
// other targets
|
||||||
|
]
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
It is also possible to use this library with your app in Xcode by adding it as a dependency in your Xcode project.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Swift 5.10 or higher is required in order to build this library.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```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
|
||||||
|
|
||||||
|
The [Amiibo API](https://www.amiiboapi.org) recommends that consumers who call the API regularly implement caching on their systems. Pass a custom `URLSessionTransport` with a cache-configured `URLSession` to `AmiiboLiveClient`:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import OpenAPIURLSession
|
||||||
|
|
||||||
|
let configuration = URLSessionConfiguration.default
|
||||||
|
|
||||||
|
configuration.urlCache = URLCache(
|
||||||
|
memoryCapacity: 5_000_000,
|
||||||
|
diskCapacity: 50_000_000
|
||||||
|
)
|
||||||
|
|
||||||
|
let transport = URLSessionTransport(
|
||||||
|
configuration: .init(
|
||||||
|
session: URLSession(configuration: configuration)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
let service = AmiiboService(
|
||||||
|
client: AmiiboLiveClient(transport: transport)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
The `AmiiboClient` protocol enables creating custom mock clients for unit testing without network calls. Conform to `AmiiboClient` and inject it into `AmiiboService` via its `init(client:)` initializer:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import AmiiboService
|
||||||
|
|
||||||
|
struct MyMockClient: AmiiboClient {
|
||||||
|
var error: AmiiboServiceError?
|
||||||
|
|
||||||
|
func getAmiibos(
|
||||||
|
by filter: AmiiboFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [Amiibo] {
|
||||||
|
if let error { throw error }
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement remaining protocol requirements...
|
||||||
|
}
|
||||||
|
|
||||||
|
let service = AmiiboService(client: MyMockClient())
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Please refer to the [online documentation](https://rock-n-code.github.io/amiibo-service/documentation/amiiboservice/) for further information about this library.
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# ``Amiibo``
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### Nested Models
|
||||||
|
|
||||||
|
- ``Amiibo/Game``
|
||||||
|
- ``Amiibo/Platform``
|
||||||
|
- ``Amiibo/Release``
|
||||||
|
- ``Amiibo/Usage``
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# ``AmiiboClient``
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### Amiibo endpoints
|
||||||
|
|
||||||
|
- ``AmiiboClient/getAmiibos(by:)``
|
||||||
|
- ``AmiiboClient/getAmiiboSeries(by:)``
|
||||||
|
- ``AmiiboClient/getAmiiboTypes(by:)``
|
||||||
|
|
||||||
|
### Game endpoints
|
||||||
|
|
||||||
|
- ``AmiiboClient/getGameCharacters(by:)``
|
||||||
|
- ``AmiiboClient/getGameSeries(by:)``
|
||||||
|
|
||||||
|
### System endpoints
|
||||||
|
|
||||||
|
- ``AmiiboClient/getLastUpdated()``
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# ``AmiiboLiveClient``
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### Initializers
|
||||||
|
|
||||||
|
- ``AmiiboLiveClient/init(transport:)``
|
||||||
|
|
||||||
|
### Amiibo endpoints
|
||||||
|
|
||||||
|
- ``AmiiboLiveClient/getAmiibos(by:)``
|
||||||
|
- ``AmiiboLiveClient/getAmiiboSeries(by:)``
|
||||||
|
- ``AmiiboLiveClient/getAmiiboTypes(by:)``
|
||||||
|
|
||||||
|
### Game endpoints
|
||||||
|
|
||||||
|
- ``AmiiboLiveClient/getGameCharacters(by:)``
|
||||||
|
- ``AmiiboLiveClient/getGameSeries(by:)``
|
||||||
|
|
||||||
|
### System endpoints
|
||||||
|
|
||||||
|
- ``AmiiboLiveClient/getLastUpdated()``
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# ``AmiiboServiceError``
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### Request errors
|
||||||
|
|
||||||
|
- ``AmiiboServiceError/badRequest``
|
||||||
|
- ``AmiiboServiceError/cancelled``
|
||||||
|
|
||||||
|
### Response errors
|
||||||
|
|
||||||
|
- ``AmiiboServiceError/decoding``
|
||||||
|
- ``AmiiboServiceError/notFound``
|
||||||
|
|
||||||
|
### Service errors
|
||||||
|
|
||||||
|
- ``AmiiboServiceError/notAvailable``
|
||||||
|
- ``AmiiboServiceError/undocumented(_:)``
|
||||||
|
- ``AmiiboServiceError/unknown``
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
# ``AmiiboService``
|
||||||
|
|
||||||
|
A library that provides everything the developer needs to interact with the **Amiibo API** backend service.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The `amiibo-service` library is a package that allows the developer to interact with the [Amiibo API](https://www.amiiboapi.org) backend service seamlessly, by not only providing the *service* type but also any possible *models*, *filters*, *errors* and *interfaces* types that might be needed during implementation.
|
||||||
|
|
||||||
|
## Design
|
||||||
|
|
||||||
|
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 `AmiiboService` 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.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To use the `AmiiboService` library with your package, then add it as a dependency in the `Package.swift` file:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
let package = Package(
|
||||||
|
// name, platforms, products, etc.
|
||||||
|
dependencies: [
|
||||||
|
.package(url: "https://github.com/rock-n-code/amiibo-service", from: "1.4.1"),
|
||||||
|
// other dependencies
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "SomeTarget",
|
||||||
|
dependencies: [
|
||||||
|
.product(name: "AmiiboService", package: "amiibo-service"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
// other targets
|
||||||
|
]
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
It is also possible to use the `AmiiboService` library with your app in Xcode, then add it as a dependency in your Xcode project.
|
||||||
|
|
||||||
|
> important: Swift 5.10 or higher is required in order to compile this library.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
### URLCache on the transport layer
|
||||||
|
|
||||||
|
Pass a custom `URLSessionTransport` with a cache-configured `URLSession` to ``AmiiboLiveClient``:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import OpenAPIURLSession
|
||||||
|
|
||||||
|
let configuration = URLSessionConfiguration.default
|
||||||
|
|
||||||
|
configuration.urlCache = URLCache(
|
||||||
|
memoryCapacity: 5_000_000,
|
||||||
|
diskCapacity: 50_000_000
|
||||||
|
)
|
||||||
|
|
||||||
|
let transport = URLSessionTransport(
|
||||||
|
configuration: .init(
|
||||||
|
session: URLSession(configuration: configuration)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
let service = AmiiboService(
|
||||||
|
client: AmiiboLiveClient(transport: transport)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
This leverages HTTP cache headers from the server and persists cached responses to disk.
|
||||||
|
|
||||||
|
### Application-level caching
|
||||||
|
|
||||||
|
Alternatively, cache the results returned by ``AmiiboService`` directly in your application using any storage mechanism that fits your needs, such as an in-memory dictionary, a database, or a file-based store.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
The ``AmiiboClient`` protocol enables creating custom mock clients for testing, eliminating the need for network calls in unit tests. Conform to ``AmiiboClient`` and return stubbed data or throw ``AmiiboServiceError`` errors to verify your application's behavior:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import AmiiboService
|
||||||
|
|
||||||
|
struct MyMockClient: AmiiboClient {
|
||||||
|
var error: AmiiboServiceError?
|
||||||
|
|
||||||
|
func getAmiibos(
|
||||||
|
by filter: AmiiboFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [Amiibo] {
|
||||||
|
if let error { throw error }
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement remaining protocol requirements...
|
||||||
|
}
|
||||||
|
|
||||||
|
let service = AmiiboService(client: MyMockClient())
|
||||||
|
```
|
||||||
|
|
||||||
|
Inject the mock client into ``AmiiboService`` via its ``AmiiboService/init(client:)`` initializer to test how your code handles empty results, specific errors, or any other scenario without relying on the live backend.
|
||||||
|
|
||||||
|
## Tasks
|
||||||
|
|
||||||
|
This library offers a set of ready-to-use tasks that simplify the interaction with the library, which the developer can use from any `Terminal` application.
|
||||||
|
|
||||||
|
> Tip: To show the available list of tasks, plus display some explanations about each and every one of them; please enter the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ make
|
||||||
|
```
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### Service
|
||||||
|
|
||||||
|
- ``AmiiboService``
|
||||||
|
|
||||||
|
### Clients
|
||||||
|
|
||||||
|
- ``AmiiboClient``
|
||||||
|
- ``AmiiboLiveClient``
|
||||||
|
|
||||||
|
### Models
|
||||||
|
|
||||||
|
- ``Amiibo``
|
||||||
|
- ``AmiiboSeries``
|
||||||
|
- ``AmiiboType``
|
||||||
|
- ``GameCharacter``
|
||||||
|
- ``GameSeries``
|
||||||
|
|
||||||
|
### Filters
|
||||||
|
|
||||||
|
- ``AmiiboFilter``
|
||||||
|
- ``AmiiboSeriesFilter``
|
||||||
|
- ``AmiiboTypeFilter``
|
||||||
|
- ``GameCharacterFilter``
|
||||||
|
- ``GameSeriesFilter``
|
||||||
|
|
||||||
|
### Errors
|
||||||
|
|
||||||
|
- ``AmiiboServiceError``
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension DateFormatter {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// An ISO date formatter.
|
||||||
|
///
|
||||||
|
/// This formatter implements the `yyyy-MM-dd` date format.
|
||||||
|
static let isoDate: DateFormatter = {
|
||||||
|
let formatter = DateFormatter()
|
||||||
|
|
||||||
|
formatter.dateFormat = "yyyy-MM-dd"
|
||||||
|
formatter.timeZone = .init(secondsFromGMT: 0)
|
||||||
|
|
||||||
|
return formatter
|
||||||
|
}()
|
||||||
|
|
||||||
|
/// An ISO timestamp formatter.
|
||||||
|
///
|
||||||
|
/// This formatter implements the `yyyy-MM-dd'T'HH:mm:ss.SSSSSS` custom date format.
|
||||||
|
/// Within the context of this library, this formatter is solely used to decode a date formatted as a timestamp that is returned by the ``AmiiboService/getLastUpdated()`` function.
|
||||||
|
static let isoTimestamp: DateFormatter = {
|
||||||
|
let formatter = DateFormatter()
|
||||||
|
|
||||||
|
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
|
||||||
|
formatter.timeZone = .init(secondsFromGMT: 0)
|
||||||
|
|
||||||
|
return formatter
|
||||||
|
}()
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A protocol that defines filters containing optional `key` and/or `name` values for querying resources.
|
||||||
|
protocol KeyNameFilter {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A key to return, if any.
|
||||||
|
var key: String? { get }
|
||||||
|
|
||||||
|
/// A name to return, if any.
|
||||||
|
var name: String? { get }
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this filter without key or name values.
|
||||||
|
init()
|
||||||
|
|
||||||
|
/// Initializes this filter with a key value.
|
||||||
|
/// - Parameter key: A key to return.
|
||||||
|
init(key: String)
|
||||||
|
|
||||||
|
/// Initializes this filter with a name value.
|
||||||
|
/// - Parameter name: A name to return.
|
||||||
|
init(name: String)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A protocol that defines models containing a `key` and `name` pair.
|
||||||
|
protocol KeyNameModel: Sendable, Hashable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A hexadecimal key that uniquely identifies this model.
|
||||||
|
var key: String { get }
|
||||||
|
|
||||||
|
/// A display name for this model.
|
||||||
|
var name: String { get }
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.Tuple)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import OpenAPIRuntime
|
||||||
|
|
||||||
|
/// A type that allows the decoding and encoding of ISO dates, supporting both the `yyyy-MM-dd'T'HH:mm:ss.SSSSSS` timestamp format and the `yyyy-MM-dd` date-only format.
|
||||||
|
struct ISODateTimeTranscoder {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A formatter to use to decode and encode ISO timestamp dates.
|
||||||
|
private let timestampFormatter: DateFormatter = .isoTimestamp
|
||||||
|
|
||||||
|
/// A formatter to use to decode and encode ISO date-only strings.
|
||||||
|
private let dateFormatter: DateFormatter = .isoDate
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - DateTranscoder
|
||||||
|
|
||||||
|
extension ISODateTimeTranscoder: DateTranscoder {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
/// Encodes a date into an ISO timestamp string.
|
||||||
|
/// - Parameter date: A date to encode.
|
||||||
|
/// - Returns: A string representation of the date in `yyyy-MM-dd'T'HH:mm:ss.SSSSSS` format.
|
||||||
|
func encode(_ date: Date) throws -> String {
|
||||||
|
timestampFormatter.string(from: date)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Decodes an ISO date string into a date, trying the timestamp format first and falling back to the date-only format.
|
||||||
|
/// - Parameter string: A string to decode.
|
||||||
|
/// - Returns: A date parsed from the string.
|
||||||
|
/// - Throws: A `DecodingError` if the string cannot be parsed into a valid date.
|
||||||
|
func decode(_ string: String) throws -> Date {
|
||||||
|
if let date = timestampFormatter.date(from: string) {
|
||||||
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
if let date = dateFormatter.date(from: string) {
|
||||||
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
throw DecodingError.dataCorrupted(.init(
|
||||||
|
codingPath: [],
|
||||||
|
debugDescription: "Expected an ISO date with format 'yyyy-MM-dd'T'HH:mm:ss.SSSSSS' or 'yyyy-MM-dd', but found '\(string)' instead."
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,452 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import OpenAPIRuntime
|
||||||
|
import OpenAPIURLSession
|
||||||
|
|
||||||
|
/// A type that implements a live client to the [Amiibo API](https://www.amiiboapi.org) online service.
|
||||||
|
public struct AmiiboLiveClient: Sendable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A client generated by the OpenAPI Runtime library to perform API calls.
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this client with a transport for performing HTTP operations.
|
||||||
|
/// - Parameter transport: A transport that performs HTTP operations. Defaults to a `URLSessionTransport` using the shared session.
|
||||||
|
public init(transport: any ClientTransport = URLSessionTransport()) {
|
||||||
|
guard let serverURL = try? Servers.Server1.url() else {
|
||||||
|
fatalError("The server URL defined in the OpenAPI specification could not be resolved. Verify that the 'openapi.yaml' server definition is valid.")
|
||||||
|
}
|
||||||
|
|
||||||
|
self.client = .init(
|
||||||
|
serverURL: serverURL,
|
||||||
|
configuration: .init(dateTranscoder: ISODateTimeTranscoder()),
|
||||||
|
transport: transport
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - AmiiboClient
|
||||||
|
// TODO: Remove the documentation from the functions inside the following extension as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
|
||||||
|
|
||||||
|
extension AmiiboLiveClient: AmiiboClient {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
#if swift(>=6.0)
|
||||||
|
/// Gets a list of amiibo items based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo items.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiibos(
|
||||||
|
by filter: AmiiboFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [Amiibo] {
|
||||||
|
try await fetchAmiibos(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboSeries(
|
||||||
|
by filter: AmiiboSeriesFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [AmiiboSeries] {
|
||||||
|
try await fetchAmiiboSeries(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo types based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo types.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboTypes(
|
||||||
|
by filter: AmiiboTypeFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [AmiiboType] {
|
||||||
|
try await fetchAmiiboTypes(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game characters based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game characters.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameCharacters(
|
||||||
|
by filter: GameCharacterFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [GameCharacter] {
|
||||||
|
try await fetchGameCharacters(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameSeries(
|
||||||
|
by filter: GameSeriesFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [GameSeries] {
|
||||||
|
try await fetchGameSeries(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the date when the data was last updated.
|
||||||
|
/// - Returns: A last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getLastUpdated() async throws(AmiiboServiceError) -> Date {
|
||||||
|
try await fetchLastUpdated()
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/// Gets a list of amiibo items based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo items.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiibos(
|
||||||
|
by filter: AmiiboFilter
|
||||||
|
) async throws -> [Amiibo] {
|
||||||
|
try await fetchAmiibos(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboSeries(
|
||||||
|
by filter: AmiiboSeriesFilter
|
||||||
|
) async throws -> [AmiiboSeries] {
|
||||||
|
try await fetchAmiiboSeries(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo types based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo types.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboTypes(
|
||||||
|
by filter: AmiiboTypeFilter
|
||||||
|
) async throws -> [AmiiboType] {
|
||||||
|
try await fetchAmiiboTypes(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game characters based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game characters.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameCharacters(
|
||||||
|
by filter: GameCharacterFilter
|
||||||
|
) async throws -> [GameCharacter] {
|
||||||
|
try await fetchGameCharacters(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameSeries(
|
||||||
|
by filter: GameSeriesFilter
|
||||||
|
) async throws -> [GameSeries] {
|
||||||
|
try await fetchGameSeries(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the date when the data was last updated.
|
||||||
|
/// - Returns: A last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getLastUpdated() async throws -> Date {
|
||||||
|
try await fetchLastUpdated()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
private extension AmiiboLiveClient {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
/// Fetches a list of amiibo items based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of fetched amiibo items filtered, if requested.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func fetchAmiibos(
|
||||||
|
_ filter: AmiiboFilter
|
||||||
|
) async throws -> [Amiibo] {
|
||||||
|
let response: Operations.getAmiibos.Output
|
||||||
|
|
||||||
|
do {
|
||||||
|
response = try await client.getAmiibos(.init(query: .init(
|
||||||
|
id: filter.identifier,
|
||||||
|
head: filter.head,
|
||||||
|
tail: filter.tail,
|
||||||
|
name: filter.name,
|
||||||
|
_type: filter.type,
|
||||||
|
amiiboSeries: filter.series,
|
||||||
|
character: filter.gameCharacter,
|
||||||
|
gameseries: filter.gameSeries,
|
||||||
|
showgames: filter.showGames,
|
||||||
|
showusage: filter.showUsage
|
||||||
|
)))
|
||||||
|
} catch {
|
||||||
|
try handle(error: error)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch response {
|
||||||
|
case let .ok(ok):
|
||||||
|
switch ok.body {
|
||||||
|
case let .json(output):
|
||||||
|
switch output.amiibo {
|
||||||
|
case let .Amiibo(object):
|
||||||
|
return [Amiibo(object)]
|
||||||
|
case let .case2(list):
|
||||||
|
return list
|
||||||
|
.map { Amiibo($0) }
|
||||||
|
.sorted { $0.identifier < $1.identifier }
|
||||||
|
case .none:
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case .badRequest:
|
||||||
|
throw AmiiboServiceError.badRequest
|
||||||
|
case .notFound:
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
case .internalServerError:
|
||||||
|
throw AmiiboServiceError.notAvailable
|
||||||
|
case let .undocumented(statusCode, _):
|
||||||
|
throw AmiiboServiceError.undocumented(statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of amiibo series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of fetched amiibo series filtered, if requested.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func fetchAmiiboSeries(
|
||||||
|
_ filter: AmiiboSeriesFilter
|
||||||
|
) async throws -> [AmiiboSeries] {
|
||||||
|
let response: Operations.getAmiiboSeries.Output
|
||||||
|
|
||||||
|
do {
|
||||||
|
response = try await client.getAmiiboSeries(.init(query: .init(
|
||||||
|
key: filter.key,
|
||||||
|
name: filter.name
|
||||||
|
)))
|
||||||
|
} catch {
|
||||||
|
try handle(error: error)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch response {
|
||||||
|
case let .ok(ok):
|
||||||
|
switch ok.body {
|
||||||
|
case let .json(output):
|
||||||
|
switch output.amiibo {
|
||||||
|
case let .AmiiboSeries(payload):
|
||||||
|
return [AmiiboSeries(payload.value1)]
|
||||||
|
case let .case2(list):
|
||||||
|
return list
|
||||||
|
.map { AmiiboSeries($0.value1) }
|
||||||
|
.sorted { $0.key < $1.key }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case .badRequest:
|
||||||
|
throw AmiiboServiceError.badRequest
|
||||||
|
case .internalServerError:
|
||||||
|
throw AmiiboServiceError.notAvailable
|
||||||
|
case .notFound:
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
case let .undocumented(statusCode, _):
|
||||||
|
throw AmiiboServiceError.undocumented(statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of amiibo types based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of fetched amiibo types filtered, if requested.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func fetchAmiiboTypes(
|
||||||
|
_ filter: AmiiboTypeFilter
|
||||||
|
) async throws -> [AmiiboType] {
|
||||||
|
let response: Operations.getAmiiboTypes.Output
|
||||||
|
|
||||||
|
do {
|
||||||
|
response = try await client.getAmiiboTypes(.init(query: .init(
|
||||||
|
key: filter.key,
|
||||||
|
name: filter.name
|
||||||
|
)))
|
||||||
|
} catch {
|
||||||
|
try handle(error: error)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch response {
|
||||||
|
case let .ok(ok):
|
||||||
|
switch ok.body {
|
||||||
|
case let .json(output):
|
||||||
|
switch output.amiibo {
|
||||||
|
case let .AmiiboType(payload):
|
||||||
|
return [AmiiboType(payload.value1)]
|
||||||
|
case let .case2(list):
|
||||||
|
return list
|
||||||
|
.map { AmiiboType($0.value1) }
|
||||||
|
.sorted { $0.key < $1.key }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case .badRequest:
|
||||||
|
throw AmiiboServiceError.badRequest
|
||||||
|
case .internalServerError:
|
||||||
|
throw AmiiboServiceError.notAvailable
|
||||||
|
case .notFound:
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
case let .undocumented(statusCode, _):
|
||||||
|
throw AmiiboServiceError.undocumented(statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of game characters based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of fetched game characters filtered, if requested.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func fetchGameCharacters(
|
||||||
|
_ filter: GameCharacterFilter
|
||||||
|
) async throws -> [GameCharacter] {
|
||||||
|
let response: Operations.getGameCharacters.Output
|
||||||
|
|
||||||
|
do {
|
||||||
|
response = try await client.getGameCharacters(.init(query: .init(
|
||||||
|
key: filter.key,
|
||||||
|
name: filter.name
|
||||||
|
)))
|
||||||
|
} catch {
|
||||||
|
try handle(error: error)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch response {
|
||||||
|
case let .ok(ok):
|
||||||
|
switch ok.body {
|
||||||
|
case let .json(output):
|
||||||
|
switch output.amiibo {
|
||||||
|
case let .GameCharacter(payload):
|
||||||
|
return [GameCharacter(payload.value1)]
|
||||||
|
case let .case2(list):
|
||||||
|
return list
|
||||||
|
.map { GameCharacter($0.value1) }
|
||||||
|
.sorted { $0.key < $1.key }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case .badRequest:
|
||||||
|
throw AmiiboServiceError.badRequest
|
||||||
|
case .internalServerError:
|
||||||
|
throw AmiiboServiceError.notAvailable
|
||||||
|
case .notFound:
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
case let .undocumented(statusCode, _):
|
||||||
|
throw AmiiboServiceError.undocumented(statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of game series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of fetched game series filtered, if requested.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func fetchGameSeries(
|
||||||
|
_ filter: GameSeriesFilter
|
||||||
|
) async throws -> [GameSeries] {
|
||||||
|
let response: Operations.getGameSeries.Output
|
||||||
|
|
||||||
|
do {
|
||||||
|
response = try await client.getGameSeries(.init(query: .init(
|
||||||
|
key: filter.key,
|
||||||
|
name: filter.name
|
||||||
|
)))
|
||||||
|
} catch {
|
||||||
|
try handle(error: error)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch response {
|
||||||
|
case let .ok(ok):
|
||||||
|
switch ok.body {
|
||||||
|
case let .json(output):
|
||||||
|
switch output.amiibo {
|
||||||
|
case let .GameSeries(payload):
|
||||||
|
return [GameSeries(payload.value1)]
|
||||||
|
case let .case2(list):
|
||||||
|
return list
|
||||||
|
.map { GameSeries($0.value1) }
|
||||||
|
.sorted { $0.key < $1.key }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case .badRequest:
|
||||||
|
throw AmiiboServiceError.badRequest
|
||||||
|
case .internalServerError:
|
||||||
|
throw AmiiboServiceError.notAvailable
|
||||||
|
case .notFound:
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
case let .undocumented(statusCode, _):
|
||||||
|
throw AmiiboServiceError.undocumented(statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches the date when the data was last updated.
|
||||||
|
/// - Returns: A fetched last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func fetchLastUpdated() async throws -> Date {
|
||||||
|
let response: Operations.getLastUpdated.Output
|
||||||
|
|
||||||
|
do {
|
||||||
|
response = try await client.getLastUpdated()
|
||||||
|
} catch {
|
||||||
|
try handle(error: error)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch response {
|
||||||
|
case let .ok(ok):
|
||||||
|
switch ok.body {
|
||||||
|
case let .json(output):
|
||||||
|
return output.lastUpdated
|
||||||
|
}
|
||||||
|
case .internalServerError:
|
||||||
|
throw AmiiboServiceError.notAvailable
|
||||||
|
case let .undocumented(statusCode, _):
|
||||||
|
throw AmiiboServiceError.undocumented(statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Maps a given error to an ``AmiiboServiceError`` error.
|
||||||
|
/// - Parameter error: An error to map.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error that corresponds to the given error.
|
||||||
|
func handle(error: any Error) throws -> Never {
|
||||||
|
switch error {
|
||||||
|
case is CancellationError:
|
||||||
|
throw AmiiboServiceError.cancelled
|
||||||
|
case let clientError as ClientError:
|
||||||
|
switch clientError.underlyingError {
|
||||||
|
case is DecodingError:
|
||||||
|
throw AmiiboServiceError.decoding
|
||||||
|
case let urlError as URLError:
|
||||||
|
switch urlError.code {
|
||||||
|
case .cannotFindHost,
|
||||||
|
.cannotConnectToHost,
|
||||||
|
.dnsLookupFailed,
|
||||||
|
.networkConnectionLost,
|
||||||
|
.notConnectedToInternet,
|
||||||
|
.timedOut:
|
||||||
|
throw AmiiboServiceError.notAvailable
|
||||||
|
default:
|
||||||
|
throw AmiiboServiceError.unknown
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw AmiiboServiceError.unknown
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw AmiiboServiceError.unknown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// A representation of all the possible errors that the ``AmiiboService`` service could throw.
|
||||||
|
public enum AmiiboServiceError: Error {
|
||||||
|
/// The request was malformed or contained invalid filter parameters.
|
||||||
|
case badRequest
|
||||||
|
/// The request was cancelled before a response was received.
|
||||||
|
case cancelled
|
||||||
|
/// The response body could not be decoded into the expected model.
|
||||||
|
case decoding
|
||||||
|
/// The backend service is currently unreachable due to a network or server issue.
|
||||||
|
case notAvailable
|
||||||
|
/// No results were found matching the given filter criteria.
|
||||||
|
case notFound
|
||||||
|
/// The server returned an undocumented HTTP status code.
|
||||||
|
case undocumented(_ statusCode: Int)
|
||||||
|
/// An unexpected error that does not fall into any other category.
|
||||||
|
case unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Equatable
|
||||||
|
|
||||||
|
extension AmiiboServiceError: Equatable {}
|
||||||
|
|
||||||
|
// MARK: - LocalizedError
|
||||||
|
|
||||||
|
extension AmiiboServiceError: LocalizedError {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
public var errorDescription: String? {
|
||||||
|
switch self {
|
||||||
|
case .badRequest: "The request was malformed or contained invalid filter parameters."
|
||||||
|
case .cancelled: "The request was cancelled before a response was received."
|
||||||
|
case .decoding: "The response body could not be decoded into the expected model."
|
||||||
|
case .notAvailable: "The backend service is currently unreachable due to a network or server issue."
|
||||||
|
case .notFound: "No results were found matching the given filter criteria."
|
||||||
|
case .undocumented(let statusCode): "The server returned an undocumented HTTP status code: \(statusCode)."
|
||||||
|
case .unknown: "An unexpected error occurred."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A type that contains values to fine-tune a response when requesting amiibo items.
|
||||||
|
public struct AmiiboFilter: Sendable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A game character to filter the result, if any.
|
||||||
|
public let gameCharacter: String?
|
||||||
|
|
||||||
|
/// 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 filter the result, if any.
|
||||||
|
public let identifier: String?
|
||||||
|
|
||||||
|
/// An amiibo name to filter the result, if any.
|
||||||
|
public let name: String?
|
||||||
|
|
||||||
|
/// 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.
|
||||||
|
public let showGames: Bool?
|
||||||
|
|
||||||
|
/// 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 filter the result, if any.
|
||||||
|
public let type: String?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this filter.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - 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,
|
||||||
|
series: String? = nil,
|
||||||
|
gameCharacter: String? = nil,
|
||||||
|
gameSeries: String? = nil,
|
||||||
|
showGames: Bool? = nil,
|
||||||
|
showUsage: Bool? = nil
|
||||||
|
) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A type that contains values to fine-tune a response when requesting amiibo series.
|
||||||
|
public struct AmiiboSeriesFilter: KeyNameFilter, Sendable {
|
||||||
|
|
||||||
|
// TODO: Remove the documentation from the properties and initializers of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A key to return, if any.
|
||||||
|
public let key: String?
|
||||||
|
|
||||||
|
/// A name to return, if any.
|
||||||
|
public let name: String?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this filter without key or name values.
|
||||||
|
public init() {
|
||||||
|
self.key = nil
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a key value.
|
||||||
|
/// - Parameter key: A key to return.
|
||||||
|
public init(key: String) {
|
||||||
|
self.key = key
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a name value.
|
||||||
|
/// - Parameter name: A name to return.
|
||||||
|
public init(name: String) {
|
||||||
|
self.key = nil
|
||||||
|
self.name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A type that contains values to fine-tune a response when requesting amiibo types.
|
||||||
|
public struct AmiiboTypeFilter: KeyNameFilter, Sendable {
|
||||||
|
|
||||||
|
// TODO: Remove the documentation from the properties and initializers of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A key to return, if any.
|
||||||
|
public let key: String?
|
||||||
|
|
||||||
|
/// A name to return, if any.
|
||||||
|
public let name: String?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this filter without key or name values.
|
||||||
|
public init() {
|
||||||
|
self.key = nil
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a key value.
|
||||||
|
/// - Parameter key: A key to return.
|
||||||
|
public init(key: String) {
|
||||||
|
self.key = key
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a name value.
|
||||||
|
/// - Parameter name: A name to return.
|
||||||
|
public init(name: String) {
|
||||||
|
self.key = nil
|
||||||
|
self.name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A type that contains values to fine-tune a response when requesting game characters.
|
||||||
|
public struct GameCharacterFilter: KeyNameFilter, Sendable {
|
||||||
|
|
||||||
|
// TODO: Remove the documentation from the properties and initializers of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A key to return, if any.
|
||||||
|
public let key: String?
|
||||||
|
|
||||||
|
/// A name to return, if any.
|
||||||
|
public let name: String?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this filter without key or name values.
|
||||||
|
public init() {
|
||||||
|
self.key = nil
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a key value.
|
||||||
|
/// - Parameter key: A key to return.
|
||||||
|
public init(key: String) {
|
||||||
|
self.key = key
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a name value.
|
||||||
|
/// - Parameter name: A name to return.
|
||||||
|
public init(name: String) {
|
||||||
|
self.key = nil
|
||||||
|
self.name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A type that contains values to fine-tune a response when requesting game series.
|
||||||
|
public struct GameSeriesFilter: KeyNameFilter, Sendable {
|
||||||
|
|
||||||
|
// TODO: Remove the documentation from the properties and initializers of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A key to return, if any.
|
||||||
|
public let key: String?
|
||||||
|
|
||||||
|
/// A name to return, if any.
|
||||||
|
public let name: String?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this filter without key or name values.
|
||||||
|
public init() {
|
||||||
|
self.key = nil
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a key value.
|
||||||
|
/// - Parameter key: A key to return.
|
||||||
|
public init(key: String) {
|
||||||
|
self.key = key
|
||||||
|
self.name = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initializes this filter with a name value.
|
||||||
|
/// - Parameter name: A name to return.
|
||||||
|
public init(name: String) {
|
||||||
|
self.key = nil
|
||||||
|
self.name = name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// A model that represents an amiibo.
|
||||||
|
public struct Amiibo: Sendable, Hashable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// The name of the game character associated with this amiibo.
|
||||||
|
public let gameCharacter: String
|
||||||
|
|
||||||
|
/// The name of the game series associated with this amiibo.
|
||||||
|
public let gameSeries: String
|
||||||
|
|
||||||
|
/// The first 8 hexadecimal characters of the amiibo identifier.
|
||||||
|
public let head: String
|
||||||
|
|
||||||
|
/// A URL string pointing to the image of this amiibo.
|
||||||
|
public let image: String
|
||||||
|
|
||||||
|
/// The name of this amiibo.
|
||||||
|
public let name: String
|
||||||
|
|
||||||
|
/// The game platform data for this amiibo, if available.
|
||||||
|
public let platform: Platform?
|
||||||
|
|
||||||
|
/// The release dates of this amiibo across different regions.
|
||||||
|
public let release: Release
|
||||||
|
|
||||||
|
/// The name of the amiibo series this amiibo belongs to.
|
||||||
|
public let series: String
|
||||||
|
|
||||||
|
/// The last 8 hexadecimal characters of the amiibo identifier.
|
||||||
|
public let tail: String
|
||||||
|
|
||||||
|
/// The type of this amiibo (e.g., Figure, Card, Yarn, Band).
|
||||||
|
public let type: String
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.Amiibo) {
|
||||||
|
self.gameCharacter = payload.character
|
||||||
|
self.gameSeries = payload.gameSeries
|
||||||
|
self.head = payload.head
|
||||||
|
self.image = payload.image
|
||||||
|
self.name = payload.name
|
||||||
|
self.platform = .init(
|
||||||
|
payload.gamesSwitch,
|
||||||
|
payload.gamesSwitch2,
|
||||||
|
payload.games3DS,
|
||||||
|
payload.gamesWiiU
|
||||||
|
)
|
||||||
|
self.release = .init(payload.release)
|
||||||
|
self.series = payload.amiiboSeries
|
||||||
|
self.tail = payload.tail
|
||||||
|
self.type = payload._type
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Computed
|
||||||
|
|
||||||
|
/// The full 16-character hexadecimal identifier, composed of the ``head`` and ``tail``.
|
||||||
|
public var identifier: String {
|
||||||
|
head + tail
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A URL constructed from the ``image`` string, if valid.
|
||||||
|
public var imageURL: URL? {
|
||||||
|
.init(string: image)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
extension Amiibo {
|
||||||
|
/// A model that represents a game related to an amiibo.
|
||||||
|
public struct Game: Sendable, Hashable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A list of game identifiers associated with this game.
|
||||||
|
public let identifiers: [String]
|
||||||
|
|
||||||
|
/// The name of this game.
|
||||||
|
public let name: String
|
||||||
|
|
||||||
|
/// A list of amiibo usages within this game, if available.
|
||||||
|
public let usages: [Usage]?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.AmiiboGame) {
|
||||||
|
self.identifiers = payload.gameID
|
||||||
|
self.name = payload.gameName
|
||||||
|
self.usages = {
|
||||||
|
guard let usages = payload.amiiboUsage else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return usages.map { .init($0) }
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
extension Amiibo {
|
||||||
|
/// A model that represents a collection of `Switch`, `Switch 2`, `3DS`, and `Wii U` games related to an amiibo.
|
||||||
|
public struct Platform: Sendable, Hashable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A list of `Switch` games related to an amiibo.
|
||||||
|
public let `switch`: [Game]
|
||||||
|
|
||||||
|
/// A list of `Switch 2` games related to an amiibo.
|
||||||
|
public let switch2: [Game]
|
||||||
|
|
||||||
|
/// A list of `3DS` games related to an amiibo.
|
||||||
|
public let threeDS: [Game]
|
||||||
|
|
||||||
|
/// A list of `Wii U` games related to an amiibo.
|
||||||
|
public let wiiU: [Game]
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model.
|
||||||
|
///
|
||||||
|
/// > important: In case no data is provided, then an instance of this model is not created.
|
||||||
|
///
|
||||||
|
/// - Parameters:
|
||||||
|
/// - switch: A list of `Switch` games related to an amiibo, if any.
|
||||||
|
/// - switch2: A list of `Switch 2` games related to an amiibo, if any.
|
||||||
|
/// - threeDS: A list of `3DS` games related to an amiibo, if any.
|
||||||
|
/// - wiiU: A list of `Wii U` games related to an amiibo, if any.
|
||||||
|
init?(
|
||||||
|
_ `switch`: [Components.Schemas.AmiiboGame]?,
|
||||||
|
_ switch2: [Components.Schemas.AmiiboGame]?,
|
||||||
|
_ threeDS: [Components.Schemas.AmiiboGame]?,
|
||||||
|
_ wiiU: [Components.Schemas.AmiiboGame]?
|
||||||
|
) {
|
||||||
|
guard (`switch` != nil && `switch`?.isEmpty == false)
|
||||||
|
|| (switch2 != nil && switch2?.isEmpty == false)
|
||||||
|
|| (threeDS != nil && threeDS?.isEmpty == false)
|
||||||
|
|| (wiiU != nil && wiiU?.isEmpty == false)
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
self.switch = {
|
||||||
|
guard let `switch` else { return [] }
|
||||||
|
return `switch`.map { .init($0) }
|
||||||
|
}()
|
||||||
|
self.switch2 = {
|
||||||
|
guard let switch2 else { return [] }
|
||||||
|
return switch2.map { .init($0) }
|
||||||
|
}()
|
||||||
|
self.threeDS = {
|
||||||
|
guard let threeDS else { return [] }
|
||||||
|
return threeDS.map { .init($0) }
|
||||||
|
}()
|
||||||
|
self.wiiU = {
|
||||||
|
guard let wiiU else { return [] }
|
||||||
|
return wiiU.map { .init($0) }
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Amiibo {
|
||||||
|
/// A model that represents the regional release dates of an amiibo.
|
||||||
|
public struct Release: Sendable, Hashable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A release date for North America, if any.
|
||||||
|
public let america: Date?
|
||||||
|
|
||||||
|
/// A release date for Australia, if any.
|
||||||
|
public let australia: Date?
|
||||||
|
|
||||||
|
/// A release date for Europe, if any.
|
||||||
|
public let europe: Date?
|
||||||
|
|
||||||
|
/// A release date for Japan, if any.
|
||||||
|
public let japan: Date?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.AmiiboRelease) {
|
||||||
|
self.america = payload.na
|
||||||
|
self.australia = payload.au
|
||||||
|
self.europe = payload.eu
|
||||||
|
self.japan = payload.jp
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
extension Amiibo {
|
||||||
|
/// A model that represents the usage of an amiibo within a certain game.
|
||||||
|
public struct Usage: Sendable, Hashable {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A description of how the amiibo is used within the game.
|
||||||
|
public let explanation: String
|
||||||
|
|
||||||
|
/// A flag that indicates whether the amiibo can save game data.
|
||||||
|
public let isWriteable: Bool
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.AmiiboUsage) {
|
||||||
|
self.explanation = payload.Usage
|
||||||
|
self.isWriteable = payload.write
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A model that represents an amiibo series.
|
||||||
|
public struct AmiiboSeries: KeyNameModel {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// The hexadecimal key that uniquely identifies this amiibo series.
|
||||||
|
public let key: String
|
||||||
|
|
||||||
|
/// The name of this amiibo series.
|
||||||
|
public let name: String
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.Tuple) {
|
||||||
|
self.key = payload.key
|
||||||
|
self.name = payload.name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A model that represents an amiibo type.
|
||||||
|
public struct AmiiboType: KeyNameModel {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// The hexadecimal key that uniquely identifies this amiibo type.
|
||||||
|
public let key: String
|
||||||
|
|
||||||
|
/// The name of this amiibo type (e.g., Figure, Card, Yarn, Band).
|
||||||
|
public let name: String
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.Tuple) {
|
||||||
|
self.key = payload.key
|
||||||
|
self.name = payload.name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A model that represents a game character.
|
||||||
|
public struct GameCharacter: KeyNameModel {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// The hexadecimal key that uniquely identifies this game character.
|
||||||
|
public let key: String
|
||||||
|
|
||||||
|
/// The name of this game character.
|
||||||
|
public let name: String
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.Tuple) {
|
||||||
|
self.key = payload.key
|
||||||
|
self.name = payload.name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
/// A model that represents a game series.
|
||||||
|
public struct GameSeries: KeyNameModel {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// The hexadecimal key that uniquely identifies this game series.
|
||||||
|
public let key: String
|
||||||
|
|
||||||
|
/// The name of this game series.
|
||||||
|
public let name: String
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this model from a given payload.
|
||||||
|
/// - Parameter payload: A payload that contains the values for the model.
|
||||||
|
init(_ payload: Components.Schemas.Tuple) {
|
||||||
|
self.key = payload.key
|
||||||
|
self.name = payload.name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// A protocol that defines API clients containing all available endpoints to interact with.
|
||||||
|
public protocol AmiiboClient {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
#if swift(>=6.0)
|
||||||
|
/// Gets a list of amiibo items based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo items.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getAmiibos(by filter: AmiiboFilter) async throws(AmiiboServiceError) -> [Amiibo]
|
||||||
|
|
||||||
|
/// Gets a list of amiibo series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getAmiiboSeries(by filter: AmiiboSeriesFilter) async throws(AmiiboServiceError) -> [AmiiboSeries]
|
||||||
|
|
||||||
|
/// Gets a list of amiibo types based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo types.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getAmiiboTypes(by filter: AmiiboTypeFilter) async throws(AmiiboServiceError) -> [AmiiboType]
|
||||||
|
|
||||||
|
/// Gets a list of game characters based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game characters.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getGameCharacters(by filter: GameCharacterFilter) async throws(AmiiboServiceError) -> [GameCharacter]
|
||||||
|
|
||||||
|
/// Gets a list of game series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getGameSeries(by filter: GameSeriesFilter) async throws(AmiiboServiceError) -> [GameSeries]
|
||||||
|
|
||||||
|
/// Gets the date when the data was last updated.
|
||||||
|
/// - Returns: A last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getLastUpdated() async throws(AmiiboServiceError) -> Date
|
||||||
|
#else
|
||||||
|
/// Gets a list of amiibo items based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo items.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getAmiibos(by filter: AmiiboFilter) async throws -> [Amiibo]
|
||||||
|
|
||||||
|
/// Gets a list of amiibo series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getAmiiboSeries(by filter: AmiiboSeriesFilter) async throws -> [AmiiboSeries]
|
||||||
|
|
||||||
|
/// Gets a list of amiibo types based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo types.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getAmiiboTypes(by filter: AmiiboTypeFilter) async throws -> [AmiiboType]
|
||||||
|
|
||||||
|
/// Gets a list of game characters based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game characters.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getGameCharacters(by filter: GameCharacterFilter) async throws -> [GameCharacter]
|
||||||
|
|
||||||
|
/// Gets a list of game series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getGameSeries(by filter: GameSeriesFilter) async throws -> [GameSeries]
|
||||||
|
|
||||||
|
/// Gets the date when the data was last updated.
|
||||||
|
/// - Returns: A last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
func getLastUpdated() async throws -> Date
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// A type that implements the service that uses a client to make calls.
|
||||||
|
public struct AmiiboService {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// A client to interact with the endpoints.
|
||||||
|
private let client: any AmiiboClient
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this service with a specific client type.
|
||||||
|
/// - Parameter client: A client to use to interact with the endpoints.
|
||||||
|
public init(client: some AmiiboClient = AmiiboLiveClient()) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
#if swift(>=6.0)
|
||||||
|
/// Gets a list of amiibo items based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo items.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiibos(
|
||||||
|
_ filter: AmiiboFilter = .init()
|
||||||
|
) async throws(AmiiboServiceError) -> [Amiibo] {
|
||||||
|
try await client.getAmiibos(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboSeries(
|
||||||
|
_ filter: AmiiboSeriesFilter = .init()
|
||||||
|
) async throws(AmiiboServiceError) -> [AmiiboSeries] {
|
||||||
|
try await client.getAmiiboSeries(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo types based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo types.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboTypes(
|
||||||
|
_ filter: AmiiboTypeFilter = .init()
|
||||||
|
) async throws(AmiiboServiceError) -> [AmiiboType] {
|
||||||
|
try await client.getAmiiboTypes(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game characters based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game characters.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameCharacters(
|
||||||
|
_ filter: GameCharacterFilter = .init()
|
||||||
|
) async throws(AmiiboServiceError) -> [GameCharacter] {
|
||||||
|
try await client.getGameCharacters(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameSeries(
|
||||||
|
_ filter: GameSeriesFilter = .init()
|
||||||
|
) async throws(AmiiboServiceError) -> [GameSeries] {
|
||||||
|
try await client.getGameSeries(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the date when the data was last updated.
|
||||||
|
/// - Returns: A last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getLastUpdated() async throws(AmiiboServiceError) -> Date {
|
||||||
|
try await client.getLastUpdated()
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/// Gets a list of amiibo items based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo items.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiibos(
|
||||||
|
_ filter: AmiiboFilter = .init()
|
||||||
|
) async throws -> [Amiibo] {
|
||||||
|
try await client.getAmiibos(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboSeries(
|
||||||
|
_ filter: AmiiboSeriesFilter = .init()
|
||||||
|
) async throws -> [AmiiboSeries] {
|
||||||
|
try await client.getAmiiboSeries(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of amiibo types based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered amiibo types.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getAmiiboTypes(
|
||||||
|
_ filter: AmiiboTypeFilter = .init()
|
||||||
|
) async throws -> [AmiiboType] {
|
||||||
|
try await client.getAmiiboTypes(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game characters based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game characters.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameCharacters(
|
||||||
|
_ filter: GameCharacterFilter = .init()
|
||||||
|
) async throws -> [GameCharacter] {
|
||||||
|
try await client.getGameCharacters(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets a list of game series based on a given filter.
|
||||||
|
/// - Parameter filter: A filter to remove unwanted items from the result.
|
||||||
|
/// - Returns: A list of filtered game series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getGameSeries(
|
||||||
|
_ filter: GameSeriesFilter = .init()
|
||||||
|
) async throws -> [GameSeries] {
|
||||||
|
try await client.getGameSeries(by: filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets the date when the data was last updated.
|
||||||
|
/// - Returns: A last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
|
||||||
|
public func getLastUpdated() async throws -> Date {
|
||||||
|
try await client.getLastUpdated()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
##
|
||||||
|
## This source file is part of the Amiibo Service open source project
|
||||||
|
##
|
||||||
|
## Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
## Licensed under Apache license v2.0
|
||||||
|
##
|
||||||
|
## See LICENSE for license information
|
||||||
|
## See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0
|
||||||
|
##
|
||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
generate:
|
||||||
|
- types
|
||||||
|
- client
|
||||||
|
namingStrategy: defensive
|
||||||
|
accessModifier: internal
|
||||||
@@ -0,0 +1,608 @@
|
|||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
##
|
||||||
|
## This source file is part of the Amiibo Service open source project
|
||||||
|
##
|
||||||
|
## Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
## Licensed under Apache license v2.0
|
||||||
|
##
|
||||||
|
## See LICENSE for license information
|
||||||
|
## See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0
|
||||||
|
##
|
||||||
|
## ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
openapi: '3.1.1'
|
||||||
|
info:
|
||||||
|
title: Amiibo API
|
||||||
|
summary: A RESTFul API for Amiibo.
|
||||||
|
description: |
|
||||||
|
# Information
|
||||||
|
|
||||||
|
The [AmiiboAPI](https://www.amiiboapi.org) service is primarily used for educational purposes.
|
||||||
|
|
||||||
|
This is a **reading-only API**. Only HTTP GET method is allowed by this API.
|
||||||
|
**No authentication** is required to use this API. All resources are allowed to access.
|
||||||
|
If you are going to be calling this API regularly. We recommend that you use **caching** on your system.
|
||||||
|
|
||||||
|
# Terms & Conditions
|
||||||
|
|
||||||
|
By using our API, you hereby accepted the following terms and conditions:
|
||||||
|
|
||||||
|
* *This API has no affiliation with Nintendo or any other companies that own the rights to it.*
|
||||||
|
* *Other reports collected by the respective companies that own the rights are not our responsibility.*
|
||||||
|
* *User agrees that the use of this API is entirely at user's own risks.*
|
||||||
|
* *You will require your end users to comply with (and not knowingly enable them to violate) applicable law, regulation, and the Terms.*
|
||||||
|
* *You will comply with all applicable law, regulation, and third party rights (including without limitation laws regarding the import or export of data or software, privacy, and local laws). You will not use the APIs to encourage or promote illegal activity or violation of third party rights.*
|
||||||
|
* *These Terms and Conditions are subject to change without notice, from time to time in our sole discretion.*
|
||||||
|
version: v1.0.0
|
||||||
|
termsOfService: https://www.amiiboapi.org/docs/#termscondition
|
||||||
|
contact:
|
||||||
|
name: FAQ
|
||||||
|
url: https://www.amiiboapi.org/faq/
|
||||||
|
license:
|
||||||
|
name: MIT license
|
||||||
|
identifier: MIT
|
||||||
|
externalDocs:
|
||||||
|
url: https://www.amiiboapi.org/docs
|
||||||
|
description: Amiibo API documentation
|
||||||
|
servers:
|
||||||
|
- url: https://www.amiiboapi.org/api
|
||||||
|
description: Live service
|
||||||
|
tags:
|
||||||
|
- name: Amiibo
|
||||||
|
description: Amiibo-related endpoints.
|
||||||
|
- name: Game
|
||||||
|
description: Game-related endpoints.
|
||||||
|
- name: Service
|
||||||
|
description: Service-related endpoints.
|
||||||
|
paths:
|
||||||
|
/amiibo:
|
||||||
|
get:
|
||||||
|
summary: Get a list of amiibos.
|
||||||
|
description: |
|
||||||
|
Get a list of all the amiibo items available in the database, optionally filtered by various criteria such as name, type, series, or game.
|
||||||
|
|
||||||
|
Please refer to [the documentation of the endpoint](https://www.amiiboapi.org/docs/#amiibo) for further information.
|
||||||
|
operationId: getAmiibos
|
||||||
|
tags:
|
||||||
|
- Amiibo
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/Identifier'
|
||||||
|
- $ref: '#/components/parameters/IdentifierHead'
|
||||||
|
- $ref: '#/components/parameters/IdentifierTail'
|
||||||
|
- $ref: '#/components/parameters/Name'
|
||||||
|
description: A name of an amiibo to include in the response.
|
||||||
|
- $ref: '#/components/parameters/AmiiboType'
|
||||||
|
- $ref: '#/components/parameters/AmiiboSeries'
|
||||||
|
- $ref: '#/components/parameters/GameCharacter'
|
||||||
|
- $ref: '#/components/parameters/GameSeries'
|
||||||
|
- $ref: '#/components/parameters/ShowGames'
|
||||||
|
- $ref: '#/components/parameters/ShowUsage'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful response returning an object that contains zero, one or more amiibos matching the filter criteria.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AmiiboWrapper'
|
||||||
|
'400':
|
||||||
|
$ref: '#/components/responses/BadRequest'
|
||||||
|
'404':
|
||||||
|
$ref: '#/components/responses/NotFound'
|
||||||
|
'500':
|
||||||
|
description: The service is currently unavailable.
|
||||||
|
/amiiboseries:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Amiibo
|
||||||
|
summary: Get the amiibo series.
|
||||||
|
description: |
|
||||||
|
Get a list of all the amiibo series available in the database, optionally filtered by key or name.
|
||||||
|
|
||||||
|
Please refer to [the documentation of the endpoint](https://www.amiiboapi.org/docs/#series) for further information.
|
||||||
|
operationId: getAmiiboSeries
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/Key'
|
||||||
|
description: A key of an amiibo series to include in the response.
|
||||||
|
- $ref: '#/components/parameters/Name'
|
||||||
|
description: A name of an amiibo series to include in the response.
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful response returning an object that contains one or more amiibo series matching the filter criteria.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AmiiboSeriesWrapper'
|
||||||
|
'400':
|
||||||
|
$ref: '#/components/responses/BadRequest'
|
||||||
|
'404':
|
||||||
|
$ref: '#/components/responses/NotFound'
|
||||||
|
'500':
|
||||||
|
description: The service is currently unavailable.
|
||||||
|
/character:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Game
|
||||||
|
summary: Get the game characters.
|
||||||
|
description: |
|
||||||
|
Get a list of all the game characters available in the database, optionally filtered by key or name.
|
||||||
|
|
||||||
|
Please refer to [the documentation of the endpoint](https://www.amiiboapi.org/docs/#character) for further information.
|
||||||
|
operationId: getGameCharacters
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/Key'
|
||||||
|
description: A key of a game character to include in the response.
|
||||||
|
- $ref: '#/components/parameters/Name'
|
||||||
|
description: A name of a game character to include in the response.
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful response returning an object that contains one or more game characters matching the filter criteria.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GameCharacterWrapper'
|
||||||
|
'400':
|
||||||
|
$ref: '#/components/responses/BadRequest'
|
||||||
|
'404':
|
||||||
|
$ref: '#/components/responses/NotFound'
|
||||||
|
'500':
|
||||||
|
description: The service is currently unavailable.
|
||||||
|
/gameseries:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Game
|
||||||
|
summary: Get the game series.
|
||||||
|
description: |
|
||||||
|
Get a list of all the game series available in the database, optionally filtered by key or name.
|
||||||
|
|
||||||
|
Please refer to [the documentation of the endpoint](https://www.amiiboapi.org/docs/#gameSeries) for further information.
|
||||||
|
operationId: getGameSeries
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/Key'
|
||||||
|
description: A key of a game series to include in the response.
|
||||||
|
- $ref: '#/components/parameters/Name'
|
||||||
|
description: A name of a game series to include in the response.
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful response returning an object that contains one or more game series matching the filter criteria.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GameSeriesWrapper'
|
||||||
|
'400':
|
||||||
|
$ref: '#/components/responses/BadRequest'
|
||||||
|
'404':
|
||||||
|
$ref: '#/components/responses/NotFound'
|
||||||
|
'500':
|
||||||
|
description: The service is currently unavailable.
|
||||||
|
/type:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Amiibo
|
||||||
|
summary: Get the amiibo types.
|
||||||
|
description: |
|
||||||
|
Get a list of all the amiibo types available in the database, optionally filtered by key or name.
|
||||||
|
|
||||||
|
Please refer to [the documentation of the endpoint](https://www.amiiboapi.org/docs/#type) for further information.
|
||||||
|
operationId: getAmiiboTypes
|
||||||
|
parameters:
|
||||||
|
- $ref: '#/components/parameters/Key'
|
||||||
|
description: A key of an amiibo type to include in the response.
|
||||||
|
- $ref: '#/components/parameters/Name'
|
||||||
|
description: A name of an amiibo type to include in the response.
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful response returning an object that contains one or more amiibo types matching the filter criteria.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AmiiboTypeWrapper'
|
||||||
|
'400':
|
||||||
|
$ref: '#/components/responses/BadRequest'
|
||||||
|
'404':
|
||||||
|
$ref: '#/components/responses/NotFound'
|
||||||
|
'500':
|
||||||
|
description: The service is currently unavailable.
|
||||||
|
/lastupdated:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Service
|
||||||
|
summary: Get the date when data was last updated.
|
||||||
|
description: |
|
||||||
|
Get an ISO-formatted date and time when the amiibo data was last updated.
|
||||||
|
|
||||||
|
Please refer to [the documentation of the endpoint](https://www.amiiboapi.org/docs/#lastUpdated) for further information.
|
||||||
|
operationId: getLastUpdated
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful response returning an object that contains the date and time when the database was last updated.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/LastUpdated'
|
||||||
|
'500':
|
||||||
|
description: The service is currently unavailable.
|
||||||
|
components:
|
||||||
|
parameters:
|
||||||
|
AmiiboSeries:
|
||||||
|
description: A hexadecimal key or name of an amiibo series to include in the response.
|
||||||
|
name: amiiboSeries
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
AmiiboType:
|
||||||
|
description: A hexadecimal key or name of an amiibo type to include in the response.
|
||||||
|
name: type
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
GameCharacter:
|
||||||
|
description: A hexadecimal key or name of a game character to include in the response.
|
||||||
|
name: character
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
GameSeries:
|
||||||
|
description: A hexadecimal key or name of a game series to include in the response.
|
||||||
|
name: gameseries
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
Identifier:
|
||||||
|
description: The full 16-character hexadecimal identifier of an amiibo to include in the response.
|
||||||
|
name: id
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
maxLength: 18
|
||||||
|
IdentifierHead:
|
||||||
|
description: The first 8 hexadecimal characters of an amiibo identifier to include in the response.
|
||||||
|
name: head
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
maxLength: 10
|
||||||
|
IdentifierTail:
|
||||||
|
description: The last 8 hexadecimal characters of an amiibo identifier to include in the response.
|
||||||
|
name: tail
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
maxLength: 10
|
||||||
|
Key:
|
||||||
|
description: A hexadecimal key to filter the results by.
|
||||||
|
name: key
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
Name:
|
||||||
|
description: A name to filter the results by.
|
||||||
|
name: name
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
ShowGames:
|
||||||
|
description: A flag that indicates whether to include information about related games.
|
||||||
|
name: showgames
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
ShowUsage:
|
||||||
|
description: A flag that indicates whether to include information about amiibo usages in related games.
|
||||||
|
name: showusage
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
responses:
|
||||||
|
BadRequest:
|
||||||
|
description: The request was malformed or contained invalid parameters.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ServiceError'
|
||||||
|
NotFound:
|
||||||
|
description: No results were found matching the given filter criteria.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ServiceError'
|
||||||
|
schemas:
|
||||||
|
# Core Entities
|
||||||
|
Amiibo:
|
||||||
|
description: A type that represents an amiibo figurine, card, or other collectible.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
amiiboSeries:
|
||||||
|
description: The name of the amiibo series this amiibo belongs to.
|
||||||
|
type: string
|
||||||
|
character:
|
||||||
|
description: |
|
||||||
|
The name of the game character associated with this amiibo.
|
||||||
|
|
||||||
|
Multiple characters can have different amiibo designs.
|
||||||
|
type: string
|
||||||
|
gameSeries:
|
||||||
|
description: The name of the game series associated with this amiibo.
|
||||||
|
type: string
|
||||||
|
games3DS:
|
||||||
|
description: A list of 3DS games an amiibo could be used in, if any.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AmiiboGame'
|
||||||
|
gamesSwitch:
|
||||||
|
description: A list of Switch games an amiibo could be used in, if any.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AmiiboGame'
|
||||||
|
gamesSwitch2:
|
||||||
|
description: A list of Switch 2 games an amiibo could be used in, if any.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AmiiboGame'
|
||||||
|
gamesWiiU:
|
||||||
|
description: A list of Wii U games an amiibo could be used in, if any.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AmiiboGame'
|
||||||
|
head:
|
||||||
|
description: |
|
||||||
|
The first 8 characters of the hexadecimal value that identifies an amiibo.
|
||||||
|
|
||||||
|
The positions 0 to 7 of the hexadecimal string.
|
||||||
|
type: string
|
||||||
|
pattern: "^[0-9a-fA-F]+$"
|
||||||
|
minLength: 8
|
||||||
|
maxLength: 8
|
||||||
|
image:
|
||||||
|
description: A URL pointing to an image of this amiibo.
|
||||||
|
type: string
|
||||||
|
format: uri
|
||||||
|
name:
|
||||||
|
description: The name of this amiibo.
|
||||||
|
type: string
|
||||||
|
release:
|
||||||
|
description: The regional release dates of this amiibo, if known.
|
||||||
|
$ref: '#/components/schemas/AmiiboRelease'
|
||||||
|
tail:
|
||||||
|
description: |
|
||||||
|
The last 8 characters of the hexadecimal value that identifies an amiibo.
|
||||||
|
|
||||||
|
The positions 8 to 15 of the hexadecimal string.
|
||||||
|
type: string
|
||||||
|
pattern: "^[0-9a-fA-F]+$"
|
||||||
|
minLength: 8
|
||||||
|
maxLength: 8
|
||||||
|
type:
|
||||||
|
description: The type of this amiibo (e.g., Figure, Card, Yarn, Band).
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- amiiboSeries
|
||||||
|
- character
|
||||||
|
- gameSeries
|
||||||
|
- head
|
||||||
|
- image
|
||||||
|
- name
|
||||||
|
- release
|
||||||
|
- tail
|
||||||
|
- type
|
||||||
|
AmiiboGame:
|
||||||
|
description: A type that represents a game in which an amiibo can be used.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
amiiboUsage:
|
||||||
|
description: A list of available usages an amiibo has in a game, if any.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AmiiboUsage'
|
||||||
|
gameID:
|
||||||
|
description: A list of identifiers for the game.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
gameName:
|
||||||
|
description: The name of the game.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- gameID
|
||||||
|
- gameName
|
||||||
|
AmiiboRelease:
|
||||||
|
description: A type that contains the regional release dates of an amiibo.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
au:
|
||||||
|
description: The release date in Australia, if known.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
eu:
|
||||||
|
description: The release date in Europe, if known.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
jp:
|
||||||
|
description: The release date in Japan, if known.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
na:
|
||||||
|
description: The release date in North America, if known.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
AmiiboSeries:
|
||||||
|
description: A type that represents an amiibo series.
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/Tuple'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: The hexadecimal key that uniquely identifies this amiibo series.
|
||||||
|
name:
|
||||||
|
description: The name of this amiibo series.
|
||||||
|
AmiiboType:
|
||||||
|
description: A type that represents an amiibo type (e.g., Figure, Card, Yarn, Band).
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/Tuple'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: The hexadecimal key that uniquely identifies this amiibo type.
|
||||||
|
name:
|
||||||
|
description: The name of this amiibo type.
|
||||||
|
AmiiboUsage:
|
||||||
|
description: A type that represents how an amiibo is used within a game.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
Usage:
|
||||||
|
description: A description of how the amiibo is used within the game.
|
||||||
|
type: string
|
||||||
|
write:
|
||||||
|
description: A flag that indicates whether the amiibo can save game data.
|
||||||
|
type: boolean
|
||||||
|
required:
|
||||||
|
- Usage
|
||||||
|
- write
|
||||||
|
GameCharacter:
|
||||||
|
description: A type that represents a game character.
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/Tuple'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: The hexadecimal key that uniquely identifies this game character.
|
||||||
|
name:
|
||||||
|
description: The name of this game character.
|
||||||
|
GameSeries:
|
||||||
|
description: A type that represents a game series.
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/Tuple'
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: The hexadecimal key that uniquely identifies this game series.
|
||||||
|
name:
|
||||||
|
description: The name of this game series.
|
||||||
|
LastUpdated:
|
||||||
|
description: A type that contains the date and time when the service data was last updated.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
lastUpdated:
|
||||||
|
description: The date and time when the data in the database was last updated.
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
required:
|
||||||
|
- lastUpdated
|
||||||
|
Tuple:
|
||||||
|
description: |
|
||||||
|
A base type composed of a `key` and `name` pair.
|
||||||
|
|
||||||
|
This type is the base schema for the `AmiiboSeries`, `AmiiboType`, `GameCharacter`, and `GameSeries` types.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
key:
|
||||||
|
description: A hexadecimal key that uniquely identifies this resource.
|
||||||
|
type: string
|
||||||
|
pattern: "^0x[0-9a-fA-F]+$"
|
||||||
|
minLength: 3
|
||||||
|
name:
|
||||||
|
description: A display name for this resource.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- key
|
||||||
|
- name
|
||||||
|
# Wrapper Entities
|
||||||
|
AmiiboWrapper:
|
||||||
|
description: A response wrapper that contains zero, one, or more amiibos.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
amiibo:
|
||||||
|
description: A container that holds zero, one or more amiibos.
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/Amiibo'
|
||||||
|
description: A certain amiibo.
|
||||||
|
- type: array
|
||||||
|
description: A list that contains amiibos.
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Amiibo'
|
||||||
|
AmiiboSeriesWrapper:
|
||||||
|
description: A response wrapper that contains one or more amiibo series.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
amiibo:
|
||||||
|
description: A container that holds one or more amiibo series.
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/AmiiboSeries'
|
||||||
|
description: A certain amiibo series.
|
||||||
|
- type: array
|
||||||
|
description: A list that contains amiibo series.
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AmiiboSeries'
|
||||||
|
required:
|
||||||
|
- amiibo
|
||||||
|
AmiiboTypeWrapper:
|
||||||
|
description: A response wrapper that contains one or more amiibo types.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
amiibo:
|
||||||
|
description: A container that holds one or more amiibo types.
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/AmiiboType'
|
||||||
|
description: A certain amiibo type.
|
||||||
|
- type: array
|
||||||
|
description: A list that contains amiibo types.
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AmiiboType'
|
||||||
|
required:
|
||||||
|
- amiibo
|
||||||
|
GameCharacterWrapper:
|
||||||
|
description: A response wrapper that contains one or more game characters.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
amiibo:
|
||||||
|
description: A container that holds one or more game characters.
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/GameCharacter'
|
||||||
|
description: A certain game character.
|
||||||
|
- type: array
|
||||||
|
description: A list that contains game characters.
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/GameCharacter'
|
||||||
|
required:
|
||||||
|
- amiibo
|
||||||
|
GameSeriesWrapper:
|
||||||
|
description: A response wrapper that contains one or more game series.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
amiibo:
|
||||||
|
description: A container that holds one or more game series.
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/GameSeries'
|
||||||
|
description: A certain game series.
|
||||||
|
- type: array
|
||||||
|
description: A list that contains game series.
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/GameSeries'
|
||||||
|
required:
|
||||||
|
- amiibo
|
||||||
|
# Error Entities
|
||||||
|
ServiceError:
|
||||||
|
description: A type that represents an error response from the service.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
description: The HTTP status code of the error.
|
||||||
|
type: integer
|
||||||
|
error:
|
||||||
|
description: A human-readable message describing the error.
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- code
|
||||||
|
- error
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import OpenAPIURLSession
|
|
||||||
|
|
||||||
extension Client {
|
|
||||||
|
|
||||||
// MARK: Constants
|
|
||||||
|
|
||||||
static var live: Client {
|
|
||||||
get throws {
|
|
||||||
.init(
|
|
||||||
serverURL: try Servers.server1(),
|
|
||||||
configuration: .init(dateTranscoder: ISODateTranscoder()),
|
|
||||||
transport: URLSessionTransport()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
extension DateFormatter {
|
|
||||||
|
|
||||||
static var isoDateTime: DateFormatter {
|
|
||||||
let formatter = DateFormatter()
|
|
||||||
|
|
||||||
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
|
|
||||||
formatter.timeZone = .init(secondsFromGMT: 0)
|
|
||||||
|
|
||||||
return formatter
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
public protocol APIClient {
|
|
||||||
|
|
||||||
// MARK: Functions
|
|
||||||
|
|
||||||
func getAmiibos(by filter: AmiiboFilter) async throws -> [Amiibo]
|
|
||||||
func getAmiiboSeries(by filter: AmiiboSeriesFilter) async throws -> [AmiiboSeries]
|
|
||||||
func getAmiiboTypes(by filter: AmiiboTypeFilter) async throws -> [AmiiboType]
|
|
||||||
func getGameCharacters(by filter: GameCharacterFilter) async throws -> [GameCharacter]
|
|
||||||
func getGameSeries(by filter: GameSeriesFilter) async throws -> [GameSeries]
|
|
||||||
func getLastUpdated() async throws -> Date
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
protocol KeyNameFilter {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
var key: String? { get }
|
|
||||||
var name: String? { get }
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init()
|
|
||||||
init(key: String)
|
|
||||||
init(name: String)
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
protocol KeyNameModel: Sendable {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
var key: String { get }
|
|
||||||
var name: String { get }
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.Tuple)
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import OpenAPIRuntime
|
|
||||||
|
|
||||||
struct ISODateTranscoder: DateTranscoder {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
private let dateFormatter: DateFormatter = .isoDateTime
|
|
||||||
|
|
||||||
// MARK: Functions
|
|
||||||
|
|
||||||
func encode(_ date: Date) throws -> String {
|
|
||||||
dateFormatter.string(from: date)
|
|
||||||
}
|
|
||||||
|
|
||||||
func decode(_ string: String) throws -> Date {
|
|
||||||
dateFormatter.date(from: string) ?? .init()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,248 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import OpenAPIRuntime
|
|
||||||
import OpenAPIURLSession
|
|
||||||
|
|
||||||
public struct AmiiboLiveClient {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
private let client: Client
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init() throws {
|
|
||||||
self.client = .init(
|
|
||||||
serverURL: try Servers.server1(),
|
|
||||||
configuration: .init(dateTranscoder: ISODateTranscoder()),
|
|
||||||
transport: URLSessionTransport()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - APIProtocol
|
|
||||||
|
|
||||||
extension AmiiboLiveClient: APIClient {
|
|
||||||
|
|
||||||
// MARK: Functions
|
|
||||||
|
|
||||||
public func getAmiibos(by filter: AmiiboFilter) async throws -> [Amiibo] {
|
|
||||||
let response = try await {
|
|
||||||
do {
|
|
||||||
return try await client.getAmiibos(
|
|
||||||
.init(query: .init(
|
|
||||||
amiiboSeries: filter.series,
|
|
||||||
character: filter.gameCharacter,
|
|
||||||
gameseries: filter.gameSeries,
|
|
||||||
id: filter.identifier,
|
|
||||||
name: filter.name,
|
|
||||||
showgames: filter.showGames,
|
|
||||||
showusage: filter.showUsage,
|
|
||||||
_type: filter.type
|
|
||||||
))
|
|
||||||
)
|
|
||||||
} catch let error as ClientError {
|
|
||||||
guard let _ = error.underlyingError as? DecodingError else {
|
|
||||||
throw AmiiboServiceError.unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
throw AmiiboServiceError.decoding
|
|
||||||
} catch {
|
|
||||||
throw AmiiboServiceError.unknown
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
switch response {
|
|
||||||
case let .ok(ok):
|
|
||||||
switch ok.body {
|
|
||||||
case let .json(output):
|
|
||||||
return map(output)
|
|
||||||
}
|
|
||||||
|
|
||||||
case .badRequest:
|
|
||||||
throw AmiiboServiceError.badRequest
|
|
||||||
|
|
||||||
case let .undocumented(statusCode, _):
|
|
||||||
throw AmiiboServiceError.undocumented(statusCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getAmiiboSeries(by filter: AmiiboSeriesFilter) async throws -> [AmiiboSeries] {
|
|
||||||
let response = try await client.getAmiiboSeries(
|
|
||||||
.init(query: .init(
|
|
||||||
key: filter.key,
|
|
||||||
name: filter.name
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
switch response {
|
|
||||||
case let .ok(ok):
|
|
||||||
switch ok.body {
|
|
||||||
case let .json(output):
|
|
||||||
return map(output, as: AmiiboSeries.self)
|
|
||||||
}
|
|
||||||
|
|
||||||
case .badRequest:
|
|
||||||
throw AmiiboServiceError.badRequest
|
|
||||||
|
|
||||||
case .internalServerError:
|
|
||||||
throw AmiiboServiceError.notAvailable
|
|
||||||
|
|
||||||
case .notFound:
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
|
|
||||||
case let .undocumented(statusCode, _):
|
|
||||||
throw AmiiboServiceError.undocumented(statusCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getAmiiboTypes(by filter: AmiiboTypeFilter) async throws -> [AmiiboType] {
|
|
||||||
let response = try await client.getAmiiboTypes(
|
|
||||||
.init(query: .init(
|
|
||||||
key: filter.key,
|
|
||||||
name: filter.name
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
switch response {
|
|
||||||
case let .ok(ok):
|
|
||||||
switch ok.body {
|
|
||||||
case let .json(output):
|
|
||||||
return map(output, as: AmiiboType.self)
|
|
||||||
}
|
|
||||||
|
|
||||||
case .badRequest:
|
|
||||||
throw AmiiboServiceError.badRequest
|
|
||||||
|
|
||||||
case .internalServerError:
|
|
||||||
throw AmiiboServiceError.notAvailable
|
|
||||||
|
|
||||||
case .notFound:
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
|
|
||||||
case let .undocumented(statusCode, _):
|
|
||||||
throw AmiiboServiceError.undocumented(statusCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getGameCharacters(by filter: GameCharacterFilter) async throws -> [GameCharacter] {
|
|
||||||
let response = try await client.getGameCharacters(
|
|
||||||
.init(query: .init(
|
|
||||||
key: filter.key,
|
|
||||||
name: filter.name
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
switch response {
|
|
||||||
case let .ok(ok):
|
|
||||||
switch ok.body {
|
|
||||||
case let .json(output):
|
|
||||||
return map(output, as: GameCharacter.self)
|
|
||||||
}
|
|
||||||
|
|
||||||
case .badRequest:
|
|
||||||
throw AmiiboServiceError.badRequest
|
|
||||||
|
|
||||||
case .internalServerError:
|
|
||||||
throw AmiiboServiceError.notAvailable
|
|
||||||
|
|
||||||
case .notFound:
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
|
|
||||||
case let .undocumented(statusCode, _):
|
|
||||||
throw AmiiboServiceError.undocumented(statusCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getGameSeries(by filter: GameSeriesFilter) async throws -> [GameSeries] {
|
|
||||||
let response = try await client.getGameSeries(
|
|
||||||
.init(query: .init(
|
|
||||||
key: filter.key,
|
|
||||||
name: filter.name
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
switch response {
|
|
||||||
case let .ok(ok):
|
|
||||||
switch ok.body {
|
|
||||||
case let .json(output):
|
|
||||||
return map(output, as: GameSeries.self)
|
|
||||||
}
|
|
||||||
|
|
||||||
case .badRequest:
|
|
||||||
throw AmiiboServiceError.badRequest
|
|
||||||
|
|
||||||
case .internalServerError:
|
|
||||||
throw AmiiboServiceError.notAvailable
|
|
||||||
|
|
||||||
case .notFound:
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
|
|
||||||
case let .undocumented(statusCode, _):
|
|
||||||
throw AmiiboServiceError.undocumented(statusCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getLastUpdated() async throws -> Date {
|
|
||||||
let response = try await client.getLastUpdated()
|
|
||||||
|
|
||||||
switch response {
|
|
||||||
case let .ok(ok):
|
|
||||||
switch ok.body {
|
|
||||||
case let .json(output):
|
|
||||||
return output.lastUpdated
|
|
||||||
}
|
|
||||||
|
|
||||||
case let .undocumented(statusCode, _):
|
|
||||||
throw AmiiboServiceError.undocumented(statusCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Helpers
|
|
||||||
|
|
||||||
private extension AmiiboLiveClient {
|
|
||||||
|
|
||||||
// MARK: Functions
|
|
||||||
|
|
||||||
func map(_ wrapper: Components.Schemas.AmiiboWrapper) -> [Amiibo] {
|
|
||||||
switch wrapper.amiibo {
|
|
||||||
case let .Amiibo(object):
|
|
||||||
return [.init(object)]
|
|
||||||
|
|
||||||
case let .AmiiboList(list):
|
|
||||||
return list
|
|
||||||
.map { .init($0) }
|
|
||||||
.sorted { $0.identifier < $1.identifier }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func map<Model: KeyNameModel>(
|
|
||||||
_ wrapper: Components.Schemas.TupleWrapper,
|
|
||||||
as: Model.Type
|
|
||||||
) -> [Model] {
|
|
||||||
switch wrapper.amiibo {
|
|
||||||
case let .Tuple(payload):
|
|
||||||
return [.init(payload)]
|
|
||||||
|
|
||||||
case let .TupleList(list):
|
|
||||||
return list
|
|
||||||
.map { .init($0) }
|
|
||||||
.sorted { $0.key < $1.key }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
public struct AmiiboMockClient {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
private let amiibos: [Amiibo]?
|
|
||||||
private let amiiboSeries: [AmiiboSeries]?
|
|
||||||
private let amiiboTypes: [AmiiboType]?
|
|
||||||
private let error: AmiiboServiceError?
|
|
||||||
private let gameCharacters: [GameCharacter]?
|
|
||||||
private let gameSeries: [GameSeries]?
|
|
||||||
private let lastUpdated: Date?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init(
|
|
||||||
amiibos: [Amiibo]? = nil,
|
|
||||||
amiiboSeries: [AmiiboSeries]? = nil,
|
|
||||||
amiiboTypes: [AmiiboType]? = nil,
|
|
||||||
gameCharacters: [GameCharacter]? = nil,
|
|
||||||
gameSeries: [GameSeries]? = nil,
|
|
||||||
lastUpdated: Date? = nil,
|
|
||||||
error: AmiiboServiceError? = nil
|
|
||||||
) {
|
|
||||||
self.amiibos = amiibos
|
|
||||||
self.amiiboSeries = amiiboSeries
|
|
||||||
self.amiiboTypes = amiiboTypes
|
|
||||||
self.error = error
|
|
||||||
self.gameCharacters = gameCharacters
|
|
||||||
self.gameSeries = gameSeries
|
|
||||||
self.lastUpdated = lastUpdated
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - APIClient
|
|
||||||
|
|
||||||
extension AmiiboMockClient: APIClient {
|
|
||||||
|
|
||||||
// MARK: Functions
|
|
||||||
|
|
||||||
public func getAmiibos(by filter: AmiiboFilter) async throws -> [Amiibo] {
|
|
||||||
try throwErrorIfExists()
|
|
||||||
|
|
||||||
guard let amiibos else {
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
}
|
|
||||||
|
|
||||||
return amiibos
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getAmiiboSeries(by filter: AmiiboSeriesFilter) async throws -> [AmiiboSeries] {
|
|
||||||
try throwErrorIfExists()
|
|
||||||
|
|
||||||
guard let amiiboSeries else {
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
}
|
|
||||||
|
|
||||||
return amiiboSeries
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getAmiiboTypes(by filter: AmiiboTypeFilter) async throws -> [AmiiboType] {
|
|
||||||
try throwErrorIfExists()
|
|
||||||
|
|
||||||
guard let amiiboTypes else {
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
}
|
|
||||||
|
|
||||||
return amiiboTypes
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getGameCharacters(by filter: GameCharacterFilter) async throws -> [GameCharacter] {
|
|
||||||
try throwErrorIfExists()
|
|
||||||
|
|
||||||
guard let gameCharacters else {
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
}
|
|
||||||
|
|
||||||
return gameCharacters
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getGameSeries(by filter: GameSeriesFilter) async throws -> [GameSeries] {
|
|
||||||
try throwErrorIfExists()
|
|
||||||
|
|
||||||
guard let gameSeries else {
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
}
|
|
||||||
|
|
||||||
return gameSeries
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getLastUpdated() async throws -> Date {
|
|
||||||
try throwErrorIfExists()
|
|
||||||
|
|
||||||
guard let lastUpdated else {
|
|
||||||
throw AmiiboServiceError.notFound
|
|
||||||
}
|
|
||||||
|
|
||||||
return lastUpdated
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Helpers
|
|
||||||
|
|
||||||
private extension AmiiboMockClient {
|
|
||||||
|
|
||||||
// MARK: Functions
|
|
||||||
|
|
||||||
func throwErrorIfExists() throws {
|
|
||||||
if let error {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public enum AmiiboServiceError: Error {
|
|
||||||
case badRequest
|
|
||||||
case decoding
|
|
||||||
case notAvailable
|
|
||||||
case notFound
|
|
||||||
case undocumented(_ statusCode: Int)
|
|
||||||
case unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Equatable
|
|
||||||
|
|
||||||
extension AmiiboServiceError: Equatable {}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct AmiiboFilter {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let gameCharacter: String?
|
|
||||||
public let gameSeries: String?
|
|
||||||
public let identifier: String?
|
|
||||||
public let name: String?
|
|
||||||
public let series: String?
|
|
||||||
public let showGames: Bool?
|
|
||||||
public let showUsage: Bool?
|
|
||||||
public let type: String?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init(
|
|
||||||
identifier: String? = nil,
|
|
||||||
name: String? = nil,
|
|
||||||
type: String? = nil,
|
|
||||||
series: String? = nil,
|
|
||||||
gameCharacter: String? = nil,
|
|
||||||
gameSeries: String? = nil,
|
|
||||||
showGames: Bool? = nil,
|
|
||||||
showUsage: Bool? = nil
|
|
||||||
) {
|
|
||||||
self.gameCharacter = gameCharacter
|
|
||||||
self.gameSeries = gameSeries
|
|
||||||
self.identifier = identifier
|
|
||||||
self.name = name
|
|
||||||
self.series = series
|
|
||||||
self.showGames = showGames
|
|
||||||
self.showUsage = showUsage
|
|
||||||
self.type = type
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct AmiiboSeriesFilter: KeyNameFilter {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String?
|
|
||||||
public let name: String?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
self.key = nil
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(key: String) {
|
|
||||||
self.key = key
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(name: String) {
|
|
||||||
self.key = nil
|
|
||||||
self.name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct AmiiboTypeFilter: KeyNameFilter {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String?
|
|
||||||
public let name: String?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
self.key = nil
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(key: String) {
|
|
||||||
self.key = key
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(name: String) {
|
|
||||||
self.key = nil
|
|
||||||
self.name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct GameCharacterFilter: KeyNameFilter {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String?
|
|
||||||
public let name: String?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
self.key = nil
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(key: String) {
|
|
||||||
self.key = key
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(name: String) {
|
|
||||||
self.key = nil
|
|
||||||
self.name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct GameSeriesFilter: KeyNameFilter {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String?
|
|
||||||
public let name: String?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
self.key = nil
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(key: String) {
|
|
||||||
self.key = key
|
|
||||||
self.name = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
public init(name: String) {
|
|
||||||
self.key = nil
|
|
||||||
self.name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
public struct Amiibo: Sendable {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let gameCharacter: String
|
|
||||||
public let gameSeries: String
|
|
||||||
public let head: String
|
|
||||||
public let image: String
|
|
||||||
public let name: String
|
|
||||||
public let platform: Platform?
|
|
||||||
public let release: Release
|
|
||||||
public let series: String
|
|
||||||
public let tail: String
|
|
||||||
public let type: String
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.Amiibo) {
|
|
||||||
self.gameCharacter = payload.character
|
|
||||||
self.gameSeries = payload.gameSeries
|
|
||||||
self.head = payload.head
|
|
||||||
self.image = payload.image
|
|
||||||
self.name = payload.name
|
|
||||||
self.platform = .init(
|
|
||||||
payload.gamesSwitch,
|
|
||||||
payload.games3DS,
|
|
||||||
payload.gamesWiiU
|
|
||||||
)
|
|
||||||
self.release = .init(payload.release)
|
|
||||||
self.series = payload.amiiboSeries
|
|
||||||
self.tail = payload.tail
|
|
||||||
self.type = payload._type
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Computed
|
|
||||||
|
|
||||||
public var identifier: String {
|
|
||||||
head + tail
|
|
||||||
}
|
|
||||||
|
|
||||||
public var imageURL: URL? {
|
|
||||||
.init(string: image)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
extension Amiibo {
|
|
||||||
public struct Game: Sendable {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let identifiers: [String]
|
|
||||||
public let name: String
|
|
||||||
public let usages: [Usage]?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.AmiiboGame) {
|
|
||||||
self.identifiers = payload.gameID
|
|
||||||
self.name = payload.gameName
|
|
||||||
self.usages = {
|
|
||||||
guard let usages = payload.amiiboUsage else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return usages.map { .init($0) }
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
extension Amiibo {
|
|
||||||
public struct Platform: Sendable {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let `switch`: [Game]
|
|
||||||
public let threeDS: [Game]
|
|
||||||
public let wiiU: [Game]
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init?(
|
|
||||||
_ `switch`: [Components.Schemas.AmiiboGame]?,
|
|
||||||
_ threeDS: [Components.Schemas.AmiiboGame]?,
|
|
||||||
_ wiiU: [Components.Schemas.AmiiboGame]?
|
|
||||||
) {
|
|
||||||
guard (`switch` != nil && `switch`?.isEmpty == false)
|
|
||||||
|| (threeDS != nil && threeDS?.isEmpty == false)
|
|
||||||
|| (wiiU != nil && wiiU?.isEmpty == false)
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
self.switch = {
|
|
||||||
guard let `switch` else { return [] }
|
|
||||||
return `switch`.map { .init($0) }
|
|
||||||
}()
|
|
||||||
self.threeDS = {
|
|
||||||
guard let threeDS else { return [] }
|
|
||||||
return threeDS.map { .init($0) }
|
|
||||||
}()
|
|
||||||
self.wiiU = {
|
|
||||||
guard let wiiU else { return [] }
|
|
||||||
return wiiU.map { .init($0) }
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
extension Amiibo {
|
|
||||||
public struct Release: Sendable {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let america: Date?
|
|
||||||
public let australia: Date?
|
|
||||||
public let europe: Date?
|
|
||||||
public let japan: Date?
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.AmiiboRelease) {
|
|
||||||
self.america = payload.na
|
|
||||||
self.australia = payload.au
|
|
||||||
self.europe = payload.eu
|
|
||||||
self.japan = payload.jp
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
extension Amiibo {
|
|
||||||
public struct Usage: Sendable {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let explanation: String
|
|
||||||
public let isWriteable: Bool
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.AmiiboUsage) {
|
|
||||||
self.explanation = payload.Usage
|
|
||||||
self.isWriteable = payload.write
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct AmiiboSeries: KeyNameModel {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String
|
|
||||||
public let name: String
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.Tuple) {
|
|
||||||
self.key = payload.key
|
|
||||||
self.name = payload.name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct AmiiboType: KeyNameModel {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String
|
|
||||||
public let name: String
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.Tuple) {
|
|
||||||
self.key = payload.key
|
|
||||||
self.name = payload.name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct GameCharacter: KeyNameModel {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String
|
|
||||||
public let name: String
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.Tuple) {
|
|
||||||
self.key = payload.key
|
|
||||||
self.name = payload.name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
public struct GameSeries: KeyNameModel {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
public let key: String
|
|
||||||
public let name: String
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
init(_ payload: Components.Schemas.Tuple) {
|
|
||||||
self.key = payload.key
|
|
||||||
self.name = payload.name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===
|
|
||||||
//
|
|
||||||
// This source file is part of the AmiiboAPI open source project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
// Licensed under the EUPL 1.2 or later.
|
|
||||||
//
|
|
||||||
// See LICENSE for license information
|
|
||||||
// See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
public struct AmiiboService {
|
|
||||||
|
|
||||||
// MARK: Properties
|
|
||||||
|
|
||||||
private let client: any APIClient
|
|
||||||
|
|
||||||
// MARK: Initialisers
|
|
||||||
|
|
||||||
public init(_ client: any APIClient) {
|
|
||||||
self.client = client
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Functions
|
|
||||||
|
|
||||||
public func getAmiibos(
|
|
||||||
_ filter: AmiiboFilter = .init()
|
|
||||||
) async throws -> [Amiibo] {
|
|
||||||
try await client.getAmiibos(by: filter)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getAmiiboSeries(
|
|
||||||
_ filter: AmiiboSeriesFilter = .init()
|
|
||||||
) async throws -> [AmiiboSeries] {
|
|
||||||
try await client.getAmiiboSeries(by: filter)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getAmiiboTypes(
|
|
||||||
_ filter: AmiiboTypeFilter = .init()
|
|
||||||
) async throws -> [AmiiboType] {
|
|
||||||
try await client.getAmiiboTypes(by: filter)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getGameCharacters(
|
|
||||||
_ filter: GameCharacterFilter = .init()
|
|
||||||
) async throws -> [GameCharacter] {
|
|
||||||
try await client.getGameCharacters(by: filter)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getGameSeries(
|
|
||||||
_ filter: GameSeriesFilter = .init()
|
|
||||||
) async throws -> [GameSeries] {
|
|
||||||
try await client.getGameSeries(by: filter)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func getLastUpdated() async throws -> Date {
|
|
||||||
try await client.getLastUpdated()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
# ===----------------------------------------------------------------------===
|
|
||||||
#
|
|
||||||
# This source file is part of the AmiiboAPI open source project
|
|
||||||
#
|
|
||||||
# Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
# Licensed under the EUPL 1.2 or later.
|
|
||||||
#
|
|
||||||
# See LICENSE for license information
|
|
||||||
# See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
#
|
|
||||||
# ===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
generate:
|
|
||||||
- types
|
|
||||||
- client
|
|
||||||
accessModifier: internal
|
|
||||||
@@ -1,376 +0,0 @@
|
|||||||
# ===----------------------------------------------------------------------===
|
|
||||||
#
|
|
||||||
# This source file is part of the AmiiboAPI open source project
|
|
||||||
#
|
|
||||||
# Copyright (c) 2024 Röck+Cöde VoF. and the AmiiboAPI project authors
|
|
||||||
# Licensed under the EUPL 1.2 or later.
|
|
||||||
#
|
|
||||||
# See LICENSE for license information
|
|
||||||
# See CONTRIBUTORS for the list of AmiiboAPI project authors
|
|
||||||
#
|
|
||||||
# ===----------------------------------------------------------------------===
|
|
||||||
|
|
||||||
openapi: '3.1.0'
|
|
||||||
info:
|
|
||||||
title: Amiibo API service
|
|
||||||
description: The Amiibo API RESTful service.
|
|
||||||
version: 1.0.0
|
|
||||||
servers:
|
|
||||||
- url: https://www.amiiboapi.com/api
|
|
||||||
description: Amiibo API service (live)
|
|
||||||
paths:
|
|
||||||
/amiibo:
|
|
||||||
get:
|
|
||||||
description: Get a list of all the Amiibo items available in the database.
|
|
||||||
operationId: getAmiibos
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Successful response returning the object that contains a list of Amiibo items.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/AmiiboWrapper'
|
|
||||||
'400':
|
|
||||||
description: Bad Amiibo request.
|
|
||||||
parameters:
|
|
||||||
- name: amiiboSeries
|
|
||||||
in: query
|
|
||||||
description: The Amiibo series identifier or name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: character
|
|
||||||
in: query
|
|
||||||
description: The game character identifier or name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: gameseries
|
|
||||||
in: query
|
|
||||||
description: The game series identifier or name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: id
|
|
||||||
in: query
|
|
||||||
description: The Amiibo identifier to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: name
|
|
||||||
in: query
|
|
||||||
description: The Amiibo name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: showgames
|
|
||||||
in: query
|
|
||||||
description: The flag that indicates whether to include information about related games.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: boolean
|
|
||||||
style: form
|
|
||||||
- name: showusage
|
|
||||||
in: query
|
|
||||||
description: The flag that indicates whether to include information about Amiibo usage in related games.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: boolean
|
|
||||||
style: form
|
|
||||||
- name: type
|
|
||||||
in: query
|
|
||||||
description: The Amiibo type to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
|
|
||||||
/amiiboseries:
|
|
||||||
get:
|
|
||||||
description: Get a list of all the Amiibo series available in the database.
|
|
||||||
operationId: getAmiiboSeries
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Successful response returning the object that contains a list of Amiibo series.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/TupleWrapper'
|
|
||||||
'400':
|
|
||||||
description: Bad Amiibo series request.
|
|
||||||
'404':
|
|
||||||
description: Amiibo series not found.
|
|
||||||
'500':
|
|
||||||
description: Service currently not available.
|
|
||||||
parameters:
|
|
||||||
- name: key
|
|
||||||
in: query
|
|
||||||
description: The Amiibo series key to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: name
|
|
||||||
in: query
|
|
||||||
description: The Amiibo series name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
|
|
||||||
/character:
|
|
||||||
get:
|
|
||||||
description: Get a list of all the game characters available in the database.
|
|
||||||
operationId: getGameCharacters
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Successful response returning the object that contains a list of game characters.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/TupleWrapper'
|
|
||||||
'400':
|
|
||||||
description: Bad game character request.
|
|
||||||
'404':
|
|
||||||
description: Game character not found.
|
|
||||||
'500':
|
|
||||||
description: Service currently not available.
|
|
||||||
parameters:
|
|
||||||
- name: key
|
|
||||||
in: query
|
|
||||||
description: The game character key to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: name
|
|
||||||
in: query
|
|
||||||
description: The game character name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
|
|
||||||
/gameseries:
|
|
||||||
get:
|
|
||||||
description: Gets a list of all the game series available in the database.
|
|
||||||
operationId: getGameSeries
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Successful response returning the object that contains a list of game series.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/TupleWrapper'
|
|
||||||
'400':
|
|
||||||
description: Bad game series request.
|
|
||||||
'404':
|
|
||||||
description: Game series not found.
|
|
||||||
'500':
|
|
||||||
description: Service currently not available.
|
|
||||||
parameters:
|
|
||||||
- name: key
|
|
||||||
in: query
|
|
||||||
description: The game series key to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: name
|
|
||||||
in: query
|
|
||||||
description: The game series name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
|
|
||||||
/type:
|
|
||||||
get:
|
|
||||||
description: Gets a list of all the Amiibo types available in the database.
|
|
||||||
operationId: getAmiiboTypes
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Successful response returning the object that contains a list of Amiibo types.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/TupleWrapper'
|
|
||||||
'400':
|
|
||||||
description: Bad Amiibo type request.
|
|
||||||
'404':
|
|
||||||
description: Amiibo type not found.
|
|
||||||
'500':
|
|
||||||
description: Service currently not available.
|
|
||||||
parameters:
|
|
||||||
- name: key
|
|
||||||
in: query
|
|
||||||
description: The Amiibo type key to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
- name: name
|
|
||||||
in: query
|
|
||||||
description: The Amiibo type name to filter the response.
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
style: form
|
|
||||||
|
|
||||||
/lastupdated:
|
|
||||||
get:
|
|
||||||
description: Gets a timestamp when the Amiibo data was last updated.
|
|
||||||
operationId: getLastUpdated
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Successful response returning the object that contains the date and time when the database was last updated.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/LastUpdated'
|
|
||||||
|
|
||||||
components:
|
|
||||||
schemas:
|
|
||||||
Amiibo:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
amiiboSeries:
|
|
||||||
type: string
|
|
||||||
character:
|
|
||||||
type: string
|
|
||||||
gameSeries:
|
|
||||||
type: string
|
|
||||||
games3DS:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/AmiiboGame'
|
|
||||||
gamesSwitch:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/AmiiboGame'
|
|
||||||
gamesWiiU:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/AmiiboGame'
|
|
||||||
head:
|
|
||||||
type: string
|
|
||||||
image:
|
|
||||||
type: string
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
release:
|
|
||||||
type: object
|
|
||||||
$ref: '#/components/schemas/AmiiboRelease'
|
|
||||||
tail:
|
|
||||||
type: string
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- amiiboSeries
|
|
||||||
- character
|
|
||||||
- gameSeries
|
|
||||||
- head
|
|
||||||
- image
|
|
||||||
- name
|
|
||||||
- release
|
|
||||||
- tail
|
|
||||||
- type
|
|
||||||
|
|
||||||
AmiiboGame:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
amiiboUsage:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/AmiiboUsage'
|
|
||||||
gameID:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
gameName:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- gameID
|
|
||||||
- gameName
|
|
||||||
|
|
||||||
AmiiboList:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/Amiibo'
|
|
||||||
|
|
||||||
AmiiboRelease:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
au:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
eu:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
jp:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
na:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
|
|
||||||
AmiiboUsage:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
Usage:
|
|
||||||
type: string
|
|
||||||
write:
|
|
||||||
type: boolean
|
|
||||||
required:
|
|
||||||
- Usage
|
|
||||||
- write
|
|
||||||
|
|
||||||
AmiiboWrapper:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
amiibo:
|
|
||||||
oneOf:
|
|
||||||
- $ref: '#/components/schemas/Amiibo'
|
|
||||||
- $ref: '#/components/schemas/AmiiboList'
|
|
||||||
required:
|
|
||||||
- amiibo
|
|
||||||
|
|
||||||
LastUpdated:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
lastUpdated:
|
|
||||||
type: string
|
|
||||||
format: date-time
|
|
||||||
required:
|
|
||||||
- lastUpdated
|
|
||||||
|
|
||||||
Tuple:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
key:
|
|
||||||
type: string
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- key
|
|
||||||
- name
|
|
||||||
|
|
||||||
TupleList:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/Tuple'
|
|
||||||
|
|
||||||
TupleWrapper:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
amiibo:
|
|
||||||
oneOf:
|
|
||||||
- $ref: '#/components/schemas/Tuple'
|
|
||||||
- $ref: '#/components/schemas/TupleList'
|
|
||||||
required:
|
|
||||||
- amiibo
|
|
||||||
@@ -0,0 +1,703 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import AmiiboService
|
||||||
|
import Foundation
|
||||||
|
import Testing
|
||||||
|
|
||||||
|
@Suite("Amiibo Service", .tags(.live))
|
||||||
|
struct AmiiboServiceLiveTests {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
private let service: AmiiboService
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
init() {
|
||||||
|
self.service = .init()
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Functions tests
|
||||||
|
|
||||||
|
#if swift(>=6.2)
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.amiibos,
|
||||||
|
Output.amiibos
|
||||||
|
))
|
||||||
|
func `get amiibos`(
|
||||||
|
filter: AmiiboFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertAmiibos(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.amiibosThrows,
|
||||||
|
Output.amiibosThrows
|
||||||
|
))
|
||||||
|
func `get amiibos throws`(
|
||||||
|
filter: AmiiboFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsAmiibosThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.amiiboSeries,
|
||||||
|
Output.amiiboSeries
|
||||||
|
))
|
||||||
|
func `get amiibo series`(
|
||||||
|
filter: AmiiboSeriesFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertAmiiboSeries(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.amiiboSeriesThrows,
|
||||||
|
Output.amiiboSeriesThrows
|
||||||
|
))
|
||||||
|
func `get amiibo series throws`(
|
||||||
|
filter: AmiiboSeriesFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsAmiiboSeriesThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.amiiboTypes,
|
||||||
|
Output.amiiboTypes
|
||||||
|
))
|
||||||
|
func `get amiibo types`(
|
||||||
|
filter: AmiiboTypeFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertAmiiboTypes(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.amiiboTypesThrows,
|
||||||
|
Output.amiiboTypesThrows
|
||||||
|
))
|
||||||
|
func `get amiibo types throws`(
|
||||||
|
filter: AmiiboTypeFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsAmiiboTypesThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.gameCharacters,
|
||||||
|
Output.gameCharacters
|
||||||
|
))
|
||||||
|
func `get game characters`(
|
||||||
|
filter: GameCharacterFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertGameCharacters(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.gameCharactersThrows,
|
||||||
|
Output.gameCharactersThrows
|
||||||
|
))
|
||||||
|
func `get game characters throws`(
|
||||||
|
filter: GameCharacterFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsGameCharactersThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.gameSeries,
|
||||||
|
Output.gameSeries
|
||||||
|
))
|
||||||
|
func `get game series`(
|
||||||
|
filter: GameSeriesFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertGameSeries(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(arguments: zip(
|
||||||
|
Input.gameSeriesThrows,
|
||||||
|
Output.gameSeriesThrows
|
||||||
|
))
|
||||||
|
func `get game series throws`(
|
||||||
|
filter: GameSeriesFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsGameSeriesThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
func `get the last updated timestamp`() async throws {
|
||||||
|
try await assertLastUpdated(
|
||||||
|
day: 26,
|
||||||
|
month: 3,
|
||||||
|
year: 2026
|
||||||
|
)
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
@Test("get amiibos", arguments: zip(
|
||||||
|
Input.amiibos,
|
||||||
|
Output.amiibos
|
||||||
|
))
|
||||||
|
func getAmiibos(
|
||||||
|
filter: AmiiboFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertAmiibos(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get amiibos throws", arguments: zip(
|
||||||
|
Input.amiibosThrows,
|
||||||
|
Output.amiibosThrows
|
||||||
|
))
|
||||||
|
func getAmiibosThrows(
|
||||||
|
filter: AmiiboFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsAmiibosThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get amiibo series", arguments: zip(
|
||||||
|
Input.amiiboSeries,
|
||||||
|
Output.amiiboSeries
|
||||||
|
))
|
||||||
|
func getAmiiboSeries(
|
||||||
|
filter: AmiiboSeriesFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertAmiiboSeries(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get amiibo series throws", arguments: zip(
|
||||||
|
Input.amiiboSeriesThrows,
|
||||||
|
Output.amiiboSeriesThrows
|
||||||
|
))
|
||||||
|
func getAmiiboSeriesThrows(
|
||||||
|
filter: AmiiboSeriesFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsAmiiboSeriesThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get amiibo types", arguments: zip(
|
||||||
|
Input.amiiboTypes,
|
||||||
|
Output.amiiboTypes
|
||||||
|
))
|
||||||
|
func getAmiiboTypes(
|
||||||
|
filter: AmiiboTypeFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertAmiiboTypes(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get amiibo types throws", arguments: zip(
|
||||||
|
Input.amiiboTypesThrows,
|
||||||
|
Output.amiiboTypesThrows
|
||||||
|
))
|
||||||
|
func getAmiiboTypesThrows(
|
||||||
|
filter: AmiiboTypeFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsAmiiboTypesThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get game characters", arguments: zip(
|
||||||
|
Input.gameCharacters,
|
||||||
|
Output.gameCharacters
|
||||||
|
))
|
||||||
|
func getGameCharacters(
|
||||||
|
filter: GameCharacterFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertGameCharacters(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get game characters throws", arguments: zip(
|
||||||
|
Input.gameCharactersThrows,
|
||||||
|
Output.gameCharactersThrows
|
||||||
|
))
|
||||||
|
func getGameCharactersThrows(
|
||||||
|
filter: GameCharacterFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsGameCharactersThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get game series", arguments: zip(
|
||||||
|
Input.gameSeries,
|
||||||
|
Output.gameSeries
|
||||||
|
))
|
||||||
|
func getGameSeries(
|
||||||
|
filter: GameSeriesFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
try await assertGameSeries(
|
||||||
|
with: filter,
|
||||||
|
expects: numberOfItems
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get game series throws", arguments: zip(
|
||||||
|
Input.gameSeriesThrows,
|
||||||
|
Output.gameSeriesThrows
|
||||||
|
))
|
||||||
|
func getGameSeriesThrows(
|
||||||
|
filter: GameSeriesFilter,
|
||||||
|
expects error: AmiiboServiceError
|
||||||
|
) async throws {
|
||||||
|
try await assertsGameSeriesThrows(
|
||||||
|
error: error,
|
||||||
|
when: filter
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("get last updated timestamp")
|
||||||
|
func getLastUpdated() async throws {
|
||||||
|
try await assertLastUpdated(
|
||||||
|
day: 26,
|
||||||
|
month: 3,
|
||||||
|
year: 2026
|
||||||
|
)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Assertions
|
||||||
|
|
||||||
|
private extension AmiiboServiceLiveTests {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
/// Asserts the number of items returned by the `amiibos` endpoint that matched a given filter.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - filter: An amiibo filter type.
|
||||||
|
/// - numberOfItems: An expected number of items returned.
|
||||||
|
func assertAmiibos(
|
||||||
|
with filter: AmiiboFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
let amiibos = try await service.getAmiibos(filter)
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(amiibos.count == numberOfItems)
|
||||||
|
|
||||||
|
guard
|
||||||
|
!amiibos.isEmpty,
|
||||||
|
(filter.showGames == true || filter.showUsage == true)
|
||||||
|
else { return }
|
||||||
|
|
||||||
|
let firstAmiiboPlatform = try #require(amiibos.first?.platform)
|
||||||
|
|
||||||
|
#expect(amiibos.last?.platform != nil)
|
||||||
|
|
||||||
|
if filter.showUsage == true {
|
||||||
|
#expect(firstAmiiboPlatform.switch.first?.usages?.isEmpty == false)
|
||||||
|
// Given the live data is still not returning any Switch 2 games.
|
||||||
|
#expect(firstAmiiboPlatform.switch2.isEmpty == true)
|
||||||
|
#expect(firstAmiiboPlatform.threeDS.first?.usages?.isEmpty == false)
|
||||||
|
#expect(firstAmiiboPlatform.wiiU.first?.usages?.isEmpty == false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the error thrown by the `amiibos` endpoint.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - error: An expected error.
|
||||||
|
/// - filter: An amiibo filter type.
|
||||||
|
func assertsAmiibosThrows(
|
||||||
|
error: AmiiboServiceError,
|
||||||
|
when filter: AmiiboFilter
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getAmiibos(filter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the number of items returned by the `amiiboSeries` endpoint that matched a given filter.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - filter: An amiibo series filter type.
|
||||||
|
/// - numberOfItems: An expected number of items returned.
|
||||||
|
func assertAmiiboSeries(
|
||||||
|
with filter: AmiiboSeriesFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
let amiiboSeries = try await service.getAmiiboSeries(filter)
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(amiiboSeries.count == numberOfItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the error thrown by the `amiiboSeries` endpoint.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - error: An expected error.
|
||||||
|
/// - filter: An amiibo series filter type.
|
||||||
|
func assertsAmiiboSeriesThrows(
|
||||||
|
error: AmiiboServiceError,
|
||||||
|
when filter: AmiiboSeriesFilter
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getAmiiboSeries(filter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the number of items returned by the `amiiboTypes` endpoint that matched a given filter.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - filter: An amiibo type filter type.
|
||||||
|
/// - numberOfItems: An expected number of items returned.
|
||||||
|
func assertAmiiboTypes(
|
||||||
|
with filter: AmiiboTypeFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
let amiiboTypes = try await service.getAmiiboTypes(filter)
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(amiiboTypes.count == numberOfItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the error thrown by the `amiiboTypes` endpoint.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - error: An expected error.
|
||||||
|
/// - filter: An amiibo type filter type.
|
||||||
|
func assertsAmiiboTypesThrows(
|
||||||
|
error: AmiiboServiceError,
|
||||||
|
when filter: AmiiboTypeFilter
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getAmiiboTypes(filter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the number of items returned by the `gameCharacters` endpoint that matched a given filter.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - filter: A game character filter type.
|
||||||
|
/// - numberOfItems: An expected number of items returned.
|
||||||
|
func assertGameCharacters(
|
||||||
|
with filter: GameCharacterFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
let gameCharacters = try await service.getGameCharacters(filter)
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(gameCharacters.count == numberOfItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the error thrown by the `gameCharacters` endpoint.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - error: An expected error.
|
||||||
|
/// - filter: A game character filter type.
|
||||||
|
func assertsGameCharactersThrows(
|
||||||
|
error: AmiiboServiceError,
|
||||||
|
when filter: GameCharacterFilter
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getGameCharacters(filter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the number of items returned by the `gameSeries` endpoint that matched a given filter.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - filter: A game series filter type.
|
||||||
|
/// - numberOfItems: An expected number of items returned.
|
||||||
|
func assertGameSeries(
|
||||||
|
with filter: GameSeriesFilter,
|
||||||
|
expects numberOfItems: Int
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
let gameSeries = try await service.getGameSeries(filter)
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(gameSeries.count == numberOfItems)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the error thrown by the `gameSeries` endpoint.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - error: An expected error.
|
||||||
|
/// - filter: A game series filter type.
|
||||||
|
func assertsGameSeriesThrows(
|
||||||
|
error: AmiiboServiceError,
|
||||||
|
when filter: GameSeriesFilter
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getGameSeries(filter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asserts the date returned by the `lastUpdated` endpoint.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - day: A number of day of the last updated date.
|
||||||
|
/// - month: A number of month of the last updated date.
|
||||||
|
/// - year: A number of year of the last updated date.
|
||||||
|
func assertLastUpdated(
|
||||||
|
day: Int,
|
||||||
|
month: Int,
|
||||||
|
year: Int
|
||||||
|
) async throws {
|
||||||
|
// GIVEN
|
||||||
|
// WHEN
|
||||||
|
let dateLastUpdated = try await service.getLastUpdated()
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
let dateComponents = Calendar.current.dateComponents(
|
||||||
|
[.year, .month, .day],
|
||||||
|
from: dateLastUpdated
|
||||||
|
)
|
||||||
|
|
||||||
|
#expect(dateComponents.year == year)
|
||||||
|
#expect(dateComponents.month == month)
|
||||||
|
#expect(dateComponents.day == day)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Arguments
|
||||||
|
|
||||||
|
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(identifier: "0000000000000000"),
|
||||||
|
.init(identifier: "0000000"),
|
||||||
|
.init(name: "zelda"),
|
||||||
|
.init(name: "Something"),
|
||||||
|
.init(name: "zel"),
|
||||||
|
.init(name: .empty),
|
||||||
|
.init(type: "0x00"),
|
||||||
|
.init(type: "Figure"),
|
||||||
|
.init(type: "0x0f"),
|
||||||
|
.init(type: "something"),
|
||||||
|
.init(type: "fig"),
|
||||||
|
.init(type: .empty),
|
||||||
|
.init(series: "0x00"),
|
||||||
|
.init(series: "Legend of Zelda"),
|
||||||
|
.init(series: "0xf9"),
|
||||||
|
.init(series: "something"),
|
||||||
|
.init(series: "fig"),
|
||||||
|
.init(series: .empty),
|
||||||
|
.init(gameCharacter: "0x00"),
|
||||||
|
.init(gameCharacter: "Zelda"),
|
||||||
|
.init(gameCharacter: "0xf9"),
|
||||||
|
.init(gameCharacter: "something"),
|
||||||
|
.init(gameCharacter: "fig"),
|
||||||
|
.init(gameCharacter: .empty),
|
||||||
|
.init(gameSeries: "0x00"),
|
||||||
|
.init(gameSeries: "Legend of Zelda"),
|
||||||
|
.init(gameSeries: "0xf9"),
|
||||||
|
.init(gameSeries: "something"),
|
||||||
|
.init(gameSeries: "Super"),
|
||||||
|
.init(gameSeries: .empty),
|
||||||
|
.init(showGames: true),
|
||||||
|
.init(showUsage: true)
|
||||||
|
]
|
||||||
|
/// A list of amiibo series filters to input to the `assertAmiibosThrows` assertion.
|
||||||
|
static let amiibosThrows: [AmiiboFilter] = [
|
||||||
|
.init(head: .empty),
|
||||||
|
.init(tail: .empty),
|
||||||
|
.init(identifier: .empty),
|
||||||
|
.init(type: "0x"),
|
||||||
|
.init(series: "0x"),
|
||||||
|
.init(gameCharacter: "0x"),
|
||||||
|
.init(gameSeries: "0x"),
|
||||||
|
]
|
||||||
|
/// A list of amiibo series filters to input to the `assertAmiiboSeries` assertion.
|
||||||
|
static let amiiboSeries: [AmiiboSeriesFilter] = [
|
||||||
|
.init(),
|
||||||
|
.init(key: "0x01"),
|
||||||
|
.init(name: "Legend of Zelda"),
|
||||||
|
.init(name: "Zelda"),
|
||||||
|
.init(name: .empty)
|
||||||
|
]
|
||||||
|
/// A list of amiibo series filters to input to the `assertAmiiboSeriesThrows` assertion.
|
||||||
|
static let amiiboSeriesThrows: [AmiiboSeriesFilter] = [
|
||||||
|
.init(key: "0xf9"),
|
||||||
|
.init(key: "0x"),
|
||||||
|
.init(key: .empty),
|
||||||
|
.init(name: "Something")
|
||||||
|
]
|
||||||
|
/// A list of amiibo type filters to input to the `assertAmiiboTypes` assertion.
|
||||||
|
static let amiiboTypes: [AmiiboTypeFilter] = [
|
||||||
|
.init(),
|
||||||
|
.init(key: "0x01"),
|
||||||
|
.init(name: "Card"),
|
||||||
|
.init(name: "Ca"),
|
||||||
|
.init(name: .empty)
|
||||||
|
]
|
||||||
|
/// A list of amiibo type filters to input to the `assertAmiiboTypesThrows` assertion.
|
||||||
|
static let amiiboTypesThrows: [AmiiboTypeFilter] = [
|
||||||
|
.init(key: "0x09"),
|
||||||
|
.init(key: "0x"),
|
||||||
|
.init(key: .empty),
|
||||||
|
.init(name: "Something")
|
||||||
|
]
|
||||||
|
/// A list of game character filters to input to the `assertGameCharacters` assertion.
|
||||||
|
static let gameCharacters: [GameCharacterFilter] = [
|
||||||
|
.init(),
|
||||||
|
.init(key: "0x0001"),
|
||||||
|
.init(name: "Zelda"),
|
||||||
|
.init(name: "Zeld"),
|
||||||
|
.init(name: .empty)
|
||||||
|
]
|
||||||
|
/// A list of game character filters to input to the `assertGameCharactersThrows` assertion.
|
||||||
|
static let gameCharactersThrows: [GameCharacterFilter] = [
|
||||||
|
.init(key: "0xffff"),
|
||||||
|
.init(key: "0x"),
|
||||||
|
.init(key: .empty),
|
||||||
|
.init(name: "Something")
|
||||||
|
]
|
||||||
|
/// A list of game series filters to input to the `assertGameSeries` assertion.
|
||||||
|
static let gameSeries: [GameSeriesFilter] = [
|
||||||
|
.init(),
|
||||||
|
.init(key: "0x001"),
|
||||||
|
.init(name: "Pikmin"),
|
||||||
|
.init(name: "Pik"),
|
||||||
|
.init(name: .empty)
|
||||||
|
]
|
||||||
|
/// A list of game series filters to input to the `assertGameSeriesThrows` assertion.
|
||||||
|
static let gameSeriesThrows: [GameSeriesFilter] = [
|
||||||
|
.init(key: "0xffff"),
|
||||||
|
.init(key: "0x"),
|
||||||
|
.init(key: .empty),
|
||||||
|
.init(name: "Something")
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Output {
|
||||||
|
/// A list of number of items that are expected from the `assertAmiibos` assertion.
|
||||||
|
static let amiibos: [Int] = [.totalAmiibos, 7, 7, 1, 1, 1, .zero, .zero, 5, .zero, 7, .totalAmiibos, 247, 247, .zero, .zero, .zero, .zero, 96, 26, .zero, .zero, 63, .totalAmiibos, 13, 6, .zero, .zero, .zero, .totalAmiibos, 51, 32, .zero, .zero, 150, .totalAmiibos, .totalAmiibos, .totalAmiibos]
|
||||||
|
/// A list of errors are expected to be thrown from the `assertAmiibosThrows` assertion.
|
||||||
|
static let amiibosThrows: [AmiiboServiceError] = [.badRequest, .badRequest, .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.
|
||||||
|
static let amiiboSeriesThrows: [AmiiboServiceError] = [.notFound, .badRequest, .badRequest, .notFound]
|
||||||
|
/// A list of number of items that are expected from the `assertAmiiboTypes` assertion.
|
||||||
|
static let amiiboTypes: [Int] = [.totalAmiiboTypes, 1, 1, 1, .totalAmiiboTypes]
|
||||||
|
/// A list of errors are expected to be thrown from the `assertAmiiboTypesThrows` assertion.
|
||||||
|
static let amiiboTypesThrows: [AmiiboServiceError] = [.notFound, .badRequest, .badRequest, .notFound]
|
||||||
|
/// A list of number of items that are expected from the `assertGameCharacters` assertion.
|
||||||
|
static let gameCharacters: [Int] = [.totalGameCharacters, 1, 1, 1, .totalGameCharacters]
|
||||||
|
/// A list of errors are expected to be thrown from the `assertGameCharactersThrows` assertion.
|
||||||
|
static let gameCharactersThrows: [AmiiboServiceError] = [.notFound, .badRequest, .badRequest, .notFound]
|
||||||
|
/// A list of number of items that are expected from the `assertGameSeries` assertion.
|
||||||
|
static let gameSeries: [Int] = [.totalGameSeries, 1, 1, 1, .totalGameSeries]
|
||||||
|
/// A list of errors are expected to be thrown from the `assertGameSeriesThrows` assertion.
|
||||||
|
static let gameSeriesThrows: [AmiiboServiceError] = [.notFound, .badRequest, .badRequest, .notFound]
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Constants
|
||||||
|
|
||||||
|
private extension Int {
|
||||||
|
/// A number that represents the total number of amiibo items currently available at the live service.
|
||||||
|
static let totalAmiibos = 939
|
||||||
|
/// A number that represents the total number of amiibo series currently available at the live service.
|
||||||
|
static let totalAmiiboSeries = 30
|
||||||
|
/// A number that represents the total number of amiibo types currently available at the live service.
|
||||||
|
static let totalAmiiboTypes = 5
|
||||||
|
/// A number that represents the total number of game characters currently available at the live service.
|
||||||
|
static let totalGameCharacters = 680
|
||||||
|
/// A number that represents the total number of game series currently available at the live service.
|
||||||
|
static let totalGameSeries = 117
|
||||||
|
}
|
||||||
|
|
||||||
|
private extension String {
|
||||||
|
/// An empty string.
|
||||||
|
static let empty = ""
|
||||||
|
}
|
||||||
@@ -0,0 +1,266 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import AmiiboService
|
||||||
|
import Foundation
|
||||||
|
import Testing
|
||||||
|
|
||||||
|
@Suite("Amiibo Service [Mock]", .tags(.mock))
|
||||||
|
struct AmiiboServiceMockTests {
|
||||||
|
|
||||||
|
// MARK: Get Amiibos tests
|
||||||
|
|
||||||
|
@Test("returns empty amiibos when mock provides an empty list")
|
||||||
|
func getAmiibosEmpty() async throws {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(amiibos: []))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
let amiibos = try await service.getAmiibos()
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(amiibos.isEmpty)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws notFound when mock provides no amiibos")
|
||||||
|
func getAmiibosNotFound() async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient())
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: AmiiboServiceError.notFound) {
|
||||||
|
try await service.getAmiibos()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws error for amiibos when mock is configured with error", arguments: Errors.all)
|
||||||
|
func getAmiibosThrows(error: AmiiboServiceError) async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(error: error))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getAmiibos()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Get Amiibo Series tests
|
||||||
|
|
||||||
|
@Test("returns empty amiibo series when mock provides an empty list")
|
||||||
|
func getAmiiboSeriesEmpty() async throws {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(amiiboSeries: []))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
let amiiboSeries = try await service.getAmiiboSeries()
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(amiiboSeries.isEmpty)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws notFound when mock provides no amiibo series")
|
||||||
|
func getAmiiboSeriesNotFound() async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient())
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: AmiiboServiceError.notFound) {
|
||||||
|
try await service.getAmiiboSeries()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws error for amiibo series when mock is configured with error", arguments: Errors.all)
|
||||||
|
func getAmiiboSeriesThrows(error: AmiiboServiceError) async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(error: error))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getAmiiboSeries()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Get Amiibo Types tests
|
||||||
|
|
||||||
|
@Test("returns empty amiibo types when mock provides an empty list")
|
||||||
|
func getAmiiboTypesEmpty() async throws {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(amiiboTypes: []))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
let amiiboTypes = try await service.getAmiiboTypes()
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(amiiboTypes.isEmpty)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws notFound when mock provides no amiibo types")
|
||||||
|
func getAmiiboTypesNotFound() async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient())
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: AmiiboServiceError.notFound) {
|
||||||
|
try await service.getAmiiboTypes()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws error for amiibo types when mock is configured with error", arguments: Errors.all)
|
||||||
|
func getAmiiboTypesThrows(error: AmiiboServiceError) async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(error: error))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getAmiiboTypes()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Get Game Characters tests
|
||||||
|
|
||||||
|
@Test("returns empty game characters when mock provides an empty list")
|
||||||
|
func getGameCharactersEmpty() async throws {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(gameCharacters: []))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
let gameCharacters = try await service.getGameCharacters()
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(gameCharacters.isEmpty)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws notFound when mock provides no game characters")
|
||||||
|
func getGameCharactersNotFound() async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient())
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: AmiiboServiceError.notFound) {
|
||||||
|
try await service.getGameCharacters()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws error for game characters when mock is configured with error", arguments: Errors.all)
|
||||||
|
func getGameCharactersThrows(error: AmiiboServiceError) async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(error: error))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getGameCharacters()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Get Game Series tests
|
||||||
|
|
||||||
|
@Test("returns empty game series when mock provides an empty list")
|
||||||
|
func getGameSeriesEmpty() async throws {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(gameSeries: []))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
let gameSeries = try await service.getGameSeries()
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(gameSeries.isEmpty)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws notFound when mock provides no game series")
|
||||||
|
func getGameSeriesNotFound() async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient())
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: AmiiboServiceError.notFound) {
|
||||||
|
try await service.getGameSeries()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws error for game series when mock is configured with error", arguments: Errors.all)
|
||||||
|
func getGameSeriesThrows(error: AmiiboServiceError) async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(error: error))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getGameSeries()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Get Last Updated tests
|
||||||
|
|
||||||
|
@Test("returns date when mock provides a last updated date")
|
||||||
|
func getLastUpdated() async throws {
|
||||||
|
// GIVEN
|
||||||
|
let expectedDate = Date(timeIntervalSince1970: 1_700_000_000)
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(lastUpdated: expectedDate))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
let lastUpdated = try await service.getLastUpdated()
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
#expect(lastUpdated == expectedDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws notFound when mock provides no last updated date")
|
||||||
|
func getLastUpdatedNotFound() async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient())
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: AmiiboServiceError.notFound) {
|
||||||
|
try await service.getLastUpdated()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test("throws error for last updated when mock is configured with error", arguments: Errors.all)
|
||||||
|
func getLastUpdatedThrows(error: AmiiboServiceError) async {
|
||||||
|
// GIVEN
|
||||||
|
let service = AmiiboService(client: AmiiboMockClient(error: error))
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
// THEN
|
||||||
|
await #expect(throws: error) {
|
||||||
|
try await service.getLastUpdated()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Arguments
|
||||||
|
|
||||||
|
private enum Errors {
|
||||||
|
/// All possible errors that can be thrown by the service.
|
||||||
|
static let all: [AmiiboServiceError] = [
|
||||||
|
.badRequest,
|
||||||
|
.cancelled,
|
||||||
|
.decoding,
|
||||||
|
.notAvailable,
|
||||||
|
.notFound,
|
||||||
|
.undocumented(500),
|
||||||
|
.unknown
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import AmiiboService
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// A mock implementation of ``AmiiboClient`` that returns pre-configured data or throws pre-configured errors, for testing purposes.
|
||||||
|
struct AmiiboMockClient {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// The list of amiibo items to return when ``getAmiibos(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||||
|
private let amiibos: [Amiibo]?
|
||||||
|
|
||||||
|
/// The list of amiibo series to return when ``getAmiiboSeries(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||||
|
private let amiiboSeries: [AmiiboSeries]?
|
||||||
|
|
||||||
|
/// The list of amiibo types to return when ``getAmiiboTypes(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||||
|
private let amiiboTypes: [AmiiboType]?
|
||||||
|
|
||||||
|
/// An error to throw before returning any data. Takes precedence over stored data when set.
|
||||||
|
private let error: AmiiboServiceError?
|
||||||
|
|
||||||
|
/// The list of game characters to return when ``getGameCharacters(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||||
|
private let gameCharacters: [GameCharacter]?
|
||||||
|
|
||||||
|
/// The list of game series to return when ``getGameSeries(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||||
|
private let gameSeries: [GameSeries]?
|
||||||
|
|
||||||
|
/// The last updated date to return when ``getLastUpdated()`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||||
|
private let lastUpdated: Date?
|
||||||
|
|
||||||
|
// MARK: Initializers
|
||||||
|
|
||||||
|
/// Initializes this client.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - amiibos: A list of amiibo items to return, if any.
|
||||||
|
/// - amiiboSeries: A list of amiibo series to return, if any.
|
||||||
|
/// - amiiboTypes: A list of amiibo types to return, if any.
|
||||||
|
/// - gameCharacters: A list of game characters to return, if any.
|
||||||
|
/// - gameSeries: A list of game series to return, if any.
|
||||||
|
/// - lastUpdated: A last updated date to return, if any.
|
||||||
|
/// - error: An error to throw, if any.
|
||||||
|
init(
|
||||||
|
amiibos: [Amiibo]? = nil,
|
||||||
|
amiiboSeries: [AmiiboSeries]? = nil,
|
||||||
|
amiiboTypes: [AmiiboType]? = nil,
|
||||||
|
gameCharacters: [GameCharacter]? = nil,
|
||||||
|
gameSeries: [GameSeries]? = nil,
|
||||||
|
lastUpdated: Date? = nil,
|
||||||
|
error: AmiiboServiceError? = nil
|
||||||
|
) {
|
||||||
|
self.amiibos = amiibos
|
||||||
|
self.amiiboSeries = amiiboSeries
|
||||||
|
self.amiiboTypes = amiiboTypes
|
||||||
|
self.error = error
|
||||||
|
self.gameCharacters = gameCharacters
|
||||||
|
self.gameSeries = gameSeries
|
||||||
|
self.lastUpdated = lastUpdated
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - AmiiboClient
|
||||||
|
|
||||||
|
extension AmiiboMockClient: AmiiboClient {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
#if swift(>=6.0)
|
||||||
|
func getAmiibos(
|
||||||
|
by filter: AmiiboFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [Amiibo] {
|
||||||
|
try fetchAmiibosIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getAmiiboSeries(
|
||||||
|
by filter: AmiiboSeriesFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [AmiiboSeries] {
|
||||||
|
try fetchAmiiboSeriesIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getAmiiboTypes(
|
||||||
|
by filter: AmiiboTypeFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [AmiiboType] {
|
||||||
|
try fetchAmiiboTypesIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getGameCharacters(
|
||||||
|
by filter: GameCharacterFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [GameCharacter] {
|
||||||
|
try fetchGameCharactersIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getGameSeries(
|
||||||
|
by filter: GameSeriesFilter
|
||||||
|
) async throws(AmiiboServiceError) -> [GameSeries] {
|
||||||
|
try fetchGameSeriesIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getLastUpdated() async throws(AmiiboServiceError) -> Date {
|
||||||
|
fetchLastUpdatedIfAny()
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
func getAmiibos(
|
||||||
|
by filter: AmiiboFilter
|
||||||
|
) async throws -> [Amiibo] {
|
||||||
|
try fetchAmiibosIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getAmiiboSeries(
|
||||||
|
by filter: AmiiboSeriesFilter
|
||||||
|
) async throws -> [AmiiboSeries] {
|
||||||
|
try fetchAmiiboSeriesIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getAmiiboTypes(
|
||||||
|
by filter: AmiiboTypeFilter
|
||||||
|
) async throws -> [AmiiboType] {
|
||||||
|
try fetchAmiiboTypesIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getGameCharacters(
|
||||||
|
by filter: GameCharacterFilter
|
||||||
|
) async throws -> [GameCharacter] {
|
||||||
|
try fetchGameCharactersIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getGameSeries(
|
||||||
|
by filter: GameSeriesFilter
|
||||||
|
) async throws -> [GameSeries] {
|
||||||
|
try fetchGameSeriesIfAny()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getLastUpdated() async throws -> Date {
|
||||||
|
try fetchLastUpdatedIfAny()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
private extension AmiiboMockClient {
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
/// Fetches a list of amiibo items, if any.
|
||||||
|
/// - Returns: A list of amiibo items.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||||
|
func fetchAmiibosIfAny() throws -> [Amiibo] {
|
||||||
|
try throwErrorIfExists()
|
||||||
|
|
||||||
|
guard let amiibos else {
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return amiibos
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of amiibo series, if any.
|
||||||
|
/// - Returns: A list of amiibo series.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||||
|
func fetchAmiiboSeriesIfAny() throws -> [AmiiboSeries] {
|
||||||
|
try throwErrorIfExists()
|
||||||
|
|
||||||
|
guard let amiiboSeries else {
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return amiiboSeries
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of amiibo types, if any.
|
||||||
|
/// - Returns: A list of amiibo types.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||||
|
func fetchAmiiboTypesIfAny() throws -> [AmiiboType] {
|
||||||
|
try throwErrorIfExists()
|
||||||
|
|
||||||
|
guard let amiiboTypes else {
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return amiiboTypes
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of game characters, if any.
|
||||||
|
/// - Returns: A list of game characters.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||||
|
func fetchGameCharactersIfAny() throws -> [GameCharacter] {
|
||||||
|
try throwErrorIfExists()
|
||||||
|
|
||||||
|
guard let gameCharacters else {
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return gameCharacters
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a list of game series, if any.
|
||||||
|
/// - Returns: A list of game series, if any.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||||
|
func fetchGameSeriesIfAny() throws -> [GameSeries] {
|
||||||
|
try throwErrorIfExists()
|
||||||
|
|
||||||
|
guard let gameSeries else {
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return gameSeries
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetches a last updated date, if any.
|
||||||
|
/// - Returns: A last updated date.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||||
|
func fetchLastUpdatedIfAny() throws -> Date {
|
||||||
|
try throwErrorIfExists()
|
||||||
|
|
||||||
|
guard let lastUpdated else {
|
||||||
|
throw AmiiboServiceError.notFound
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastUpdated
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Throws the configured error if one has been provided.
|
||||||
|
/// - Throws: An ``AmiiboServiceError`` error if one was configured during initialization.
|
||||||
|
func throwErrorIfExists() throws(AmiiboServiceError) {
|
||||||
|
if let error {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
//
|
||||||
|
// This source file is part of the Amiibo Service open source project
|
||||||
|
//
|
||||||
|
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||||
|
// Licensed under Apache license v2.0
|
||||||
|
//
|
||||||
|
// See LICENSE for license information
|
||||||
|
// See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
// ===----------------------------------------------------------------------===
|
||||||
|
|
||||||
|
import Testing
|
||||||
|
|
||||||
|
extension Tag {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
/// Tag that indicates tests against a live backend service.
|
||||||
|
@Tag static var live: Self
|
||||||
|
|
||||||
|
/// Tag that indicates tests using a mock client.
|
||||||
|
@Tag static var mock: Self
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"primaryContentSections":[{"declarations":[{"tokens":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"lhs","kind":"internalParam"},{"text":": ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"rhs","kind":"internalParam"},{"text":": ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"text":"Bool","preciseIdentifier":"s:Sb","kind":"typeIdentifier"}],"platforms":["macOS"],"languages":["swift"]}],"kind":"declarations"},{"kind":"parameters","parameters":[{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"A value to compare."}]}],"name":"lhs"},{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Another value to compare."}]}],"name":"rhs"}]},{"kind":"content","content":[{"type":"heading","level":2,"text":"Discussion","anchor":"discussion"},{"type":"paragraph","inlineContent":[{"text":"Inequality is the inverse of equality. For any values ","type":"text"},{"code":"a","type":"codeVoice"},{"text":" and ","type":"text"},{"code":"b","type":"codeVoice"},{"text":", ","type":"text"},{"code":"a != b","type":"codeVoice"},{"text":" ","type":"text"},{"text":"implies that ","type":"text"},{"code":"a == b","type":"codeVoice"},{"text":" is ","type":"text"},{"code":"false","type":"codeVoice"},{"text":".","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"This is the default implementation of the not-equal-to operator (","type":"text"},{"code":"!=","type":"codeVoice"},{"text":")","type":"text"},{"text":" ","type":"text"},{"text":"for any type that conforms to ","type":"text"},{"code":"Equatable","type":"codeVoice"},{"text":".","type":"text"}]}]}],"sections":[],"kind":"symbol","schemaVersion":{"minor":3,"patch":0,"major":0},"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/!=(_:_:)","interfaceLanguage":"swift"},"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"abstract":[{"text":"Returns a Boolean value indicating whether two values are not equal.","type":"text"}],"metadata":{"extendedModule":"Swift","fragments":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"text":"Bool","kind":"typeIdentifier","preciseIdentifier":"s:Sb"}],"symbolKind":"op","modules":[{"name":"AmiiboService","relatedModules":["Swift"]}],"role":"symbol","externalID":"s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::s:13AmiiboService0A0V","roleHeading":"Operator","title":"!=(_:_:)"},"variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/!=(_:_:)"],"traits":[{"interfaceLanguage":"swift"}]}],"references":{"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/!=(_:_:)":{"abstract":[{"type":"text","text":"Returns a Boolean value indicating whether two values are not equal."}],"fragments":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"preciseIdentifier":"s:Sb","text":"Bool","kind":"typeIdentifier"}],"title":"!=(_:_:)","role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/!=(_:_:)","type":"topic","kind":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/!=(_:_:)"},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"metadata":{"roleHeading":"API Collection","role":"collectionGroup","title":"Equatable Implementations","modules":[{"name":"AmiiboService"}]},"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"kind":"article","variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/equatable-implementations"],"traits":[{"interfaceLanguage":"swift"}]}],"schemaVersion":{"patch":0,"minor":3,"major":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Equatable-Implementations"},"topicSections":[{"generated":true,"title":"Operators","anchor":"Operators","identifiers":["doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/!=(_:_:)"]}],"sections":[],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/!=(_:_:)":{"abstract":[{"type":"text","text":"Returns a Boolean value indicating whether two values are not equal."}],"fragments":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"preciseIdentifier":"s:Sb","text":"Bool","kind":"typeIdentifier"}],"title":"!=(_:_:)","role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/!=(_:_:)","type":"topic","kind":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/!=(_:_:)"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"sections":[],"kind":"article","schemaVersion":{"major":0,"patch":0,"minor":3},"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/Equatable-Implementations","interfaceLanguage":"swift"},"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game"]]},"topicSections":[{"identifiers":["doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/!=(_:_:)"],"title":"Operators","anchor":"Operators","generated":true}],"metadata":{"modules":[{"name":"AmiiboService"}],"title":"Equatable Implementations","roleHeading":"API Collection","role":"collectionGroup"},"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/amiiboservice\/amiibo\/game\/equatable-implementations"]}],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game":{"fragments":[{"text":"struct","kind":"keyword"},{"text":" ","kind":"text"},{"text":"Game","kind":"identifier"}],"title":"Amiibo.Game","type":"topic","abstract":[{"text":"A model that represents a game related to an amiibo.","type":"text"}],"role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/game","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game","navigatorTitle":[{"text":"Game","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game/!=(_:_:)":{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/!=(_:_:)","fragments":[{"text":"static","kind":"keyword"},{"text":" ","kind":"text"},{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":"!=","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":", ","kind":"text"},{"text":"Self","kind":"typeIdentifier"},{"text":") -> ","kind":"text"},{"text":"Bool","kind":"typeIdentifier","preciseIdentifier":"s:Sb"}],"title":"!=(_:_:)","role":"symbol","type":"topic","url":"\/documentation\/amiiboservice\/amiibo\/game\/!=(_:_:)","kind":"symbol","abstract":[{"type":"text","text":"Returns a Boolean value indicating whether two values are not equal."}]}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"metadata":{"symbolKind":"property","role":"symbol","roleHeading":"Instance Property","externalID":"s:13AmiiboService0A0V4GameV11identifiersSaySSGvp","fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"identifiers"},{"kind":"text","text":": ["},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"},{"kind":"text","text":"]"}],"title":"identifiers","modules":[{"name":"AmiiboService"}]},"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game"]]},"abstract":[{"text":"A list of game identifiers associated with this game.","type":"text"}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/amiiboservice\/amiibo\/game\/identifiers"]}],"kind":"symbol","schemaVersion":{"minor":3,"major":0,"patch":0},"primaryContentSections":[{"declarations":[{"platforms":["macOS"],"tokens":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"identifiers","kind":"identifier"},{"text":": [","kind":"text"},{"preciseIdentifier":"s:SS","text":"String","kind":"typeIdentifier"},{"text":"]","kind":"text"}],"languages":["swift"]}],"kind":"declarations"}],"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/identifiers","interfaceLanguage":"swift"},"sections":[],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game/identifiers":{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/identifiers","fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"identifiers"},{"kind":"text","text":": ["},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"},{"kind":"text","text":"]"}],"title":"identifiers","role":"symbol","type":"topic","url":"\/documentation\/amiiboservice\/amiibo\/game\/identifiers","kind":"symbol","abstract":[{"type":"text","text":"A list of game identifiers associated with this game."}]},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game":{"fragments":[{"text":"struct","kind":"keyword"},{"text":" ","kind":"text"},{"text":"Game","kind":"identifier"}],"title":"Amiibo.Game","type":"topic","abstract":[{"text":"A model that represents a game related to an amiibo.","type":"text"}],"role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/game","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game","navigatorTitle":[{"text":"Game","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schemaVersion":{"major":0,"minor":3,"patch":0},"abstract":[{"text":"The name of this game.","type":"text"}],"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game"]]},"variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/game\/name"],"traits":[{"interfaceLanguage":"swift"}]}],"metadata":{"roleHeading":"Instance Property","fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"name"},{"text":": ","kind":"text"},{"text":"String","preciseIdentifier":"s:SS","kind":"typeIdentifier"}],"title":"name","modules":[{"name":"AmiiboService"}],"role":"symbol","symbolKind":"property","externalID":"s:13AmiiboService0A0V4GameV4nameSSvp"},"kind":"symbol","sections":[],"primaryContentSections":[{"kind":"declarations","declarations":[{"platforms":["macOS"],"tokens":[{"kind":"keyword","text":"let"},{"text":" ","kind":"text"},{"kind":"identifier","text":"name"},{"kind":"text","text":": "},{"preciseIdentifier":"s:SS","text":"String","kind":"typeIdentifier"}],"languages":["swift"]}]}],"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/name"},"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game/name":{"kind":"symbol","fragments":[{"text":"let","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"name"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"}],"abstract":[{"text":"The name of this game.","type":"text"}],"url":"\/documentation\/amiiboservice\/amiibo\/game\/name","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/name","title":"name","role":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game":{"fragments":[{"text":"struct","kind":"keyword"},{"text":" ","kind":"text"},{"text":"Game","kind":"identifier"}],"title":"Amiibo.Game","type":"topic","abstract":[{"text":"A model that represents a game related to an amiibo.","type":"text"}],"role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/game","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game","navigatorTitle":[{"text":"Game","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"metadata":{"roleHeading":"Instance Property","externalID":"s:13AmiiboService0A0V4GameV6usagesSayAC5UsageVGSgvp","modules":[{"name":"AmiiboService"}],"symbolKind":"property","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"usages","kind":"identifier"},{"text":": [","kind":"text"},{"text":"Amiibo","kind":"typeIdentifier","preciseIdentifier":"s:13AmiiboService0A0V"},{"text":".","kind":"text"},{"text":"Usage","kind":"typeIdentifier","preciseIdentifier":"s:13AmiiboService0A0V5UsageV"},{"text":"]?","kind":"text"}],"role":"symbol","title":"usages"},"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game"]]},"abstract":[{"text":"A list of amiibo usages within this game, if available.","type":"text"}],"variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/game\/usages"],"traits":[{"interfaceLanguage":"swift"}]}],"kind":"symbol","schemaVersion":{"minor":3,"patch":0,"major":0},"primaryContentSections":[{"declarations":[{"tokens":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"usages","kind":"identifier"},{"text":": [","kind":"text"},{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","text":"Amiibo","kind":"typeIdentifier","preciseIdentifier":"s:13AmiiboService0A0V"},{"text":".","kind":"text"},{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Usage","text":"Usage","kind":"typeIdentifier","preciseIdentifier":"s:13AmiiboService0A0V5UsageV"},{"text":"]?","kind":"text"}],"platforms":["macOS"],"languages":["swift"]}],"kind":"declarations"}],"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/usages"},"sections":[],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game":{"fragments":[{"text":"struct","kind":"keyword"},{"text":" ","kind":"text"},{"text":"Game","kind":"identifier"}],"title":"Amiibo.Game","type":"topic","abstract":[{"text":"A model that represents a game related to an amiibo.","type":"text"}],"role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/game","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game","navigatorTitle":[{"text":"Game","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Game/usages":{"role":"symbol","kind":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Game\/usages","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"usages","kind":"identifier"},{"text":": [","kind":"text"},{"text":"Amiibo","preciseIdentifier":"s:13AmiiboService0A0V","kind":"typeIdentifier"},{"text":".","kind":"text"},{"text":"Usage","preciseIdentifier":"s:13AmiiboService0A0V5UsageV","kind":"typeIdentifier"},{"text":"]?","kind":"text"}],"title":"usages","url":"\/documentation\/amiiboservice\/amiibo\/game\/usages","type":"topic","abstract":[{"text":"A list of amiibo usages within this game, if available.","type":"text"}]},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Usage":{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Usage","fragments":[{"text":"struct","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"Usage"}],"title":"Amiibo.Usage","role":"symbol","type":"topic","url":"\/documentation\/amiiboservice\/amiibo\/usage","kind":"symbol","navigatorTitle":[{"kind":"identifier","text":"Usage"}],"abstract":[{"type":"text","text":"A model that represents the usage of an amiibo within a certain game."}]}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"primaryContentSections":[{"declarations":[{"platforms":["macOS"],"tokens":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"gameCharacter"},{"kind":"text","text":": "},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"}],"languages":["swift"]}],"kind":"declarations"}],"sections":[],"schemaVersion":{"patch":0,"minor":3,"major":0},"kind":"symbol","hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/gameCharacter","interfaceLanguage":"swift"},"abstract":[{"text":"The name of the game character associated with this amiibo.","type":"text"}],"metadata":{"fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"gameCharacter"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"}],"symbolKind":"property","role":"symbol","modules":[{"name":"AmiiboService"}],"externalID":"s:13AmiiboService0A0V13gameCharacterSSvp","roleHeading":"Instance Property","title":"gameCharacter"},"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/amiiboservice\/amiibo\/gamecharacter"]}],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo/gameCharacter":{"abstract":[{"text":"The name of the game character associated with this amiibo.","type":"text"}],"fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"gameCharacter","kind":"identifier"},{"text":": ","kind":"text"},{"preciseIdentifier":"s:SS","text":"String","kind":"typeIdentifier"}],"title":"gameCharacter","role":"symbol","type":"topic","url":"\/documentation\/amiiboservice\/amiibo\/gamecharacter","kind":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/gameCharacter"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"gameSeries"},{"kind":"text","text":": "},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"}],"languages":["swift"],"platforms":["macOS"]}]}],"sections":[],"kind":"symbol","schemaVersion":{"minor":3,"patch":0,"major":0},"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/gameSeries","interfaceLanguage":"swift"},"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"abstract":[{"text":"The name of the game series associated with this amiibo.","type":"text"}],"metadata":{"fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"gameSeries","kind":"identifier"},{"text":": ","kind":"text"},{"preciseIdentifier":"s:SS","text":"String","kind":"typeIdentifier"}],"symbolKind":"property","role":"symbol","modules":[{"name":"AmiiboService"}],"externalID":"s:13AmiiboService0A0V10gameSeriesSSvp","roleHeading":"Instance Property","title":"gameSeries"},"variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/gameseries"],"traits":[{"interfaceLanguage":"swift"}]}],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/gameSeries":{"role":"symbol","kind":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/gameSeries","fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"gameSeries"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"}],"url":"\/documentation\/amiiboservice\/amiibo\/gameseries","type":"topic","title":"gameSeries","abstract":[{"type":"text","text":"The name of the game series associated with this amiibo."}]}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"schemaVersion":{"minor":3,"major":0,"patch":0},"sections":[],"primaryContentSections":[{"kind":"declarations","declarations":[{"platforms":["macOS"],"languages":["swift"],"tokens":[{"text":"let","kind":"keyword"},{"kind":"text","text":" "},{"text":"head","kind":"identifier"},{"kind":"text","text":": "},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"}]}]}],"variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/head"],"traits":[{"interfaceLanguage":"swift"}]}],"kind":"symbol","metadata":{"symbolKind":"property","fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"head"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"}],"role":"symbol","roleHeading":"Instance Property","modules":[{"name":"AmiiboService"}],"title":"head","externalID":"s:13AmiiboService0A0V4headSSvp"},"abstract":[{"text":"The first 8 hexadecimal characters of the amiibo identifier.","type":"text"}],"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/head","interfaceLanguage":"swift"},"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/head":{"abstract":[{"text":"The first 8 hexadecimal characters of the amiibo identifier.","type":"text"}],"kind":"symbol","role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/head","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"head","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","kind":"typeIdentifier","preciseIdentifier":"s:SS"}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/head","title":"head","type":"topic"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"abstract":[{"type":"text","text":"The full 16-character hexadecimal identifier, composed of the "},{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/head","type":"reference","isActive":true},{"type":"text","text":" and "},{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/tail","type":"reference","isActive":true},{"type":"text","text":"."}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/amiiboservice\/amiibo\/identifier"]}],"kind":"symbol","identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/identifier","interfaceLanguage":"swift"},"metadata":{"role":"symbol","externalID":"s:13AmiiboService0A0V10identifierSSvp","symbolKind":"property","fragments":[{"kind":"keyword","text":"var"},{"kind":"text","text":" "},{"kind":"identifier","text":"identifier"},{"kind":"text","text":": "},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"}],"title":"identifier","modules":[{"name":"AmiiboService"}],"roleHeading":"Instance Property"},"sections":[],"schemaVersion":{"major":0,"minor":3,"patch":0},"primaryContentSections":[{"declarations":[{"tokens":[{"kind":"keyword","text":"var"},{"kind":"text","text":" "},{"kind":"identifier","text":"identifier"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"},{"kind":"text","text":" { "},{"kind":"keyword","text":"get"},{"kind":"text","text":" }"}],"languages":["swift"],"platforms":["macOS"]}],"kind":"declarations"}],"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"references":{"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/identifier":{"fragments":[{"kind":"keyword","text":"var"},{"kind":"text","text":" "},{"kind":"identifier","text":"identifier"},{"kind":"text","text":": "},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"}],"kind":"symbol","role":"symbol","abstract":[{"type":"text","text":"The full 16-character hexadecimal identifier, composed of the "},{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/head","type":"reference","isActive":true},{"type":"text","text":" and "},{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/tail","type":"reference","isActive":true},{"type":"text","text":"."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/identifier","url":"\/documentation\/amiiboservice\/amiibo\/identifier","type":"topic","title":"identifier"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/tail":{"abstract":[{"text":"The last 8 hexadecimal characters of the amiibo identifier.","type":"text"}],"fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"tail"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"}],"title":"tail","role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/tail","type":"topic","kind":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/tail"},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/head":{"abstract":[{"text":"The first 8 hexadecimal characters of the amiibo identifier.","type":"text"}],"kind":"symbol","role":"symbol","url":"\/documentation\/amiiboservice\/amiibo\/head","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"head","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","kind":"typeIdentifier","preciseIdentifier":"s:SS"}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/head","title":"head","type":"topic"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schemaVersion":{"major":0,"minor":3,"patch":0},"abstract":[{"text":"A URL string pointing to the image of this amiibo.","type":"text"}],"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/amiiboservice\/amiibo\/image"]}],"sections":[],"metadata":{"roleHeading":"Instance Property","fragments":[{"kind":"keyword","text":"let"},{"kind":"text","text":" "},{"kind":"identifier","text":"image"},{"kind":"text","text":": "},{"preciseIdentifier":"s:SS","kind":"typeIdentifier","text":"String"}],"title":"image","modules":[{"name":"AmiiboService"}],"role":"symbol","symbolKind":"property","externalID":"s:13AmiiboService0A0V5imageSSvp"},"kind":"symbol","primaryContentSections":[{"kind":"declarations","declarations":[{"languages":["swift"],"platforms":["macOS"],"tokens":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"image","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","preciseIdentifier":"s:SS","kind":"typeIdentifier"}]}]}],"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/image","interfaceLanguage":"swift"},"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo/image":{"kind":"symbol","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"image","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","preciseIdentifier":"s:SS","kind":"typeIdentifier"}],"abstract":[{"type":"text","text":"A URL string pointing to the image of this amiibo."}],"url":"\/documentation\/amiiboservice\/amiibo\/image","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/image","title":"image","role":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schemaVersion":{"patch":0,"major":0,"minor":3},"abstract":[{"text":"A URL constructed from the ","type":"text"},{"type":"reference","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/image","isActive":true},{"text":" string, if valid.","type":"text"}],"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/imageurl"],"traits":[{"interfaceLanguage":"swift"}]}],"metadata":{"roleHeading":"Instance Property","fragments":[{"text":"var","kind":"keyword"},{"text":" ","kind":"text"},{"text":"imageURL","kind":"identifier"},{"text":": ","kind":"text"},{"preciseIdentifier":"s:10Foundation3URLV","text":"URL","kind":"typeIdentifier"},{"text":"?","kind":"text"}],"title":"imageURL","modules":[{"name":"AmiiboService"}],"role":"symbol","symbolKind":"property","externalID":"s:13AmiiboService0A0V8imageURL10Foundation0D0VSgvp"},"kind":"symbol","sections":[],"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"text":"var","kind":"keyword"},{"text":" ","kind":"text"},{"text":"imageURL","kind":"identifier"},{"text":": ","kind":"text"},{"text":"URL","kind":"typeIdentifier","preciseIdentifier":"s:10Foundation3URLV"},{"text":"? { ","kind":"text"},{"text":"get","kind":"keyword"},{"text":" }","kind":"text"}],"platforms":["macOS"],"languages":["swift"]}]}],"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/imageURL"},"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/imageURL":{"kind":"symbol","fragments":[{"text":"var","kind":"keyword"},{"text":" ","kind":"text"},{"text":"imageURL","kind":"identifier"},{"text":": ","kind":"text"},{"preciseIdentifier":"s:10Foundation3URLV","text":"URL","kind":"typeIdentifier"},{"text":"?","kind":"text"}],"abstract":[{"text":"A URL constructed from the ","type":"text"},{"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/image","isActive":true,"type":"reference"},{"text":" string, if valid.","type":"text"}],"url":"\/documentation\/amiiboservice\/amiibo\/imageurl","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/imageURL","title":"imageURL","role":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/image":{"kind":"symbol","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"image","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","preciseIdentifier":"s:SS","kind":"typeIdentifier"}],"abstract":[{"type":"text","text":"A URL string pointing to the image of this amiibo."}],"url":"\/documentation\/amiiboservice\/amiibo\/image","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/image","title":"image","role":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schemaVersion":{"minor":3,"major":0,"patch":0},"abstract":[{"type":"text","text":"The name of this amiibo."}],"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"variants":[{"paths":["\/documentation\/amiiboservice\/amiibo\/name"],"traits":[{"interfaceLanguage":"swift"}]}],"metadata":{"roleHeading":"Instance Property","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"name","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","kind":"typeIdentifier","preciseIdentifier":"s:SS"}],"title":"name","modules":[{"name":"AmiiboService"}],"role":"symbol","symbolKind":"property","externalID":"s:13AmiiboService0A0V4nameSSvp"},"kind":"symbol","sections":[],"primaryContentSections":[{"kind":"declarations","declarations":[{"languages":["swift"],"tokens":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"name","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","preciseIdentifier":"s:SS","kind":"typeIdentifier"}],"platforms":["macOS"]}]}],"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/name"},"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo/name":{"kind":"symbol","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"name","kind":"identifier"},{"text":": ","kind":"text"},{"text":"String","kind":"typeIdentifier","preciseIdentifier":"s:SS"}],"abstract":[{"type":"text","text":"The name of this amiibo."}],"url":"\/documentation\/amiiboservice\/amiibo\/name","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/name","title":"name","role":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"kind":"symbol","hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"]]},"metadata":{"modules":[{"name":"AmiiboService"}],"externalID":"s:13AmiiboService0A0V8platformAC8PlatformVSgvp","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"platform","kind":"identifier"},{"text":": ","kind":"text"},{"text":"Amiibo","preciseIdentifier":"s:13AmiiboService0A0V","kind":"typeIdentifier"},{"text":".","kind":"text"},{"text":"Platform","preciseIdentifier":"s:13AmiiboService0A0V8PlatformV","kind":"typeIdentifier"},{"text":"?","kind":"text"}],"role":"symbol","title":"platform","symbolKind":"property","roleHeading":"Instance Property"},"primaryContentSections":[{"declarations":[{"tokens":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"platform","kind":"identifier"},{"text":": ","kind":"text"},{"preciseIdentifier":"s:13AmiiboService0A0V","text":"Amiibo","kind":"typeIdentifier","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo"},{"text":".","kind":"text"},{"preciseIdentifier":"s:13AmiiboService0A0V8PlatformV","text":"Platform","kind":"typeIdentifier","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Platform-swift.struct"},{"text":"?","kind":"text"}],"languages":["swift"],"platforms":["macOS"]}],"kind":"declarations"}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/amiiboservice\/amiibo\/platform-swift.property"]}],"abstract":[{"text":"The game platform data for this amiibo, if available.","type":"text"}],"schemaVersion":{"minor":3,"major":0,"patch":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/platform-swift.property"},"sections":[],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/platform-swift.property":{"kind":"symbol","fragments":[{"text":"let","kind":"keyword"},{"text":" ","kind":"text"},{"text":"platform","kind":"identifier"},{"text":": ","kind":"text"},{"text":"Amiibo","preciseIdentifier":"s:13AmiiboService0A0V","kind":"typeIdentifier"},{"text":".","kind":"text"},{"text":"Platform","preciseIdentifier":"s:13AmiiboService0A0V8PlatformV","kind":"typeIdentifier"},{"text":"?","kind":"text"}],"abstract":[{"type":"text","text":"The game platform data for this amiibo, if available."}],"url":"\/documentation\/amiiboservice\/amiibo\/platform-swift.property","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/platform-swift.property","title":"platform","role":"symbol"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Platform-swift.struct":{"kind":"symbol","abstract":[{"text":"A model that represents a collection of ","type":"text"},{"type":"codeVoice","code":"Switch"},{"text":", ","type":"text"},{"type":"codeVoice","code":"Switch 2"},{"type":"text","text":", "},{"type":"codeVoice","code":"3DS"},{"type":"text","text":", and "},{"type":"codeVoice","code":"Wii U"},{"text":" games related to an amiibo.","type":"text"}],"title":"Amiibo.Platform","role":"symbol","fragments":[{"text":"struct","kind":"keyword"},{"text":" ","kind":"text"},{"text":"Platform","kind":"identifier"}],"navigatorTitle":[{"text":"Platform","kind":"identifier"}],"url":"\/documentation\/amiiboservice\/amiibo\/platform-swift.struct","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Platform-swift.struct"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"}}}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
|||||||
|
{"kind":"article","schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"identifier":{"url":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Platform-swift.struct\/Equatable-Implementations","interfaceLanguage":"swift"},"hierarchy":{"paths":[["doc:\/\/AmiiboService\/documentation\/AmiiboService","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Platform-swift.struct"]]},"topicSections":[{"title":"Operators","generated":true,"identifiers":["doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Platform-swift.struct\/!=(_:_:)"],"anchor":"Operators"}],"metadata":{"role":"collectionGroup","title":"Equatable Implementations","modules":[{"name":"AmiiboService"}],"roleHeading":"API Collection"},"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/amiiboservice\/amiibo\/platform-swift.struct\/equatable-implementations"]}],"references":{"doc://AmiiboService/documentation/AmiiboService/Amiibo":{"abstract":[{"text":"A model that represents an amiibo.","type":"text"}],"navigatorTitle":[{"kind":"identifier","text":"Amiibo"}],"role":"symbol","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo","type":"topic","title":"Amiibo","url":"\/documentation\/amiiboservice\/amiibo","fragments":[{"kind":"keyword","text":"struct"},{"text":" ","kind":"text"},{"text":"Amiibo","kind":"identifier"}],"kind":"symbol"},"doc://AmiiboService/documentation/AmiiboService":{"title":"AmiiboService","kind":"symbol","type":"topic","abstract":[{"text":"A library that provides everything the developer needs to interact with the ","type":"text"},{"inlineContent":[{"text":"Amiibo API","type":"text"}],"type":"strong"},{"type":"text","text":" backend service."}],"identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService","url":"\/documentation\/amiiboservice","role":"collection"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Platform-swift.struct":{"kind":"symbol","abstract":[{"text":"A model that represents a collection of ","type":"text"},{"type":"codeVoice","code":"Switch"},{"text":", ","type":"text"},{"type":"codeVoice","code":"Switch 2"},{"type":"text","text":", "},{"type":"codeVoice","code":"3DS"},{"type":"text","text":", and "},{"type":"codeVoice","code":"Wii U"},{"text":" games related to an amiibo.","type":"text"}],"title":"Amiibo.Platform","role":"symbol","fragments":[{"text":"struct","kind":"keyword"},{"text":" ","kind":"text"},{"text":"Platform","kind":"identifier"}],"navigatorTitle":[{"text":"Platform","kind":"identifier"}],"url":"\/documentation\/amiiboservice\/amiibo\/platform-swift.struct","type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Platform-swift.struct"},"doc://AmiiboService/documentation/AmiiboService/Amiibo/Platform-swift.struct/!=(_:_:)":{"abstract":[{"text":"Returns a Boolean value indicating whether two values are not equal.","type":"text"}],"type":"topic","identifier":"doc:\/\/AmiiboService\/documentation\/AmiiboService\/Amiibo\/Platform-swift.struct\/!=(_:_:)","fragments":[{"kind":"keyword","text":"static"},{"kind":"text","text":" "},{"kind":"keyword","text":"func"},{"kind":"text","text":" "},{"kind":"identifier","text":"!="},{"kind":"text","text":" "},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":", "},{"kind":"typeIdentifier","text":"Self"},{"kind":"text","text":") -> "},{"kind":"typeIdentifier","preciseIdentifier":"s:Sb","text":"Bool"}],"title":"!=(_:_:)","url":"\/documentation\/amiiboservice\/amiibo\/platform-swift.struct\/!=(_:_:)","role":"symbol","kind":"symbol"}}}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user