Improved the overall documentation for the public and internal types in the package.
This commit is contained in:
@@ -15,30 +15,30 @@
|
||||
import AmiiboService
|
||||
import Foundation
|
||||
|
||||
/// A type that implements a mock client, for testing purposes.
|
||||
/// A mock implementation of ``AmiiboClient`` that returns pre-configured data or throws pre-configured errors, for testing purposes.
|
||||
struct AmiiboMockClient {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// A list of amiibo items to return, if any.
|
||||
/// The list of amiibo items to return when ``getAmiibos(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||
private let amiibos: [Amiibo]?
|
||||
|
||||
/// A list of amiibo series to return, if any.
|
||||
/// The list of amiibo series to return when ``getAmiiboSeries(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||
private let amiiboSeries: [AmiiboSeries]?
|
||||
|
||||
/// A list of amiibo types to return, if any.
|
||||
/// 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, if any.
|
||||
/// An error to throw before returning any data. Takes precedence over stored data when set.
|
||||
private let error: AmiiboServiceError?
|
||||
|
||||
/// A list of game characters to return, if any.
|
||||
/// The list of game characters to return when ``getGameCharacters(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||
private let gameCharacters: [GameCharacter]?
|
||||
|
||||
/// A list of game series to return, if any.
|
||||
/// The list of game series to return when ``getGameSeries(by:)`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||
private let gameSeries: [GameSeries]?
|
||||
|
||||
/// A last updated date to return, if any.
|
||||
/// The last updated date to return when ``getLastUpdated()`` is called, or `nil` to trigger a ``AmiiboServiceError/notFound`` error.
|
||||
private let lastUpdated: Date?
|
||||
|
||||
// MARK: Initializers
|
||||
@@ -234,8 +234,8 @@ private extension AmiiboMockClient {
|
||||
return lastUpdated
|
||||
}
|
||||
|
||||
/// Throws an error if it has been provided,
|
||||
/// - Throws: An ``AmiiboServiceError`` error in case an error has been provided.
|
||||
/// 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
|
||||
|
||||
Reference in New Issue
Block a user