amiibo-service/README.md
Javier Cicchelli c4a25afad4 [Setup] Documentation (#10)
This PR contains the work done to address the issue #7, related to documenting the source code that would be used for other developers.

To provide further details about the work done:
- [x] restructured the hierarchy of some models that are related to the `Amiibo` model;
- [x] written documentation for the `AmiiboService` service;
- [x] written documentation for the `AmiiboFilter` and `KeyNameFilter` filters;
- [x] written documentation for the `Amiibo`, `KeyName`, `LastUpdated` and children model;
- [x] written documentation for the `AmiiboClientError` error;
- [x] written documentation for the README file.

Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Reviewed-on: #10
2023-04-23 13:16:22 +00:00

3.0 KiB

AmiiboService: Amiibo API service written in Swift

This package contains a ready-to-use service that can retrieve data as decoded models/entities from any of the Amiibo API available endpoints.

Installation

It is possible to add this library in your projects either by explicitly add it as a dependency either in a Package.swift file or in your Xcode project.

This package has minimum platform requirements that are important to take into account:

  • iOS 13.0 or higher;
  • macOS 10.15 or higher;
  • tvOS 13.0 or higher;
  • watchOS 8.0 or higher;

Package file

In the intended Package.swift file, it is required to add the following dependency:

dependencies: [
    // ...
    .package(url: "https://github.com/rock-n-code/amiibo-service.git", from: "1.0.0")
    // ...
],

Then it is required to add the package to your target, like this:

targets: [
    .target(
        ...
        dependencies: [
            .product(name: "AmiiboService", package: "amiibo-service")
        ],
        ...
    ),
]

Xcode

In an opened Xcode project, it is required to do these steps:

  1. click on your Xcode project file to display Project and Targets;
  2. select the project under the Project section to show the Info, Build Settings and Package Dependencies in the center menu of the screen;
  3. select the Package Dependencies to show the defined dependencies of the project;
  4. press on the + (plus) button to add dependencies to the project;
  5. enter the URLhttps://github.com/rock-n-code/amiibo-service into the Search or Enter Package URL located in the upper right corner;
  6. select the given option;
  7. define the dependency rule (the Up to Next Major Version option and the 1.0.0 text are recommended);
  8. select the target to which the dependency will be applied (if required);
  9. wait for the package to be resolved and included in the project;
  10. done!

Other considerations

This library is fully supported on Apple platforms only for the time being: iOS, macOS, tvOS, and watchOS. Support for other platforms such as Linux or Windows might be added in the future, depending on the type of changes those platforms require but this needs to be researched first.

⚠️ Please notice that this library only supports the Swift Package Manager, and that support for other dependency managers such as Cocoapods and Carthage is not planned.

Usage

This package provides an actor called AmiiboService which, after is initialised, is responsible for making requests based on a given filter criteria to the remote API, handling the responses, and decoding the retrieved data into models/entities structs, or throws errors if necessary.

It is needless to say, all the necessary filters, models/entities, and enumerations are also provided in this package.

Further documentation

For further information about the API, please refer to the Amiibo API documentation available online.