11 Commits

Author SHA1 Message Date
javier eaee2b84f0 Documentation update (#17)
This PR contains the work done to update the overall documentation of the package.

Reviewed-on: #17
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2026-03-24 01:54:43 +00:00
javier b14a9fa816 Documentation improvements (#16)
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>
2026-03-24 01:22:53 +00:00
javier a0672cc4af Implemented the Marketplace endpoints (#15)
This PR contains the work done to implement the *Marketplace* endpoints for the **Discogs API** backend service, which include the following endpoints:
* GET `/users/{username}/inventory` endpoint
* GET `/marketplace/listings/{listing_id}` endpoint
* DELETE `/marketplace/listings/{listing_id}` endpoint
* POST `/marketplace/listings/{listing_id}` endpoint
* POST `/marketplace/listings` endpoint
* GET `/marketplace/orders` endpoint
* GET `/marketplace/orders/{order_id}` endpoint
* GET `/marketplace/orders/{order_id}/messages` endpoint
* POST `/marketplace/orders/{order_id}/messages` endpoint
* GET `/marketplace/fee/{price}` endpoint
* GET `/marketplace/fee/{price}/{currency}` endpoint
* GET `/marketplace/price_suggestions/{release_id}` endpoint
* GET `/marketplace/stats/{release_id}` endpoint

Reviewed-on: #15
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-11-10 00:34:18 +00:00
javier 63118db805 Implemented the User Lists endpoints (#14)
This PR contains the work done to implement the *User Lists* endpoints of the *Discogs API* service in the `Open API` specification document:

* GET `/users/{username}/lists`
* GET `/lists/{list_id}`

Reviewed-on: #14
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-16 17:33:15 +00:00
javier f3d5c0e6ac Implemented the User Wantlist endpoints (#13)
This PR contains the work done to implement the *User Wantlist* endpoints of the *Discogs API* online service in the `Open API` specification document:

* GET `/users/{username}/wants`
* POST `/users/{username}/wants/{release_id}`
* PUT `/users/{username}/wants/{release_id}`
* DELETE `/users/{username}/wants/{release_id}`

Reviewed-on: #13
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-16 16:24:46 +00:00
javier 2a7b9746a7 Implemented the User Collection endpoints (#12)
This PR contains the work done to implement the *User Collection* endpoints of the Discogs API into the `OpenAPI` specification document:

* GET `/users/{username}/collection/folders`
* POST `/users/{username}/collection/folders`
* GET `/users/{username}/collection/folders/{folder_id}`
* POST `/users/{username}/collection/folders/{folder_id}`
* DELETE `/users/{username}/collection/folders/{folder_id}`
* GET `/users/{username}/collection/releases/{release_id}`
* GET `/users/{username}/collection/folders/{folder_id}/releases`
* POST `/users/{username}/collection/folders/{folder_id}/releases/{release_id}`
* POST `/users/{username}/collection/folders/{folder_id}/releases/{release_id}/instances/{instance_id}`
* DELETE `/users/{username}/collection/folders/{folder_id}/releases/{release_id}/instances/{instance_id}`
* GET `/users/{username}/collection/fields`
* POST `/users/{username}/collection/folders/{folder_id}/releases/{release_id}/instances/{instance_id}/fields/{field_id}`
* GET `/users/{username}/collection/value`

Reviewed-on: #12
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-16 14:38:41 +00:00
javier 2c91cad0bf User Identity endpoints (#11)
This PR contains the work done to implement the *User Identity* endpoints of the **Discogs API** online service:
* GET `/users/{username}`
* POST `/users/{username}`
* GET `/users/{username}/contributions`
* GET `/users/{username}/submissions`

Reviewed-on: #11
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-15 21:59:32 +00:00
javier 39e9dc5d53 Fox to Authentication endpoints (#10)
This PR contains the rock done to securize the /GET `/oauth/identity` endpoints on the OpenAPI specification document, plus it also improves the endpoints ordering in the *Database* section.

Reviewed-on: #10
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-13 18:41:24 +00:00
javier 9a30b69561 Implemented the Authentication endpoints (#9)
This PR contains the work done to implement the *Authentication* endpoints of the Discogs API:
* GET `/oauth/request_token`
* POST `/oauth/access_token`
* GET `/oauth/identity`

Reviewed-on: #9
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-13 17:55:48 +00:00
javier de5b4ff5d0 Implemented the missing Database endpoints (#8)
This PR contains the work done to declare the missing, non-GET endpoints of the *Database* section in the [Discogs API documentation](https://www.discogs.com/developers#page:database) into the `OpenAPI` specification document.

Furthermore, documentation extensions have been defined for the `APIProtocol` and `Client` types in the `DocC` documentation catalog to match the categories of these endpoint calls to the categories in the Discogs documentation.

Reviewed-on: #8
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-13 15:20:20 +00:00
javier d01b60e6dd Added the Rate Limiting headers (#7)
This PR contains the work done to define the `RateLimit`, `RateLimitRemaining` and the `RateLimitUsed` heades into the Open API specification document, as well as including these headers as part of the response for every existing endpoint declared in the mentioned document.

In addition, the `openapi-generator-config` files was also changed to have a different naming strategy.

Reviewed-on: #7
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2025-10-13 13:09:10 +00:00
13049 changed files with 16779 additions and 4627 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
## ##
## This source file is part of the DiscogsService open source project ## This source file is part of the DiscogsService open source project
## ##
## Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors ## Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
## Licensed under Apache license v2.0 ## Licensed under Apache license v2.0
## ##
## See LICENSE for license information ## See LICENSE for license information
+1 -1
View File
@@ -2,7 +2,7 @@
## ##
## This source file is part of the DiscogsService open source project ## This source file is part of the DiscogsService open source project
## ##
## Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors ## Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
## Licensed under Apache license v2.0 ## Licensed under Apache license v2.0
## ##
## See LICENSE for license information ## See LICENSE for license information
+1 -1
View File
@@ -2,7 +2,7 @@
## ##
## This source file is part of the DiscogsService open source project ## This source file is part of the DiscogsService open source project
## ##
## Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors ## Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
## Licensed under Apache license v2.0 ## Licensed under Apache license v2.0
## ##
## See LICENSE for license information ## See LICENSE for license information
+1 -1
View File
@@ -5,7 +5,7 @@ Please visit the Discogs Service web site for more information:
* https://github.com/rock-n-code/discogs-service * https://github.com/rock-n-code/discogs-service
Copyright 2025 Röck+Cöde VoF Copyright 2026 Röck+Cöde VoF
The Discogs Service Project licenses this file to you under the Apache License, The Discogs Service Project licenses this file to you under the Apache License,
version 2.0 (the "License"); you may not use this file except in compliance version 2.0 (the "License"); you may not use this file except in compliance
+2 -2
View File
@@ -4,7 +4,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -32,7 +32,7 @@ let package = Package(
), ),
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/apple/swift-openapi-generator.git", from: "1.3.0"), .package(url: "https://github.com/apple/swift-openapi-generator.git", exact: "1.11.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.5.0"), .package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.2"), .package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.2"),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0") .package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0")
+1 -1
View File
@@ -13,7 +13,7 @@ To use this library, then add it as a dependency in the `Package.swift` file of
let package = Package( let package = Package(
// name, platforms, products, etc. // name, platforms, products, etc.
dependencies: [ dependencies: [
.package(url: "https://github.com/rock-n-code/discogs-service", from: "0.3.0"), .package(url: "https://github.com/rock-n-code/discogs-service", from: "0.6.1"),
// other dependencies // other dependencies
], ],
targets: [ targets: [
@@ -0,0 +1,133 @@
# ``APIProtocol``
## Topics
### Service endpoints
- ``APIProtocol/getService(_:)``
- ``APIProtocol/getService(headers:)``
### Authentication endpoints
- ``APIProtocol/getRequestToken(_:)``
- ``APIProtocol/getRequestToken(headers:)``
- ``APIProtocol/postAccessToken(_:)``
- ``APIProtocol/postAccessToken(headers:)``
- ``APIProtocol/getUserIdentity(_:)``
- ``APIProtocol/getUserIdentity(headers:)``
### Database endpoints
- ``APIProtocol/searchDatabase(_:)``
- ``APIProtocol/searchDatabase(query:headers:)``
- ``APIProtocol/getArtist(_:)``
- ``APIProtocol/getArtist(path:headers:)``
- ``APIProtocol/getArtistReleases(_:)``
- ``APIProtocol/getArtistReleases(path:query:headers:)``
- ``APIProtocol/getLabel(_:)``
- ``APIProtocol/getLabel(path:headers:)``
- ``APIProtocol/getLabelReleases(_:)``
- ``APIProtocol/getLabelReleases(path:query:headers:)``
- ``APIProtocol/getMaster(_:)``
- ``APIProtocol/getMaster(path:headers:)``
- ``APIProtocol/getMasterVersions(_:)``
- ``APIProtocol/getMasterVersions(path:query:headers:)``
- ``APIProtocol/getRelease(_:)``
- ``APIProtocol/getRelease(path:query:headers:)``
- ``APIProtocol/getReleaseRating(_:)``
- ``APIProtocol/getReleaseRating(path:headers:)``
- ``APIProtocol/getReleaseRatingByUser(_:)``
- ``APIProtocol/getReleaseRatingByUser(path:headers:)``
- ``APIProtocol/putReleaseRatingByUser(_:)``
- ``APIProtocol/putReleaseRatingByUser(path:query:headers:)``
- ``APIProtocol/deleteReleaseRatingByUser(_:)``
- ``APIProtocol/deleteReleaseRatingByUser(path:headers:)``
- ``APIProtocol/getReleaseStats(_:)``
- ``APIProtocol/getReleaseStats(path:headers:)``
### User Identity endpoints
- ``APIProtocol/getUserProfile(_:)``
- ``APIProtocol/getUserProfile(path:headers:)``
- ``APIProtocol/postUserProfile(_:)``
- ``APIProtocol/postUserProfile(path:query:headers:)``
- ``APIProtocol/getUserContributions(_:)``
- ``APIProtocol/getUserContributions(path:query:headers:)``
- ``APIProtocol/getUserSubmissions(_:)``
- ``APIProtocol/getUserSubmissions(path:headers:)``
### User Collection endpoints
- ``APIProtocol/getCollectionFolders(_:)``
- ``APIProtocol/getCollectionFolders(path:headers:)``
- ``APIProtocol/postCollectionFolders(_:)``
- ``APIProtocol/postCollectionFolders(path:query:headers:)``
- ``APIProtocol/getCollectionFolder(_:)``
- ``APIProtocol/getCollectionFolder(path:headers:)``
- ``APIProtocol/postCollectionFolder(_:)``
- ``APIProtocol/postCollectionFolder(path:query:headers:)``
- ``APIProtocol/deleteCollectionFolder(_:)``
- ``APIProtocol/deleteCollectionFolder(path:headers:)``
- ``APIProtocol/getCollectionItemsByRelease(_:)``
- ``APIProtocol/getCollectionItemsByRelease(path:headers:)``
- ``APIProtocol/getCollectionItemsByFolder(_:)``
- ``APIProtocol/getCollectionItemsByFolder(path:query:headers:)``
- ``APIProtocol/postReleaseToCollectionFolder(_:)``
- ``APIProtocol/postReleaseToCollectionFolder(path:headers:)``
- ``APIProtocol/postChangeRatingOfRelease(_:)``
- ``APIProtocol/postChangeRatingOfRelease(path:query:headers:body:)``
- ``APIProtocol/deleteInstanceFromCollectionFolder(_:)``
- ``APIProtocol/deleteInstanceFromCollectionFolder(path:headers:)``
- ``APIProtocol/getCustomFields(_:)``
- ``APIProtocol/getCustomFields(path:headers:)``
- ``APIProtocol/editFieldsInstance(_:)``
- ``APIProtocol/editFieldsInstance(path:query:headers:)``
- ``APIProtocol/getCollectionValue(_:)``
- ``APIProtocol/getCollectionValue(path:headers:)``
### User Wantlist endpoints
- ``APIProtocol/getWantlist(_:)``
- ``APIProtocol/getWantlist(path:query:headers:)``
- ``APIProtocol/addToWantlist(_:)``
- ``APIProtocol/addToWantlist(path:query:headers:)``
- ``APIProtocol/updateInWantlist(_:)``
- ``APIProtocol/updateInWantlist(path:query:headers:)``
- ``APIProtocol/deleteFromWantlist(_:)``
- ``APIProtocol/deleteFromWantlist(path:headers:)``
### User Lists endpoints
- ``APIProtocol/getLists(_:)``
- ``APIProtocol/getLists(path:query:headers:)``
- ``APIProtocol/getList(_:)``
- ``APIProtocol/getList(path:headers:)``
### Marketplace endpoints
- ``APIProtocol/getInventory(_:)``
- ``APIProtocol/getInventory(path:query:headers:)``
- ``APIProtocol/getListing(_:)``
- ``APIProtocol/getListing(path:query:headers:)``
- ``APIProtocol/createListing(_:)``
- ``APIProtocol/createListing(headers:body:)``
- ``APIProtocol/editListing(_:)``
- ``APIProtocol/editListing(path:headers:body:)``
- ``APIProtocol/deleteListing(_:)``
- ``APIProtocol/deleteListing(path:headers:)``
- ``APIProtocol/getOrders(_:)``
- ``APIProtocol/getOrders(query:headers:)``
- ``APIProtocol/getOrder(_:)``
- ``APIProtocol/getOrder(path:headers:)``
- ``APIProtocol/getOrderMessages(_:)``
- ``APIProtocol/getOrderMessages(path:headers:)``
- ``APIProtocol/addOrderMessage(_:)``
- ``APIProtocol/addOrderMessage(path:headers:body:)``
- ``APIProtocol/getFee(_:)``
- ``APIProtocol/getFee(path:headers:)``
- ``APIProtocol/getFeeWithCurrency(_:)``
- ``APIProtocol/getFeeWithCurrency(path:headers:)``
- ``APIProtocol/getPriceSuggestions(_:)``
- ``APIProtocol/getPriceSuggestions(path:headers:)``
- ``APIProtocol/getStatistics(_:)``
- ``APIProtocol/getStatistics(path:query:headers:)``
@@ -0,0 +1,84 @@
# ``Client``
## Topics
### Initializers
- ``Client/init(serverURL:configuration:transport:middlewares:)``
### Service endpoints
- ``Client/getService(_:)``
### Authentication endpoints
- ``Client/getRequestToken(_:)``
- ``Client/postAccessToken(_:)``
- ``Client/getUserIdentity(_:)``
### Database endpoints
- ``Client/searchDatabase(_:)``
- ``Client/getArtist(_:)``
- ``Client/getArtistReleases(_:)``
- ``Client/getLabel(_:)``
- ``Client/getLabelReleases(_:)``
- ``Client/getMaster(_:)``
- ``Client/getMasterVersions(_:)``
- ``Client/getRelease(_:)``
- ``Client/getReleaseRating(_:)``
- ``Client/getReleaseRatingByUser(_:)``
- ``Client/putReleaseRatingByUser(_:)``
- ``Client/deleteReleaseRatingByUser(_:)``
- ``Client/getReleaseStats(_:)``
### User Identity
- ``Client/getUserProfile(_:)``
- ``Client/postUserProfile(_:)``
- ``Client/getUserContributions(_:)``
- ``Client/getUserSubmissions(_:)``
### User Collection
- ``Client/getCollectionFolders(_:)``
- ``Client/postCollectionFolders(_:)``
- ``Client/getCollectionFolder(_:)``
- ``Client/postCollectionFolder(_:)``
- ``Client/deleteCollectionFolder(_:)``
- ``Client/getCollectionItemsByRelease(_:)``
- ``Client/getCollectionItemsByFolder(_:)``
- ``Client/postReleaseToCollectionFolder(_:)``
- ``Client/postChangeRatingOfRelease(_:)``
- ``Client/deleteInstanceFromCollectionFolder(_:)``
- ``Client/getCustomFields(_:)``
- ``Client/editFieldsInstance(_:)``
- ``Client/getCollectionValue(_:)``
### User Wantlist
- ``Client/getWantlist(_:)``
- ``Client/addToWantlist(_:)``
- ``Client/updateInWantlist(_:)``
- ``Client/deleteFromWantlist(_:)``
### User Lists
- ``Client/getLists(_:)``
- ``Client/getList(_:)``
### Marketplace
- ``Client/getInventory(_:)``
- ``Client/getListing(_:)``
- ``Client/createListing(_:)``
- ``Client/editListing(_:)``
- ``Client/deleteListing(_:)``
- ``Client/getOrders(_:)``
- ``Client/getOrder(_:)``
- ``Client/getOrderMessages(_:)``
- ``Client/addOrderMessage(_:)``
- ``Client/getFee(_:)``
- ``Client/getFeeWithCurrency(_:)``
- ``Client/getPriceSuggestions(_:)``
- ``Client/getStatistics(_:)``
@@ -1,10 +1,37 @@
# ``DiscogsService`` # ``DiscogsService``
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@--> A Swift client library for the Discogs API, built on top of Swift OpenAPI.
## Overview ## Overview
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@--> This library provides a type-safe client for interacting with the [Discogs API](https://www.discogs.com/developers), including endpoints for the database, user identity, user collections, wantlists, lists, and the marketplace. It supports multiple authentication methods and transports credentials via headers or query parameters.
## Installation
To use this library, then add it as a dependency in the `Package.swift` file of your project:
```swift
let package = Package(
// name, platforms, products, etc.
dependencies: [
.package(url: "https://github.com/rock-n-code/discogs-service", from: "0.6.1"),
// other dependencies
],
targets: [
.target(
name: "SomeTarget",
dependencies: [
.product(name: "DiscogsService", package: "discogs-service"),
]
)
// other targets
]
)
```
It is also possible to use this library with your app in Xcode, then add it as a dependency in your Xcode project.
> important: Swift 5.10 or higher is required in order to compile this library.
## Topics ## Topics
@@ -14,7 +41,7 @@
### Servers ### Servers
- ``Servers/Server1`` - ``LiveService``
### Authentication ### Authentication
@@ -26,7 +53,6 @@
- ``UserAgentMiddleware`` - ``UserAgentMiddleware``
- ``Product`` - ``Product``
- ``InputValidationError``
### Types ### Types
@@ -34,6 +60,10 @@
- ``Operations`` - ``Operations``
- ``Servers`` - ``Servers``
### Errors
- ``InputValidationError``
### Protocols ### Protocols
- ``APIProtocol`` - ``APIProtocol``
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -16,7 +16,7 @@ extension String {
/// An empty string. /// An empty string.
static let empty = "" static let empty = ""
/// A namespaces assigned for the names of parameters. /// A namespace for the names of parameters.
enum Parameter { enum Parameter {
/// A name for the consumer key. /// A name for the consumer key.
static let key = "key" static let key = "key"
@@ -25,9 +25,9 @@ extension String {
/// A name for the user token. /// A name for the user token.
static let token = "token" static let token = "token"
} }
/// A namespaces assigned for the formats of string values. /// A namespace for the formats of string values.
enum Format {} enum Format {}
/// A namespaces assigned for the formats of regular expression patterns. /// A namespace for the formats of regular expression patterns.
enum Pattern {} enum Pattern {}
} }
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -52,7 +52,7 @@ private extension CamelCaseValidationRule {
/// ///
/// - Parameter input: An input to be validated. /// - Parameter input: An input to be validated.
/// - Returns: A flag that indicates whether a given input has been validated or not. /// - Returns: A flag that indicates whether a given input has been validated or not.
/// - Throws: An error of type ``InputValidatorError`` in case the validation failed. /// - Throws: An error of type ``InputValidationError`` in case the validation failed.
func validate(input: String?) throws -> Bool { func validate(input: String?) throws -> Bool {
guard let input else { guard let input else {
return false return false
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -52,7 +52,7 @@ private extension NotEmptyValidationRule {
/// ///
/// - Parameter input: An input to be validated. /// - Parameter input: An input to be validated.
/// - Returns: A flag that indicates whether a given input has been validated or not. /// - Returns: A flag that indicates whether a given input has been validated or not.
/// - Throws: An error of type ``InputValidatorError`` in case the validation failed. /// - Throws: An error of type ``InputValidationError`` in case the validation failed.
func validate(input: String?) throws -> Bool { func validate(input: String?) throws -> Bool {
guard let input else { guard let input else {
return false return false
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -52,7 +52,7 @@ private extension NotNilValidationRule {
/// ///
/// - Parameter input: An input to be validated. /// - Parameter input: An input to be validated.
/// - Returns: A flag that indicates whether a given input has been validated or not. /// - Returns: A flag that indicates whether a given input has been validated or not.
/// - Throws: An error of type ``InputValidatorError`` in case the validation failed. /// - Throws: An error of type ``InputValidationError`` in case the validation failed.
func validate(input: String?) throws -> Bool { func validate(input: String?) throws -> Bool {
guard input != nil else { guard input != nil else {
throw InputValidationError.inputIsNil throw InputValidationError.inputIsNil
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -65,9 +65,9 @@ extension InputValidationRule where Self == SecureValidationRule {
enum SecurityInput: Int { enum SecurityInput: Int {
/// A consumer key is 20 characters long. /// A consumer key is 20 characters long.
case consumerKey = 20 case consumerKey = 20
/// A consumer key is 32 characters long. /// A consumer secret is 32 characters long.
case consumerSecret = 32 case consumerSecret = 32
/// A consumer key is 40 characters long. /// A user token is 40 characters long.
case userToken = 40 case userToken = 40
} }
@@ -83,7 +83,7 @@ private extension SecureValidationRule {
/// ///
/// - Parameter input: An input to be validated. /// - Parameter input: An input to be validated.
/// - Returns: A flag that indicates whether a given input has been validated or not. /// - Returns: A flag that indicates whether a given input has been validated or not.
/// - Throws: An error of type ``InputValidatorError`` in case the validation failed. /// - Throws: An error of type ``InputValidationError`` in case the validation failed.
func validate(input: String?) throws -> Bool { func validate(input: String?) throws -> Bool {
guard let input else { guard let input else {
return false return false
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -54,7 +54,7 @@ private extension SemanticVersionValidationRule {
/// ///
/// - Parameter input: An input to be validated. /// - Parameter input: An input to be validated.
/// - Returns: A flag that indicates whether a given input has been validated or not. /// - Returns: A flag that indicates whether a given input has been validated or not.
/// - Throws: An error of type ``InputValidatorError`` in case the validation failed. /// - Throws: An error of type ``InputValidationError`` in case the validation failed.
func validate(input: String?) throws -> Bool { func validate(input: String?) throws -> Bool {
guard let input else { guard let input else {
return false return false
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -56,7 +56,7 @@ private extension URLValidationRule {
/// ///
/// - Parameter input: An input to be validated. /// - Parameter input: An input to be validated.
/// - Returns: A flag that indicates whether a given input has been validated or not. /// - Returns: A flag that indicates whether a given input has been validated or not.
/// - Throws: An error of type ``InputValidatorError`` in case the validation failed. /// - Throws: An error of type ``InputValidationError`` in case the validation failed.
func validate(input: String?) throws -> Bool { func validate(input: String?) throws -> Bool {
guard let input else { guard let input else {
return false return false
@@ -0,0 +1,18 @@
// ===----------------------------------------------------------------------===
//
// 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
//
// ===----------------------------------------------------------------------===
/// A type alias for the live (production) Discogs API server defined in the OpenAPI document.
///
/// Use this as the `serverURL` when initializing a ``Client`` to connect to the production Discogs API.
public typealias LiveService = Servers.Server1
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -13,8 +13,11 @@
// ===----------------------------------------------------------------------=== // ===----------------------------------------------------------------------===
/// A representation of the available transport options to send credentials in authenticated requests. /// A representation of the available transport options to send credentials in authenticated requests.
///
/// This enumeration is used in conjunction with ``AuthMiddleware`` to determine how authentication credentials
/// are attached to outgoing requests.
public enum AuthTransport: CaseIterable, Sendable { public enum AuthTransport: CaseIterable, Sendable {
/// Authentication credential are sent in a request as an `Authentication` header. /// Authentication credentials are sent in a request as an `Authorization` header.
/// ///
/// This means that the header will be added to any existing header in a request, like this: /// This means that the header will be added to any existing header in a request, like this:
/// ```bash /// ```bash
@@ -22,7 +25,7 @@ public enum AuthTransport: CaseIterable, Sendable {
/// curl "https://api.discogs.com/database/search?q=Slayer" -H "Authorization: Discogs token=abcxyz123456" /// curl "https://api.discogs.com/database/search?q=Slayer" -H "Authorization: Discogs token=abcxyz123456"
/// ``` /// ```
case onHeader case onHeader
/// Authentication credential are sent in a request as parameters in the query string. /// Authentication credentials are sent in a request as parameters in the query string.
/// ///
/// This means that the parameters will be injected into the query in a request, like this: /// This means that the parameters will be injected into the query in a request, like this:
/// ```bash /// ```bash
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -12,7 +12,7 @@
// //
// ===----------------------------------------------------------------------=== // ===----------------------------------------------------------------------===
/// A representation of all the possible validation error that could be thrown while validating an input. /// A representation of all the possible validation errors that could be thrown while validating an input.
public enum InputValidationError: Error { public enum InputValidationError: Error {
/// An input is empty. /// An input is empty.
case inputIsEmpty case inputIsEmpty
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -110,6 +110,14 @@ extension AuthMiddleware: ClientMiddleware {
// MARK: Functions // MARK: Functions
/// Intercepts an outgoing HTTP request and injects authentication credentials if configured.
/// - Parameters:
/// - request: The outgoing HTTP request to potentially authenticate.
/// - body: The optional body of the HTTP request.
/// - baseURL: The base URL of the service.
/// - operationID: The identifier of the API operation being called.
/// - next: The next middleware or transport to call in the chain.
/// - Returns: The HTTP response and optional response body from the service.
public func intercept( public func intercept(
_ request: HTTPRequest, _ request: HTTPRequest,
body: HTTPBody?, body: HTTPBody?,
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -60,6 +60,14 @@ extension UserAgentMiddleware: ClientMiddleware {
// MARK: Functions // MARK: Functions
/// Intercepts an outgoing HTTP request and attaches the `User-Agent` header.
/// - Parameters:
/// - request: The outgoing HTTP request to modify.
/// - body: The optional body of the HTTP request.
/// - baseURL: The base URL of the service.
/// - operationID: The identifier of the API operation being called.
/// - next: The next middleware or transport to call in the chain.
/// - Returns: The HTTP response and optional response body from the service.
public func intercept( public func intercept(
_ request: HTTPRequest, _ request: HTTPRequest,
body: HTTPBody?, body: HTTPBody?,
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -14,27 +14,32 @@
import Foundation import Foundation
/// A type that represents a product that uses the ``Client`` client. /// 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 { public struct Product: Sendable {
// MARK: Properties // MARK: Properties
/// A camel-cased name of a product. /// The camel-cased name of the product (e.g., `MyDiscogsApp`).
let name: String let name: String
/// A URI link related to a product. /// A URI link related to the product (e.g., `https://example.com`).
let url: String let url: String
/// A semantic version of a product. /// The semantic version of the product (e.g., `1.0.0`).
let version: String let version: String
// MARK: Initializers // MARK: Initializers
/// Initializes this model. /// Initializes this model.
/// - Parameters: /// - Parameters:
/// - name: A camel-cased name of a product. /// - name: The camel-cased name of the product.
/// - version: A semantic version of a 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 a product. /// - url: A URI link related to the product.
public init( public init(
name: String, name: String,
version: String, version: String,
@@ -2,7 +2,7 @@
## ##
## This source file is part of the Discogs Service open source project ## This source file is part of the Discogs Service open source project
## ##
## Copyright (c) 2025 Röck+Cöde VoF. and the Discogs Service project authors ## Copyright (c) 2026 Röck+Cöde VoF. and the Discogs Service project authors
## Licensed under Apache license v2.0 ## Licensed under Apache license v2.0
## ##
## See LICENSE for license information ## See LICENSE for license information
@@ -15,5 +15,5 @@
generate: generate:
- types - types
- client - client
namingStrategy: defensive namingStrategy: idiomatic
accessModifier: public accessModifier: public
File diff suppressed because it is too large Load Diff
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -85,7 +85,7 @@ private extension StringFunctionsTests {
private extension Input { private extension Input {
/// A list of strings to match against a regular expression pattern in test cases. /// A list of strings to match against a regular expression pattern in test cases.
static let stringsToMatch: [String] = ["Some Pattern", "Some", "Some Other Pattern", "Pattern", .empty] static let stringsToMatch: [String] = [.Pattern.sample, "Some", "Some Other Pattern", "Pattern", .empty]
} }
private extension Output { private extension Output {
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
@@ -2,7 +2,7 @@
// //
// This source file is part of the DiscogsService open source project // This source file is part of the DiscogsService open source project
// //
// Copyright (c) 2025 Röck+Cöde VoF. and the DiscogsService project authors // Copyright (c) 2026 Röck+Cöde VoF. and the DiscogsService project authors
// Licensed under Apache license v2.0 // Licensed under Apache license v2.0
// //
// See LICENSE for license information // See LICENSE for license information
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More