b14a9fa816
This PR contains the work done to improve the documentation efforts in the package, aiming at improving the documentation of the source code as well as the OpenAPI specification document. In addition, a breaking bug has been fixed. Reviewed-on: #16 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
54 lines
1.8 KiB
Swift
54 lines
1.8 KiB
Swift
// ===----------------------------------------------------------------------===
|
|
//
|
|
// This source file is part of the DiscogsService open source project
|
|
//
|
|
// Copyright (c) 2026 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 representation of the product information used to generate the `User-Agent` header for requests to the Discogs API.
|
|
///
|
|
/// The Discogs API requires a `User-Agent` header that identifies the application making the request. This model captures
|
|
/// the product name, version, and URL needed to build that header via the ``UserAgentMiddleware``.
|
|
///
|
|
/// The generated `User-Agent` header follows the format: `ProductName/1.0.0 +https://example.com`
|
|
public struct Product: Sendable {
|
|
|
|
// MARK: Properties
|
|
|
|
/// The camel-cased name of the product (e.g., `MyDiscogsApp`).
|
|
let name: String
|
|
|
|
/// A URI link related to the product (e.g., `https://example.com`).
|
|
let url: String
|
|
|
|
/// The semantic version of the product (e.g., `1.0.0`).
|
|
let version: String
|
|
|
|
// MARK: Initializers
|
|
|
|
/// Initializes this model.
|
|
/// - Parameters:
|
|
/// - name: The camel-cased name of the product.
|
|
/// - version: The semantic version of the product, following [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).
|
|
/// - url: A URI link related to the product.
|
|
public init(
|
|
name: String,
|
|
version: String,
|
|
url: String
|
|
) {
|
|
self.name = name
|
|
self.url = url
|
|
self.version = version
|
|
}
|
|
|
|
}
|