Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eaee2b84f0 | |||
| b14a9fa816 | |||
| a0672cc4af | |||
| 63118db805 | |||
| f3d5c0e6ac | |||
| 2a7b9746a7 | |||
| 2c91cad0bf | |||
| 39e9dc5d53 | |||
| 9a30b69561 | |||
| de5b4ff5d0 | |||
| d01b60e6dd |
@@ -2,7 +2,7 @@
|
||||
##
|
||||
## 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
|
||||
##
|
||||
## See LICENSE for license information
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
##
|
||||
## 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
|
||||
##
|
||||
## See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
##
|
||||
## 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
|
||||
##
|
||||
## See LICENSE for license information
|
||||
|
||||
@@ -5,7 +5,7 @@ Please visit the Discogs Service web site for more information:
|
||||
|
||||
* 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,
|
||||
version 2.0 (the "License"); you may not use this file except in compliance
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -32,7 +32,7 @@ let package = Package(
|
||||
),
|
||||
],
|
||||
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-urlsession", from: "1.0.2"),
|
||||
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0")
|
||||
|
||||
@@ -13,7 +13,7 @@ To use this library, then add it as a dependency in the `Package.swift` file of
|
||||
let package = Package(
|
||||
// name, platforms, products, etc.
|
||||
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
|
||||
],
|
||||
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``
|
||||
|
||||
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
|
||||
A Swift client library for the Discogs API, built on top of Swift OpenAPI.
|
||||
|
||||
## 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
|
||||
|
||||
@@ -14,7 +41,7 @@
|
||||
|
||||
### Servers
|
||||
|
||||
- ``Servers/Server1``
|
||||
- ``LiveService``
|
||||
|
||||
### Authentication
|
||||
|
||||
@@ -26,7 +53,6 @@
|
||||
|
||||
- ``UserAgentMiddleware``
|
||||
- ``Product``
|
||||
- ``InputValidationError``
|
||||
|
||||
### Types
|
||||
|
||||
@@ -34,6 +60,10 @@
|
||||
- ``Operations``
|
||||
- ``Servers``
|
||||
|
||||
### Errors
|
||||
|
||||
- ``InputValidationError``
|
||||
|
||||
### Protocols
|
||||
|
||||
- ``APIProtocol``
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -16,7 +16,7 @@ extension String {
|
||||
/// An empty string.
|
||||
static let empty = ""
|
||||
|
||||
/// A namespaces assigned for the names of parameters.
|
||||
/// A namespace for the names of parameters.
|
||||
enum Parameter {
|
||||
/// A name for the consumer key.
|
||||
static let key = "key"
|
||||
@@ -25,9 +25,9 @@ extension String {
|
||||
/// A name for the user token.
|
||||
static let token = "token"
|
||||
}
|
||||
/// A namespaces assigned for the formats of string values.
|
||||
/// A namespace for the formats of string values.
|
||||
enum Format {}
|
||||
|
||||
/// A namespaces assigned for the formats of regular expression patterns.
|
||||
/// A namespace for the formats of regular expression patterns.
|
||||
enum Pattern {}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -52,7 +52,7 @@ private extension CamelCaseValidationRule {
|
||||
///
|
||||
/// - Parameter input: An input to be validated.
|
||||
/// - 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 {
|
||||
guard let input else {
|
||||
return false
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -52,7 +52,7 @@ private extension NotEmptyValidationRule {
|
||||
///
|
||||
/// - Parameter input: An input to be validated.
|
||||
/// - 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 {
|
||||
guard let input else {
|
||||
return false
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -52,7 +52,7 @@ private extension NotNilValidationRule {
|
||||
///
|
||||
/// - Parameter input: An input to be validated.
|
||||
/// - 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 {
|
||||
guard input != nil else {
|
||||
throw InputValidationError.inputIsNil
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -65,9 +65,9 @@ extension InputValidationRule where Self == SecureValidationRule {
|
||||
enum SecurityInput: Int {
|
||||
/// A consumer key is 20 characters long.
|
||||
case consumerKey = 20
|
||||
/// A consumer key is 32 characters long.
|
||||
/// A consumer secret is 32 characters long.
|
||||
case consumerSecret = 32
|
||||
/// A consumer key is 40 characters long.
|
||||
/// A user token is 40 characters long.
|
||||
case userToken = 40
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ private extension SecureValidationRule {
|
||||
///
|
||||
/// - Parameter input: An input to be validated.
|
||||
/// - 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 {
|
||||
guard let input else {
|
||||
return false
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -54,7 +54,7 @@ private extension SemanticVersionValidationRule {
|
||||
///
|
||||
/// - Parameter input: An input to be validated.
|
||||
/// - 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 {
|
||||
guard let input else {
|
||||
return false
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -56,7 +56,7 @@ private extension URLValidationRule {
|
||||
///
|
||||
/// - Parameter input: An input to be validated.
|
||||
/// - 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 {
|
||||
guard let input else {
|
||||
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
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -13,8 +13,11 @@
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
/// 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 {
|
||||
/// 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:
|
||||
/// ```bash
|
||||
@@ -22,7 +25,7 @@ public enum AuthTransport: CaseIterable, Sendable {
|
||||
/// curl "https://api.discogs.com/database/search?q=Slayer" -H "Authorization: Discogs token=abcxyz123456"
|
||||
/// ```
|
||||
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:
|
||||
/// ```bash
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// 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 {
|
||||
/// An input is empty.
|
||||
case inputIsEmpty
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -110,6 +110,14 @@ extension AuthMiddleware: ClientMiddleware {
|
||||
|
||||
// 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(
|
||||
_ request: HTTPRequest,
|
||||
body: HTTPBody?,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -60,6 +60,14 @@ extension UserAgentMiddleware: ClientMiddleware {
|
||||
|
||||
// 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(
|
||||
_ request: HTTPRequest,
|
||||
body: HTTPBody?,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -14,27 +14,32 @@
|
||||
|
||||
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 {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// A camel-cased name of a product.
|
||||
/// The camel-cased name of the product (e.g., `MyDiscogsApp`).
|
||||
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
|
||||
|
||||
/// A semantic version of a product.
|
||||
/// The semantic version of the product (e.g., `1.0.0`).
|
||||
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.
|
||||
/// - 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,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
##
|
||||
## 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
|
||||
##
|
||||
## See LICENSE for license information
|
||||
@@ -15,5 +15,5 @@
|
||||
generate:
|
||||
- types
|
||||
- client
|
||||
namingStrategy: defensive
|
||||
namingStrategy: idiomatic
|
||||
accessModifier: public
|
||||
|
||||
+3434
-270
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
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
@@ -85,7 +85,7 @@ private extension StringFunctionsTests {
|
||||
|
||||
private extension Input {
|
||||
/// 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 {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// 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
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
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
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
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
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
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
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
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
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
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
+1
-1
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
Reference in New Issue
Block a user