2025-10-07 22:32:54 +00:00
// ===----------------------------------------------------------------------===
//
// This source file is part of the Amiibo Service open source project
//
2026-03-22 23:39:48 +00:00
// Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
2025-10-07 22:32:54 +00:00
// Licensed under Apache license v2.0
//
2024-09-14 22:26:39 +00:00
// See LICENSE for license information
2025-10-07 22:32:54 +00:00
// See CONTRIBUTORS for the list of Amiibo Service project authors
2024-09-14 22:26:39 +00:00
//
2025-10-07 22:32:54 +00:00
// SPDX-License-Identifier: Apache-2.0
//
// ===----------------------------------------------------------------------===
2024-09-14 22:26:39 +00:00
import Foundation
2026-09-14 12:07:53 +02:00
/// A protocol that defines a client that fetches data from the Amiibo API.
2026-07-26 09:56:32 +00:00
///
2026-09-14 12:07:53 +02:00
/// ``AmiiboLiveClient`` is the default implementation. Conform to this protocol to provide another one, such as a mock for tests. Conforming types must be `Sendable`.
2026-07-26 09:56:32 +00:00
public protocol AmiiboClient : Sendable {
2024-09-14 22:26:39 +00:00
// MARK: Functions
2025-09-09 17:30:19 +00:00
/// 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.
2026-07-26 09:56:32 +00:00
/// - Returns: A last updated date, decoded as UTC.
2025-09-09 17:30:19 +00:00
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
func getLastUpdated () async throws ( AmiiboServiceError ) -> Date
2025-09-11 22:49:58 +00:00
2024-09-14 22:26:39 +00:00
}