Overall improvements and data update (#22)
This PR contains the work done to update the live tests to the latest data plus lots of QoL improvements to the library, including: * added test cases to test the ``AmiiboService` locally; * conformed the models to the `Hashable` protocol; * documented the use of caching with the `AmiiboService` service; * updated the reference to the new AmiiboAPI url; * updated the year on the copyrights and header files; * updated the overall documentation of the source code and the package. Reviewed-on: #22 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #22.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Amiibo Service open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||
// 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Amiibo Service open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||
// 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
|
||||
@@ -12,7 +12,7 @@
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
/// A protocol that defines filters that might contain `key` and/or `name` values.
|
||||
/// A protocol that defines filters containing optional `key` and/or `name` values for querying resources.
|
||||
protocol KeyNameFilter {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Amiibo Service open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||
// 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
|
||||
@@ -12,15 +12,15 @@
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
/// A protocol that defines decodable models containing the `key` and `name` properties.
|
||||
protocol KeyNameModel: Sendable {
|
||||
/// A protocol that defines models containing a `key` and `name` pair.
|
||||
protocol KeyNameModel: Sendable, Hashable {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// A key.
|
||||
/// A hexadecimal key that uniquely identifies this model.
|
||||
var key: String { get }
|
||||
|
||||
/// A name.
|
||||
/// A display name for this model.
|
||||
var name: String { get }
|
||||
|
||||
// MARK: Initializers
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Amiibo Service open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||
// 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
|
||||
@@ -31,10 +31,16 @@ extension ISOTimestampTranscoder: 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 {
|
||||
dateFormatter.string(from: date)
|
||||
}
|
||||
|
||||
/// Decodes an ISO timestamp string into a date.
|
||||
/// - Parameter string: A string to decode.
|
||||
/// - Returns: A date parsed from the string, or the Unix epoch if the string cannot be parsed.
|
||||
func decode(_ string: String) throws -> Date {
|
||||
dateFormatter.date(from: string) ?? .init()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user