Adopted Swift 6.2 tools version at the Package in the library target to drop legacy conditional code.

This commit is contained in:
2026-07-26 01:37:12 +02:00
parent fa4fb21351
commit b9935d22b3
6 changed files with 14 additions and 356 deletions
@@ -58,7 +58,6 @@ 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.
@@ -115,64 +114,6 @@ extension AmiiboLiveClient: AmiiboClient {
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
}
@@ -188,7 +129,7 @@ private extension AmiiboLiveClient {
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
func fetchAmiibos(
_ filter: AmiiboFilter
) async throws -> [Amiibo] {
) async throws(AmiiboServiceError) -> [Amiibo] {
let response: Operations.getAmiibos.Output
do {
@@ -240,7 +181,7 @@ private extension AmiiboLiveClient {
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
func fetchAmiiboSeries(
_ filter: AmiiboSeriesFilter
) async throws -> [AmiiboSeries] {
) async throws(AmiiboServiceError) -> [AmiiboSeries] {
let response: Operations.getAmiiboSeries.Output
do {
@@ -282,7 +223,7 @@ private extension AmiiboLiveClient {
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
func fetchAmiiboTypes(
_ filter: AmiiboTypeFilter
) async throws -> [AmiiboType] {
) async throws(AmiiboServiceError) -> [AmiiboType] {
let response: Operations.getAmiiboTypes.Output
do {
@@ -324,7 +265,7 @@ private extension AmiiboLiveClient {
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
func fetchGameCharacters(
_ filter: GameCharacterFilter
) async throws -> [GameCharacter] {
) async throws(AmiiboServiceError) -> [GameCharacter] {
let response: Operations.getGameCharacters.Output
do {
@@ -366,7 +307,7 @@ private extension AmiiboLiveClient {
/// - Throws: An ``AmiiboServiceError`` error in case some issue is encountered while generating the result.
func fetchGameSeries(
_ filter: GameSeriesFilter
) async throws -> [GameSeries] {
) async throws(AmiiboServiceError) -> [GameSeries] {
let response: Operations.getGameSeries.Output
do {
@@ -405,7 +346,7 @@ private extension AmiiboLiveClient {
/// 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 {
func fetchLastUpdated() async throws(AmiiboServiceError) -> Date {
let response: Operations.getLastUpdated.Output
do {
@@ -430,7 +371,7 @@ private extension AmiiboLiveClient {
/// 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 {
func handle(error: any Error) throws(AmiiboServiceError) -> Never {
switch error {
case is CancellationError:
throw AmiiboServiceError.cancelled