791ebf4f78
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>
49 lines
1.3 KiB
Swift
49 lines
1.3 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
|
|
//
|
|
// ===----------------------------------------------------------------------===
|
|
|
|
import Foundation
|
|
|
|
/// A type that represents a product that uses the ``Client`` client.
|
|
public struct Product: Sendable {
|
|
|
|
// MARK: Properties
|
|
|
|
/// A camel-cased name of a product.
|
|
let name: String
|
|
|
|
/// A URI link related to a product.
|
|
let url: String
|
|
|
|
/// A semantic version of a product.
|
|
let version: String
|
|
|
|
// MARK: Initializers
|
|
|
|
/// Initializes this model.
|
|
/// - Parameters:
|
|
/// - name: A camel-cased name of a product.
|
|
/// - version: A semantic version of a product.
|
|
/// - url: A URI link related to a product.
|
|
public init(
|
|
name: String,
|
|
version: String,
|
|
url: String
|
|
) {
|
|
self.name = name
|
|
self.url = url
|
|
self.version = version
|
|
}
|
|
|
|
}
|