Files
discogs-service/Sources/DiscogsService/Public/Models/Product.swift
T

54 lines
1.8 KiB
Swift
Raw Normal View History

// ===----------------------------------------------------------------------===
//
// This source file is part of the DiscogsService open source project
//
2026-03-24 01:22:53 +00:00
// 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
2026-03-24 01:22:53 +00:00
/// 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
2026-03-24 01:22:53 +00:00
/// The camel-cased name of the product (e.g., `MyDiscogsApp`).
let name: String
2026-03-24 01:22:53 +00:00
/// A URI link related to the product (e.g., `https://example.com`).
let url: String
2026-03-24 01:22:53 +00:00
/// The semantic version of the product (e.g., `1.0.0`).
let version: String
// MARK: Initializers
/// Initializes this model.
/// - Parameters:
2026-03-24 01:22:53 +00:00
/// - 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
}
}