Files
discogs-service/Sources/DiscogsService/Public/Errors/InputValidationError.swift
T
javier 791ebf4f78 Implemented the User Agent middleware (#6)
This PR contains the work done to implement the `UserAgentMiddleware` middleware that includes user agent information into a header of the requests sent by the `Client` type, as defined in the [Discogs documentation](https://www.discogs.com/developers/#page:home,header:home-general-information). For this purpose, the `CamelCaseValidationRule`, `SemanticVersionValidationRule` and `URLValidationRule` types were implemented and integrated into the existing `ValidateInputUseCase` type.

Reviewed-on: #6
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-13 00:54:17 +00:00

34 lines
1.2 KiB
Swift

// ===----------------------------------------------------------------------===
//
// This source file is part of the DiscogsService open source project
//
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0
//
// See LICENSE for license information
// See CONTRIBUTORS for the list of DiscogsService project authors
//
// SPDX-License-Identifier: Apache-2.0
//
// ===----------------------------------------------------------------------===
/// A representation of all the possible validation error that could be thrown while validating an input.
public enum InputValidationError: Error {
/// An input is empty.
case inputIsEmpty
/// An input is nil.
case inputIsNil
/// An input is not camel-case.
case inputNotCamelCase
/// An input does not comply with the consumer key requirements.
case inputNotConsumerKey
/// An input does not comply with the consumer secret requirements.
case inputNotConsumerSecret
/// An input is not a semantic version.
case inputNotSemanticVersion
/// An input is not a URL.
case inputNotURL
/// An input does not comply with the user token requirements.
case inputNotUserToken
}