diff --git a/Package.resolved b/Package.resolved index 3101f931..1ca31849 100644 --- a/Package.resolved +++ b/Package.resolved @@ -45,15 +45,6 @@ "version" : "1.6.1" } }, - { - "identity" : "swiftlintplugin", - "kind" : "remoteSourceControl", - "location" : "https://github.com/lukepistrol/SwiftLintPlugin", - "state" : { - "revision" : "5a65f4074975f811da666dfe31a19850950b1ea4", - "version" : "0.56.2" - } - }, { "identity" : "swxmlhash", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 2a4dce52..7c0f0ded 100644 --- a/Package.swift +++ b/Package.swift @@ -44,16 +44,12 @@ let package = Package( .package(url: "https://github.com/drmohundro/SWXMLHash.git", from: "7.0.2"), .package(url: "https://github.com/kishikawakatsumi/KeychainAccess.git", from: "4.2.2"), .package(url: "https://github.com/MobileNativeFoundation/Kronos.git", exact: "4.2.2"), - .package(url: "https://github.com/lukepistrol/SwiftLintPlugin", from: "0.54.0"), .package(url: "https://github.com/apple/swift-log.git", from: "1.6.1"), .package(url: "https://github.com/Flight-School/AnyCodable", from: "0.6.0"), ] + (shouldIncludeDocCPlugin ? [.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")] : []), targets: [ .target( - name: "Template", - plugins: [ - .plugin(name: "SwiftLint", package: "SwiftLintPlugin"), - ] + name: "Template" ), .testTarget( name: "TemplateTests", @@ -67,9 +63,6 @@ let package = Package( .AnyCodable, .auth, .common, - ], - plugins: [ - .plugin(name: "SwiftLint", package: "SwiftLintPlugin"), ] ), .target( @@ -77,9 +70,6 @@ let package = Package( dependencies: [ .Logging, .AnyCodable, - ], - plugins: [ - .plugin(name: "SwiftLint", package: "SwiftLintPlugin"), ] ), .testTarget( @@ -95,9 +85,6 @@ let package = Package( .GRDB, .SWXMLHash, .auth, - ], - plugins: [ - .plugin(name: "SwiftLint", package: "SwiftLintPlugin"), ] ), .testTarget( @@ -114,9 +101,6 @@ let package = Package( .common, .KeychainAccess, .Logging, - ], - plugins: [ - .plugin(name: "SwiftLint", package: "SwiftLintPlugin"), ] ), .testTarget( @@ -136,9 +120,6 @@ let package = Package( ], resources: [ .process("README.md"), - ], - plugins: [ - .plugin(name: "SwiftLint", package: "SwiftLintPlugin"), ] ), .testTarget( @@ -150,9 +131,6 @@ let package = Package( ], resources: [ .process("Resources"), - ], - plugins: [ - .plugin(name: "SwiftLint", package: "SwiftLintPlugin"), ] ), ] diff --git a/Sources/Auth/Login/LoginRepository.swift b/Sources/Auth/Login/LoginRepository.swift index a684a605..b7ffc1f9 100644 --- a/Sources/Auth/Login/LoginRepository.swift +++ b/Sources/Auth/Login/LoginRepository.swift @@ -11,7 +11,7 @@ final class LoginRepository { private let tokensStore: TokensStore private let exponentialBackoffPolicy: RetryPolicy private let logger: TidalLogger? - + private var codeVerifier: String? init( @@ -74,7 +74,7 @@ final class LoginRepository { case let .success(successData): try saveTokens(response: successData) case let .failure(error): - self.logger?.log(loggable: AuthLoggable.finalizeLoginNetworkError(error: error)) + logger?.log(loggable: AuthLoggable.finalizeLoginNetworkError(error: error)) } return response @@ -113,9 +113,9 @@ final class LoginRepository { deviceLoginPollHelper.prepareForPoll(interval: response.interval, maxDuration: response.expiresIn) return response } - + if case let .failure(error) = result { - self.logger?.log(loggable: AuthLoggable.initializeDeviceLoginNetworkError(error: error)) + logger?.log(loggable: AuthLoggable.initializeDeviceLoginNetworkError(error: error)) } return result @@ -133,8 +133,9 @@ final class LoginRepository { case let .success(successData): try saveTokens(response: successData) case let .failure(error): - let loggable = error.subStatus?.description.isSubStatus(status: .expiredAccessToken) == true ? AuthLoggable.finalizeDevicePollingLimitReached : AuthLoggable.finalizeDeviceLoginNetworkError(error: error) - self.logger?.log(loggable: loggable) + let loggable = error.subStatus?.description.isSubStatus(status: .expiredAccessToken) == true ? AuthLoggable + .finalizeDevicePollingLimitReached : AuthLoggable.finalizeDeviceLoginNetworkError(error: error) + logger?.log(loggable: loggable) } return response diff --git a/Sources/Auth/Model/AuthLoggable.swift b/Sources/Auth/Model/AuthLoggable.swift index 273fbbf0..a3745d75 100644 --- a/Sources/Auth/Model/AuthLoggable.swift +++ b/Sources/Auth/Model/AuthLoggable.swift @@ -63,25 +63,25 @@ extension AuthLoggable { switch self { case let .initializeDeviceLoginNetworkError(error), - let .finalizeLoginNetworkError(error), - let .finalizeDeviceLoginNetworkError(error), - let .getCredentialsUpgradeTokenNetworkError(error), - let .loadTokensFromStoreError(error): + let .finalizeLoginNetworkError(error), + let .finalizeDeviceLoginNetworkError(error), + let .getCredentialsUpgradeTokenNetworkError(error), + let .loadTokensFromStoreError(error): metadata[Logger.Metadata.errorKey] = .string(.init(describing: error)) case let .getCredentialsRefreshTokenNetworkError(error, previousSubstatus), - let .getCredentialsRefreshTokenWithClientCredentialsNetworkError(error, previousSubstatus): + let .getCredentialsRefreshTokenWithClientCredentialsNetworkError(error, previousSubstatus): metadata[Logger.Metadata.errorKey] = .string(.init(describing: error)) metadata[Self.metadataPreviousSubstatusKey] = "\(previousSubstatus ?? "nil")" case let .authLogout(reason, error, previousSubstatus): metadata[Logger.Metadata.reasonKey] = "\(reason)" - if let error = error { + if let error { metadata[Logger.Metadata.errorKey] = .string(.init(describing: error)) } metadata[Self.metadataPreviousSubstatusKey] = "\(previousSubstatus ?? "nil")" default: break } - + metadata[Logger.Metadata.codeKey] = .string(eventCode) return metadata @@ -95,11 +95,11 @@ extension AuthLoggable { .error } } - + var source: String? { "Auth" } - + private var eventCode: String { let intCode = switch self { case .initializeDeviceLoginNetworkError: @@ -129,7 +129,7 @@ extension AuthLoggable { case .loadTokensFromStoreError: 13 } - + return intCode.description } } diff --git a/Sources/Auth/TidalAuth.swift b/Sources/Auth/TidalAuth.swift index ce6d8511..79984830 100644 --- a/Sources/Auth/TidalAuth.swift +++ b/Sources/Auth/TidalAuth.swift @@ -15,18 +15,20 @@ public class TidalAuth: Auth & CredentialsProvider { ) { self.config = config - let tokensStore = DefaultTokensStore(credentialsKey: config.credentialsKey, credentialsAccessGroup: config.credentialsAccessGroup) + let tokensStore = DefaultTokensStore( + credentialsKey: config.credentialsKey, + credentialsAccessGroup: config.credentialsAccessGroup + ) - let authLogger: TidalLogger? - if config.enableLogging { - authLogger = TidalLogger(label: "Auth", level: .trace) + let authLogger: TidalLogger? = if config.enableLogging { + TidalLogger(label: "Auth", level: .trace) } else { - authLogger = nil + nil } loginRepository = provideLoginRepository(config, tokensStore: tokensStore, logger: authLogger) tokenRepository = provideTokenRepository(config, tokensStore: tokensStore, logger: authLogger) } - + private func provideLoginRepository(_ config: AuthConfig, tokensStore: TokensStore, logger: TidalLogger?) -> LoginRepository { LoginRepository( authConfig: config, @@ -48,7 +50,7 @@ public class TidalAuth: Auth & CredentialsProvider { tokensStore: tokensStore, tokenService: DefaultTokenService(authBaseUrl: config.tidalAuthServiceBaseUri), defaultBackoffPolicy: DefaultRetryPolicy(), - upgradeBackoffPolicy: DefaultRetryPolicy(), + upgradeBackoffPolicy: DefaultRetryPolicy(), logger: logger ) } diff --git a/Sources/Auth/TokenRepository.swift b/Sources/Auth/TokenRepository.swift index 18db7f2a..f0100644 100644 --- a/Sources/Auth/TokenRepository.swift +++ b/Sources/Auth/TokenRepository.swift @@ -89,7 +89,7 @@ struct TokenRepository { ) } } else if let clientSecret = authConfig.clientSecret { // if nothing is stored, we will try and refresh using a client secret - self.logger?.log(loggable: AuthLoggable.getCredentialsRefreshTokenIsNotAvailable) + logger?.log(loggable: AuthLoggable.getCredentialsRefreshTokenIsNotAvailable) refreshCredentialsBlock = { await getClientAccessToken(clientSecret: clientSecret) } networkErrorLoggableBlock = { AuthLoggable.getCredentialsRefreshTokenWithClientCredentialsNetworkError( @@ -110,12 +110,12 @@ struct TokenRepository { switch (authResult, networkErrorLoggableBlock) { case let (.failure(error), _) where shouldLogoutWithLowerLevelTokenAfterUpdate(error: error): if let loggable = logoutAfterErrorLoggableBlock?(error) { - self.logger?.log(loggable: loggable) + logger?.log(loggable: loggable) } return .success(.init(authConfig: authConfig)) case let (.failure(error), .some(networkErrorLoggableBlock)): - self.logger?.log(loggable: networkErrorLoggableBlock(error)) + logger?.log(loggable: networkErrorLoggableBlock(error)) default: break } @@ -123,7 +123,10 @@ struct TokenRepository { return authResult } - self.logger?.log(loggable: AuthLoggable.authLogout(reason: "No refresh token or client secret available", previousSubstatus: apiErrorSubStatus)) + logger?.log(loggable: AuthLoggable.authLogout( + reason: "No refresh token or client secret available", + previousSubstatus: apiErrorSubStatus + )) return logout() } @@ -162,10 +165,10 @@ struct TokenRepository { switch result { case let .success(tokens): if tokens.credentials.token == nil { - self.logger?.log(loggable: AuthLoggable.getCredentialsUpgradeTokenNoTokenInResponse) + logger?.log(loggable: AuthLoggable.getCredentialsUpgradeTokenNoTokenInResponse) } case let .failure(error): - self.logger?.log(loggable: AuthLoggable.getCredentialsUpgradeTokenNetworkError(error: error)) + logger?.log(loggable: AuthLoggable.getCredentialsUpgradeTokenNetworkError(error: error)) } return result diff --git a/Sources/Common/Logger/LoggerMetadata+Extension.swift b/Sources/Common/Logger/LoggerMetadata+Extension.swift index 364fec61..df3f4871 100644 --- a/Sources/Common/Logger/LoggerMetadata+Extension.swift +++ b/Sources/Common/Logger/LoggerMetadata+Extension.swift @@ -5,7 +5,7 @@ public extension Logger.Metadata { init(stringDict: [String: String]) { self = stringDict.mapValues { .string($0) } } - + // Common keys that can be used in metadata for the sake of consistency static let errorKey = "error" static let codeKey = "code" diff --git a/Sources/Common/Logger/TidalLoggable.swift b/Sources/Common/Logger/TidalLoggable.swift index b199abe7..9929227b 100644 --- a/Sources/Common/Logger/TidalLoggable.swift +++ b/Sources/Common/Logger/TidalLoggable.swift @@ -4,13 +4,14 @@ import Logging public protocol TidalLoggable { /// Message you want to log var loggingMessage: Logger.Message { get } - + /// Additional information attached to a log message var loggingMetadata: Logger.Metadata { get } - + /// Level of a log message var logLevel: Logger.Level { get } - - /// The origin of a log message. If you don't provide it, it will be set automatically to the name of a calling module, which might not be intended + + /// The origin of a log message. If you don't provide it, it will be set automatically to the name of a calling module, which + /// might not be intended var source: String? { get } } diff --git a/Sources/Common/Logger/TidalLogger.swift b/Sources/Common/Logger/TidalLogger.swift index 84bac708..d697fc9f 100644 --- a/Sources/Common/Logger/TidalLogger.swift +++ b/Sources/Common/Logger/TidalLogger.swift @@ -1,24 +1,34 @@ import Logging +// MARK: - TidalLogger + /// Struct abstraction for a logger offering a convenient API for logging. public struct TidalLogger { private var logger: Logger public init(label: String, level: Logger.Level = .trace) { - self.logger = Logger(label: label) - self.logger.logLevel = level + logger = Logger(label: label) + logger.logLevel = level } } private extension TidalLogger { - func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata? = nil, source: String? = nil, file: String, function: String, line: UInt) { - self.logger.log(level: level, message, metadata: metadata, source: source, file: file, function: function, line: line) + func log( + level: Logger.Level, + message: Logger.Message, + metadata: Logger.Metadata? = nil, + source: String? = nil, + file: String, + function: String, + line: UInt + ) { + logger.log(level: level, message, metadata: metadata, source: source, file: file, function: function, line: line) } } public extension TidalLogger { func log(loggable: TidalLoggable, file: String = #fileID, function: String = #function, line: UInt = #line) { - self.log( + log( level: loggable.logLevel, message: loggable.loggingMessage, metadata: loggable.loggingMetadata, @@ -28,11 +38,12 @@ public extension TidalLogger { line: line ) } - + /// Logs a string message /// - Parameters: /// - message: Message you want to log - /// - source: The origin of a log message. If you don't provide it, it will be set automatically to the name of a calling module, which might not be intended + /// - source: The origin of a log message. If you don't provide it, it will be set automatically to the name of a calling + /// module, which might not be intended /// - level: Level of a log message /// - metadata: Additional information attached to a log message /// - file: The file this log message originates from (there's usually no need to pass it explicitly as it @@ -52,8 +63,8 @@ public extension TidalLogger { ) { let level = level ?? logger.logLevel let loggerMessage = Logger.Message(stringLiteral: message) - - self.log( + + log( level: level, message: loggerMessage, metadata: metadata, diff --git a/Sources/EventProducer/TidalEventSender.swift b/Sources/EventProducer/TidalEventSender.swift index 3f9f46da..41b3fe1e 100644 --- a/Sources/EventProducer/TidalEventSender.swift +++ b/Sources/EventProducer/TidalEventSender.swift @@ -118,8 +118,9 @@ public final class TidalEventSender: EventSender { ) endOutage(eventName: event.name) } - - /// Used to explicitly send all events directly from the scheduler. Usage would depend on the client (ex. when app moves to the background) + + /// Used to explicitly send all events directly from the scheduler. Usage would depend on the client (ex. when app moves to the + /// background) public func sendAllEvents() async throws { let headerHelper = HeaderHelper(credentialsProvider: config?.credentialsProvider) do { diff --git a/Sources/Player/Common/Data/AudioCodec.swift b/Sources/Player/Common/Data/AudioCodec.swift index 21b0c5fb..3388f40b 100644 --- a/Sources/Player/Common/Data/AudioCodec.swift +++ b/Sources/Player/Common/Data/AudioCodec.swift @@ -91,7 +91,7 @@ public enum AudioCodec: Equatable, Codable { } switch mode { // We can't know the exact codec, but the client does not need it. - case AudioMode.DOLBY_ATMOS, AudioMode.SONY_360RA: + case AudioMode.DOLBY_ATMOS, AudioMode.SONY_360RA: PlayerWorld.logger?.log(loggable: PlayerLoggable.audioCodecInitWithLowQualityAndUnsupportedMode(mode: mode.rawValue)) return nil case AudioMode.STEREO: self = .HE_AAC_V1 diff --git a/Sources/Player/Common/Event/PlayerListener.swift b/Sources/Player/Common/Event/PlayerListener.swift index 5b9b32aa..df52c8e8 100644 --- a/Sources/Player/Common/Event/PlayerListener.swift +++ b/Sources/Player/Common/Event/PlayerListener.swift @@ -19,7 +19,8 @@ public protocol PlayerListener: AnyObject { func djSessionTransitioned(to transition: DJSessionTransition) - /// Called when the media services were reset. A chance for the client of the player to respond appropriately to mediaServicesWereResetNotification. More info about this issue: + /// Called when the media services were reset. A chance for the client of the player to respond appropriately to + /// mediaServicesWereResetNotification. More info about this issue: /// https://developer.apple.com/documentation/avfaudio/avaudiosession/1616540-mediaserviceswereresetnotificati /// - Important: This is a good time to set up the audio session again. func mediaServicesWereReset() diff --git a/Sources/Player/Common/HttpClient/ResponseHandler.swift b/Sources/Player/Common/HttpClient/ResponseHandler.swift index 0bdf7627..e6a87eb5 100644 --- a/Sources/Player/Common/HttpClient/ResponseHandler.swift +++ b/Sources/Player/Common/HttpClient/ResponseHandler.swift @@ -47,7 +47,10 @@ final class ResponseHandler { PlayerWorld.logger?.log(loggable: PlayerLoggable.backoffHandleResponseFailed(error: error, retryStrategy: "NONE")) throw error case let .BACKOFF(duration): - PlayerWorld.logger?.log(loggable: PlayerLoggable.backoffHandleResponseFailed(error: error, retryStrategy: "BACKOFF(duration: \(duration))")) + PlayerWorld.logger?.log(loggable: PlayerLoggable.backoffHandleResponseFailed( + error: error, + retryStrategy: "BACKOFF(duration: \(duration))" + )) try await Task.sleep(seconds: duration) return try await execute(attemptCount: attemptCount + 1) } diff --git a/Sources/Player/Mocks/PlaybackEngine/PlayerListenerMock.swift b/Sources/Player/Mocks/PlaybackEngine/PlayerListenerMock.swift index 7c6daa90..d968adb0 100644 --- a/Sources/Player/Mocks/PlaybackEngine/PlayerListenerMock.swift +++ b/Sources/Player/Mocks/PlaybackEngine/PlayerListenerMock.swift @@ -32,6 +32,6 @@ public final class PlayerListenerMock: PlayerListener { public func djSessionEnded(with reason: DJSessionEndReason) {} public func djSessionTransitioned(to transition: DJSessionTransition) {} - + public func mediaServicesWereReset() {} } diff --git a/Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/Legacy/AVQueuePlayerWrapperLegacy.swift b/Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/Legacy/AVQueuePlayerWrapperLegacy.swift index d51aa56b..680f7a18 100644 --- a/Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/Legacy/AVQueuePlayerWrapperLegacy.swift +++ b/Sources/Player/PlaybackEngine/Internal/AVQueuePlayer/Legacy/AVQueuePlayerWrapperLegacy.swift @@ -372,7 +372,7 @@ private extension AVQueuePlayerWrapperLegacy { onStall: stalled, onCompletelyDownloaded: downloaded, onReadyToPlayToPlay: loaded, - onItemPlayedToEnd: playedToEnd, + onItemPlayedToEnd: playedToEnd, onDjSessionTransition: receivedDjSessionTransition ) } @@ -566,7 +566,7 @@ private extension AVQueuePlayerWrapperLegacy { func playedToEnd(playerItem: AVPlayerItem) { if featureFlagProvider.shouldNotPerformActionAtItemEnd() { - self.player.remove(playerItem) + player.remove(playerItem) } } } @@ -606,14 +606,14 @@ private extension AVQueuePlayerWrapperLegacy { // If it's the error related to the media services being reset, we create a specific internal error instead of a generic one. // This is because the media services being reset is a recoverable error that should be handled differently. if nserror.domain == ErrorConstants.avfoundationErrorDomain, - nserror.code == ErrorConstants.averrorMediaServicesWereResetErrorCode + nserror.code == ErrorConstants.averrorMediaServicesWereResetErrorCode { return PlayerInternalError( errorId: .PERetryable, - errorType: .mediaServicesWereReset, - code: nserror.code, - description: description - ) + errorType: .mediaServicesWereReset, + code: nserror.code, + description: description + ) } else { return (error as? AVError).map { PlayerInternalError( diff --git a/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionMediaServicesWereResetMonitor.swift b/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionMediaServicesWereResetMonitor.swift index 5ebbf55f..1d67c2d0 100644 --- a/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionMediaServicesWereResetMonitor.swift +++ b/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionMediaServicesWereResetMonitor.swift @@ -2,56 +2,55 @@ import AVFoundation import Foundation -// swiftlint:disable:next type_name -final class AudioSessionMediaServicesWereResetMonitor { - private weak var playerEngine: PlayerEngine? - private weak var audioSession: AVAudioSession? - - init(playerEngine: PlayerEngine) { - self.playerEngine = playerEngine - audioSession = AVAudioSession.sharedInstance() - - NotificationCenter.default.addObserver( - self, - selector: #selector(handleMediaServicesWereLost), - name: AVAudioSession.mediaServicesWereLostNotification, - object: audioSession - ) - NotificationCenter.default.addObserver( - self, - selector: #selector(handleMediaServicesWereReset), - name: AVAudioSession.mediaServicesWereResetNotification, - object: audioSession - ) + // swiftlint:disable:next type_name + final class AudioSessionMediaServicesWereResetMonitor { + private weak var playerEngine: PlayerEngine? + private weak var audioSession: AVAudioSession? + + init(playerEngine: PlayerEngine) { + self.playerEngine = playerEngine + audioSession = AVAudioSession.sharedInstance() + + NotificationCenter.default.addObserver( + self, + selector: #selector(handleMediaServicesWereLost), + name: AVAudioSession.mediaServicesWereLostNotification, + object: audioSession + ) + NotificationCenter.default.addObserver( + self, + selector: #selector(handleMediaServicesWereReset), + name: AVAudioSession.mediaServicesWereResetNotification, + object: audioSession + ) + } + + deinit { + NotificationCenter.default.removeObserver( + self, + name: AVAudioSession.mediaServicesWereLostNotification, + object: audioSession + ) + + NotificationCenter.default.removeObserver( + self, + name: AVAudioSession.mediaServicesWereResetNotification, + object: audioSession + ) + } } - deinit { - NotificationCenter.default.removeObserver( - self, - name: AVAudioSession.mediaServicesWereLostNotification, - object: audioSession - ) - - NotificationCenter.default.removeObserver( - self, - name: AVAudioSession.mediaServicesWereResetNotification, - object: audioSession - ) - } -} - -private extension AudioSessionMediaServicesWereResetMonitor { - - @objc - func handleMediaServicesWereLost(notification: Notification) { - PlayerWorld.logger?.log(loggable: PlayerLoggable.handleMediaServicesWereLost) - } + private extension AudioSessionMediaServicesWereResetMonitor { + @objc + func handleMediaServicesWereLost(notification: Notification) { + PlayerWorld.logger?.log(loggable: PlayerLoggable.handleMediaServicesWereLost) + } - @objc - func handleMediaServicesWereReset(notification: Notification) { - PlayerWorld.logger?.log(loggable: PlayerLoggable.handleMediaServicesWereReset) + @objc + func handleMediaServicesWereReset(notification: Notification) { + PlayerWorld.logger?.log(loggable: PlayerLoggable.handleMediaServicesWereReset) - self.playerEngine?.mediaServicesWereReset() + playerEngine?.mediaServicesWereReset() + } } -} #endif diff --git a/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionRouteChangeMonitor.swift b/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionRouteChangeMonitor.swift index cc2ceaf8..4b9a8cc0 100644 --- a/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionRouteChangeMonitor.swift +++ b/Sources/Player/PlaybackEngine/Internal/AudioSessionMonitors/AudioSessionRouteChangeMonitor.swift @@ -43,7 +43,8 @@ case .oldDeviceUnavailable: playerEngine?.pause() default: () - PlayerWorld.logger?.log(loggable: PlayerLoggable.changeMonitorHandleNotificationDefaultReason(reason: String(describing: reason))) + PlayerWorld.logger? + .log(loggable: PlayerLoggable.changeMonitorHandleNotificationDefaultReason(reason: String(describing: reason))) } updateVolume() diff --git a/Sources/Player/PlaybackEngine/Internal/Cache/GRDBCache/GRDBCacheStorage.swift b/Sources/Player/PlaybackEngine/Internal/Cache/GRDBCache/GRDBCacheStorage.swift index a58fedd4..cbb65c9f 100644 --- a/Sources/Player/PlaybackEngine/Internal/Cache/GRDBCache/GRDBCacheStorage.swift +++ b/Sources/Player/PlaybackEngine/Internal/Cache/GRDBCache/GRDBCacheStorage.swift @@ -102,7 +102,7 @@ extension GRDBCacheStorage: CacheStorage { private extension GRDBCacheStorage { func initializeDatabase() throws { do { - try dbQueue.write { db in + try dbQueue.write { db in if try !db.tableExists(CacheEntryGRDBEntity.databaseTableName) { try db.create(table: CacheEntryGRDBEntity.databaseTableName) { t in t.column("key", .text).primaryKey() diff --git a/Sources/Player/PlaybackEngine/Types/AssetPlaybackMetadata.swift b/Sources/Player/PlaybackEngine/Types/AssetPlaybackMetadata.swift index 2d6248b5..9f9a7f80 100644 --- a/Sources/Player/PlaybackEngine/Types/AssetPlaybackMetadata.swift +++ b/Sources/Player/PlaybackEngine/Types/AssetPlaybackMetadata.swift @@ -33,7 +33,8 @@ public struct AssetPlaybackMetadata: Equatable { } else if formatFlags == kAppleLosslessFormatFlag_32BitSourceData { bitDepth = 32 } else { - PlayerWorld.logger?.log(loggable: PlayerLoggable.assetPlaybackMetadataInitWithInvalidFormatFlags(formatFlags: String(describing: formatFlags))) + PlayerWorld.logger? + .log(loggable: PlayerLoggable.assetPlaybackMetadataInitWithInvalidFormatFlags(formatFlags: String(describing: formatFlags))) return nil } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIHelper.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIHelper.swift index 7c975bb6..56e0306f 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIHelper.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIHelper.swift @@ -1,121 +1,116 @@ -// APIHelper.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation -public struct APIHelper { - public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { - let destination = source.reduce(into: [String: Any]()) { result, item in - if let value = item.value { - result[item.key] = value - } - } - - if destination.isEmpty { - return nil - } - return destination - } - - public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { - return source.reduce(into: [String: String]()) { result, item in - if let collection = item.value as? [Any?] { - result[item.key] = collection - .compactMap { value in convertAnyToString(value) } - .joined(separator: ",") - } else if let value: Any = item.value { - result[item.key] = convertAnyToString(value) - } - } - } - - public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { - guard let source = source else { - return nil - } - - return source.reduce(into: [String: Any]()) { result, item in - switch item.value { - case let x as Bool: - result[item.key] = x.description - default: - result[item.key] = item.value - } - } - } - - public static func convertAnyToString(_ value: Any?) -> String? { - guard let value = value else { return nil } - if let value = value as? any RawRepresentable { - return "\(value.rawValue)" - } else { - return "\(value)" - } - } - - public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? [Any?] { - return collection - .compactMap { value in convertAnyToString(value) } - .joined(separator: ",") - } else if let value = source as? any RawRepresentable { - return "\(value.rawValue)" - } - return source - } - - /// maps all values from source to query parameters - /// - /// explode attribute is respected: collection values might be either joined or split up into separate key value pairs - public static func mapValuesToQueryItems(_ source: [String: (wrappedValue: Any?, isExplode: Bool)]) -> [URLQueryItem]? { - let destination = source.filter { $0.value.wrappedValue != nil }.reduce(into: [URLQueryItem]()) { result, item in - if let collection = item.value.wrappedValue as? [Any?] { - - let collectionValues: [String] = collection.compactMap { value in convertAnyToString(value) } - - if !item.value.isExplode { - result.append(URLQueryItem(name: item.key, value: collectionValues.joined(separator: ","))) - } else { - collectionValues - .forEach { value in - result.append(URLQueryItem(name: item.key, value: value)) - } - } - - } else if let value = item.value.wrappedValue { - result.append(URLQueryItem(name: item.key, value: convertAnyToString(value))) - } - } - - if destination.isEmpty { - return nil - } - return destination.sorted { $0.name < $1.name } - } - - /// maps all values from source to query parameters - /// - /// collection values are always exploded - public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { - let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in - if let collection = item.value as? [Any?] { - collection - .compactMap { value in convertAnyToString(value) } - .forEach { value in - result.append(URLQueryItem(name: item.key, value: value)) - } - - } else if let value = item.value { - result.append(URLQueryItem(name: item.key, value: convertAnyToString(value))) - } - } - - if destination.isEmpty { - return nil - } - return destination.sorted { $0.name < $1.name } - } +public enum APIHelper { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { + let destination = source.reduce(into: [String: Any]()) { result, item in + if let value = item.value { + result[item.key] = value + } + } + + if destination.isEmpty { + return nil + } + return destination + } + + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { + source.reduce(into: [String: String]()) { result, item in + if let collection = item.value as? [Any?] { + result[item.key] = collection + .compactMap { value in convertAnyToString(value) } + .joined(separator: ",") + } else if let value: Any = item.value { + result[item.key] = convertAnyToString(value) + } + } + } + + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { + guard let source else { + return nil + } + + return source.reduce(into: [String: Any]()) { result, item in + switch item.value { + case let x as Bool: + result[item.key] = x.description + default: + result[item.key] = item.value + } + } + } + + public static func convertAnyToString(_ value: Any?) -> String? { + guard let value else { + return nil + } + if let value = value as? any RawRepresentable { + return "\(value.rawValue)" + } else { + return "\(value)" + } + } + + public static func mapValueToPathItem(_ source: Any) -> Any { + if let collection = source as? [Any?] { + return collection + .compactMap { value in convertAnyToString(value) } + .joined(separator: ",") + } else if let value = source as? any RawRepresentable { + return "\(value.rawValue)" + } + return source + } + + /// maps all values from source to query parameters + /// + /// explode attribute is respected: collection values might be either joined or split up into separate key value pairs + public static func mapValuesToQueryItems(_ source: [String: (wrappedValue: Any?, isExplode: Bool)]) -> [URLQueryItem]? { + let destination = source.filter { $0.value.wrappedValue != nil }.reduce(into: [URLQueryItem]()) { result, item in + if let collection = item.value.wrappedValue as? [Any?] { + let collectionValues: [String] = collection.compactMap { value in convertAnyToString(value) } + + if !item.value.isExplode { + result.append(URLQueryItem(name: item.key, value: collectionValues.joined(separator: ","))) + } else { + collectionValues + .forEach { value in + result.append(URLQueryItem(name: item.key, value: value)) + } + } + + } else if let value = item.value.wrappedValue { + result.append(URLQueryItem(name: item.key, value: convertAnyToString(value))) + } + } + + if destination.isEmpty { + return nil + } + return destination.sorted { $0.name < $1.name } + } + + /// maps all values from source to query parameters + /// + /// collection values are always exploded + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { + let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in + if let collection = item.value as? [Any?] { + collection + .compactMap { value in convertAnyToString(value) } + .forEach { value in + result.append(URLQueryItem(name: item.key, value: value)) + } + + } else if let value = item.value { + result.append(URLQueryItem(name: item.key, value: convertAnyToString(value))) + } + } + + if destination.isEmpty { + return nil + } + return destination.sorted { $0.name < $1.name } + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs.swift index be8c1239..06d1b5cf 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs.swift @@ -1,93 +1,103 @@ -// APIs.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif + +// MARK: - OpenAPIClientAPI + open class OpenAPIClientAPI { - public static var basePath = "https://openapi.tidal.com/v2" - public static var customHeaders: [String: String] = [:] - public static var credential: URLCredential? - public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() - public static var apiResponseQueue: DispatchQueue = .main + public static var basePath = "https://openapi.tidal.com/v2" + public static var customHeaders: [String: String] = [:] + public static var credential: URLCredential? + public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main } +// MARK: - RequestBuilder + open class RequestBuilder { - var credential: URLCredential? - var headers: [String: String] - public let parameters: [String: Any]? - public let method: String - public let URLString: String - public let requestTask: RequestTask = RequestTask() - public let requiresAuthentication: Bool + var credential: URLCredential? + var headers: [String: String] + public let parameters: [String: Any]? + public let method: String + public let URLString: String + public let requestTask: RequestTask = RequestTask() + public let requiresAuthentication: Bool + + /// Optional block to obtain a reference to the request's progress instance when available. + public var onProgressReady: ((Progress) -> Void)? - /// Optional block to obtain a reference to the request's progress instance when available. - public var onProgressReady: ((Progress) -> Void)? + public required init( + method: String, + URLString: String, + parameters: [String: Any]?, + headers: [String: String] = [:], + requiresAuthentication: Bool + ) { + self.method = method + self.URLString = URLString + self.parameters = parameters + self.headers = headers + self.requiresAuthentication = requiresAuthentication - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) { - self.method = method - self.URLString = URLString - self.parameters = parameters - self.headers = headers - self.requiresAuthentication = requiresAuthentication + addHeaders(OpenAPIClientAPI.customHeaders) + } - addHeaders(OpenAPIClientAPI.customHeaders) - } + open func addHeaders(_ aHeaders: [String: String]) { + for (header, value) in aHeaders { + headers[header] = value + } + } - open func addHeaders(_ aHeaders: [String: String]) { - for (header, value) in aHeaders { - headers[header] = value - } - } + @discardableResult + open func execute( + _ apiResponseQueue: DispatchQueue = OpenAPIClientAPI.apiResponseQueue, + _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void + ) -> RequestTask { + requestTask + } - @discardableResult - open func execute(_ apiResponseQueue: DispatchQueue = OpenAPIClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { - return requestTask - } + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + @discardableResult + open func execute() async throws -> Response { + try await withTaskCancellationHandler { + try Task.checkCancellation() + return try await withCheckedThrowingContinuation { continuation in + guard !Task.isCancelled else { + continuation.resume(throwing: CancellationError()) + return + } - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - @discardableResult - open func execute() async throws -> Response { - return try await withTaskCancellationHandler { - try Task.checkCancellation() - return try await withCheckedThrowingContinuation { continuation in - guard !Task.isCancelled else { - continuation.resume(throwing: CancellationError()) - return - } + self.execute { result in + switch result { + case let .success(response): + continuation.resume(returning: response) + case let .failure(error): + continuation.resume(throwing: error) + } + } + } + } onCancel: { + self.requestTask.cancel() + } + } - self.execute { result in - switch result { - case let .success(response): - continuation.resume(returning: response) - case let .failure(error): - continuation.resume(throwing: error) - } - } - } - } onCancel: { - self.requestTask.cancel() - } - } - - public func addHeader(name: String, value: String) -> Self { - if !value.isEmpty { - headers[name] = value - } - return self - } + public func addHeader(name: String, value: String) -> Self { + if !value.isEmpty { + headers[name] = value + } + return self + } - open func addCredential() -> Self { - credential = OpenAPIClientAPI.credential - return self - } + open func addCredential() -> Self { + credential = OpenAPIClientAPI.credential + return self + } } +// MARK: - RequestBuilderFactory + public protocol RequestBuilderFactory { - func getNonDecodableBuilder() -> RequestBuilder.Type - func getBuilder() -> RequestBuilder.Type + func getNonDecodableBuilder() -> RequestBuilder.Type + func getBuilder() -> RequestBuilder.Type } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPI.swift index f808c130..617a911f 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPI.swift @@ -1,351 +1,470 @@ -// -// AlbumsAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class AlbumsAPI { - - /** - Relationship: artists - - - parameter id: (path) TIDAL album id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: AlbumsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getAlbumArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await getAlbumArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: artists - - GET /albums/{id}/relationships/artists - - Retrieve artist details of the related album. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL album id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getAlbumArtistsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/albums/{id}/relationships/artists" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get single album - - - parameter id: (path) TIDAL album id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, items, providers, similarAlbums (optional) - - returns: AlbumsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getAlbumById(id: String, countryCode: String, include: [String]? = nil) async throws -> AlbumsSingleDataDocument { - return try await getAlbumByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body - } - - /** - Get single album - - GET /albums/{id} - - Retrieve album details by TIDAL album id. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL album id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, items, providers, similarAlbums (optional) - - returns: RequestBuilder - */ - internal class func getAlbumByIdWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/albums/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: items - - - parameter id: (path) TIDAL album id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: AlbumsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getAlbumItemsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await getAlbumItemsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: items - - GET /albums/{id}/relationships/items - - Retrieve album item details. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL album id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getAlbumItemsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/albums/{id}/relationships/items" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: providers - - - parameter id: (path) TIDAL id of the album - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: providers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: AlbumsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getAlbumProvidersRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await getAlbumProvidersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: providers - - GET /albums/{id}/relationships/providers - - This endpoint can be used to retrieve a list of album's related providers. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the album - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: providers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getAlbumProvidersRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/albums/{id}/relationships/providers" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: similar albums - - - parameter id: (path) TIDAL id of the album - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: similarAlbums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: AlbumsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getAlbumSimilarAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await getAlbumSimilarAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: similar albums - - GET /albums/{id}/relationships/similarAlbums - - This endpoint can be used to retrieve a list of albums similar to the given album. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the album - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: similarAlbums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getAlbumSimilarAlbumsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/albums/{id}/relationships/similarAlbums" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get multiple albums - - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, items, providers, similarAlbums (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterBarcodeId: (query) Allows to filter the collection of resources based on barcodeId attribute value (optional) - - returns: AlbumsMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getAlbumsByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterBarcodeId: [String]? = nil) async throws -> AlbumsMultiDataDocument { - return try await getAlbumsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId, filterBarcodeId: filterBarcodeId).execute().body - } - - /** - Get multiple albums - - GET /albums - - Retrieve multiple album details. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, items, providers, similarAlbums (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterBarcodeId: (query) Allows to filter the collection of resources based on barcodeId attribute value (optional) - - returns: RequestBuilder - */ - internal class func getAlbumsByFiltersWithRequestBuilder(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterBarcodeId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/albums" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - "filter[barcodeId]": (wrappedValue: filterBarcodeId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - AlbumsAPI + +class AlbumsAPI { + /// Relationship: artists + /// + /// - parameter id: (path) TIDAL album id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: AlbumsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getAlbumArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await getAlbumArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: artists + /// - GET /albums/{id}/relationships/artists + /// - Retrieve artist details of the related album. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL album id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getAlbumArtistsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/albums/{id}/relationships/artists" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get single album + /// + /// - parameter id: (path) TIDAL album id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, items, providers, similarAlbums (optional) + /// - returns: AlbumsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getAlbumById(id: String, countryCode: String, include: [String]? = nil) async throws -> AlbumsSingleDataDocument { + try await getAlbumByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body + } + + /// Get single album + /// - GET /albums/{id} + /// - Retrieve album details by TIDAL album id. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL album id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, items, providers, similarAlbums (optional) + /// - returns: RequestBuilder + class func getAlbumByIdWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/albums/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: items + /// + /// - parameter id: (path) TIDAL album id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: AlbumsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getAlbumItemsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await getAlbumItemsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: items + /// - GET /albums/{id}/relationships/items + /// - Retrieve album item details. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL album id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getAlbumItemsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/albums/{id}/relationships/items" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: providers + /// + /// - parameter id: (path) TIDAL id of the album + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// providers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: AlbumsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getAlbumProvidersRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await getAlbumProvidersRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: providers + /// - GET /albums/{id}/relationships/providers + /// - This endpoint can be used to retrieve a list of album's related providers. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the album + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// providers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getAlbumProvidersRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/albums/{id}/relationships/providers" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: similar albums + /// + /// - parameter id: (path) TIDAL id of the album + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// similarAlbums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: AlbumsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getAlbumSimilarAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await getAlbumSimilarAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: similar albums + /// - GET /albums/{id}/relationships/similarAlbums + /// - This endpoint can be used to retrieve a list of albums similar to the given album. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the album + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// similarAlbums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getAlbumSimilarAlbumsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/albums/{id}/relationships/similarAlbums" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get multiple albums + /// + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, items, providers, similarAlbums (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterBarcodeId: (query) Allows to filter the collection of resources based on barcodeId attribute value + /// (optional) + /// - returns: AlbumsMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getAlbumsByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterBarcodeId: [String]? = nil + ) async throws -> AlbumsMultiDataDocument { + try await getAlbumsByFiltersWithRequestBuilder( + countryCode: countryCode, + include: include, + filterId: filterId, + filterBarcodeId: filterBarcodeId + ).execute().body + } + + /// Get multiple albums + /// - GET /albums + /// - Retrieve multiple album details. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, items, providers, similarAlbums (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterBarcodeId: (query) Allows to filter the collection of resources based on barcodeId attribute value + /// (optional) + /// - returns: RequestBuilder + class func getAlbumsByFiltersWithRequestBuilder( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterBarcodeId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/albums" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + "filter[barcodeId]": (wrappedValue: filterBarcodeId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPITidal.swift index 737c3481..da1211a2 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/AlbumsAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - AlbumsAPITidal + /// This is a wrapper around `AlbumsAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,76 +14,111 @@ import AnyCodable /// let dataDocument = try await AlbumsAPITidal.getResource() /// ``` public enum AlbumsAPITidal { - - - /** - Relationship: artists - - - returns: AlbumsMultiDataRelationshipDocument - */ - public static func getAlbumArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - AlbumsAPI.getAlbumArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: artists + /// + /// - returns: AlbumsMultiDataRelationshipDocument + public static func getAlbumArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + AlbumsAPI.getAlbumArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get single album - - - returns: AlbumsSingleDataDocument - */ - public static func getAlbumById(id: String, countryCode: String, include: [String]? = nil) async throws -> AlbumsSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get single album + /// + /// - returns: AlbumsSingleDataDocument + public static func getAlbumById( + id: String, + countryCode: String, + include: [String]? = nil + ) async throws -> AlbumsSingleDataDocument { + try await RequestHelper.createRequest { AlbumsAPI.getAlbumByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include) } } - - /** - Relationship: items - - - returns: AlbumsMultiDataRelationshipDocument - */ - public static func getAlbumItemsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - AlbumsAPI.getAlbumItemsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: items + /// + /// - returns: AlbumsMultiDataRelationshipDocument + public static func getAlbumItemsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + AlbumsAPI.getAlbumItemsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: providers - - - returns: AlbumsMultiDataRelationshipDocument - */ - public static func getAlbumProvidersRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - AlbumsAPI.getAlbumProvidersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: providers + /// + /// - returns: AlbumsMultiDataRelationshipDocument + public static func getAlbumProvidersRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + AlbumsAPI.getAlbumProvidersRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: similar albums - - - returns: AlbumsMultiDataRelationshipDocument - */ - public static func getAlbumSimilarAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> AlbumsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - AlbumsAPI.getAlbumSimilarAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: similar albums + /// + /// - returns: AlbumsMultiDataRelationshipDocument + public static func getAlbumSimilarAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> AlbumsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + AlbumsAPI.getAlbumSimilarAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get multiple albums - - - returns: AlbumsMultiDataDocument - */ - public static func getAlbumsByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterBarcodeId: [String]? = nil) async throws -> AlbumsMultiDataDocument { - return try await RequestHelper.createRequest { - AlbumsAPI.getAlbumsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId, filterBarcodeId: filterBarcodeId) + /// Get multiple albums + /// + /// - returns: AlbumsMultiDataDocument + public static func getAlbumsByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterBarcodeId: [String]? = nil + ) async throws -> AlbumsMultiDataDocument { + try await RequestHelper.createRequest { + AlbumsAPI.getAlbumsByFiltersWithRequestBuilder( + countryCode: countryCode, + include: include, + filterId: filterId, + filterBarcodeId: filterBarcodeId + ) } } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPI.swift index a3b102c3..553eb055 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPI.swift @@ -1,470 +1,630 @@ -// -// ArtistsAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class ArtistsAPI { - - /** - Relationship: albums - - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: ArtistsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await getArtistAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: albums - - GET /artists/{id}/relationships/albums - - Retrieve album details of the related artist. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getArtistAlbumsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/artists/{id}/relationships/albums" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get single artist - - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums, tracks, videos, similarArtists, trackProviders, radio (optional) - - returns: ArtistsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistById(id: String, countryCode: String, include: [String]? = nil) async throws -> ArtistsSingleDataDocument { - return try await getArtistByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body - } - - /** - Get single artist - - GET /artists/{id} - - Retrieve artist details by TIDAL artist id. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums, tracks, videos, similarArtists, trackProviders, radio (optional) - - returns: RequestBuilder - */ - internal class func getArtistByIdWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/artists/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: radio - - - parameter id: (path) TIDAL id of the artist - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: radio (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: ArtistsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistRadioRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await getArtistRadioRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: radio - - GET /artists/{id}/relationships/radio - - This endpoint can be used to retrieve a list of radios for the given artist. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the artist - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: radio (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getArtistRadioRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/artists/{id}/relationships/radio" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: similar artists - - - parameter id: (path) TIDAL id of the artist - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: similarArtists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: ArtistsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistSimilarArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await getArtistSimilarArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: similar artists - - GET /artists/{id}/relationships/similarArtists - - This endpoint can be used to retrieve a list of artists similar to the given artist. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the artist - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: similarArtists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getArtistSimilarArtistsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/artists/{id}/relationships/similarArtists" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: track providers - - - parameter id: (path) TIDAL id of the artist - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: trackProviders (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: ArtistsTrackProvidersMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistTrackProvidersRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsTrackProvidersMultiDataRelationshipDocument { - return try await getArtistTrackProvidersRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: track providers - - GET /artists/{id}/relationships/trackProviders - - Retrieve providers that have released tracks for this artist - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the artist - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: trackProviders (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getArtistTrackProvidersRelationshipWithRequestBuilder(id: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/artists/{id}/relationships/trackProviders" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - * enum for parameter collapseBy - */ - public enum CollapseBy_getArtistTracksRelationship: String, CaseIterable { - case fingerprint = "FINGERPRINT" - case _none = "NONE" - } - - /** - Relationship: tracks - - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter collapseBy: (query) Collapse by options for getting artist tracks. Available options: FINGERPRINT, ID. FINGERPRINT option might collapse similar tracks based item fingerprints while collapsing by ID always returns all available items. (optional, default to .fingerprint) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: tracks (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: ArtistsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistTracksRelationship(id: String, countryCode: String, collapseBy: CollapseBy_getArtistTracksRelationship? = nil, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await getArtistTracksRelationshipWithRequestBuilder(id: id, countryCode: countryCode, collapseBy: collapseBy, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: tracks - - GET /artists/{id}/relationships/tracks - - Retrieve track details by related artist. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter collapseBy: (query) Collapse by options for getting artist tracks. Available options: FINGERPRINT, ID. FINGERPRINT option might collapse similar tracks based item fingerprints while collapsing by ID always returns all available items. (optional, default to .fingerprint) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: tracks (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getArtistTracksRelationshipWithRequestBuilder(id: String, countryCode: String, collapseBy: CollapseBy_getArtistTracksRelationship? = nil, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/artists/{id}/relationships/tracks" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "collapseBy": (wrappedValue: collapseBy?.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: videos - - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: videos (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: ArtistsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistVideosRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await getArtistVideosRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: videos - - GET /artists/{id}/relationships/videos - - Retrieve video details by related artist. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL artist id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: videos (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getArtistVideosRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/artists/{id}/relationships/videos" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get multiple artists - - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums, tracks, videos, similarArtists, trackProviders, radio (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - returns: ArtistsMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getArtistsByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil) async throws -> ArtistsMultiDataDocument { - return try await getArtistsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId).execute().body - } - - /** - Get multiple artists - - GET /artists - - Retrieve multiple artist details. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums, tracks, videos, similarArtists, trackProviders, radio (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - returns: RequestBuilder - */ - internal class func getArtistsByFiltersWithRequestBuilder(countryCode: String, include: [String]? = nil, filterId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/artists" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - ArtistsAPI + +class ArtistsAPI { + /// Relationship: albums + /// + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: ArtistsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await getArtistAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: albums + /// - GET /artists/{id}/relationships/albums + /// - Retrieve album details of the related artist. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getArtistAlbumsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/artists/{id}/relationships/albums" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get single artist + /// + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums, tracks, videos, similarArtists, trackProviders, radio (optional) + /// - returns: ArtistsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistById( + id: String, + countryCode: String, + include: [String]? = nil + ) async throws -> ArtistsSingleDataDocument { + try await getArtistByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body + } + + /// Get single artist + /// - GET /artists/{id} + /// - Retrieve artist details by TIDAL artist id. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums, tracks, videos, similarArtists, trackProviders, radio (optional) + /// - returns: RequestBuilder + class func getArtistByIdWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/artists/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: radio + /// + /// - parameter id: (path) TIDAL id of the artist + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// radio (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: ArtistsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistRadioRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await getArtistRadioRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: radio + /// - GET /artists/{id}/relationships/radio + /// - This endpoint can be used to retrieve a list of radios for the given artist. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the artist + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// radio (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getArtistRadioRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/artists/{id}/relationships/radio" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: similar artists + /// + /// - parameter id: (path) TIDAL id of the artist + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// similarArtists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: ArtistsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistSimilarArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await getArtistSimilarArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: similar artists + /// - GET /artists/{id}/relationships/similarArtists + /// - This endpoint can be used to retrieve a list of artists similar to the given artist. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the artist + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// similarArtists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getArtistSimilarArtistsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/artists/{id}/relationships/similarArtists" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: track providers + /// + /// - parameter id: (path) TIDAL id of the artist + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// trackProviders (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: ArtistsTrackProvidersMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistTrackProvidersRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsTrackProvidersMultiDataRelationshipDocument { + try await getArtistTrackProvidersRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + .execute().body + } + + /// Relationship: track providers + /// - GET /artists/{id}/relationships/trackProviders + /// - Retrieve providers that have released tracks for this artist + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the artist + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// trackProviders (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getArtistTrackProvidersRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/artists/{id}/relationships/trackProviders" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder + .Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// enum for parameter collapseBy + public enum CollapseBy_getArtistTracksRelationship: String, CaseIterable { + case fingerprint = "FINGERPRINT" + case _none = "NONE" + } + + /// Relationship: tracks + /// + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter collapseBy: (query) Collapse by options for getting artist tracks. Available options: FINGERPRINT, ID. + /// FINGERPRINT option might collapse similar tracks based item fingerprints while collapsing by ID always returns all available + /// items. (optional, default to .fingerprint) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// tracks (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: ArtistsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistTracksRelationship( + id: String, + countryCode: String, + collapseBy: CollapseBy_getArtistTracksRelationship? = nil, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await getArtistTracksRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + collapseBy: collapseBy, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: tracks + /// - GET /artists/{id}/relationships/tracks + /// - Retrieve track details by related artist. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter collapseBy: (query) Collapse by options for getting artist tracks. Available options: FINGERPRINT, ID. + /// FINGERPRINT option might collapse similar tracks based item fingerprints while collapsing by ID always returns all available + /// items. (optional, default to .fingerprint) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// tracks (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getArtistTracksRelationshipWithRequestBuilder( + id: String, + countryCode: String, + collapseBy: CollapseBy_getArtistTracksRelationship? = nil, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/artists/{id}/relationships/tracks" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "collapseBy": (wrappedValue: collapseBy?.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: videos + /// + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// videos (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: ArtistsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistVideosRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await getArtistVideosRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: videos + /// - GET /artists/{id}/relationships/videos + /// - Retrieve video details by related artist. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL artist id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// videos (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getArtistVideosRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/artists/{id}/relationships/videos" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get multiple artists + /// + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums, tracks, videos, similarArtists, trackProviders, radio (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - returns: ArtistsMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getArtistsByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> ArtistsMultiDataDocument { + try await getArtistsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId).execute() + .body + } + + /// Get multiple artists + /// - GET /artists + /// - Retrieve multiple artist details. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums, tracks, videos, similarArtists, trackProviders, radio (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - returns: RequestBuilder + class func getArtistsByFiltersWithRequestBuilder( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/artists" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPITidal.swift index ec693f22..965833d0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ArtistsAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - ArtistsAPITidal + /// This is a wrapper around `ArtistsAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,114 +14,151 @@ import AnyCodable /// let dataDocument = try await ArtistsAPITidal.getResource() /// ``` public enum ArtistsAPITidal { - - - /** - Relationship: albums - - - returns: ArtistsMultiDataRelationshipDocument - */ - public static func getArtistAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - ArtistsAPI.getArtistAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: albums + /// + /// - returns: ArtistsMultiDataRelationshipDocument + public static func getArtistAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + ArtistsAPI.getArtistAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get single artist - - - returns: ArtistsSingleDataDocument - */ - public static func getArtistById(id: String, countryCode: String, include: [String]? = nil) async throws -> ArtistsSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get single artist + /// + /// - returns: ArtistsSingleDataDocument + public static func getArtistById( + id: String, + countryCode: String, + include: [String]? = nil + ) async throws -> ArtistsSingleDataDocument { + try await RequestHelper.createRequest { ArtistsAPI.getArtistByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include) } } - - /** - Relationship: radio - - - returns: ArtistsMultiDataRelationshipDocument - */ - public static func getArtistRadioRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - ArtistsAPI.getArtistRadioRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: radio + /// + /// - returns: ArtistsMultiDataRelationshipDocument + public static func getArtistRadioRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + ArtistsAPI.getArtistRadioRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: similar artists - - - returns: ArtistsMultiDataRelationshipDocument - */ - public static func getArtistSimilarArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - ArtistsAPI.getArtistSimilarArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: similar artists + /// + /// - returns: ArtistsMultiDataRelationshipDocument + public static func getArtistSimilarArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + ArtistsAPI.getArtistSimilarArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: track providers - - - returns: ArtistsTrackProvidersMultiDataRelationshipDocument - */ - public static func getArtistTrackProvidersRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsTrackProvidersMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: track providers + /// + /// - returns: ArtistsTrackProvidersMultiDataRelationshipDocument + public static func getArtistTrackProvidersRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsTrackProvidersMultiDataRelationshipDocument { + try await RequestHelper.createRequest { ArtistsAPI.getArtistTrackProvidersRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) } } - - /** - * enum for parameter collapseBy - */ + /// enum for parameter collapseBy public enum CollapseBy_getArtistTracksRelationship: String, CaseIterable { case fingerprint = "FINGERPRINT" case _none = "NONE" func toArtistsAPIEnum() -> ArtistsAPI.CollapseBy_getArtistTracksRelationship { switch self { - case .fingerprint: return .fingerprint - case ._none: return ._none + case .fingerprint: .fingerprint + case ._none: ._none } } } - /** - Relationship: tracks - - - returns: ArtistsMultiDataRelationshipDocument - */ - public static func getArtistTracksRelationship(id: String, countryCode: String, collapseBy: ArtistsAPITidal.CollapseBy_getArtistTracksRelationship? = nil, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - ArtistsAPI.getArtistTracksRelationshipWithRequestBuilder(id: id, countryCode: countryCode, collapseBy: collapseBy?.toArtistsAPIEnum(), include: include, pageCursor: pageCursor) + /// Relationship: tracks + /// + /// - returns: ArtistsMultiDataRelationshipDocument + public static func getArtistTracksRelationship( + id: String, + countryCode: String, + collapseBy: ArtistsAPITidal.CollapseBy_getArtistTracksRelationship? = nil, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + ArtistsAPI.getArtistTracksRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + collapseBy: collapseBy?.toArtistsAPIEnum(), + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: videos - - - returns: ArtistsMultiDataRelationshipDocument - */ - public static func getArtistVideosRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> ArtistsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - ArtistsAPI.getArtistVideosRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: videos + /// + /// - returns: ArtistsMultiDataRelationshipDocument + public static func getArtistVideosRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> ArtistsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + ArtistsAPI.getArtistVideosRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get multiple artists - - - returns: ArtistsMultiDataDocument - */ - public static func getArtistsByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil) async throws -> ArtistsMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get multiple artists + /// + /// - returns: ArtistsMultiDataDocument + public static func getArtistsByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> ArtistsMultiDataDocument { + try await RequestHelper.createRequest { ArtistsAPI.getArtistsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId) } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPI.swift index 17b39f54..4a509096 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPI.swift @@ -1,280 +1,352 @@ -// -// PlaylistsAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class PlaylistsAPI { - - /** - Get current user's playlists - - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items, owners (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: PlaylistsMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getMyPlaylists(include: [String]? = nil, pageCursor: String? = nil) async throws -> PlaylistsMultiDataDocument { - return try await getMyPlaylistsWithRequestBuilder(include: include, pageCursor: pageCursor).execute().body - } - - /** - Get current user's playlists - - GET /playlists/me - - Get my playlists - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items, owners (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getMyPlaylistsWithRequestBuilder(include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - let localVariablePath = "/playlists/me" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get single playlist - - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter id: (path) TIDAL playlist id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items, owners (optional) - - returns: PlaylistsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getPlaylistById(countryCode: String, id: String, include: [String]? = nil) async throws -> PlaylistsSingleDataDocument { - return try await getPlaylistByIdWithRequestBuilder(countryCode: countryCode, id: id, include: include).execute().body - } - - /** - Get single playlist - - GET /playlists/{id} - - Get playlist by id - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter id: (path) TIDAL playlist id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items, owners (optional) - - returns: RequestBuilder - */ - internal class func getPlaylistByIdWithRequestBuilder(countryCode: String, id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/playlists/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: items - - - parameter id: (path) TIDAL playlist id - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: PlaylistsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getPlaylistItemsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> PlaylistsMultiDataRelationshipDocument { - return try await getPlaylistItemsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: items - - GET /playlists/{id}/relationships/items - - Get playlist items - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL playlist id - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getPlaylistItemsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/playlists/{id}/relationships/items" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: owner - - - parameter id: (path) TIDAL playlist id - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: owners (optional) - - returns: PlaylistsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getPlaylistOwnersRelationship(id: String, countryCode: String, include: [String]? = nil) async throws -> PlaylistsMultiDataRelationshipDocument { - return try await getPlaylistOwnersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body - } - - /** - Relationship: owner - - GET /playlists/{id}/relationships/owners - - Get playlist owner - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL playlist id - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: owners (optional) - - returns: RequestBuilder - */ - internal class func getPlaylistOwnersRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/playlists/{id}/relationships/owners" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get multiple playlists - - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items, owners (optional) - - parameter filterId: (query) public.usercontent.getPlaylists.ids.descr (optional) - - returns: PlaylistsMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getPlaylistsByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil) async throws -> PlaylistsMultiDataDocument { - return try await getPlaylistsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId).execute().body - } - - /** - Get multiple playlists - - GET /playlists - - Get user playlists - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: items, owners (optional) - - parameter filterId: (query) public.usercontent.getPlaylists.ids.descr (optional) - - returns: RequestBuilder - */ - internal class func getPlaylistsByFiltersWithRequestBuilder(countryCode: String, include: [String]? = nil, filterId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/playlists" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - PlaylistsAPI + +class PlaylistsAPI { + /// Get current user's playlists + /// + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items, owners (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: PlaylistsMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getMyPlaylists(include: [String]? = nil, pageCursor: String? = nil) async throws -> PlaylistsMultiDataDocument { + try await getMyPlaylistsWithRequestBuilder(include: include, pageCursor: pageCursor).execute().body + } + + /// Get current user's playlists + /// - GET /playlists/me + /// - Get my playlists + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items, owners (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getMyPlaylistsWithRequestBuilder( + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + let localVariablePath = "/playlists/me" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get single playlist + /// + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter id: (path) TIDAL playlist id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items, owners (optional) + /// - returns: PlaylistsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getPlaylistById( + countryCode: String, + id: String, + include: [String]? = nil + ) async throws -> PlaylistsSingleDataDocument { + try await getPlaylistByIdWithRequestBuilder(countryCode: countryCode, id: id, include: include).execute().body + } + + /// Get single playlist + /// - GET /playlists/{id} + /// - Get playlist by id + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter id: (path) TIDAL playlist id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items, owners (optional) + /// - returns: RequestBuilder + class func getPlaylistByIdWithRequestBuilder( + countryCode: String, + id: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/playlists/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: items + /// + /// - parameter id: (path) TIDAL playlist id + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: PlaylistsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getPlaylistItemsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> PlaylistsMultiDataRelationshipDocument { + try await getPlaylistItemsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: items + /// - GET /playlists/{id}/relationships/items + /// - Get playlist items + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL playlist id + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getPlaylistItemsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/playlists/{id}/relationships/items" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: owner + /// + /// - parameter id: (path) TIDAL playlist id + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// owners (optional) + /// - returns: PlaylistsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getPlaylistOwnersRelationship( + id: String, + countryCode: String, + include: [String]? = nil + ) async throws -> PlaylistsMultiDataRelationshipDocument { + try await getPlaylistOwnersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute() + .body + } + + /// Relationship: owner + /// - GET /playlists/{id}/relationships/owners + /// - Get playlist owner + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL playlist id + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// owners (optional) + /// - returns: RequestBuilder + class func getPlaylistOwnersRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/playlists/{id}/relationships/owners" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get multiple playlists + /// + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items, owners (optional) + /// - parameter filterId: (query) public.usercontent.getPlaylists.ids.descr (optional) + /// - returns: PlaylistsMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getPlaylistsByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> PlaylistsMultiDataDocument { + try await getPlaylistsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId) + .execute().body + } + + /// Get multiple playlists + /// - GET /playlists + /// - Get user playlists + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter countryCode: (query) Country code (ISO 3166-1 alpha-2) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// items, owners (optional) + /// - parameter filterId: (query) public.usercontent.getPlaylists.ids.descr (optional) + /// - returns: RequestBuilder + class func getPlaylistsByFiltersWithRequestBuilder( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/playlists" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPITidal.swift index e384b85b..13463e55 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/PlaylistsAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - PlaylistsAPITidal + /// This is a wrapper around `PlaylistsAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,63 +14,72 @@ import AnyCodable /// let dataDocument = try await PlaylistsAPITidal.getResource() /// ``` public enum PlaylistsAPITidal { - - - /** - Get current user's playlists - - - returns: PlaylistsMultiDataDocument - */ - public static func getMyPlaylists(include: [String]? = nil, pageCursor: String? = nil) async throws -> PlaylistsMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get current user's playlists + /// + /// - returns: PlaylistsMultiDataDocument + public static func getMyPlaylists( + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> PlaylistsMultiDataDocument { + try await RequestHelper.createRequest { PlaylistsAPI.getMyPlaylistsWithRequestBuilder(include: include, pageCursor: pageCursor) } } - - /** - Get single playlist - - - returns: PlaylistsSingleDataDocument - */ - public static func getPlaylistById(countryCode: String, id: String, include: [String]? = nil) async throws -> PlaylistsSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get single playlist + /// + /// - returns: PlaylistsSingleDataDocument + public static func getPlaylistById( + countryCode: String, + id: String, + include: [String]? = nil + ) async throws -> PlaylistsSingleDataDocument { + try await RequestHelper.createRequest { PlaylistsAPI.getPlaylistByIdWithRequestBuilder(countryCode: countryCode, id: id, include: include) } } - - /** - Relationship: items - - - returns: PlaylistsMultiDataRelationshipDocument - */ - public static func getPlaylistItemsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> PlaylistsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - PlaylistsAPI.getPlaylistItemsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: items + /// + /// - returns: PlaylistsMultiDataRelationshipDocument + public static func getPlaylistItemsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> PlaylistsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + PlaylistsAPI.getPlaylistItemsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: owner - - - returns: PlaylistsMultiDataRelationshipDocument - */ - public static func getPlaylistOwnersRelationship(id: String, countryCode: String, include: [String]? = nil) async throws -> PlaylistsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: owner + /// + /// - returns: PlaylistsMultiDataRelationshipDocument + public static func getPlaylistOwnersRelationship( + id: String, + countryCode: String, + include: [String]? = nil + ) async throws -> PlaylistsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { PlaylistsAPI.getPlaylistOwnersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include) } } - - /** - Get multiple playlists - - - returns: PlaylistsMultiDataDocument - */ - public static func getPlaylistsByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil) async throws -> PlaylistsMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get multiple playlists + /// + /// - returns: PlaylistsMultiDataDocument + public static func getPlaylistsByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> PlaylistsMultiDataDocument { + try await RequestHelper.createRequest { PlaylistsAPI.getPlaylistsByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId) } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPI.swift index 6cf24cc5..3c0379ab 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPI.swift @@ -1,114 +1,125 @@ -// -// ProvidersAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class ProvidersAPI { - - /** - Get single provider - - - parameter id: (path) TIDAL provider id - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: ProvidersSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getProviderById(id: String, include: [String]? = nil) async throws -> ProvidersSingleDataDocument { - return try await getProviderByIdWithRequestBuilder(id: id, include: include).execute().body - } - - /** - Get single provider - - GET /providers/{id} - - Retrieve provider details by TIDAL provider id. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL provider id - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: RequestBuilder - */ - internal class func getProviderByIdWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/providers/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get multiple providers - - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - parameter filterId: (query) provider id (optional) - - returns: ProvidersMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getProvidersByFilters(include: [String]? = nil, filterId: [String]? = nil) async throws -> ProvidersMultiDataDocument { - return try await getProvidersByFiltersWithRequestBuilder(include: include, filterId: filterId).execute().body - } - - /** - Get multiple providers - - GET /providers - - Retrieve multiple provider details. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - parameter filterId: (query) provider id (optional) - - returns: RequestBuilder - */ - internal class func getProvidersByFiltersWithRequestBuilder(include: [String]? = nil, filterId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/providers" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - ProvidersAPI + +class ProvidersAPI { + /// Get single provider + /// + /// - parameter id: (path) TIDAL provider id + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: ProvidersSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getProviderById(id: String, include: [String]? = nil) async throws -> ProvidersSingleDataDocument { + try await getProviderByIdWithRequestBuilder(id: id, include: include).execute().body + } + + /// Get single provider + /// - GET /providers/{id} + /// - Retrieve provider details by TIDAL provider id. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL provider id + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: RequestBuilder + class func getProviderByIdWithRequestBuilder( + id: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/providers/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get multiple providers + /// + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - parameter filterId: (query) provider id (optional) + /// - returns: ProvidersMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getProvidersByFilters( + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> ProvidersMultiDataDocument { + try await getProvidersByFiltersWithRequestBuilder(include: include, filterId: filterId).execute().body + } + + /// Get multiple providers + /// - GET /providers + /// - Retrieve multiple provider details. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - parameter filterId: (query) provider id (optional) + /// - returns: RequestBuilder + class func getProvidersByFiltersWithRequestBuilder( + include: [String]? = nil, + filterId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/providers" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPITidal.swift index 97cb636b..52de5e87 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/ProvidersAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - ProvidersAPITidal + /// This is a wrapper around `ProvidersAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,27 +14,23 @@ import AnyCodable /// let dataDocument = try await ProvidersAPITidal.getResource() /// ``` public enum ProvidersAPITidal { - - - /** - Get single provider - - - returns: ProvidersSingleDataDocument - */ + /// Get single provider + /// + /// - returns: ProvidersSingleDataDocument public static func getProviderById(id: String, include: [String]? = nil) async throws -> ProvidersSingleDataDocument { - return try await RequestHelper.createRequest { + try await RequestHelper.createRequest { ProvidersAPI.getProviderByIdWithRequestBuilder(id: id, include: include) } } - - /** - Get multiple providers - - - returns: ProvidersMultiDataDocument - */ - public static func getProvidersByFilters(include: [String]? = nil, filterId: [String]? = nil) async throws -> ProvidersMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get multiple providers + /// + /// - returns: ProvidersMultiDataDocument + public static func getProvidersByFilters( + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> ProvidersMultiDataDocument { + try await RequestHelper.createRequest { ProvidersAPI.getProvidersByFiltersWithRequestBuilder(include: include, filterId: filterId) } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPI.swift index 10ff6a70..b631edf4 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPI.swift @@ -1,410 +1,592 @@ -// -// SearchResultsAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class SearchResultsAPI { - - /** - Relationship: albums - - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: SearchresultsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getSearchResultsAlbumsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await getSearchResultsAlbumsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: albums - - GET /searchresults/{query}/relationships/albums - - Search for albums by a query. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getSearchResultsAlbumsRelationshipWithRequestBuilder(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/searchresults/{query}/relationships/albums" - let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" - let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{query}", with: queryPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: artists - - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: SearchresultsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getSearchResultsArtistsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await getSearchResultsArtistsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: artists - - GET /searchresults/{query}/relationships/artists - - Search for artists by a query. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getSearchResultsArtistsRelationshipWithRequestBuilder(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/searchresults/{query}/relationships/artists" - let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" - let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{query}", with: queryPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Search for music metadata by a query - - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, tracks, videos, playlists, topHits (optional) - - returns: SearchresultsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getSearchResultsByQuery(query: String, countryCode: String, include: [String]? = nil) async throws -> SearchresultsSingleDataDocument { - return try await getSearchResultsByQueryWithRequestBuilder(query: query, countryCode: countryCode, include: include).execute().body - } - - /** - Search for music metadata by a query - - GET /searchresults/{query} - - Search for music: albums, artists, tracks, etc. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, tracks, videos, playlists, topHits (optional) - - returns: RequestBuilder - */ - internal class func getSearchResultsByQueryWithRequestBuilder(query: String, countryCode: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/searchresults/{query}" - let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" - let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{query}", with: queryPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: playlists - - - parameter query: (path) Searh query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: playlists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: SearchresultsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getSearchResultsPlaylistsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await getSearchResultsPlaylistsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: playlists - - GET /searchresults/{query}/relationships/playlists - - Search for playlists by a query. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter query: (path) Searh query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: playlists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getSearchResultsPlaylistsRelationshipWithRequestBuilder(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/searchresults/{query}/relationships/playlists" - let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" - let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{query}", with: queryPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: topHits - - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: topHits (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: SearchresultsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getSearchResultsTopHitsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await getSearchResultsTopHitsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: topHits - - GET /searchresults/{query}/relationships/topHits - - Search for top hits by a query: artists, albums, tracks, videos. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: topHits (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getSearchResultsTopHitsRelationshipWithRequestBuilder(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/searchresults/{query}/relationships/topHits" - let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" - let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{query}", with: queryPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: tracks - - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: tracks (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: SearchresultsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getSearchResultsTracksRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await getSearchResultsTracksRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: tracks - - GET /searchresults/{query}/relationships/tracks - - Search for tracks by a query. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: tracks (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getSearchResultsTracksRelationshipWithRequestBuilder(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/searchresults/{query}/relationships/tracks" - let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" - let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{query}", with: queryPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: videos - - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: videos (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: SearchresultsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getSearchResultsVideosRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await getSearchResultsVideosRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: videos - - GET /searchresults/{query}/relationships/videos - - Search for videos by a query. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter query: (path) Search query - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: videos (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getSearchResultsVideosRelationshipWithRequestBuilder(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/searchresults/{query}/relationships/videos" - let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" - let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{query}", with: queryPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - SearchResultsAPI + +class SearchResultsAPI { + /// Relationship: albums + /// + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: SearchresultsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getSearchResultsAlbumsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await getSearchResultsAlbumsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: albums + /// - GET /searchresults/{query}/relationships/albums + /// - Search for albums by a query. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getSearchResultsAlbumsRelationshipWithRequestBuilder( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/searchresults/{query}/relationships/albums" + let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" + let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences( + of: "{query}", + with: queryPostEscape, + options: .literal, + range: nil + ) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: artists + /// + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: SearchresultsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getSearchResultsArtistsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await getSearchResultsArtistsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: artists + /// - GET /searchresults/{query}/relationships/artists + /// - Search for artists by a query. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getSearchResultsArtistsRelationshipWithRequestBuilder( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/searchresults/{query}/relationships/artists" + let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" + let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences( + of: "{query}", + with: queryPostEscape, + options: .literal, + range: nil + ) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Search for music metadata by a query + /// + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, tracks, videos, playlists, topHits (optional) + /// - returns: SearchresultsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getSearchResultsByQuery( + query: String, + countryCode: String, + include: [String]? = nil + ) async throws -> SearchresultsSingleDataDocument { + try await getSearchResultsByQueryWithRequestBuilder(query: query, countryCode: countryCode, include: include).execute() + .body + } + + /// Search for music metadata by a query + /// - GET /searchresults/{query} + /// - Search for music: albums, artists, tracks, etc. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, tracks, videos, playlists, topHits (optional) + /// - returns: RequestBuilder + class func getSearchResultsByQueryWithRequestBuilder( + query: String, + countryCode: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/searchresults/{query}" + let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" + let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences( + of: "{query}", + with: queryPostEscape, + options: .literal, + range: nil + ) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: playlists + /// + /// - parameter query: (path) Searh query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// playlists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: SearchresultsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getSearchResultsPlaylistsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await getSearchResultsPlaylistsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: playlists + /// - GET /searchresults/{query}/relationships/playlists + /// - Search for playlists by a query. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter query: (path) Searh query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// playlists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getSearchResultsPlaylistsRelationshipWithRequestBuilder( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/searchresults/{query}/relationships/playlists" + let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" + let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences( + of: "{query}", + with: queryPostEscape, + options: .literal, + range: nil + ) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: topHits + /// + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// topHits (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: SearchresultsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getSearchResultsTopHitsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await getSearchResultsTopHitsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: topHits + /// - GET /searchresults/{query}/relationships/topHits + /// - Search for top hits by a query: artists, albums, tracks, videos. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// topHits (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getSearchResultsTopHitsRelationshipWithRequestBuilder( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/searchresults/{query}/relationships/topHits" + let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" + let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences( + of: "{query}", + with: queryPostEscape, + options: .literal, + range: nil + ) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: tracks + /// + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// tracks (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: SearchresultsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getSearchResultsTracksRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await getSearchResultsTracksRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: tracks + /// - GET /searchresults/{query}/relationships/tracks + /// - Search for tracks by a query. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// tracks (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getSearchResultsTracksRelationshipWithRequestBuilder( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/searchresults/{query}/relationships/tracks" + let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" + let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences( + of: "{query}", + with: queryPostEscape, + options: .literal, + range: nil + ) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: videos + /// + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// videos (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: SearchresultsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getSearchResultsVideosRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await getSearchResultsVideosRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: videos + /// - GET /searchresults/{query}/relationships/videos + /// - Search for videos by a query. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter query: (path) Search query + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// videos (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getSearchResultsVideosRelationshipWithRequestBuilder( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/searchresults/{query}/relationships/videos" + let queryPreEscape = "\(APIHelper.mapValueToPathItem(query))" + let queryPostEscape = queryPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences( + of: "{query}", + with: queryPostEscape, + options: .literal, + range: nil + ) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPITidal.swift index 2b1e0520..1779e60c 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/SearchResultsAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - SearchResultsAPITidal + /// This is a wrapper around `SearchResultsAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,88 +14,130 @@ import AnyCodable /// let dataDocument = try await SearchResultsAPITidal.getResource() /// ``` public enum SearchResultsAPITidal { - - - /** - Relationship: albums - - - returns: SearchresultsMultiDataRelationshipDocument - */ - public static func getSearchResultsAlbumsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - SearchResultsAPI.getSearchResultsAlbumsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: albums + /// + /// - returns: SearchresultsMultiDataRelationshipDocument + public static func getSearchResultsAlbumsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + SearchResultsAPI.getSearchResultsAlbumsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: artists - - - returns: SearchresultsMultiDataRelationshipDocument - */ - public static func getSearchResultsArtistsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - SearchResultsAPI.getSearchResultsArtistsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: artists + /// + /// - returns: SearchresultsMultiDataRelationshipDocument + public static func getSearchResultsArtistsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + SearchResultsAPI.getSearchResultsArtistsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Search for music metadata by a query - - - returns: SearchresultsSingleDataDocument - */ - public static func getSearchResultsByQuery(query: String, countryCode: String, include: [String]? = nil) async throws -> SearchresultsSingleDataDocument { - return try await RequestHelper.createRequest { + /// Search for music metadata by a query + /// + /// - returns: SearchresultsSingleDataDocument + public static func getSearchResultsByQuery( + query: String, + countryCode: String, + include: [String]? = nil + ) async throws -> SearchresultsSingleDataDocument { + try await RequestHelper.createRequest { SearchResultsAPI.getSearchResultsByQueryWithRequestBuilder(query: query, countryCode: countryCode, include: include) } } - - /** - Relationship: playlists - - - returns: SearchresultsMultiDataRelationshipDocument - */ - public static func getSearchResultsPlaylistsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - SearchResultsAPI.getSearchResultsPlaylistsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: playlists + /// + /// - returns: SearchresultsMultiDataRelationshipDocument + public static func getSearchResultsPlaylistsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + SearchResultsAPI.getSearchResultsPlaylistsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: topHits - - - returns: SearchresultsMultiDataRelationshipDocument - */ - public static func getSearchResultsTopHitsRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - SearchResultsAPI.getSearchResultsTopHitsRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: topHits + /// + /// - returns: SearchresultsMultiDataRelationshipDocument + public static func getSearchResultsTopHitsRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + SearchResultsAPI.getSearchResultsTopHitsRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: tracks - - - returns: SearchresultsMultiDataRelationshipDocument - */ - public static func getSearchResultsTracksRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - SearchResultsAPI.getSearchResultsTracksRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: tracks + /// + /// - returns: SearchresultsMultiDataRelationshipDocument + public static func getSearchResultsTracksRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + SearchResultsAPI.getSearchResultsTracksRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: videos - - - returns: SearchresultsMultiDataRelationshipDocument - */ - public static func getSearchResultsVideosRelationship(query: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> SearchresultsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - SearchResultsAPI.getSearchResultsVideosRelationshipWithRequestBuilder(query: query, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: videos + /// + /// - returns: SearchresultsMultiDataRelationshipDocument + public static func getSearchResultsVideosRelationship( + query: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> SearchresultsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + SearchResultsAPI.getSearchResultsVideosRelationshipWithRequestBuilder( + query: query, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPI.swift index c2cc50bd..15e20b64 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPI.swift @@ -1,408 +1,548 @@ -// -// TracksAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class TracksAPI { - - /** - Relationship: albums - - - parameter id: (path) TIDAL track id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: TracksMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getTrackAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await getTrackAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: albums - - GET /tracks/{id}/relationships/albums - - Retrieve album details of the related track. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL track id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getTrackAlbumsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/tracks/{id}/relationships/albums" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: artists - - - parameter id: (path) TIDAL track id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: TracksMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getTrackArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await getTrackArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: artists - - GET /tracks/{id}/relationships/artists - - Retrieve artist details of the related track. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL track id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getTrackArtistsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/tracks/{id}/relationships/artists" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get single track - - - parameter id: (path) TIDAL track id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers, similarTracks, radio (optional) - - returns: TracksSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getTrackById(id: String, countryCode: String, include: [String]? = nil) async throws -> TracksSingleDataDocument { - return try await getTrackByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body - } - - /** - Get single track - - GET /tracks/{id} - - Retrieve track details by TIDAL track id. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL track id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers, similarTracks, radio (optional) - - returns: RequestBuilder - */ - internal class func getTrackByIdWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/tracks/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: providers - - - parameter id: (path) TIDAL id of the track - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: providers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: TracksMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getTrackProvidersRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await getTrackProvidersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: providers - - GET /tracks/{id}/relationships/providers - - This endpoint can be used to retrieve a list of track's related providers. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the track - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: providers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getTrackProvidersRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/tracks/{id}/relationships/providers" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: radio - - - parameter id: (path) TIDAL id of the track - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: radio (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: TracksMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getTrackRadioRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await getTrackRadioRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: radio - - GET /tracks/{id}/relationships/radio - - This endpoint can be used to retrieve a list of radios for the given track. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the track - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: radio (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getTrackRadioRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/tracks/{id}/relationships/radio" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: similar tracks - - - parameter id: (path) TIDAL id of the track - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: similarTracks (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: TracksMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getTrackSimilarTracksRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await getTrackSimilarTracksRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: similar tracks - - GET /tracks/{id}/relationships/similarTracks - - This endpoint can be used to retrieve a list of tracks similar to the given track. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the track - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: similarTracks (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getTrackSimilarTracksRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/tracks/{id}/relationships/similarTracks" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get multiple tracks - - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers, similarTracks, radio (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) - - returns: TracksMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getTracksByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterIsrc: [String]? = nil) async throws -> TracksMultiDataDocument { - return try await getTracksByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId, filterIsrc: filterIsrc).execute().body - } - - /** - Get multiple tracks - - GET /tracks - - Retrieve multiple track details. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers, similarTracks, radio (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) - - returns: RequestBuilder - */ - internal class func getTracksByFiltersWithRequestBuilder(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterIsrc: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/tracks" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - "filter[isrc]": (wrappedValue: filterIsrc?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - TracksAPI + +class TracksAPI { + /// Relationship: albums + /// + /// - parameter id: (path) TIDAL track id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: TracksMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getTrackAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await getTrackAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: albums + /// - GET /tracks/{id}/relationships/albums + /// - Retrieve album details of the related track. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL track id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getTrackAlbumsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/tracks/{id}/relationships/albums" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: artists + /// + /// - parameter id: (path) TIDAL track id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: TracksMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getTrackArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await getTrackArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: artists + /// - GET /tracks/{id}/relationships/artists + /// - Retrieve artist details of the related track. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL track id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getTrackArtistsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/tracks/{id}/relationships/artists" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get single track + /// + /// - parameter id: (path) TIDAL track id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers, similarTracks, radio (optional) + /// - returns: TracksSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getTrackById(id: String, countryCode: String, include: [String]? = nil) async throws -> TracksSingleDataDocument { + try await getTrackByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body + } + + /// Get single track + /// - GET /tracks/{id} + /// - Retrieve track details by TIDAL track id. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL track id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers, similarTracks, radio (optional) + /// - returns: RequestBuilder + class func getTrackByIdWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/tracks/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: providers + /// + /// - parameter id: (path) TIDAL id of the track + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// providers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: TracksMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getTrackProvidersRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await getTrackProvidersRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: providers + /// - GET /tracks/{id}/relationships/providers + /// - This endpoint can be used to retrieve a list of track's related providers. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the track + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// providers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getTrackProvidersRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/tracks/{id}/relationships/providers" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: radio + /// + /// - parameter id: (path) TIDAL id of the track + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// radio (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: TracksMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getTrackRadioRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await getTrackRadioRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: radio + /// - GET /tracks/{id}/relationships/radio + /// - This endpoint can be used to retrieve a list of radios for the given track. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the track + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// radio (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getTrackRadioRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/tracks/{id}/relationships/radio" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: similar tracks + /// + /// - parameter id: (path) TIDAL id of the track + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// similarTracks (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: TracksMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getTrackSimilarTracksRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await getTrackSimilarTracksRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: similar tracks + /// - GET /tracks/{id}/relationships/similarTracks + /// - This endpoint can be used to retrieve a list of tracks similar to the given track. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the track + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// similarTracks (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getTrackSimilarTracksRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/tracks/{id}/relationships/similarTracks" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get multiple tracks + /// + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers, similarTracks, radio (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) + /// - returns: TracksMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getTracksByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterIsrc: [String]? = nil + ) async throws -> TracksMultiDataDocument { + try await getTracksByFiltersWithRequestBuilder( + countryCode: countryCode, + include: include, + filterId: filterId, + filterIsrc: filterIsrc + ).execute().body + } + + /// Get multiple tracks + /// - GET /tracks + /// - Retrieve multiple track details. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers, similarTracks, radio (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) + /// - returns: RequestBuilder + class func getTracksByFiltersWithRequestBuilder( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterIsrc: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/tracks" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + "filter[isrc]": (wrappedValue: filterIsrc?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPITidal.swift index e9e07e06..128b405a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/TracksAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - TracksAPITidal + /// This is a wrapper around `TracksAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,88 +14,130 @@ import AnyCodable /// let dataDocument = try await TracksAPITidal.getResource() /// ``` public enum TracksAPITidal { - - - /** - Relationship: albums - - - returns: TracksMultiDataRelationshipDocument - */ - public static func getTrackAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - TracksAPI.getTrackAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: albums + /// + /// - returns: TracksMultiDataRelationshipDocument + public static func getTrackAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + TracksAPI.getTrackAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: artists - - - returns: TracksMultiDataRelationshipDocument - */ - public static func getTrackArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - TracksAPI.getTrackArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: artists + /// + /// - returns: TracksMultiDataRelationshipDocument + public static func getTrackArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + TracksAPI.getTrackArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get single track - - - returns: TracksSingleDataDocument - */ - public static func getTrackById(id: String, countryCode: String, include: [String]? = nil) async throws -> TracksSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get single track + /// + /// - returns: TracksSingleDataDocument + public static func getTrackById( + id: String, + countryCode: String, + include: [String]? = nil + ) async throws -> TracksSingleDataDocument { + try await RequestHelper.createRequest { TracksAPI.getTrackByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include) } } - - /** - Relationship: providers - - - returns: TracksMultiDataRelationshipDocument - */ - public static func getTrackProvidersRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - TracksAPI.getTrackProvidersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: providers + /// + /// - returns: TracksMultiDataRelationshipDocument + public static func getTrackProvidersRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + TracksAPI.getTrackProvidersRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: radio - - - returns: TracksMultiDataRelationshipDocument - */ - public static func getTrackRadioRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - TracksAPI.getTrackRadioRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: radio + /// + /// - returns: TracksMultiDataRelationshipDocument + public static func getTrackRadioRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + TracksAPI.getTrackRadioRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: similar tracks - - - returns: TracksMultiDataRelationshipDocument - */ - public static func getTrackSimilarTracksRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> TracksMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - TracksAPI.getTrackSimilarTracksRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: similar tracks + /// + /// - returns: TracksMultiDataRelationshipDocument + public static func getTrackSimilarTracksRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> TracksMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + TracksAPI.getTrackSimilarTracksRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get multiple tracks - - - returns: TracksMultiDataDocument - */ - public static func getTracksByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterIsrc: [String]? = nil) async throws -> TracksMultiDataDocument { - return try await RequestHelper.createRequest { - TracksAPI.getTracksByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId, filterIsrc: filterIsrc) + /// Get multiple tracks + /// + /// - returns: TracksMultiDataDocument + public static func getTracksByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterIsrc: [String]? = nil + ) async throws -> TracksMultiDataDocument { + try await RequestHelper.createRequest { + TracksAPI.getTracksByFiltersWithRequestBuilder( + countryCode: countryCode, + include: include, + filterId: filterId, + filterIsrc: filterIsrc + ) } } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPI.swift index 61d7f6a3..34f8ff63 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPI.swift @@ -1,105 +1,112 @@ -// -// UserEntitlementsAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class UserEntitlementsAPI { - - /** - Get the current users entitlements - - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: UserEntitlementsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getMyUserEntitlements(include: [String]? = nil) async throws -> UserEntitlementsSingleDataDocument { - return try await getMyUserEntitlementsWithRequestBuilder(include: include).execute().body - } - - /** - Get the current users entitlements - - GET /userEntitlements/me - - Get the current users entitlements - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: RequestBuilder - */ - internal class func getMyUserEntitlementsWithRequestBuilder(include: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/userEntitlements/me" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get user entitlements for user - - - parameter id: (path) User entitlements id - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: UserEntitlementsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserEntitlementsById(id: String, include: [String]? = nil) async throws -> UserEntitlementsSingleDataDocument { - return try await getUserEntitlementsByIdWithRequestBuilder(id: id, include: include).execute().body - } - - /** - Get user entitlements for user - - GET /userEntitlements/{id} - - Get user entitlements for user - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User entitlements id - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: RequestBuilder - */ - internal class func getUserEntitlementsByIdWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userEntitlements/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - UserEntitlementsAPI + +class UserEntitlementsAPI { + /// Get the current users entitlements + /// + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: UserEntitlementsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getMyUserEntitlements(include: [String]? = nil) async throws -> UserEntitlementsSingleDataDocument { + try await getMyUserEntitlementsWithRequestBuilder(include: include).execute().body + } + + /// Get the current users entitlements + /// - GET /userEntitlements/me + /// - Get the current users entitlements + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: RequestBuilder + class func getMyUserEntitlementsWithRequestBuilder(include: [String]? = nil) + -> RequestBuilder + { + let localVariablePath = "/userEntitlements/me" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get user entitlements for user + /// + /// - parameter id: (path) User entitlements id + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: UserEntitlementsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserEntitlementsById(id: String, include: [String]? = nil) async throws -> UserEntitlementsSingleDataDocument { + try await getUserEntitlementsByIdWithRequestBuilder(id: id, include: include).execute().body + } + + /// Get user entitlements for user + /// - GET /userEntitlements/{id} + /// - Get user entitlements for user + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User entitlements id + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: RequestBuilder + class func getUserEntitlementsByIdWithRequestBuilder( + id: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userEntitlements/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPITidal.swift index 1448388d..97e58c35 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserEntitlementsAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserEntitlementsAPITidal + /// This is a wrapper around `UserEntitlementsAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,27 +14,23 @@ import AnyCodable /// let dataDocument = try await UserEntitlementsAPITidal.getResource() /// ``` public enum UserEntitlementsAPITidal { - - - /** - Get the current users entitlements - - - returns: UserEntitlementsSingleDataDocument - */ + /// Get the current users entitlements + /// + /// - returns: UserEntitlementsSingleDataDocument public static func getMyUserEntitlements(include: [String]? = nil) async throws -> UserEntitlementsSingleDataDocument { - return try await RequestHelper.createRequest { + try await RequestHelper.createRequest { UserEntitlementsAPI.getMyUserEntitlementsWithRequestBuilder(include: include) } } - - /** - Get user entitlements for user - - - returns: UserEntitlementsSingleDataDocument - */ - public static func getUserEntitlementsById(id: String, include: [String]? = nil) async throws -> UserEntitlementsSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get user entitlements for user + /// + /// - returns: UserEntitlementsSingleDataDocument + public static func getUserEntitlementsById( + id: String, + include: [String]? = nil + ) async throws -> UserEntitlementsSingleDataDocument { + try await RequestHelper.createRequest { UserEntitlementsAPI.getUserEntitlementsByIdWithRequestBuilder(id: id, include: include) } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPI.swift index 3b389e09..8329b3b7 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPI.swift @@ -1,273 +1,344 @@ -// -// UserPublicProfilePicksAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class UserPublicProfilePicksAPI { - - /** - Get my picks - - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: item, userPublicProfile (optional) - - returns: UserPublicProfilePicksMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getMyUserPublicProfilePicks(locale: String, include: [String]? = nil) async throws -> UserPublicProfilePicksMultiDataDocument { - return try await getMyUserPublicProfilePicksWithRequestBuilder(locale: locale, include: include).execute().body - } - - /** - Get my picks - - GET /userPublicProfilePicks/me - - Retrieves picks for the logged-in user. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: item, userPublicProfile (optional) - - returns: RequestBuilder - */ - internal class func getMyUserPublicProfilePicksWithRequestBuilder(locale: String, include: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/userPublicProfilePicks/me" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: item (read) - - - parameter id: (path) TIDAL pick id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: item (optional) - - returns: UserPublicProfilePicksSingletonDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfilePickItemRelationship(id: String, locale: String, include: [String]? = nil) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { - return try await getUserPublicProfilePickItemRelationshipWithRequestBuilder(id: id, locale: locale, include: include).execute().body - } - - /** - Relationship: item (read) - - GET /userPublicProfilePicks/{id}/relationships/item - - Retrieves a picks item relationship - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL pick id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: item (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfilePickItemRelationshipWithRequestBuilder(id: String, locale: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfilePicks/{id}/relationships/item" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: user public profile - - - parameter id: (path) TIDAL pick id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: userPublicProfile (optional) - - returns: UserPublicProfilePicksSingletonDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfilePickUserPublicProfileRelationship(id: String, include: [String]? = nil) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { - return try await getUserPublicProfilePickUserPublicProfileRelationshipWithRequestBuilder(id: id, include: include).execute().body - } - - /** - Relationship: user public profile - - GET /userPublicProfilePicks/{id}/relationships/userPublicProfile - - Retrieves a picks owner public profile - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL pick id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: userPublicProfile (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfilePickUserPublicProfileRelationshipWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfilePicks/{id}/relationships/userPublicProfile" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get picks - - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: item, userPublicProfile (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterUserPublicProfileId: (query) Allows to filter the collection of resources based on userPublicProfile.id attribute value (optional) - - returns: UserPublicProfilePicksMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfilePicksByFilters(locale: String, include: [String]? = nil, filterId: [String]? = nil, filterUserPublicProfileId: [String]? = nil) async throws -> UserPublicProfilePicksMultiDataDocument { - return try await getUserPublicProfilePicksByFiltersWithRequestBuilder(locale: locale, include: include, filterId: filterId, filterUserPublicProfileId: filterUserPublicProfileId).execute().body - } - - /** - Get picks - - GET /userPublicProfilePicks - - Retrieves a filtered collection of user's public picks. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: item, userPublicProfile (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterUserPublicProfileId: (query) Allows to filter the collection of resources based on userPublicProfile.id attribute value (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfilePicksByFiltersWithRequestBuilder(locale: String, include: [String]? = nil, filterId: [String]? = nil, filterUserPublicProfileId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/userPublicProfilePicks" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - "filter[userPublicProfile.id]": (wrappedValue: filterUserPublicProfileId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: item (update) - - - parameter id: (path) TIDAL pick id - - parameter updatePickRelationshipBody: (body) - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: AnyCodable - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func setUserPublicProfilePickItemRelationship(id: String, updatePickRelationshipBody: UpdatePickRelationshipBody, include: [String]? = nil) async throws -> AnyCodable { - return try await setUserPublicProfilePickItemRelationshipWithRequestBuilder(id: id, updatePickRelationshipBody: updatePickRelationshipBody, include: include).execute().body - } - - /** - Relationship: item (update) - - PATCH /userPublicProfilePicks/{id}/relationships/item - - Updates a picks item relationship, e.g. sets a 'track', 'album' or 'artist' reference. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL pick id - - parameter updatePickRelationshipBody: (body) - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: RequestBuilder - */ - internal class func setUserPublicProfilePickItemRelationshipWithRequestBuilder(id: String, updatePickRelationshipBody: UpdatePickRelationshipBody, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfilePicks/{id}/relationships/item" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: updatePickRelationshipBody) - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "application/vnd.api+json", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - UserPublicProfilePicksAPI + +class UserPublicProfilePicksAPI { + /// Get my picks + /// + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// item, userPublicProfile (optional) + /// - returns: UserPublicProfilePicksMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getMyUserPublicProfilePicks( + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilePicksMultiDataDocument { + try await getMyUserPublicProfilePicksWithRequestBuilder(locale: locale, include: include).execute().body + } + + /// Get my picks + /// - GET /userPublicProfilePicks/me + /// - Retrieves picks for the logged-in user. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// item, userPublicProfile (optional) + /// - returns: RequestBuilder + class func getMyUserPublicProfilePicksWithRequestBuilder( + locale: String, + include: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/userPublicProfilePicks/me" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: item (read) + /// + /// - parameter id: (path) TIDAL pick id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// item (optional) + /// - returns: UserPublicProfilePicksSingletonDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfilePickItemRelationship( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { + try await getUserPublicProfilePickItemRelationshipWithRequestBuilder(id: id, locale: locale, include: include).execute() + .body + } + + /// Relationship: item (read) + /// - GET /userPublicProfilePicks/{id}/relationships/item + /// - Retrieves a picks item relationship + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL pick id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// item (optional) + /// - returns: RequestBuilder + class func getUserPublicProfilePickItemRelationshipWithRequestBuilder( + id: String, + locale: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfilePicks/{id}/relationships/item" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder + .Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: user public profile + /// + /// - parameter id: (path) TIDAL pick id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// userPublicProfile (optional) + /// - returns: UserPublicProfilePicksSingletonDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfilePickUserPublicProfileRelationship( + id: String, + include: [String]? = nil + ) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { + try await getUserPublicProfilePickUserPublicProfileRelationshipWithRequestBuilder(id: id, include: include).execute().body + } + + /// Relationship: user public profile + /// - GET /userPublicProfilePicks/{id}/relationships/userPublicProfile + /// - Retrieves a picks owner public profile + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL pick id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// userPublicProfile (optional) + /// - returns: RequestBuilder + class func getUserPublicProfilePickUserPublicProfileRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfilePicks/{id}/relationships/userPublicProfile" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder + .Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get picks + /// + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// item, userPublicProfile (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterUserPublicProfileId: (query) Allows to filter the collection of resources based on userPublicProfile.id + /// attribute value (optional) + /// - returns: UserPublicProfilePicksMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfilePicksByFilters( + locale: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterUserPublicProfileId: [String]? = nil + ) async throws -> UserPublicProfilePicksMultiDataDocument { + try await getUserPublicProfilePicksByFiltersWithRequestBuilder( + locale: locale, + include: include, + filterId: filterId, + filterUserPublicProfileId: filterUserPublicProfileId + ).execute().body + } + + /// Get picks + /// - GET /userPublicProfilePicks + /// - Retrieves a filtered collection of user's public picks. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// item, userPublicProfile (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterUserPublicProfileId: (query) Allows to filter the collection of resources based on userPublicProfile.id + /// attribute value (optional) + /// - returns: RequestBuilder + class func getUserPublicProfilePicksByFiltersWithRequestBuilder( + locale: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterUserPublicProfileId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/userPublicProfilePicks" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + "filter[userPublicProfile.id]": (wrappedValue: filterUserPublicProfileId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: item (update) + /// + /// - parameter id: (path) TIDAL pick id + /// - parameter updatePickRelationshipBody: (body) + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: AnyCodable + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func setUserPublicProfilePickItemRelationship( + id: String, + updatePickRelationshipBody: UpdatePickRelationshipBody, + include: [String]? = nil + ) async throws -> AnyCodable { + try await setUserPublicProfilePickItemRelationshipWithRequestBuilder( + id: id, + updatePickRelationshipBody: updatePickRelationshipBody, + include: include + ).execute().body + } + + /// Relationship: item (update) + /// - PATCH /userPublicProfilePicks/{id}/relationships/item + /// - Updates a picks item relationship, e.g. sets a 'track', 'album' or 'artist' reference. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL pick id + /// - parameter updatePickRelationshipBody: (body) + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: RequestBuilder + class func setUserPublicProfilePickItemRelationshipWithRequestBuilder( + id: String, + updatePickRelationshipBody: UpdatePickRelationshipBody, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfilePicks/{id}/relationships/item" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: updatePickRelationshipBody) + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "application/vnd.api+json", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "PATCH", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPITidal.swift index 3e7ad470..58ea82b0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilePicksAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserPublicProfilePicksAPITidal + /// This is a wrapper around `UserPublicProfilePicksAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,64 +14,76 @@ import AnyCodable /// let dataDocument = try await UserPublicProfilePicksAPITidal.getResource() /// ``` public enum UserPublicProfilePicksAPITidal { - - - /** - Get my picks - - - returns: UserPublicProfilePicksMultiDataDocument - */ - public static func getMyUserPublicProfilePicks(locale: String, include: [String]? = nil) async throws -> UserPublicProfilePicksMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get my picks + /// + /// - returns: UserPublicProfilePicksMultiDataDocument + public static func getMyUserPublicProfilePicks( + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilePicksMultiDataDocument { + try await RequestHelper.createRequest { UserPublicProfilePicksAPI.getMyUserPublicProfilePicksWithRequestBuilder(locale: locale, include: include) } } - - /** - Relationship: item (read) - - - returns: UserPublicProfilePicksSingletonDataRelationshipDocument - */ - public static func getUserPublicProfilePickItemRelationship(id: String, locale: String, include: [String]? = nil) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: item (read) + /// + /// - returns: UserPublicProfilePicksSingletonDataRelationshipDocument + public static func getUserPublicProfilePickItemRelationship( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { + try await RequestHelper.createRequest { UserPublicProfilePicksAPI.getUserPublicProfilePickItemRelationshipWithRequestBuilder(id: id, locale: locale, include: include) } } - - /** - Relationship: user public profile - - - returns: UserPublicProfilePicksSingletonDataRelationshipDocument - */ - public static func getUserPublicProfilePickUserPublicProfileRelationship(id: String, include: [String]? = nil) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: user public profile + /// + /// - returns: UserPublicProfilePicksSingletonDataRelationshipDocument + public static func getUserPublicProfilePickUserPublicProfileRelationship( + id: String, + include: [String]? = nil + ) async throws -> UserPublicProfilePicksSingletonDataRelationshipDocument { + try await RequestHelper.createRequest { UserPublicProfilePicksAPI.getUserPublicProfilePickUserPublicProfileRelationshipWithRequestBuilder(id: id, include: include) } } - - /** - Get picks - - - returns: UserPublicProfilePicksMultiDataDocument - */ - public static func getUserPublicProfilePicksByFilters(locale: String, include: [String]? = nil, filterId: [String]? = nil, filterUserPublicProfileId: [String]? = nil) async throws -> UserPublicProfilePicksMultiDataDocument { - return try await RequestHelper.createRequest { - UserPublicProfilePicksAPI.getUserPublicProfilePicksByFiltersWithRequestBuilder(locale: locale, include: include, filterId: filterId, filterUserPublicProfileId: filterUserPublicProfileId) + /// Get picks + /// + /// - returns: UserPublicProfilePicksMultiDataDocument + public static func getUserPublicProfilePicksByFilters( + locale: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterUserPublicProfileId: [String]? = nil + ) async throws -> UserPublicProfilePicksMultiDataDocument { + try await RequestHelper.createRequest { + UserPublicProfilePicksAPI.getUserPublicProfilePicksByFiltersWithRequestBuilder( + locale: locale, + include: include, + filterId: filterId, + filterUserPublicProfileId: filterUserPublicProfileId + ) } } - - /** - Relationship: item (update) - - - returns: AnyCodable - */ - public static func setUserPublicProfilePickItemRelationship(id: String, updatePickRelationshipBody: UpdatePickRelationshipBody, include: [String]? = nil) async throws -> AnyCodable { - return try await RequestHelper.createRequest { - UserPublicProfilePicksAPI.setUserPublicProfilePickItemRelationshipWithRequestBuilder(id: id, updatePickRelationshipBody: updatePickRelationshipBody, include: include) + /// Relationship: item (update) + /// + /// - returns: AnyCodable + public static func setUserPublicProfilePickItemRelationship( + id: String, + updatePickRelationshipBody: UpdatePickRelationshipBody, + include: [String]? = nil + ) async throws -> AnyCodable { + try await RequestHelper.createRequest { + UserPublicProfilePicksAPI.setUserPublicProfilePickItemRelationshipWithRequestBuilder( + id: id, + updatePickRelationshipBody: updatePickRelationshipBody, + include: include + ) } } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPI.swift index abe7bc9c..61eed5e0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPI.swift @@ -1,438 +1,554 @@ -// -// UserPublicProfilesAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class UserPublicProfilesAPI { - - /** - Get my user profile - - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists, publicPicks, followers, following (optional) - - returns: UserPublicProfilesSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getMyUserPublicProfile(locale: String, include: [String]? = nil) async throws -> UserPublicProfilesSingleDataDocument { - return try await getMyUserPublicProfileWithRequestBuilder(locale: locale, include: include).execute().body - } - - /** - Get my user profile - - GET /userPublicProfiles/me - - Retrieve the logged-in user's public profile details. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists, publicPicks, followers, following (optional) - - returns: RequestBuilder - */ - internal class func getMyUserPublicProfileWithRequestBuilder(locale: String, include: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/userPublicProfiles/me" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get user public profile by id - - - parameter id: (path) TIDAL user id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists, publicPicks, followers, following (optional) - - returns: UserPublicProfilesSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfileById(id: String, locale: String, include: [String]? = nil) async throws -> UserPublicProfilesSingleDataDocument { - return try await getUserPublicProfileByIdWithRequestBuilder(id: id, locale: locale, include: include).execute().body - } - - /** - Get user public profile by id - - GET /userPublicProfiles/{id} - - Retrieve user public profile details by TIDAL user id. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL user id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists, publicPicks, followers, following (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfileByIdWithRequestBuilder(id: String, locale: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfiles/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: followers - - - parameter id: (path) TIDAL user id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: followers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfileFollowersRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await getUserPublicProfileFollowersRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: followers - - GET /userPublicProfiles/{id}/relationships/followers - - Retrieve user's public followers - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL user id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: followers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfileFollowersRelationshipWithRequestBuilder(id: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfiles/{id}/relationships/followers" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: following - - - parameter id: (path) TIDAL user id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: following (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfileFollowingRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await getUserPublicProfileFollowingRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: following - - GET /userPublicProfiles/{id}/relationships/following - - Retrieve user's public followings - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL user id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: following (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfileFollowingRelationshipWithRequestBuilder(id: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfiles/{id}/relationships/following" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: picks - - - parameter id: (path) TIDAL user id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPicks (optional) - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfilePublicPicksRelationship(id: String, locale: String, include: [String]? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await getUserPublicProfilePublicPicksRelationshipWithRequestBuilder(id: id, locale: locale, include: include).execute().body - } - - /** - Relationship: picks - - GET /userPublicProfiles/{id}/relationships/publicPicks - - Retrieve user's public picks. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL user id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPicks (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfilePublicPicksRelationshipWithRequestBuilder(id: String, locale: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfiles/{id}/relationships/publicPicks" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: playlists - - - parameter id: (path) TIDAL user id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfilePublicPlaylistsRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await getUserPublicProfilePublicPlaylistsRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: playlists - - GET /userPublicProfiles/{id}/relationships/publicPlaylists - - Retrieves user's public playlists. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL user id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfilePublicPlaylistsRelationshipWithRequestBuilder(id: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfiles/{id}/relationships/publicPlaylists" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get user public profiles - - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists, publicPicks, followers, following (optional) - - parameter filterId: (query) TIDAL user id (optional) - - returns: UserPublicProfilesMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfilesByFilters(locale: String, include: [String]? = nil, filterId: [String]? = nil) async throws -> UserPublicProfilesMultiDataDocument { - return try await getUserPublicProfilesByFiltersWithRequestBuilder(locale: locale, include: include, filterId: filterId).execute().body - } - - /** - Get user public profiles - - GET /userPublicProfiles - - Reads user public profile details by TIDAL user ids. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicPlaylists, publicPicks, followers, following (optional) - - parameter filterId: (query) TIDAL user id (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfilesByFiltersWithRequestBuilder(locale: String, include: [String]? = nil, filterId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/userPublicProfiles" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Update user public profile - - - parameter id: (path) ${public.usercontent.updateProfile.id.descr} - - parameter updateUserProfileBody: (body) - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: AnyCodable - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func updateMyUserProfile(id: String, updateUserProfileBody: UpdateUserProfileBody, include: [String]? = nil) async throws -> AnyCodable { - return try await updateMyUserProfileWithRequestBuilder(id: id, updateUserProfileBody: updateUserProfileBody, include: include).execute().body - } - - /** - Update user public profile - - PATCH /userPublicProfiles/{id} - - Update user public profile - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) ${public.usercontent.updateProfile.id.descr} - - parameter updateUserProfileBody: (body) - - parameter include: (query) Allows the client to customize which related resources should be returned (optional) - - returns: RequestBuilder - */ - internal class func updateMyUserProfileWithRequestBuilder(id: String, updateUserProfileBody: UpdateUserProfileBody, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userPublicProfiles/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: updateUserProfileBody) - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "application/vnd.api+json", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PATCH", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - UserPublicProfilesAPI + +class UserPublicProfilesAPI { + /// Get my user profile + /// + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists, publicPicks, followers, following (optional) + /// - returns: UserPublicProfilesSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getMyUserPublicProfile( + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilesSingleDataDocument { + try await getMyUserPublicProfileWithRequestBuilder(locale: locale, include: include).execute().body + } + + /// Get my user profile + /// - GET /userPublicProfiles/me + /// - Retrieve the logged-in user's public profile details. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists, publicPicks, followers, following (optional) + /// - returns: RequestBuilder + class func getMyUserPublicProfileWithRequestBuilder( + locale: String, + include: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/userPublicProfiles/me" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get user public profile by id + /// + /// - parameter id: (path) TIDAL user id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists, publicPicks, followers, following (optional) + /// - returns: UserPublicProfilesSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfileById( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilesSingleDataDocument { + try await getUserPublicProfileByIdWithRequestBuilder(id: id, locale: locale, include: include).execute().body + } + + /// Get user public profile by id + /// - GET /userPublicProfiles/{id} + /// - Retrieve user public profile details by TIDAL user id. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL user id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists, publicPicks, followers, following (optional) + /// - returns: RequestBuilder + class func getUserPublicProfileByIdWithRequestBuilder( + id: String, + locale: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfiles/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: followers + /// + /// - parameter id: (path) TIDAL user id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// followers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfileFollowersRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await getUserPublicProfileFollowersRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + .execute().body + } + + /// Relationship: followers + /// - GET /userPublicProfiles/{id}/relationships/followers + /// - Retrieve user's public followers + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL user id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// followers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getUserPublicProfileFollowersRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfiles/{id}/relationships/followers" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: following + /// + /// - parameter id: (path) TIDAL user id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// following (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfileFollowingRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await getUserPublicProfileFollowingRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + .execute().body + } + + /// Relationship: following + /// - GET /userPublicProfiles/{id}/relationships/following + /// - Retrieve user's public followings + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL user id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// following (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getUserPublicProfileFollowingRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfiles/{id}/relationships/following" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: picks + /// + /// - parameter id: (path) TIDAL user id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPicks (optional) + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfilePublicPicksRelationship( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await getUserPublicProfilePublicPicksRelationshipWithRequestBuilder(id: id, locale: locale, include: include) + .execute().body + } + + /// Relationship: picks + /// - GET /userPublicProfiles/{id}/relationships/publicPicks + /// - Retrieve user's public picks. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL user id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPicks (optional) + /// - returns: RequestBuilder + class func getUserPublicProfilePublicPicksRelationshipWithRequestBuilder( + id: String, + locale: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfiles/{id}/relationships/publicPicks" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: playlists + /// + /// - parameter id: (path) TIDAL user id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfilePublicPlaylistsRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await getUserPublicProfilePublicPlaylistsRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: playlists + /// - GET /userPublicProfiles/{id}/relationships/publicPlaylists + /// - Retrieves user's public playlists. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL user id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getUserPublicProfilePublicPlaylistsRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfiles/{id}/relationships/publicPlaylists" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get user public profiles + /// + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists, publicPicks, followers, following (optional) + /// - parameter filterId: (query) TIDAL user id (optional) + /// - returns: UserPublicProfilesMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfilesByFilters( + locale: String, + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> UserPublicProfilesMultiDataDocument { + try await getUserPublicProfilesByFiltersWithRequestBuilder(locale: locale, include: include, filterId: filterId).execute() + .body + } + + /// Get user public profiles + /// - GET /userPublicProfiles + /// - Reads user public profile details by TIDAL user ids. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicPlaylists, publicPicks, followers, following (optional) + /// - parameter filterId: (query) TIDAL user id (optional) + /// - returns: RequestBuilder + class func getUserPublicProfilesByFiltersWithRequestBuilder( + locale: String, + include: [String]? = nil, + filterId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/userPublicProfiles" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Update user public profile + /// + /// - parameter id: (path) ${public.usercontent.updateProfile.id.descr} + /// - parameter updateUserProfileBody: (body) + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: AnyCodable + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func updateMyUserProfile( + id: String, + updateUserProfileBody: UpdateUserProfileBody, + include: [String]? = nil + ) async throws -> AnyCodable { + try await updateMyUserProfileWithRequestBuilder(id: id, updateUserProfileBody: updateUserProfileBody, include: include) + .execute().body + } + + /// Update user public profile + /// - PATCH /userPublicProfiles/{id} + /// - Update user public profile + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) ${public.usercontent.updateProfile.id.descr} + /// - parameter updateUserProfileBody: (body) + /// - parameter include: (query) Allows the client to customize which related resources should be returned (optional) + /// - returns: RequestBuilder + class func updateMyUserProfileWithRequestBuilder( + id: String, + updateUserProfileBody: UpdateUserProfileBody, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userPublicProfiles/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: updateUserProfileBody) + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "application/vnd.api+json", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "PATCH", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPITidal.swift index a4ea248e..dcb15da2 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserPublicProfilesAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserPublicProfilesAPITidal + /// This is a wrapper around `UserPublicProfilesAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,100 +14,122 @@ import AnyCodable /// let dataDocument = try await UserPublicProfilesAPITidal.getResource() /// ``` public enum UserPublicProfilesAPITidal { - - - /** - Get my user profile - - - returns: UserPublicProfilesSingleDataDocument - */ - public static func getMyUserPublicProfile(locale: String, include: [String]? = nil) async throws -> UserPublicProfilesSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get my user profile + /// + /// - returns: UserPublicProfilesSingleDataDocument + public static func getMyUserPublicProfile( + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilesSingleDataDocument { + try await RequestHelper.createRequest { UserPublicProfilesAPI.getMyUserPublicProfileWithRequestBuilder(locale: locale, include: include) } } - - /** - Get user public profile by id - - - returns: UserPublicProfilesSingleDataDocument - */ - public static func getUserPublicProfileById(id: String, locale: String, include: [String]? = nil) async throws -> UserPublicProfilesSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get user public profile by id + /// + /// - returns: UserPublicProfilesSingleDataDocument + public static func getUserPublicProfileById( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilesSingleDataDocument { + try await RequestHelper.createRequest { UserPublicProfilesAPI.getUserPublicProfileByIdWithRequestBuilder(id: id, locale: locale, include: include) } } - - /** - Relationship: followers - - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - public static func getUserPublicProfileFollowersRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - UserPublicProfilesAPI.getUserPublicProfileFollowersRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + /// Relationship: followers + /// + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + public static func getUserPublicProfileFollowersRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + UserPublicProfilesAPI.getUserPublicProfileFollowersRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: following - - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - public static func getUserPublicProfileFollowingRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - UserPublicProfilesAPI.getUserPublicProfileFollowingRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + /// Relationship: following + /// + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + public static func getUserPublicProfileFollowingRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + UserPublicProfilesAPI.getUserPublicProfileFollowingRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: picks - - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - public static func getUserPublicProfilePublicPicksRelationship(id: String, locale: String, include: [String]? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: picks + /// + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + public static func getUserPublicProfilePublicPicksRelationship( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await RequestHelper.createRequest { UserPublicProfilesAPI.getUserPublicProfilePublicPicksRelationshipWithRequestBuilder(id: id, locale: locale, include: include) } } - - /** - Relationship: playlists - - - returns: UserPublicProfilesMultiDataRelationshipDocument - */ - public static func getUserPublicProfilePublicPlaylistsRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserPublicProfilesMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - UserPublicProfilesAPI.getUserPublicProfilePublicPlaylistsRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + /// Relationship: playlists + /// + /// - returns: UserPublicProfilesMultiDataRelationshipDocument + public static func getUserPublicProfilePublicPlaylistsRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserPublicProfilesMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + UserPublicProfilesAPI.getUserPublicProfilePublicPlaylistsRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get user public profiles - - - returns: UserPublicProfilesMultiDataDocument - */ - public static func getUserPublicProfilesByFilters(locale: String, include: [String]? = nil, filterId: [String]? = nil) async throws -> UserPublicProfilesMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get user public profiles + /// + /// - returns: UserPublicProfilesMultiDataDocument + public static func getUserPublicProfilesByFilters( + locale: String, + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> UserPublicProfilesMultiDataDocument { + try await RequestHelper.createRequest { UserPublicProfilesAPI.getUserPublicProfilesByFiltersWithRequestBuilder(locale: locale, include: include, filterId: filterId) } } - - /** - Update user public profile - - - returns: AnyCodable - */ - public static func updateMyUserProfile(id: String, updateUserProfileBody: UpdateUserProfileBody, include: [String]? = nil) async throws -> AnyCodable { - return try await RequestHelper.createRequest { - UserPublicProfilesAPI.updateMyUserProfileWithRequestBuilder(id: id, updateUserProfileBody: updateUserProfileBody, include: include) + /// Update user public profile + /// + /// - returns: AnyCodable + public static func updateMyUserProfile( + id: String, + updateUserProfileBody: UpdateUserProfileBody, + include: [String]? = nil + ) async throws -> AnyCodable { + try await RequestHelper.createRequest { + UserPublicProfilesAPI.updateMyUserProfileWithRequestBuilder( + id: id, + updateUserProfileBody: updateUserProfileBody, + include: include + ) } } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPI.swift index bd11f2c5..4ec9fbb4 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPI.swift @@ -1,304 +1,387 @@ -// -// UserRecommendationsAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class UserRecommendationsAPI { - - /** - Get the current users recommendations - - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes, discoveryMixes, newArrivalMixes (optional) - - returns: UserRecommendationsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getMyUserRecommendations(include: [String]? = nil) async throws -> UserRecommendationsSingleDataDocument { - return try await getMyUserRecommendationsWithRequestBuilder(include: include).execute().body - } - - /** - Get the current users recommendations - - GET /userRecommendations/me - - Get the current users recommendations - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes, discoveryMixes, newArrivalMixes (optional) - - returns: RequestBuilder - */ - internal class func getMyUserRecommendationsWithRequestBuilder(include: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/userRecommendations/me" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get recommendations for users in batch - - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes, discoveryMixes, newArrivalMixes (optional) - - parameter filterId: (query) User recommendations id (optional) - - returns: UserRecommendationsMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserRecommendationsByFilters(include: [String]? = nil, filterId: [String]? = nil) async throws -> UserRecommendationsMultiDataDocument { - return try await getUserRecommendationsByFiltersWithRequestBuilder(include: include, filterId: filterId).execute().body - } - - /** - Get recommendations for users in batch - - GET /userRecommendations - - Get recommendations for users in batch - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes, discoveryMixes, newArrivalMixes (optional) - - parameter filterId: (query) User recommendations id (optional) - - returns: RequestBuilder - */ - internal class func getUserRecommendationsByFiltersWithRequestBuilder(include: [String]? = nil, filterId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/userRecommendations" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get user recommendations for user - - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes, discoveryMixes, newArrivalMixes (optional) - - returns: UserRecommendationsSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserRecommendationsById(id: String, include: [String]? = nil) async throws -> UserRecommendationsSingleDataDocument { - return try await getUserRecommendationsByIdWithRequestBuilder(id: id, include: include).execute().body - } - - /** - Get user recommendations for user - - GET /userRecommendations/{id} - - Get user recommendations for user - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes, discoveryMixes, newArrivalMixes (optional) - - returns: RequestBuilder - */ - internal class func getUserRecommendationsByIdWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/userRecommendations/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: discovery mixes - - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: discoveryMixes (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: UserRecommendationsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserRecommendationsDiscoveryMixesRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserRecommendationsMultiDataRelationshipDocument { - return try await getUserRecommendationsDiscoveryMixesRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: discovery mixes - - GET /userRecommendations/{id}/relationships/discoveryMixes - - Get discovery mixes relationship - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: discoveryMixes (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getUserRecommendationsDiscoveryMixesRelationshipWithRequestBuilder(id: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/userRecommendations/{id}/relationships/discoveryMixes" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: my mixes - - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: UserRecommendationsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserRecommendationsMyMixesRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserRecommendationsMultiDataRelationshipDocument { - return try await getUserRecommendationsMyMixesRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: my mixes - - GET /userRecommendations/{id}/relationships/myMixes - - Get my mixes relationship - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: myMixes (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getUserRecommendationsMyMixesRelationshipWithRequestBuilder(id: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/userRecommendations/{id}/relationships/myMixes" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: new arrivals mixes - - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: newArrivalMixes (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: UserRecommendationsMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserRecommendationsNewArrivalMixesRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserRecommendationsMultiDataRelationshipDocument { - return try await getUserRecommendationsNewArrivalMixesRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: new arrivals mixes - - GET /userRecommendations/{id}/relationships/newArrivalMixes - - Get new arrival mixes relationship - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User recommendations id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: newArrivalMixes (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getUserRecommendationsNewArrivalMixesRelationshipWithRequestBuilder(id: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/userRecommendations/{id}/relationships/newArrivalMixes" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - UserRecommendationsAPI + +class UserRecommendationsAPI { + /// Get the current users recommendations + /// + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes, discoveryMixes, newArrivalMixes (optional) + /// - returns: UserRecommendationsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getMyUserRecommendations(include: [String]? = nil) async throws -> UserRecommendationsSingleDataDocument { + try await getMyUserRecommendationsWithRequestBuilder(include: include).execute().body + } + + /// Get the current users recommendations + /// - GET /userRecommendations/me + /// - Get the current users recommendations + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes, discoveryMixes, newArrivalMixes (optional) + /// - returns: RequestBuilder + class func getMyUserRecommendationsWithRequestBuilder(include: [String]? = nil) + -> RequestBuilder + { + let localVariablePath = "/userRecommendations/me" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get recommendations for users in batch + /// + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes, discoveryMixes, newArrivalMixes (optional) + /// - parameter filterId: (query) User recommendations id (optional) + /// - returns: UserRecommendationsMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserRecommendationsByFilters( + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> UserRecommendationsMultiDataDocument { + try await getUserRecommendationsByFiltersWithRequestBuilder(include: include, filterId: filterId).execute().body + } + + /// Get recommendations for users in batch + /// - GET /userRecommendations + /// - Get recommendations for users in batch + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes, discoveryMixes, newArrivalMixes (optional) + /// - parameter filterId: (query) User recommendations id (optional) + /// - returns: RequestBuilder + class func getUserRecommendationsByFiltersWithRequestBuilder( + include: [String]? = nil, + filterId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/userRecommendations" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get user recommendations for user + /// + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes, discoveryMixes, newArrivalMixes (optional) + /// - returns: UserRecommendationsSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserRecommendationsById( + id: String, + include: [String]? = nil + ) async throws -> UserRecommendationsSingleDataDocument { + try await getUserRecommendationsByIdWithRequestBuilder(id: id, include: include).execute().body + } + + /// Get user recommendations for user + /// - GET /userRecommendations/{id} + /// - Get user recommendations for user + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes, discoveryMixes, newArrivalMixes (optional) + /// - returns: RequestBuilder + class func getUserRecommendationsByIdWithRequestBuilder( + id: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/userRecommendations/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: discovery mixes + /// + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// discoveryMixes (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: UserRecommendationsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserRecommendationsDiscoveryMixesRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserRecommendationsMultiDataRelationshipDocument { + try await getUserRecommendationsDiscoveryMixesRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: discovery mixes + /// - GET /userRecommendations/{id}/relationships/discoveryMixes + /// - Get discovery mixes relationship + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// discoveryMixes (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getUserRecommendationsDiscoveryMixesRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/userRecommendations/{id}/relationships/discoveryMixes" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: my mixes + /// + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: UserRecommendationsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserRecommendationsMyMixesRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserRecommendationsMultiDataRelationshipDocument { + try await getUserRecommendationsMyMixesRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + .execute().body + } + + /// Relationship: my mixes + /// - GET /userRecommendations/{id}/relationships/myMixes + /// - Get my mixes relationship + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// myMixes (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getUserRecommendationsMyMixesRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/userRecommendations/{id}/relationships/myMixes" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: new arrivals mixes + /// + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// newArrivalMixes (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: UserRecommendationsMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserRecommendationsNewArrivalMixesRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserRecommendationsMultiDataRelationshipDocument { + try await getUserRecommendationsNewArrivalMixesRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: new arrivals mixes + /// - GET /userRecommendations/{id}/relationships/newArrivalMixes + /// - Get new arrival mixes relationship + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User recommendations id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// newArrivalMixes (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getUserRecommendationsNewArrivalMixesRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/userRecommendations/{id}/relationships/newArrivalMixes" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPITidal.swift index 0281830e..25c80adc 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UserRecommendationsAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserRecommendationsAPITidal + /// This is a wrapper around `UserRecommendationsAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,76 +14,87 @@ import AnyCodable /// let dataDocument = try await UserRecommendationsAPITidal.getResource() /// ``` public enum UserRecommendationsAPITidal { - - - /** - Get the current users recommendations - - - returns: UserRecommendationsSingleDataDocument - */ + /// Get the current users recommendations + /// + /// - returns: UserRecommendationsSingleDataDocument public static func getMyUserRecommendations(include: [String]? = nil) async throws -> UserRecommendationsSingleDataDocument { - return try await RequestHelper.createRequest { + try await RequestHelper.createRequest { UserRecommendationsAPI.getMyUserRecommendationsWithRequestBuilder(include: include) } } - - /** - Get recommendations for users in batch - - - returns: UserRecommendationsMultiDataDocument - */ - public static func getUserRecommendationsByFilters(include: [String]? = nil, filterId: [String]? = nil) async throws -> UserRecommendationsMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get recommendations for users in batch + /// + /// - returns: UserRecommendationsMultiDataDocument + public static func getUserRecommendationsByFilters( + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> UserRecommendationsMultiDataDocument { + try await RequestHelper.createRequest { UserRecommendationsAPI.getUserRecommendationsByFiltersWithRequestBuilder(include: include, filterId: filterId) } } - - /** - Get user recommendations for user - - - returns: UserRecommendationsSingleDataDocument - */ - public static func getUserRecommendationsById(id: String, include: [String]? = nil) async throws -> UserRecommendationsSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get user recommendations for user + /// + /// - returns: UserRecommendationsSingleDataDocument + public static func getUserRecommendationsById( + id: String, + include: [String]? = nil + ) async throws -> UserRecommendationsSingleDataDocument { + try await RequestHelper.createRequest { UserRecommendationsAPI.getUserRecommendationsByIdWithRequestBuilder(id: id, include: include) } } - - /** - Relationship: discovery mixes - - - returns: UserRecommendationsMultiDataRelationshipDocument - */ - public static func getUserRecommendationsDiscoveryMixesRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserRecommendationsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - UserRecommendationsAPI.getUserRecommendationsDiscoveryMixesRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + /// Relationship: discovery mixes + /// + /// - returns: UserRecommendationsMultiDataRelationshipDocument + public static func getUserRecommendationsDiscoveryMixesRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserRecommendationsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + UserRecommendationsAPI.getUserRecommendationsDiscoveryMixesRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: my mixes - - - returns: UserRecommendationsMultiDataRelationshipDocument - */ - public static func getUserRecommendationsMyMixesRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserRecommendationsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - UserRecommendationsAPI.getUserRecommendationsMyMixesRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + /// Relationship: my mixes + /// + /// - returns: UserRecommendationsMultiDataRelationshipDocument + public static func getUserRecommendationsMyMixesRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserRecommendationsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + UserRecommendationsAPI.getUserRecommendationsMyMixesRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: new arrivals mixes - - - returns: UserRecommendationsMultiDataRelationshipDocument - */ - public static func getUserRecommendationsNewArrivalMixesRelationship(id: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> UserRecommendationsMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - UserRecommendationsAPI.getUserRecommendationsNewArrivalMixesRelationshipWithRequestBuilder(id: id, include: include, pageCursor: pageCursor) + /// Relationship: new arrivals mixes + /// + /// - returns: UserRecommendationsMultiDataRelationshipDocument + public static func getUserRecommendationsNewArrivalMixesRelationship( + id: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> UserRecommendationsMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + UserRecommendationsAPI.getUserRecommendationsNewArrivalMixesRelationshipWithRequestBuilder( + id: id, + include: include, + pageCursor: pageCursor + ) } } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPI.swift index 738a9e89..43d09e2a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPI.swift @@ -1,298 +1,351 @@ -// -// UsersAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class UsersAPI { - - /** - Get the current user - - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements, publicProfile, recommendations (optional) - - returns: UsersSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getMyUser(include: [String]? = nil) async throws -> UsersSingleDataDocument { - return try await getMyUserWithRequestBuilder(include: include).execute().body - } - - /** - Get the current user - - GET /users/me - - Get the current user - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements, publicProfile, recommendations (optional) - - returns: RequestBuilder - */ - internal class func getMyUserWithRequestBuilder(include: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/users/me" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get a single user by id - - - parameter id: (path) User Id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements, publicProfile, recommendations (optional) - - returns: UsersSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserById(id: String, include: [String]? = nil) async throws -> UsersSingleDataDocument { - return try await getUserByIdWithRequestBuilder(id: id, include: include).execute().body - } - - /** - Get a single user by id - - GET /users/{id} - - Get a single user by id - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User Id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements, publicProfile, recommendations (optional) - - returns: RequestBuilder - */ - internal class func getUserByIdWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/users/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: entitlements - - - parameter id: (path) User Id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements (optional) - - returns: UsersSingletonDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserEntitlementsRelationship(id: String, include: [String]? = nil) async throws -> UsersSingletonDataRelationshipDocument { - return try await getUserEntitlementsRelationshipWithRequestBuilder(id: id, include: include).execute().body - } - - /** - Relationship: entitlements - - GET /users/{id}/relationships/entitlements - - Get user entitlements relationship - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User Id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements (optional) - - returns: RequestBuilder - */ - internal class func getUserEntitlementsRelationshipWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/users/{id}/relationships/entitlements" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: public profile - - - parameter id: (path) User Id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicProfile (optional) - - returns: UsersSingletonDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserPublicProfileRelationship(id: String, locale: String, include: [String]? = nil) async throws -> UsersSingletonDataRelationshipDocument { - return try await getUserPublicProfileRelationshipWithRequestBuilder(id: id, locale: locale, include: include).execute().body - } - - /** - Relationship: public profile - - GET /users/{id}/relationships/publicProfile - - Get user public profile - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User Id - - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: publicProfile (optional) - - returns: RequestBuilder - */ - internal class func getUserPublicProfileRelationshipWithRequestBuilder(id: String, locale: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/users/{id}/relationships/publicProfile" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: user recommendations - - - parameter id: (path) User Id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: recommendations (optional) - - returns: UsersSingletonDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUserRecommendationsRelationship(id: String, include: [String]? = nil) async throws -> UsersSingletonDataRelationshipDocument { - return try await getUserRecommendationsRelationshipWithRequestBuilder(id: id, include: include).execute().body - } - - /** - Relationship: user recommendations - - GET /users/{id}/relationships/recommendations - - Get user recommendations - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) User Id - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: recommendations (optional) - - returns: RequestBuilder - */ - internal class func getUserRecommendationsRelationshipWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/users/{id}/relationships/recommendations" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get multiple users by id - - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements, publicProfile, recommendations (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - returns: UsersMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getUsersByFilters(include: [String]? = nil, filterId: [String]? = nil) async throws -> UsersMultiDataDocument { - return try await getUsersByFiltersWithRequestBuilder(include: include, filterId: filterId).execute().body - } - - /** - Get multiple users by id - - GET /users - - Get multiple users by id - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: entitlements, publicProfile, recommendations (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - returns: RequestBuilder - */ - internal class func getUsersByFiltersWithRequestBuilder(include: [String]? = nil, filterId: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/users" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - UsersAPI + +class UsersAPI { + /// Get the current user + /// + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements, publicProfile, recommendations (optional) + /// - returns: UsersSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getMyUser(include: [String]? = nil) async throws -> UsersSingleDataDocument { + try await getMyUserWithRequestBuilder(include: include).execute().body + } + + /// Get the current user + /// - GET /users/me + /// - Get the current user + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements, publicProfile, recommendations (optional) + /// - returns: RequestBuilder + class func getMyUserWithRequestBuilder(include: [String]? = nil) -> RequestBuilder { + let localVariablePath = "/users/me" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get a single user by id + /// + /// - parameter id: (path) User Id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements, publicProfile, recommendations (optional) + /// - returns: UsersSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserById(id: String, include: [String]? = nil) async throws -> UsersSingleDataDocument { + try await getUserByIdWithRequestBuilder(id: id, include: include).execute().body + } + + /// Get a single user by id + /// - GET /users/{id} + /// - Get a single user by id + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User Id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements, publicProfile, recommendations (optional) + /// - returns: RequestBuilder + class func getUserByIdWithRequestBuilder(id: String, include: [String]? = nil) -> RequestBuilder { + var localVariablePath = "/users/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: entitlements + /// + /// - parameter id: (path) User Id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements (optional) + /// - returns: UsersSingletonDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserEntitlementsRelationship( + id: String, + include: [String]? = nil + ) async throws -> UsersSingletonDataRelationshipDocument { + try await getUserEntitlementsRelationshipWithRequestBuilder(id: id, include: include).execute().body + } + + /// Relationship: entitlements + /// - GET /users/{id}/relationships/entitlements + /// - Get user entitlements relationship + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User Id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements (optional) + /// - returns: RequestBuilder + class func getUserEntitlementsRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/users/{id}/relationships/entitlements" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: public profile + /// + /// - parameter id: (path) User Id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicProfile (optional) + /// - returns: UsersSingletonDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserPublicProfileRelationship( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UsersSingletonDataRelationshipDocument { + try await getUserPublicProfileRelationshipWithRequestBuilder(id: id, locale: locale, include: include).execute().body + } + + /// Relationship: public profile + /// - GET /users/{id}/relationships/publicProfile + /// - Get user public profile + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User Id + /// - parameter locale: (query) Locale language tag (IETF BCP 47 Language Tag) + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// publicProfile (optional) + /// - returns: RequestBuilder + class func getUserPublicProfileRelationshipWithRequestBuilder( + id: String, + locale: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/users/{id}/relationships/publicProfile" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "locale": (wrappedValue: locale.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: user recommendations + /// + /// - parameter id: (path) User Id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// recommendations (optional) + /// - returns: UsersSingletonDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUserRecommendationsRelationship( + id: String, + include: [String]? = nil + ) async throws -> UsersSingletonDataRelationshipDocument { + try await getUserRecommendationsRelationshipWithRequestBuilder(id: id, include: include).execute().body + } + + /// Relationship: user recommendations + /// - GET /users/{id}/relationships/recommendations + /// - Get user recommendations + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) User Id + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// recommendations (optional) + /// - returns: RequestBuilder + class func getUserRecommendationsRelationshipWithRequestBuilder( + id: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/users/{id}/relationships/recommendations" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get multiple users by id + /// + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements, publicProfile, recommendations (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - returns: UsersMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getUsersByFilters(include: [String]? = nil, filterId: [String]? = nil) async throws -> UsersMultiDataDocument { + try await getUsersByFiltersWithRequestBuilder(include: include, filterId: filterId).execute().body + } + + /// Get multiple users by id + /// - GET /users + /// - Get multiple users by id + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// entitlements, publicProfile, recommendations (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - returns: RequestBuilder + class func getUsersByFiltersWithRequestBuilder( + include: [String]? = nil, + filterId: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/users" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPITidal.swift index 59b51d61..9de50337 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/UsersAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UsersAPITidal + /// This is a wrapper around `UsersAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,75 +14,69 @@ import AnyCodable /// let dataDocument = try await UsersAPITidal.getResource() /// ``` public enum UsersAPITidal { - - - /** - Get the current user - - - returns: UsersSingleDataDocument - */ + /// Get the current user + /// + /// - returns: UsersSingleDataDocument public static func getMyUser(include: [String]? = nil) async throws -> UsersSingleDataDocument { - return try await RequestHelper.createRequest { + try await RequestHelper.createRequest { UsersAPI.getMyUserWithRequestBuilder(include: include) } } - - /** - Get a single user by id - - - returns: UsersSingleDataDocument - */ + /// Get a single user by id + /// + /// - returns: UsersSingleDataDocument public static func getUserById(id: String, include: [String]? = nil) async throws -> UsersSingleDataDocument { - return try await RequestHelper.createRequest { + try await RequestHelper.createRequest { UsersAPI.getUserByIdWithRequestBuilder(id: id, include: include) } } - - /** - Relationship: entitlements - - - returns: UsersSingletonDataRelationshipDocument - */ - public static func getUserEntitlementsRelationship(id: String, include: [String]? = nil) async throws -> UsersSingletonDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: entitlements + /// + /// - returns: UsersSingletonDataRelationshipDocument + public static func getUserEntitlementsRelationship( + id: String, + include: [String]? = nil + ) async throws -> UsersSingletonDataRelationshipDocument { + try await RequestHelper.createRequest { UsersAPI.getUserEntitlementsRelationshipWithRequestBuilder(id: id, include: include) } } - - /** - Relationship: public profile - - - returns: UsersSingletonDataRelationshipDocument - */ - public static func getUserPublicProfileRelationship(id: String, locale: String, include: [String]? = nil) async throws -> UsersSingletonDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: public profile + /// + /// - returns: UsersSingletonDataRelationshipDocument + public static func getUserPublicProfileRelationship( + id: String, + locale: String, + include: [String]? = nil + ) async throws -> UsersSingletonDataRelationshipDocument { + try await RequestHelper.createRequest { UsersAPI.getUserPublicProfileRelationshipWithRequestBuilder(id: id, locale: locale, include: include) } } - - /** - Relationship: user recommendations - - - returns: UsersSingletonDataRelationshipDocument - */ - public static func getUserRecommendationsRelationship(id: String, include: [String]? = nil) async throws -> UsersSingletonDataRelationshipDocument { - return try await RequestHelper.createRequest { + /// Relationship: user recommendations + /// + /// - returns: UsersSingletonDataRelationshipDocument + public static func getUserRecommendationsRelationship( + id: String, + include: [String]? = nil + ) async throws -> UsersSingletonDataRelationshipDocument { + try await RequestHelper.createRequest { UsersAPI.getUserRecommendationsRelationshipWithRequestBuilder(id: id, include: include) } } - - /** - Get multiple users by id - - - returns: UsersMultiDataDocument - */ - public static func getUsersByFilters(include: [String]? = nil, filterId: [String]? = nil) async throws -> UsersMultiDataDocument { - return try await RequestHelper.createRequest { + /// Get multiple users by id + /// + /// - returns: UsersMultiDataDocument + public static func getUsersByFilters( + include: [String]? = nil, + filterId: [String]? = nil + ) async throws -> UsersMultiDataDocument { + try await RequestHelper.createRequest { UsersAPI.getUsersByFiltersWithRequestBuilder(include: include, filterId: filterId) } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPI.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPI.swift index 05847097..2f7ca787 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPI.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPI.swift @@ -1,294 +1,388 @@ -// -// VideosAPI.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -internal class VideosAPI { - - /** - Relationship: albums - - - parameter id: (path) TIDAL video id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: VideosMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getVideoAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> VideosMultiDataRelationshipDocument { - return try await getVideoAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: albums - - GET /videos/{id}/relationships/albums - - Retrieve album details of the related video. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL video id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: albums (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getVideoAlbumsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/videos/{id}/relationships/albums" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: artists - - - parameter id: (path) TIDAL video id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: VideosMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getVideoArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> VideosMultiDataRelationshipDocument { - return try await getVideoArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: artists - - GET /videos/{id}/relationships/artists - - Retrieve artist details of the related video. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL video id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getVideoArtistsRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/videos/{id}/relationships/artists" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get single video - - - parameter id: (path) TIDAL video id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers (optional) - - returns: VideosSingleDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getVideoById(id: String, countryCode: String, include: [String]? = nil) async throws -> VideosSingleDataDocument { - return try await getVideoByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body - } - - /** - Get single video - - GET /videos/{id} - - Retrieve video details by TIDAL video id. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL video id - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers (optional) - - returns: RequestBuilder - */ - internal class func getVideoByIdWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil) -> RequestBuilder { - var localVariablePath = "/videos/{id}" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Relationship: providers - - - parameter id: (path) TIDAL id of the video - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: providers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: VideosMultiDataRelationshipDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getVideoProvidersRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> VideosMultiDataRelationshipDocument { - return try await getVideoProvidersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor).execute().body - } - - /** - Relationship: providers - - GET /videos/{id}/relationships/providers - - This endpoint can be used to retrieve a list of video's related providers. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter id: (path) TIDAL id of the video - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: providers (optional) - - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page if not specified (optional) - - returns: RequestBuilder - */ - internal class func getVideoProvidersRelationshipWithRequestBuilder(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) -> RequestBuilder { - var localVariablePath = "/videos/{id}/relationships/providers" - let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" - let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - - /** - Get multiple videos - - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) - - returns: VideosMultiDataDocument - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - internal class func getVideosByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterIsrc: [String]? = nil) async throws -> VideosMultiDataDocument { - return try await getVideosByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId, filterIsrc: filterIsrc).execute().body - } - - /** - Get multiple videos - - GET /videos - - Retrieve multiple video details. - - OAuth: - - type: oauth2 - - name: Authorization_Code_PKCE - - OAuth: - - type: oauth2 - - name: Client_Credentials - - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), X-RateLimit-Requested-Tokens(Int)] - - parameter countryCode: (query) ISO 3166-1 alpha-2 country code - - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: artists, albums, providers (optional) - - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) - - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) - - returns: RequestBuilder - */ - internal class func getVideosByFiltersWithRequestBuilder(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterIsrc: [String]? = nil) -> RequestBuilder { - let localVariablePath = "/videos" - let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath - let localVariableParameters: [String: Any]? = nil - - var localVariableUrlComponents = URLComponents(string: localVariableURLString) - localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), - "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), - "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), - "filter[isrc]": (wrappedValue: filterIsrc?.encodeToJSON(), isExplode: true), - ]) - - let localVariableNillableHeaders: [String: Any?] = [ - : - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } +// MARK: - VideosAPI + +class VideosAPI { + /// Relationship: albums + /// + /// - parameter id: (path) TIDAL video id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: VideosMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getVideoAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> VideosMultiDataRelationshipDocument { + try await getVideoAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: albums + /// - GET /videos/{id}/relationships/albums + /// - Retrieve album details of the related video. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL video id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// albums (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getVideoAlbumsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/videos/{id}/relationships/albums" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: artists + /// + /// - parameter id: (path) TIDAL video id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: VideosMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getVideoArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> VideosMultiDataRelationshipDocument { + try await getVideoArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: artists + /// - GET /videos/{id}/relationships/artists + /// - Retrieve artist details of the related video. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL video id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getVideoArtistsRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/videos/{id}/relationships/artists" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get single video + /// + /// - parameter id: (path) TIDAL video id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers (optional) + /// - returns: VideosSingleDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getVideoById(id: String, countryCode: String, include: [String]? = nil) async throws -> VideosSingleDataDocument { + try await getVideoByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include).execute().body + } + + /// Get single video + /// - GET /videos/{id} + /// - Retrieve video details by TIDAL video id. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL video id + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers (optional) + /// - returns: RequestBuilder + class func getVideoByIdWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil + ) -> RequestBuilder { + var localVariablePath = "/videos/{id}" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Relationship: providers + /// + /// - parameter id: (path) TIDAL id of the video + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// providers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: VideosMultiDataRelationshipDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getVideoProvidersRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> VideosMultiDataRelationshipDocument { + try await getVideoProvidersRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ).execute().body + } + + /// Relationship: providers + /// - GET /videos/{id}/relationships/providers + /// - This endpoint can be used to retrieve a list of video's related providers. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter id: (path) TIDAL id of the video + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// providers (optional) + /// - parameter pageCursor: (query) Server-generated cursor value pointing a certain page of items. Optional, targets first page + /// if not specified (optional) + /// - returns: RequestBuilder + class func getVideoProvidersRelationshipWithRequestBuilder( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) -> RequestBuilder { + var localVariablePath = "/videos/{id}/relationships/providers" + let idPreEscape = "\(APIHelper.mapValueToPathItem(id))" + let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{id}", with: idPostEscape, options: .literal, range: nil) + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "page[cursor]": (wrappedValue: pageCursor?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI + .requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } + + /// Get multiple videos + /// + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) + /// - returns: VideosMultiDataDocument + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + class func getVideosByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterIsrc: [String]? = nil + ) async throws -> VideosMultiDataDocument { + try await getVideosByFiltersWithRequestBuilder( + countryCode: countryCode, + include: include, + filterId: filterId, + filterIsrc: filterIsrc + ).execute().body + } + + /// Get multiple videos + /// - GET /videos + /// - Retrieve multiple video details. + /// - OAuth: + /// - type: oauth2 + /// - name: Authorization_Code_PKCE + /// - OAuth: + /// - type: oauth2 + /// - name: Client_Credentials + /// - responseHeaders: [X-RateLimit-Remaining(Int), X-RateLimit-Burst-Capacity(Int), X-RateLimit-Replenish-Rate(Int), + /// X-RateLimit-Requested-Tokens(Int)] + /// - parameter countryCode: (query) ISO 3166-1 alpha-2 country code + /// - parameter include: (query) Allows the client to customize which related resources should be returned. Available options: + /// artists, albums, providers (optional) + /// - parameter filterId: (query) Allows to filter the collection of resources based on id attribute value (optional) + /// - parameter filterIsrc: (query) Allows to filter the collection of resources based on isrc attribute value (optional) + /// - returns: RequestBuilder + class func getVideosByFiltersWithRequestBuilder( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterIsrc: [String]? = nil + ) -> RequestBuilder { + let localVariablePath = "/videos" + let localVariableURLString = OpenAPIClientAPI.basePath + localVariablePath + let localVariableParameters: [String: Any]? = nil + + var localVariableUrlComponents = URLComponents(string: localVariableURLString) + localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ + "countryCode": (wrappedValue: countryCode.encodeToJSON(), isExplode: true), + "include": (wrappedValue: include?.encodeToJSON(), isExplode: true), + "filter[id]": (wrappedValue: filterId?.encodeToJSON(), isExplode: true), + "filter[isrc]": (wrappedValue: filterIsrc?.encodeToJSON(), isExplode: true), + ]) + + let localVariableNillableHeaders: [String: Any?] = [ + : + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = OpenAPIClientAPI.requestBuilderFactory + .getBuilder() + + return localVariableRequestBuilder.init( + method: "GET", + URLString: (localVariableUrlComponents?.string ?? localVariableURLString), + parameters: localVariableParameters, + headers: localVariableHeaderParameters, + requiresAuthentication: true + ) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPITidal.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPITidal.swift index c3da8400..bc152cc1 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPITidal.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/APIs/VideosAPITidal.swift @@ -1,8 +1,10 @@ import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - VideosAPITidal + /// This is a wrapper around `VideosAPI` that uses the injected credentialsprovider /// from `OpenAPIClientAPI.credentialsProvider` to provide a convenience API. /// @@ -12,64 +14,92 @@ import AnyCodable /// let dataDocument = try await VideosAPITidal.getResource() /// ``` public enum VideosAPITidal { - - - /** - Relationship: albums - - - returns: VideosMultiDataRelationshipDocument - */ - public static func getVideoAlbumsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> VideosMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - VideosAPI.getVideoAlbumsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: albums + /// + /// - returns: VideosMultiDataRelationshipDocument + public static func getVideoAlbumsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> VideosMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + VideosAPI.getVideoAlbumsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Relationship: artists - - - returns: VideosMultiDataRelationshipDocument - */ - public static func getVideoArtistsRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> VideosMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - VideosAPI.getVideoArtistsRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: artists + /// + /// - returns: VideosMultiDataRelationshipDocument + public static func getVideoArtistsRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> VideosMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + VideosAPI.getVideoArtistsRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get single video - - - returns: VideosSingleDataDocument - */ - public static func getVideoById(id: String, countryCode: String, include: [String]? = nil) async throws -> VideosSingleDataDocument { - return try await RequestHelper.createRequest { + /// Get single video + /// + /// - returns: VideosSingleDataDocument + public static func getVideoById( + id: String, + countryCode: String, + include: [String]? = nil + ) async throws -> VideosSingleDataDocument { + try await RequestHelper.createRequest { VideosAPI.getVideoByIdWithRequestBuilder(id: id, countryCode: countryCode, include: include) } } - - /** - Relationship: providers - - - returns: VideosMultiDataRelationshipDocument - */ - public static func getVideoProvidersRelationship(id: String, countryCode: String, include: [String]? = nil, pageCursor: String? = nil) async throws -> VideosMultiDataRelationshipDocument { - return try await RequestHelper.createRequest { - VideosAPI.getVideoProvidersRelationshipWithRequestBuilder(id: id, countryCode: countryCode, include: include, pageCursor: pageCursor) + /// Relationship: providers + /// + /// - returns: VideosMultiDataRelationshipDocument + public static func getVideoProvidersRelationship( + id: String, + countryCode: String, + include: [String]? = nil, + pageCursor: String? = nil + ) async throws -> VideosMultiDataRelationshipDocument { + try await RequestHelper.createRequest { + VideosAPI.getVideoProvidersRelationshipWithRequestBuilder( + id: id, + countryCode: countryCode, + include: include, + pageCursor: pageCursor + ) } } - - /** - Get multiple videos - - - returns: VideosMultiDataDocument - */ - public static func getVideosByFilters(countryCode: String, include: [String]? = nil, filterId: [String]? = nil, filterIsrc: [String]? = nil) async throws -> VideosMultiDataDocument { - return try await RequestHelper.createRequest { - VideosAPI.getVideosByFiltersWithRequestBuilder(countryCode: countryCode, include: include, filterId: filterId, filterIsrc: filterIsrc) + /// Get multiple videos + /// + /// - returns: VideosMultiDataDocument + public static func getVideosByFilters( + countryCode: String, + include: [String]? = nil, + filterId: [String]? = nil, + filterIsrc: [String]? = nil + ) async throws -> VideosMultiDataDocument { + try await RequestHelper.createRequest { + VideosAPI.getVideosByFiltersWithRequestBuilder( + countryCode: countryCode, + include: include, + filterId: filterId, + filterIsrc: filterIsrc + ) } } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/CodableHelper.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/CodableHelper.swift index 09c82e53..9117cb9d 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/CodableHelper.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/CodableHelper.swift @@ -1,49 +1,44 @@ -// -// CodableHelper.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation open class CodableHelper { - private static var customDateFormatter: DateFormatter? - private static var defaultDateFormatter: DateFormatter = OpenISO8601DateFormatter() - - private static var customJSONDecoder: JSONDecoder? - private static var defaultJSONDecoder: JSONDecoder = { - let decoder = JSONDecoder() - decoder.dateDecodingStrategy = .formatted(CodableHelper.dateFormatter) - return decoder - }() - - private static var customJSONEncoder: JSONEncoder? - private static var defaultJSONEncoder: JSONEncoder = { - let encoder = JSONEncoder() - encoder.dateEncodingStrategy = .formatted(CodableHelper.dateFormatter) - encoder.outputFormatting = .prettyPrinted - return encoder - }() - - public static var dateFormatter: DateFormatter { - get { return customDateFormatter ?? defaultDateFormatter } - set { customDateFormatter = newValue } - } - public static var jsonDecoder: JSONDecoder { - get { return customJSONDecoder ?? defaultJSONDecoder } - set { customJSONDecoder = newValue } - } - public static var jsonEncoder: JSONEncoder { - get { return customJSONEncoder ?? defaultJSONEncoder } - set { customJSONEncoder = newValue } - } - - open class func decode(_ type: T.Type, from data: Data) -> Swift.Result where T: Decodable { - return Swift.Result { try jsonDecoder.decode(type, from: data) } - } - - open class func encode(_ value: T) -> Swift.Result where T: Encodable { - return Swift.Result { try jsonEncoder.encode(value) } - } + private static var customDateFormatter: DateFormatter? + private static var defaultDateFormatter: DateFormatter = OpenISO8601DateFormatter() + + private static var customJSONDecoder: JSONDecoder? + private static var defaultJSONDecoder: JSONDecoder = { + let decoder = JSONDecoder() + decoder.dateDecodingStrategy = .formatted(CodableHelper.dateFormatter) + return decoder + }() + + private static var customJSONEncoder: JSONEncoder? + private static var defaultJSONEncoder: JSONEncoder = { + let encoder = JSONEncoder() + encoder.dateEncodingStrategy = .formatted(CodableHelper.dateFormatter) + encoder.outputFormatting = .prettyPrinted + return encoder + }() + + public static var dateFormatter: DateFormatter { + get { customDateFormatter ?? defaultDateFormatter } + set { customDateFormatter = newValue } + } + + public static var jsonDecoder: JSONDecoder { + get { customJSONDecoder ?? defaultJSONDecoder } + set { customJSONDecoder = newValue } + } + + public static var jsonEncoder: JSONEncoder { + get { customJSONEncoder ?? defaultJSONEncoder } + set { customJSONEncoder = newValue } + } + + open class func decode(_ type: T.Type, from data: Data) -> Swift.Result where T: Decodable { + Swift.Result { try jsonDecoder.decode(type, from: data) } + } + + open class func encode(_ value: T) -> Swift.Result where T: Encodable { + Swift.Result { try jsonEncoder.encode(value) } + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Configuration.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Configuration.swift index 0457d990..4ded5059 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Configuration.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Configuration.swift @@ -1,18 +1,13 @@ -// Configuration.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif +// MARK: - Configuration + open class Configuration { - - /// Configures the range of HTTP status codes that will result in a successful response - /// - /// If a HTTP status code is outside of this range the response will be interpreted as failed. - public static var successfulStatusCodeRange: Range = 200..<300 + /// Configures the range of HTTP status codes that will result in a successful response + /// + /// If a HTTP status code is outside of this range the response will be interpreted as failed. + public static var successfulStatusCodeRange: Range = 200 ..< 300 } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Extensions.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Extensions.swift index 286c5001..6db8bd2a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Extensions.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Extensions.swift @@ -1,236 +1,263 @@ -// Extensions.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - Bool + JSONEncodable + extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - Float + JSONEncodable + extension Float: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - Int + JSONEncodable + extension Int: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - Int32 + JSONEncodable + extension Int32: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - Int64 + JSONEncodable + extension Int64: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - Double + JSONEncodable + extension Double: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - Decimal + JSONEncodable + extension Decimal: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - String + JSONEncodable + extension String: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - URL + JSONEncodable + extension URL: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } +// MARK: - UUID + JSONEncodable + extension UUID: JSONEncodable { - func encodeToJSON() -> Any { self } + func encodeToJSON() -> Any { self } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { return self.rawValue } + func encodeToJSON() -> Any { rawValue } } private func encodeIfPossible(_ object: T) -> Any { - if let encodableObject = object as? JSONEncodable { - return encodableObject.encodeToJSON() - } else { - return object - } + if let encodableObject = object as? JSONEncodable { + encodableObject.encodeToJSON() + } else { + object + } } +// MARK: - Array + JSONEncodable + extension Array: JSONEncodable { - func encodeToJSON() -> Any { - return self.map(encodeIfPossible) - } + func encodeToJSON() -> Any { + map(encodeIfPossible) + } } +// MARK: - Set + JSONEncodable + extension Set: JSONEncodable { - func encodeToJSON() -> Any { - return Array(self).encodeToJSON() - } + func encodeToJSON() -> Any { + Array(self).encodeToJSON() + } } +// MARK: - Dictionary + JSONEncodable + extension Dictionary: JSONEncodable { - func encodeToJSON() -> Any { - var dictionary = [AnyHashable: Any]() - for (key, value) in self { - dictionary[key] = encodeIfPossible(value) - } - return dictionary - } + func encodeToJSON() -> Any { + var dictionary = [AnyHashable: Any]() + for (key, value) in self { + dictionary[key] = encodeIfPossible(value) + } + return dictionary + } } +// MARK: - Data + JSONEncodable + extension Data: JSONEncodable { - func encodeToJSON() -> Any { - return self.base64EncodedString(options: Data.Base64EncodingOptions()) - } + func encodeToJSON() -> Any { + base64EncodedString(options: Data.Base64EncodingOptions()) + } } +// MARK: - Date + JSONEncodable + extension Date: JSONEncodable { - func encodeToJSON() -> Any { - return CodableHelper.dateFormatter.string(from: self) - } + func encodeToJSON() -> Any { + CodableHelper.dateFormatter.string(from: self) + } } extension JSONEncodable where Self: Encodable { - func encodeToJSON() -> Any { - guard let data = try? CodableHelper.jsonEncoder.encode(self) else { - fatalError("Could not encode to json: \(self)") - } - return data.encodeToJSON() - } + func encodeToJSON() -> Any { + guard let data = try? CodableHelper.jsonEncoder.encode(self) else { + fatalError("Could not encode to json: \(self)") + } + return data.encodeToJSON() + } } -extension String: CodingKey { - - public var stringValue: String { - return self - } - - public init?(stringValue: String) { - self.init(stringLiteral: stringValue) - } +// MARK: - String + CodingKey - public var intValue: Int? { - return nil - } - - public init?(intValue: Int) { - return nil - } - -} - -extension KeyedEncodingContainerProtocol { - - public mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T: Encodable { - var arrayContainer = nestedUnkeyedContainer(forKey: key) - try arrayContainer.encode(contentsOf: values) - } - - public mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { - if let values = values { - try encodeArray(values, forKey: key) - } - } - - public mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T: Encodable { - for (key, value) in pairs { - try encode(value, forKey: key) - } - } +extension String: CodingKey { + public var stringValue: String { + self + } - public mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T: Encodable { - if let pairs = pairs { - try encodeMap(pairs) - } - } + public init?(stringValue: String) { + self.init(stringLiteral: stringValue) + } - public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws { - let decimalNumber = NSDecimalNumber(decimal: value) - let numberFormatter = NumberFormatter() - numberFormatter.numberStyle = .decimal - numberFormatter.locale = Locale(identifier: "en_US") - let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)" - try encode(formattedString, forKey: key) - } + public var intValue: Int? { + nil + } - public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws { - if let value = value { - try encode(value, forKey: key) - } - } + public init?(intValue: Int) { + nil + } } -extension KeyedDecodingContainerProtocol { - - public func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { - var tmpArray = [T]() - - var nestedContainer = try nestedUnkeyedContainer(forKey: key) - while !nestedContainer.isAtEnd { - let arrayValue = try nestedContainer.decode(T.self) - tmpArray.append(arrayValue) - } - - return tmpArray - } - - public func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { - var tmpArray: [T]? - - if contains(key) { - tmpArray = try decodeArray(T.self, forKey: key) - } - - return tmpArray - } - - public func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T: Decodable { - var map: [Self.Key: T] = [:] - - for key in allKeys { - if !excludedKeys.contains(key) { - let value = try decode(T.self, forKey: key) - map[key] = value - } - } - - return map - } - - public func decode(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal { - let stringValue = try decode(String.self, forKey: key) - guard let decimalValue = Decimal(string: stringValue) else { - let context = DecodingError.Context(codingPath: [key], debugDescription: "The key \(key) couldn't be converted to a Decimal value") - throw DecodingError.typeMismatch(type, context) - } - - return decimalValue - } - - public func decodeIfPresent(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal? { - guard let stringValue = try decodeIfPresent(String.self, forKey: key) else { - return nil - } - guard let decimalValue = Decimal(string: stringValue) else { - let context = DecodingError.Context(codingPath: [key], debugDescription: "The key \(key) couldn't be converted to a Decimal value") - throw DecodingError.typeMismatch(type, context) - } - - return decimalValue - } +public extension KeyedEncodingContainerProtocol { + mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T: Encodable { + var arrayContainer = nestedUnkeyedContainer(forKey: key) + try arrayContainer.encode(contentsOf: values) + } + + mutating func encodeArrayIfPresent(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { + if let values { + try encodeArray(values, forKey: key) + } + } + + mutating func encodeMap(_ pairs: [Self.Key: T]) throws where T: Encodable { + for (key, value) in pairs { + try encode(value, forKey: key) + } + } + + mutating func encodeMapIfPresent(_ pairs: [Self.Key: T]?) throws where T: Encodable { + if let pairs { + try encodeMap(pairs) + } + } + + mutating func encode(_ value: Decimal, forKey key: Self.Key) throws { + let decimalNumber = NSDecimalNumber(decimal: value) + let numberFormatter = NumberFormatter() + numberFormatter.numberStyle = .decimal + numberFormatter.locale = Locale(identifier: "en_US") + let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)" + try encode(formattedString, forKey: key) + } + + mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws { + if let value { + try encode(value, forKey: key) + } + } +} +public extension KeyedDecodingContainerProtocol { + func decodeArray(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { + var tmpArray = [T]() + + var nestedContainer = try nestedUnkeyedContainer(forKey: key) + while !nestedContainer.isAtEnd { + let arrayValue = try nestedContainer.decode(T.self) + tmpArray.append(arrayValue) + } + + return tmpArray + } + + func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? + + if contains(key) { + tmpArray = try decodeArray(T.self, forKey: key) + } + + return tmpArray + } + + func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] + + for key in allKeys { + if !excludedKeys.contains(key) { + let value = try decode(T.self, forKey: key) + map[key] = value + } + } + + return map + } + + func decode(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal { + let stringValue = try decode(String.self, forKey: key) + guard let decimalValue = Decimal(string: stringValue) else { + let context = DecodingError.Context( + codingPath: [key], + debugDescription: "The key \(key) couldn't be converted to a Decimal value" + ) + throw DecodingError.typeMismatch(type, context) + } + + return decimalValue + } + + func decodeIfPresent(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal? { + guard let stringValue = try decodeIfPresent(String.self, forKey: key) else { + return nil + } + guard let decimalValue = Decimal(string: stringValue) else { + let context = DecodingError.Context( + codingPath: [key], + debugDescription: "The key \(key) couldn't be converted to a Decimal value" + ) + throw DecodingError.typeMismatch(type, context) + } + + return decimalValue + } } extension HTTPURLResponse { - var isStatusCodeSuccessful: Bool { - return Configuration.successfulStatusCodeRange.contains(statusCode) - } + var isStatusCodeSuccessful: Bool { + Configuration.successfulStatusCodeRange.contains(statusCode) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONDataEncoding.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONDataEncoding.swift index cb3121a4..97ed614c 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -1,56 +1,49 @@ -// -// JSONDataEncoding.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif -public struct JSONDataEncoding { - - // MARK: Properties - - private static let jsonDataKey = "jsonData" - - // MARK: Encoding - - /// Creates a URL request by encoding parameters and applying them onto an existing request. - /// - /// - parameter urlRequest: The request to have parameters applied. - /// - parameter parameters: The parameters to apply. This should have a single key/value - /// pair with "jsonData" as the key and a Data object as the value. - /// - /// - throws: An `Error` if the encoding process encounters an error. - /// - /// - returns: The encoded request. - public func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) -> URLRequest { - var urlRequest = urlRequest - - guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { - return urlRequest - } - - if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { - urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") - } - - urlRequest.httpBody = jsonData - - return urlRequest - } - - public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? - if let jsonData = jsonData, !jsonData.isEmpty { - var params: [String: Any] = [:] - params[jsonDataKey] = jsonData - returnedParams = params - } - return returnedParams - } +// MARK: - JSONDataEncoding +public struct JSONDataEncoding { + // MARK: Properties + + private static let jsonDataKey = "jsonData" + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. This should have a single key/value + /// pair with "jsonData" as the key and a Data object as the value. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) -> URLRequest { + var urlRequest = urlRequest + + guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { + return urlRequest + } + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = jsonData + + return urlRequest + } + + public static func encodingParameters(jsonData: Data?) -> [String: Any]? { + var returnedParams: [String: Any]? + if let jsonData, !jsonData.isEmpty { + var params: [String: Any] = [:] + params[jsonDataKey] = jsonData + returnedParams = params + } + return returnedParams + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 02f78ffb..938ebbc6 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -1,45 +1,36 @@ -// -// JSONEncodingHelper.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation open class JSONEncodingHelper { - - open class func encodingParameters(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? - - // Encode the Encodable object - if let encodableObj = encodableObj { - let encodeResult = CodableHelper.encode(encodableObj) - do { - let data = try encodeResult.get() - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - } - } - - return params - } - - open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? - - if let encodableObj = encodableObj { - do { - let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) - params = JSONDataEncoding.encodingParameters(jsonData: data) - } catch { - print(error.localizedDescription) - return nil - } - } - - return params - } - + open class func encodingParameters(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? + + // Encode the Encodable object + if let encodableObj { + let encodeResult = CodableHelper.encode(encodableObj) + do { + let data = try encodeResult.get() + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error.localizedDescription) + } + } + + return params + } + + open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { + var params: [String: Any]? + + if let encodableObj { + do { + let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error.localizedDescription) + return nil + } + } + + return params + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models.swift index 4af15692..75d522bb 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models.swift @@ -1,129 +1,141 @@ -// Models.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif +// MARK: - JSONEncodable + protocol JSONEncodable { - func encodeToJSON() -> Any + func encodeToJSON() -> Any } +// MARK: - CaseIterableDefaultsLast + /// An enum where the last case value can be used as a default catch-all. protocol CaseIterableDefaultsLast: Decodable & CaseIterable & RawRepresentable -where RawValue: Decodable, AllCases: BidirectionalCollection {} + where RawValue: Decodable, AllCases: BidirectionalCollection {} extension CaseIterableDefaultsLast { - /// Initializes an enum such that if a known raw value is found, then it is decoded. - /// Otherwise the last case is used. - /// - Parameter decoder: A decoder. - public init(from decoder: Decoder) throws { - if let value = try Self(rawValue: decoder.singleValueContainer().decode(RawValue.self)) { - self = value - } else if let lastValue = Self.allCases.last { - self = lastValue - } else { - throw DecodingError.valueNotFound( - Self.Type.self, - .init(codingPath: decoder.codingPath, debugDescription: "CaseIterableDefaultsLast") - ) - } - } + /// Initializes an enum such that if a known raw value is found, then it is decoded. + /// Otherwise the last case is used. + /// - Parameter decoder: A decoder. + public init(from decoder: Decoder) throws { + if let value = try Self(rawValue: decoder.singleValueContainer().decode(RawValue.self)) { + self = value + } else if let lastValue = Self.allCases.last { + self = lastValue + } else { + throw DecodingError.valueNotFound( + Self.Type.self, + .init(codingPath: decoder.codingPath, debugDescription: "CaseIterableDefaultsLast") + ) + } + } } +// MARK: - NullEncodable + /// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`) /// or not encoded (`.encodeNothing`). Intended for request payloads. public enum NullEncodable: Hashable { - case encodeNothing - case encodeNull - case encodeValue(Wrapped) + case encodeNothing + case encodeNull + case encodeValue(Wrapped) } +// MARK: Codable + extension NullEncodable: Codable where Wrapped: Codable { - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(Wrapped.self) { - self = .encodeValue(value) - } else if container.decodeNil() { - self = .encodeNull - } else { - self = .encodeNothing - } - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .encodeNothing: return - case .encodeNull: try container.encodeNil() - case .encodeValue(let wrapped): try container.encode(wrapped) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(Wrapped.self) { + self = .encodeValue(value) + } else if container.decodeNil() { + self = .encodeNull + } else { + self = .encodeNothing + } + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case .encodeNothing: return + case .encodeNull: try container.encodeNil() + case let .encodeValue(wrapped): try container.encode(wrapped) + } + } } +// MARK: - ErrorResponse + public enum ErrorResponse: Error { - case error(Int, Data?, URLResponse?, Error) + case error(Int, Data?, URLResponse?, Error) } +// MARK: - DownloadException + public enum DownloadException: Error { - case responseDataMissing - case responseFailed - case requestMissing - case requestMissingPath - case requestMissingURL + case responseDataMissing + case responseFailed + case requestMissing + case requestMissingPath + case requestMissingURL } +// MARK: - DecodableRequestBuilderError + public enum DecodableRequestBuilderError: Error { - case emptyDataResponse - case nilHTTPResponse - case unsuccessfulHTTPStatusCode - case jsonDecoding(DecodingError) - case generalError(Error) + case emptyDataResponse + case nilHTTPResponse + case unsuccessfulHTTPStatusCode + case jsonDecoding(DecodingError) + case generalError(Error) } +// MARK: - Response + open class Response { - public let statusCode: Int - public let header: [String: String] - public let body: T - public let bodyData: Data? - - public init(statusCode: Int, header: [String: String], body: T, bodyData: Data?) { - self.statusCode = statusCode - self.header = header - self.body = body - self.bodyData = bodyData - } - - public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) { - let rawHeader = response.allHeaderFields - var responseHeader = [String: String]() - for (key, value) in rawHeader { - if let key = key.base as? String, let value = value as? String { - responseHeader[key] = value - } - } - self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData) - } + public let statusCode: Int + public let header: [String: String] + public let body: T + public let bodyData: Data? + + public init(statusCode: Int, header: [String: String], body: T, bodyData: Data?) { + self.statusCode = statusCode + self.header = header + self.body = body + self.bodyData = bodyData + } + + public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) { + let rawHeader = response.allHeaderFields + var responseHeader = [String: String]() + for (key, value) in rawHeader { + if let key = key.base as? String, let value = value as? String { + responseHeader[key] = value + } + } + self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData) + } } +// MARK: - RequestTask + public final class RequestTask: @unchecked Sendable { - private let lock = NSRecursiveLock() - private var task: URLSessionDataTaskProtocol? - - internal func set(task: URLSessionDataTaskProtocol) { - lock.lock() - defer { lock.unlock() } - self.task = task - } - - public func cancel() { - lock.lock() - defer { lock.unlock() } - task?.cancel() - task = nil - } + private let lock = NSRecursiveLock() + private var task: URLSessionDataTaskProtocol? + + func set(task: URLSessionDataTaskProtocol) { + lock.lock() + defer { lock.unlock() } + self.task = task + } + + public func cancel() { + lock.lock() + defer { lock.unlock() } + task?.cancel() + task = nil + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsAttributes.swift index 24b74f5c..0fbf14d1 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsAttributes.swift @@ -1,112 +1,123 @@ -// -// AlbumsAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - AlbumsAttributes + public struct AlbumsAttributes: Codable, Hashable { + public enum Availability: String, Codable, CaseIterable { + case stream = "STREAM" + case dj = "DJ" + case stem = "STEM" + } - public enum Availability: String, Codable, CaseIterable { - case stream = "STREAM" - case dj = "DJ" - case stem = "STEM" - } - public enum ModelType: String, Codable, CaseIterable { - case album = "ALBUM" - case ep = "EP" - case single = "SINGLE" - } - /** Original title */ - public var title: String - /** Barcode id (EAN-13 or UPC-A) */ - public var barcodeId: String - /** Number of volumes */ - public var numberOfVolumes: Int - /** Number of album items */ - public var numberOfItems: Int - /** Duration (ISO-8601) */ - public var duration: String - /** Indicates whether an album consist of any explicit content */ - public var explicit: Bool - /** Release date (ISO-8601) */ - public var releaseDate: Date? - /** Copyright information */ - public var copyright: String? - /** Album popularity (ranged in 0.00 ... 1.00). Conditionally visible */ - public var popularity: Double - /** Defines an album availability e.g. for streaming, DJs, stems */ - public var availability: [Availability]? - public var mediaTags: [String] - /** Represents available links to, and metadata about, an album cover images */ - public var imageLinks: [CatalogueItemImageLink]? - /** Represents available links to, and metadata about, an album cover videos */ - public var videoLinks: [CatalogueItemVideoLink]? - /** Represents available links to something that is related to an album resource, but external to the TIDAL API */ - public var externalLinks: [CatalogueItemExternalLink]? - /** Album type, e.g. single, regular album, or extended play */ - public var type: ModelType + public enum ModelType: String, Codable, CaseIterable { + case album = "ALBUM" + case ep = "EP" + case single = "SINGLE" + } - public init(title: String, barcodeId: String, numberOfVolumes: Int, numberOfItems: Int, duration: String, explicit: Bool, releaseDate: Date? = nil, copyright: String? = nil, popularity: Double, availability: [Availability]? = nil, mediaTags: [String], imageLinks: [CatalogueItemImageLink]? = nil, videoLinks: [CatalogueItemVideoLink]? = nil, externalLinks: [CatalogueItemExternalLink]? = nil, type: ModelType) { - self.title = title - self.barcodeId = barcodeId - self.numberOfVolumes = numberOfVolumes - self.numberOfItems = numberOfItems - self.duration = duration - self.explicit = explicit - self.releaseDate = releaseDate - self.copyright = copyright - self.popularity = popularity - self.availability = availability - self.mediaTags = mediaTags - self.imageLinks = imageLinks - self.videoLinks = videoLinks - self.externalLinks = externalLinks - self.type = type - } + /// Original title + public var title: String + /// Barcode id (EAN-13 or UPC-A) + public var barcodeId: String + /// Number of volumes + public var numberOfVolumes: Int + /// Number of album items + public var numberOfItems: Int + /// Duration (ISO-8601) + public var duration: String + /// Indicates whether an album consist of any explicit content + public var explicit: Bool + /// Release date (ISO-8601) + public var releaseDate: Date? + /// Copyright information + public var copyright: String? + /// Album popularity (ranged in 0.00 ... 1.00). Conditionally visible + public var popularity: Double + /// Defines an album availability e.g. for streaming, DJs, stems + public var availability: [Availability]? + public var mediaTags: [String] + /// Represents available links to, and metadata about, an album cover images + public var imageLinks: [CatalogueItemImageLink]? + /// Represents available links to, and metadata about, an album cover videos + public var videoLinks: [CatalogueItemVideoLink]? + /// Represents available links to something that is related to an album resource, but external to the TIDAL API + public var externalLinks: [CatalogueItemExternalLink]? + /// Album type, e.g. single, regular album, or extended play + public var type: ModelType - public enum CodingKeys: String, CodingKey, CaseIterable { - case title - case barcodeId - case numberOfVolumes - case numberOfItems - case duration - case explicit - case releaseDate - case copyright - case popularity - case availability - case mediaTags - case imageLinks - case videoLinks - case externalLinks - case type - } + public init( + title: String, + barcodeId: String, + numberOfVolumes: Int, + numberOfItems: Int, + duration: String, + explicit: Bool, + releaseDate: Date? = nil, + copyright: String? = nil, + popularity: Double, + availability: [Availability]? = nil, + mediaTags: [String], + imageLinks: [CatalogueItemImageLink]? = nil, + videoLinks: [CatalogueItemVideoLink]? = nil, + externalLinks: [CatalogueItemExternalLink]? = nil, + type: ModelType + ) { + self.title = title + self.barcodeId = barcodeId + self.numberOfVolumes = numberOfVolumes + self.numberOfItems = numberOfItems + self.duration = duration + self.explicit = explicit + self.releaseDate = releaseDate + self.copyright = copyright + self.popularity = popularity + self.availability = availability + self.mediaTags = mediaTags + self.imageLinks = imageLinks + self.videoLinks = videoLinks + self.externalLinks = externalLinks + self.type = type + } - // Encodable protocol methods + public enum CodingKeys: String, CodingKey, CaseIterable { + case title + case barcodeId + case numberOfVolumes + case numberOfItems + case duration + case explicit + case releaseDate + case copyright + case popularity + case availability + case mediaTags + case imageLinks + case videoLinks + case externalLinks + case type + } - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(title, forKey: .title) - try container.encode(barcodeId, forKey: .barcodeId) - try container.encode(numberOfVolumes, forKey: .numberOfVolumes) - try container.encode(numberOfItems, forKey: .numberOfItems) - try container.encode(duration, forKey: .duration) - try container.encode(explicit, forKey: .explicit) - try container.encodeIfPresent(releaseDate, forKey: .releaseDate) - try container.encodeIfPresent(copyright, forKey: .copyright) - try container.encode(popularity, forKey: .popularity) - try container.encodeIfPresent(availability, forKey: .availability) - try container.encode(mediaTags, forKey: .mediaTags) - try container.encodeIfPresent(imageLinks, forKey: .imageLinks) - try container.encodeIfPresent(videoLinks, forKey: .videoLinks) - try container.encodeIfPresent(externalLinks, forKey: .externalLinks) - try container.encode(type, forKey: .type) - } -} + // Encodable protocol methods + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(title, forKey: .title) + try container.encode(barcodeId, forKey: .barcodeId) + try container.encode(numberOfVolumes, forKey: .numberOfVolumes) + try container.encode(numberOfItems, forKey: .numberOfItems) + try container.encode(duration, forKey: .duration) + try container.encode(explicit, forKey: .explicit) + try container.encodeIfPresent(releaseDate, forKey: .releaseDate) + try container.encodeIfPresent(copyright, forKey: .copyright) + try container.encode(popularity, forKey: .popularity) + try container.encodeIfPresent(availability, forKey: .availability) + try container.encode(mediaTags, forKey: .mediaTags) + try container.encodeIfPresent(imageLinks, forKey: .imageLinks) + try container.encodeIfPresent(videoLinks, forKey: .videoLinks) + try container.encodeIfPresent(externalLinks, forKey: .externalLinks) + try container.encode(type, forKey: .type) + } +} diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsMultiDataRelationshipDocument.swift index 08bee147..8588c45c 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsMultiDataRelationshipDocument.swift @@ -1,36 +1,29 @@ -// -// AlbumsItemsMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct AlbumsItemsMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [AlbumsItemsResourceIdentifier]? - public var links: Links? - - public init(data: [AlbumsItemsResourceIdentifier]? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - AlbumsItemsMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct AlbumsItemsMultiDataRelationshipDocument: Codable, Hashable { + public var data: [AlbumsItemsResourceIdentifier]? + public var links: Links? + + public init(data: [AlbumsItemsResourceIdentifier]? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifier.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifier.swift index f11841b0..3b8ee7c4 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifier.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifier.swift @@ -1,43 +1,36 @@ -// -// AlbumsItemsResourceIdentifier.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Resource identifier JSON:API object */ -public struct AlbumsItemsResourceIdentifier: Codable, Hashable { - - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - public var meta: AlbumsItemsResourceIdentifierMeta? - - public init(id: String, type: String, meta: AlbumsItemsResourceIdentifierMeta? = nil) { - self.id = id - self.type = type - self.meta = meta - } +// MARK: - AlbumsItemsResourceIdentifier - public enum CodingKeys: String, CodingKey, CaseIterable { - case id - case type - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - try container.encodeIfPresent(meta, forKey: .meta) - } +/// Resource identifier JSON:API object +public struct AlbumsItemsResourceIdentifier: Codable, Hashable { + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + public var meta: AlbumsItemsResourceIdentifierMeta? + + public init(id: String, type: String, meta: AlbumsItemsResourceIdentifierMeta? = nil) { + self.id = id + self.type = type + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case type + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + try container.encodeIfPresent(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifierMeta.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifierMeta.swift index 61a47ea0..20f85ddb 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifierMeta.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsItemsResourceIdentifierMeta.swift @@ -1,38 +1,31 @@ -// -// AlbumsItemsResourceIdentifierMeta.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct AlbumsItemsResourceIdentifierMeta: Codable, Hashable { - - /** volume number */ - public var volumeNumber: Int - /** track number */ - public var trackNumber: Int - - public init(volumeNumber: Int, trackNumber: Int) { - self.volumeNumber = volumeNumber - self.trackNumber = trackNumber - } +// MARK: - AlbumsItemsResourceIdentifierMeta - public enum CodingKeys: String, CodingKey, CaseIterable { - case volumeNumber - case trackNumber - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(volumeNumber, forKey: .volumeNumber) - try container.encode(trackNumber, forKey: .trackNumber) - } +public struct AlbumsItemsResourceIdentifierMeta: Codable, Hashable { + /// volume number + public var volumeNumber: Int + /// track number + public var trackNumber: Int + + public init(volumeNumber: Int, trackNumber: Int) { + self.volumeNumber = volumeNumber + self.trackNumber = trackNumber + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case volumeNumber + case trackNumber + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(volumeNumber, forKey: .volumeNumber) + try container.encode(trackNumber, forKey: .trackNumber) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataDocument.swift index bba688a8..0c2d1254 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataDocument.swift @@ -1,40 +1,33 @@ -// -// AlbumsMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct AlbumsMultiDataDocument: Codable, Hashable { - - public var data: [AlbumsResource]? - public var links: Links? - public var included: [AlbumsSingleDataDocumentIncludedInner]? - - public init(data: [AlbumsResource]? = nil, links: Links? = nil, included: [AlbumsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - AlbumsMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct AlbumsMultiDataDocument: Codable, Hashable { + public var data: [AlbumsResource]? + public var links: Links? + public var included: [AlbumsSingleDataDocumentIncludedInner]? + + public init(data: [AlbumsResource]? = nil, links: Links? = nil, included: [AlbumsSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataRelationshipDocument.swift index 45d5c6a6..5b06938a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// AlbumsMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct AlbumsMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [AlbumsSingleDataDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [AlbumsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - AlbumsMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct AlbumsMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [AlbumsSingleDataDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [AlbumsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsRelationships.swift index b84ccfe4..8c3cfb33 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsRelationships.swift @@ -1,44 +1,42 @@ -// -// AlbumsRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct AlbumsRelationships: Codable, Hashable { - - public var artists: MultiDataRelationshipDoc - public var similarAlbums: MultiDataRelationshipDoc - public var items: AlbumsItemsMultiDataRelationshipDocument - public var providers: MultiDataRelationshipDoc - - public init(artists: MultiDataRelationshipDoc, similarAlbums: MultiDataRelationshipDoc, items: AlbumsItemsMultiDataRelationshipDocument, providers: MultiDataRelationshipDoc) { - self.artists = artists - self.similarAlbums = similarAlbums - self.items = items - self.providers = providers - } +// MARK: - AlbumsRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case artists - case similarAlbums - case items - case providers - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(artists, forKey: .artists) - try container.encode(similarAlbums, forKey: .similarAlbums) - try container.encode(items, forKey: .items) - try container.encode(providers, forKey: .providers) - } +public struct AlbumsRelationships: Codable, Hashable { + public var artists: MultiDataRelationshipDoc + public var similarAlbums: MultiDataRelationshipDoc + public var items: AlbumsItemsMultiDataRelationshipDocument + public var providers: MultiDataRelationshipDoc + + public init( + artists: MultiDataRelationshipDoc, + similarAlbums: MultiDataRelationshipDoc, + items: AlbumsItemsMultiDataRelationshipDocument, + providers: MultiDataRelationshipDoc + ) { + self.artists = artists + self.similarAlbums = similarAlbums + self.items = items + self.providers = providers + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case artists + case similarAlbums + case items + case providers + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(artists, forKey: .artists) + try container.encode(similarAlbums, forKey: .similarAlbums) + try container.encode(items, forKey: .items) + try container.encode(providers, forKey: .providers) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsResource.swift index 73ffa39e..5562a77e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsResource.swift @@ -1,50 +1,49 @@ -// -// AlbumsResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct AlbumsResource: Codable, Hashable { - - public var attributes: AlbumsAttributes? - public var relationships: AlbumsRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: AlbumsAttributes? = nil, relationships: AlbumsRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - AlbumsResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct AlbumsResource: Codable, Hashable { + public var attributes: AlbumsAttributes? + public var relationships: AlbumsRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: AlbumsAttributes? = nil, + relationships: AlbumsRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocument.swift index b0c135d8..e59eec95 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocument.swift @@ -1,40 +1,33 @@ -// -// AlbumsSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct AlbumsSingleDataDocument: Codable, Hashable { - - public var data: AlbumsResource? - public var links: Links? - public var included: [AlbumsSingleDataDocumentIncludedInner]? - - public init(data: AlbumsResource? = nil, links: Links? = nil, included: [AlbumsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - AlbumsSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct AlbumsSingleDataDocument: Codable, Hashable { + public var data: AlbumsResource? + public var links: Links? + public var included: [AlbumsSingleDataDocumentIncludedInner]? + + public init(data: AlbumsResource? = nil, links: Links? = nil, included: [AlbumsSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocumentIncludedInner.swift index 1cd8ebd2..a6f277be 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/AlbumsSingleDataDocumentIncludedInner.swift @@ -1,53 +1,53 @@ -// -// AlbumsSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - AlbumsSingleDataDocumentIncludedInner + public enum AlbumsSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typeProvidersResource(ProvidersResource) - case typeTracksResource(TracksResource) - case typeVideosResource(VideosResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typeProvidersResource(ProvidersResource) + case typeTracksResource(TracksResource) + case typeVideosResource(VideosResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typeProvidersResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeVideosResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typeProvidersResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeVideosResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(ProvidersResource.self) { - self = .typeProvidersResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(VideosResource.self) { - self = .typeVideosResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of AlbumsSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(ProvidersResource.self) { + self = .typeProvidersResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(VideosResource.self) { + self = .typeVideosResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of AlbumsSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistRole.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistRole.swift index 4a15a8a8..ad7c00a7 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistRole.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistRole.swift @@ -1,36 +1,29 @@ -// -// ArtistRole.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistRole: Codable, Hashable { - - public var id: String? - public var name: String? - - public init(id: String? = nil, name: String? = nil) { - self.id = id - self.name = name - } +// MARK: - ArtistRole - public enum CodingKeys: String, CodingKey, CaseIterable { - case id - case name - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(id, forKey: .id) - try container.encodeIfPresent(name, forKey: .name) - } +public struct ArtistRole: Codable, Hashable { + public var id: String? + public var name: String? + + public init(id: String? = nil, name: String? = nil) { + self.id = id + self.name = name + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case name + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(id, forKey: .id) + try container.encodeIfPresent(name, forKey: .name) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsAttributes.swift index a1662f10..aa76dc1a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsAttributes.swift @@ -1,53 +1,52 @@ -// -// ArtistsAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsAttributes: Codable, Hashable { - - /** Artist name */ - public var name: String - /** Artist popularity (ranged in 0.00 ... 1.00). Conditionally visible */ - public var popularity: Double - /** Represents available links to, and metadata about, an artist images */ - public var imageLinks: [CatalogueItemImageLink]? - /** Represents available links to something that is related to an artist resource, but external to the TIDAL API */ - public var externalLinks: [CatalogueItemExternalLink]? - /** Artist roles */ - public var roles: [ArtistRole]? - - public init(name: String, popularity: Double, imageLinks: [CatalogueItemImageLink]? = nil, externalLinks: [CatalogueItemExternalLink]? = nil, roles: [ArtistRole]? = nil) { - self.name = name - self.popularity = popularity - self.imageLinks = imageLinks - self.externalLinks = externalLinks - self.roles = roles - } +// MARK: - ArtistsAttributes - public enum CodingKeys: String, CodingKey, CaseIterable { - case name - case popularity - case imageLinks - case externalLinks - case roles - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(name, forKey: .name) - try container.encode(popularity, forKey: .popularity) - try container.encodeIfPresent(imageLinks, forKey: .imageLinks) - try container.encodeIfPresent(externalLinks, forKey: .externalLinks) - try container.encodeIfPresent(roles, forKey: .roles) - } +public struct ArtistsAttributes: Codable, Hashable { + /// Artist name + public var name: String + /// Artist popularity (ranged in 0.00 ... 1.00). Conditionally visible + public var popularity: Double + /// Represents available links to, and metadata about, an artist images + public var imageLinks: [CatalogueItemImageLink]? + /// Represents available links to something that is related to an artist resource, but external to the TIDAL API + public var externalLinks: [CatalogueItemExternalLink]? + /// Artist roles + public var roles: [ArtistRole]? + + public init( + name: String, + popularity: Double, + imageLinks: [CatalogueItemImageLink]? = nil, + externalLinks: [CatalogueItemExternalLink]? = nil, + roles: [ArtistRole]? = nil + ) { + self.name = name + self.popularity = popularity + self.imageLinks = imageLinks + self.externalLinks = externalLinks + self.roles = roles + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case name + case popularity + case imageLinks + case externalLinks + case roles + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(name, forKey: .name) + try container.encode(popularity, forKey: .popularity) + try container.encodeIfPresent(imageLinks, forKey: .imageLinks) + try container.encodeIfPresent(externalLinks, forKey: .externalLinks) + try container.encodeIfPresent(roles, forKey: .roles) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataDocument.swift index a38136ac..36c6c60c 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataDocument.swift @@ -1,40 +1,33 @@ -// -// ArtistsMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsMultiDataDocument: Codable, Hashable { - - public var data: [ArtistsResource]? - public var links: Links? - public var included: [ArtistsSingleDataDocumentIncludedInner]? - - public init(data: [ArtistsResource]? = nil, links: Links? = nil, included: [ArtistsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - ArtistsMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct ArtistsMultiDataDocument: Codable, Hashable { + public var data: [ArtistsResource]? + public var links: Links? + public var included: [ArtistsSingleDataDocumentIncludedInner]? + + public init(data: [ArtistsResource]? = nil, links: Links? = nil, included: [ArtistsSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataRelationshipDocument.swift index f575d713..0d0457a5 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// ArtistsMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [ArtistsSingleDataDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [ArtistsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - ArtistsMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct ArtistsMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [ArtistsSingleDataDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [ArtistsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsRelationships.swift index 27710543..29dbcad8 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsRelationships.swift @@ -1,52 +1,52 @@ -// -// ArtistsRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsRelationships: Codable, Hashable { - - public var similarArtists: MultiDataRelationshipDoc - public var albums: MultiDataRelationshipDoc - public var videos: MultiDataRelationshipDoc - public var trackProviders: ArtistsTrackProvidersMultiDataRelationshipDocument - public var tracks: MultiDataRelationshipDoc - public var radio: MultiDataRelationshipDoc - - public init(similarArtists: MultiDataRelationshipDoc, albums: MultiDataRelationshipDoc, videos: MultiDataRelationshipDoc, trackProviders: ArtistsTrackProvidersMultiDataRelationshipDocument, tracks: MultiDataRelationshipDoc, radio: MultiDataRelationshipDoc) { - self.similarArtists = similarArtists - self.albums = albums - self.videos = videos - self.trackProviders = trackProviders - self.tracks = tracks - self.radio = radio - } +// MARK: - ArtistsRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case similarArtists - case albums - case videos - case trackProviders - case tracks - case radio - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(similarArtists, forKey: .similarArtists) - try container.encode(albums, forKey: .albums) - try container.encode(videos, forKey: .videos) - try container.encode(trackProviders, forKey: .trackProviders) - try container.encode(tracks, forKey: .tracks) - try container.encode(radio, forKey: .radio) - } +public struct ArtistsRelationships: Codable, Hashable { + public var similarArtists: MultiDataRelationshipDoc + public var albums: MultiDataRelationshipDoc + public var videos: MultiDataRelationshipDoc + public var trackProviders: ArtistsTrackProvidersMultiDataRelationshipDocument + public var tracks: MultiDataRelationshipDoc + public var radio: MultiDataRelationshipDoc + + public init( + similarArtists: MultiDataRelationshipDoc, + albums: MultiDataRelationshipDoc, + videos: MultiDataRelationshipDoc, + trackProviders: ArtistsTrackProvidersMultiDataRelationshipDocument, + tracks: MultiDataRelationshipDoc, + radio: MultiDataRelationshipDoc + ) { + self.similarArtists = similarArtists + self.albums = albums + self.videos = videos + self.trackProviders = trackProviders + self.tracks = tracks + self.radio = radio + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case similarArtists + case albums + case videos + case trackProviders + case tracks + case radio + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(similarArtists, forKey: .similarArtists) + try container.encode(albums, forKey: .albums) + try container.encode(videos, forKey: .videos) + try container.encode(trackProviders, forKey: .trackProviders) + try container.encode(tracks, forKey: .tracks) + try container.encode(radio, forKey: .radio) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsResource.swift index 99b9fc11..1b12405e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsResource.swift @@ -1,50 +1,49 @@ -// -// ArtistsResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsResource: Codable, Hashable { - - public var attributes: ArtistsAttributes? - public var relationships: ArtistsRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: ArtistsAttributes? = nil, relationships: ArtistsRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - ArtistsResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct ArtistsResource: Codable, Hashable { + public var attributes: ArtistsAttributes? + public var relationships: ArtistsRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: ArtistsAttributes? = nil, + relationships: ArtistsRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocument.swift index 75511ba2..b78bf6af 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocument.swift @@ -1,40 +1,33 @@ -// -// ArtistsSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsSingleDataDocument: Codable, Hashable { - - public var data: ArtistsResource? - public var links: Links? - public var included: [ArtistsSingleDataDocumentIncludedInner]? - - public init(data: ArtistsResource? = nil, links: Links? = nil, included: [ArtistsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - ArtistsSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct ArtistsSingleDataDocument: Codable, Hashable { + public var data: ArtistsResource? + public var links: Links? + public var included: [ArtistsSingleDataDocumentIncludedInner]? + + public init(data: ArtistsResource? = nil, links: Links? = nil, included: [ArtistsSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocumentIncludedInner.swift index a9d940a7..2667bf17 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsSingleDataDocumentIncludedInner.swift @@ -1,58 +1,58 @@ -// -// ArtistsSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - ArtistsSingleDataDocumentIncludedInner + public enum ArtistsSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typePlaylistsResource(PlaylistsResource) - case typeProvidersResource(ProvidersResource) - case typeTracksResource(TracksResource) - case typeVideosResource(VideosResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typePlaylistsResource(PlaylistsResource) + case typeProvidersResource(ProvidersResource) + case typeTracksResource(TracksResource) + case typeVideosResource(VideosResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeProvidersResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeVideosResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeProvidersResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeVideosResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(ProvidersResource.self) { - self = .typeProvidersResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(VideosResource.self) { - self = .typeVideosResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of ArtistsSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(ProvidersResource.self) { + self = .typeProvidersResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(VideosResource.self) { + self = .typeVideosResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of ArtistsSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersMultiDataRelationshipDocument.swift index aa625c39..4598015f 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersMultiDataRelationshipDocument.swift @@ -1,36 +1,29 @@ -// -// ArtistsTrackProvidersMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsTrackProvidersMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ArtistsTrackProvidersResourceIdentifier]? - public var links: Links? - - public init(data: [ArtistsTrackProvidersResourceIdentifier]? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - ArtistsTrackProvidersMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct ArtistsTrackProvidersMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ArtistsTrackProvidersResourceIdentifier]? + public var links: Links? + + public init(data: [ArtistsTrackProvidersResourceIdentifier]? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifier.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifier.swift index c6f5edb3..85339e82 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifier.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifier.swift @@ -1,43 +1,36 @@ -// -// ArtistsTrackProvidersResourceIdentifier.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Resource identifier JSON:API object */ -public struct ArtistsTrackProvidersResourceIdentifier: Codable, Hashable { - - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - public var meta: ArtistsTrackProvidersResourceIdentifierMeta? - - public init(id: String, type: String, meta: ArtistsTrackProvidersResourceIdentifierMeta? = nil) { - self.id = id - self.type = type - self.meta = meta - } +// MARK: - ArtistsTrackProvidersResourceIdentifier - public enum CodingKeys: String, CodingKey, CaseIterable { - case id - case type - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - try container.encodeIfPresent(meta, forKey: .meta) - } +/// Resource identifier JSON:API object +public struct ArtistsTrackProvidersResourceIdentifier: Codable, Hashable { + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + public var meta: ArtistsTrackProvidersResourceIdentifierMeta? + + public init(id: String, type: String, meta: ArtistsTrackProvidersResourceIdentifierMeta? = nil) { + self.id = id + self.type = type + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case type + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + try container.encodeIfPresent(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifierMeta.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifierMeta.swift index 1221e8f8..0491a4bb 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifierMeta.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ArtistsTrackProvidersResourceIdentifierMeta.swift @@ -1,33 +1,26 @@ -// -// ArtistsTrackProvidersResourceIdentifierMeta.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ArtistsTrackProvidersResourceIdentifierMeta: Codable, Hashable { +// MARK: - ArtistsTrackProvidersResourceIdentifierMeta - /** total number of tracks released together with the provider */ - public var numberOfTracks: Int64 +public struct ArtistsTrackProvidersResourceIdentifierMeta: Codable, Hashable { + /// total number of tracks released together with the provider + public var numberOfTracks: Int64 - public init(numberOfTracks: Int64) { - self.numberOfTracks = numberOfTracks - } + public init(numberOfTracks: Int64) { + self.numberOfTracks = numberOfTracks + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case numberOfTracks - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case numberOfTracks + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(numberOfTracks, forKey: .numberOfTracks) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(numberOfTracks, forKey: .numberOfTracks) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemExternalLink.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemExternalLink.swift index c41a6653..0860946a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemExternalLink.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemExternalLink.swift @@ -1,37 +1,30 @@ -// -// CatalogueItemExternalLink.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct CatalogueItemExternalLink: Codable, Hashable { - - /** link to something that is related to a resource */ - public var href: String - public var meta: ExternalLinkMeta - - public init(href: String, meta: ExternalLinkMeta) { - self.href = href - self.meta = meta - } +// MARK: - CatalogueItemExternalLink - public enum CodingKeys: String, CodingKey, CaseIterable { - case href - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(href, forKey: .href) - try container.encode(meta, forKey: .meta) - } +public struct CatalogueItemExternalLink: Codable, Hashable { + /// link to something that is related to a resource + public var href: String + public var meta: ExternalLinkMeta + + public init(href: String, meta: ExternalLinkMeta) { + self.href = href + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case href + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(href, forKey: .href) + try container.encode(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemImageLink.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemImageLink.swift index f2ce74bb..e34667b5 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemImageLink.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemImageLink.swift @@ -1,37 +1,30 @@ -// -// CatalogueItemImageLink.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct CatalogueItemImageLink: Codable, Hashable { - - /** link to an image */ - public var href: String - public var meta: ImageLinkMeta - - public init(href: String, meta: ImageLinkMeta) { - self.href = href - self.meta = meta - } +// MARK: - CatalogueItemImageLink - public enum CodingKeys: String, CodingKey, CaseIterable { - case href - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(href, forKey: .href) - try container.encode(meta, forKey: .meta) - } +public struct CatalogueItemImageLink: Codable, Hashable { + /// link to an image + public var href: String + public var meta: ImageLinkMeta + + public init(href: String, meta: ImageLinkMeta) { + self.href = href + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case href + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(href, forKey: .href) + try container.encode(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemVideoLink.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemVideoLink.swift index c5aca805..d7796544 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemVideoLink.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/CatalogueItemVideoLink.swift @@ -1,37 +1,30 @@ -// -// CatalogueItemVideoLink.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct CatalogueItemVideoLink: Codable, Hashable { - - /** link to a video */ - public var href: String - public var meta: VideoLinkMeta - - public init(href: String, meta: VideoLinkMeta) { - self.href = href - self.meta = meta - } +// MARK: - CatalogueItemVideoLink - public enum CodingKeys: String, CodingKey, CaseIterable { - case href - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(href, forKey: .href) - try container.encode(meta, forKey: .meta) - } +public struct CatalogueItemVideoLink: Codable, Hashable { + /// link to a video + public var href: String + public var meta: VideoLinkMeta + + public init(href: String, meta: VideoLinkMeta) { + self.href = href + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case href + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(href, forKey: .href) + try container.encode(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorDocument.swift index 5344faa9..91fcb7b6 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorDocument.swift @@ -1,38 +1,31 @@ -// -// ErrorDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** JSON:API error document object */ -public struct ErrorDocument: Codable, Hashable { - - /** array of error objects */ - public var errors: [ErrorObject]? - public var links: Links? - - public init(errors: [ErrorObject]? = nil, links: Links? = nil) { - self.errors = errors - self.links = links - } +// MARK: - ErrorDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case errors - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(errors, forKey: .errors) - try container.encodeIfPresent(links, forKey: .links) - } +/// JSON:API error document object +public struct ErrorDocument: Codable, Hashable { + /// array of error objects + public var errors: [ErrorObject]? + public var links: Links? + + public init(errors: [ErrorObject]? = nil, links: Links? = nil) { + self.errors = errors + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case errors + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(errors, forKey: .errors) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObject.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObject.swift index 4789a44b..a3754479 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObject.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObject.swift @@ -1,53 +1,52 @@ -// -// ErrorObject.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** JSON:API error object */ -public struct ErrorObject: Codable, Hashable { - - /** unique identifier for this particular occurrence of the problem */ - public var id: String? - /** HTTP status code applicable to this problem */ - public var status: String? - /** application-specific error code */ - public var code: String? - /** human-readable explanation specific to this occurrence of the problem */ - public var detail: String? - public var source: ErrorObjectSource? - - public init(id: String? = nil, status: String? = nil, code: String? = nil, detail: String? = nil, source: ErrorObjectSource? = nil) { - self.id = id - self.status = status - self.code = code - self.detail = detail - self.source = source - } +// MARK: - ErrorObject - public enum CodingKeys: String, CodingKey, CaseIterable { - case id - case status - case code - case detail - case source - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(id, forKey: .id) - try container.encodeIfPresent(status, forKey: .status) - try container.encodeIfPresent(code, forKey: .code) - try container.encodeIfPresent(detail, forKey: .detail) - try container.encodeIfPresent(source, forKey: .source) - } +/// JSON:API error object +public struct ErrorObject: Codable, Hashable { + /// unique identifier for this particular occurrence of the problem + public var id: String? + /// HTTP status code applicable to this problem + public var status: String? + /// application-specific error code + public var code: String? + /// human-readable explanation specific to this occurrence of the problem + public var detail: String? + public var source: ErrorObjectSource? + + public init( + id: String? = nil, + status: String? = nil, + code: String? = nil, + detail: String? = nil, + source: ErrorObjectSource? = nil + ) { + self.id = id + self.status = status + self.code = code + self.detail = detail + self.source = source + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case status + case code + case detail + case source + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(id, forKey: .id) + try container.encodeIfPresent(status, forKey: .status) + try container.encodeIfPresent(code, forKey: .code) + try container.encodeIfPresent(detail, forKey: .detail) + try container.encodeIfPresent(source, forKey: .source) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObjectSource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObjectSource.swift index d820ffb9..83d8191d 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObjectSource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ErrorObjectSource.swift @@ -1,44 +1,37 @@ -// -// ErrorObjectSource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** object containing references to the primary source of the error */ -public struct ErrorObjectSource: Codable, Hashable { - - /** a JSON Pointer [RFC6901] to the value in the request document that caused the error */ - public var pointer: String? - /** string indicating which URI query parameter caused the error. */ - public var parameter: String? - /** string indicating the name of a single request header which caused the error */ - public var header: String? - - public init(pointer: String? = nil, parameter: String? = nil, header: String? = nil) { - self.pointer = pointer - self.parameter = parameter - self.header = header - } +// MARK: - ErrorObjectSource - public enum CodingKeys: String, CodingKey, CaseIterable { - case pointer - case parameter - case header - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(pointer, forKey: .pointer) - try container.encodeIfPresent(parameter, forKey: .parameter) - try container.encodeIfPresent(header, forKey: .header) - } +/// object containing references to the primary source of the error +public struct ErrorObjectSource: Codable, Hashable { + /// a JSON Pointer [RFC6901] to the value in the request document that caused the error + public var pointer: String? + /// string indicating which URI query parameter caused the error. + public var parameter: String? + /// string indicating the name of a single request header which caused the error + public var header: String? + + public init(pointer: String? = nil, parameter: String? = nil, header: String? = nil) { + self.pointer = pointer + self.parameter = parameter + self.header = header + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case pointer + case parameter + case header + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(pointer, forKey: .pointer) + try container.encodeIfPresent(parameter, forKey: .parameter) + try container.encodeIfPresent(header, forKey: .header) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ExternalLinkMeta.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ExternalLinkMeta.swift index f9f6af4c..284066e6 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ExternalLinkMeta.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ExternalLinkMeta.swift @@ -1,46 +1,40 @@ -// -// ExternalLinkMeta.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** metadata about an external link */ -public struct ExternalLinkMeta: Codable, Hashable { - - public enum ModelType: String, Codable, CaseIterable { - case tidalSharing = "TIDAL_SHARING" - case tidalAutoplayAndroid = "TIDAL_AUTOPLAY_ANDROID" - case tidalAutoplayIos = "TIDAL_AUTOPLAY_IOS" - case tidalAutoplayWeb = "TIDAL_AUTOPLAY_WEB" - case twitter = "TWITTER" - case facebook = "FACEBOOK" - case instagram = "INSTAGRAM" - case tiktok = "TIKTOK" - case snapchat = "SNAPCHAT" - case homepage = "HOMEPAGE" - } - /** external link type */ - public var type: ModelType - - public init(type: ModelType) { - self.type = type - } +// MARK: - ExternalLinkMeta - public enum CodingKeys: String, CodingKey, CaseIterable { - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(type, forKey: .type) - } +/// metadata about an external link +public struct ExternalLinkMeta: Codable, Hashable { + public enum ModelType: String, Codable, CaseIterable { + case tidalSharing = "TIDAL_SHARING" + case tidalAutoplayAndroid = "TIDAL_AUTOPLAY_ANDROID" + case tidalAutoplayIos = "TIDAL_AUTOPLAY_IOS" + case tidalAutoplayWeb = "TIDAL_AUTOPLAY_WEB" + case twitter = "TWITTER" + case facebook = "FACEBOOK" + case instagram = "INSTAGRAM" + case tiktok = "TIKTOK" + case snapchat = "SNAPCHAT" + case homepage = "HOMEPAGE" + } + + /// external link type + public var type: ModelType + + public init(type: ModelType) { + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ImageLinkMeta.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ImageLinkMeta.swift index 9c332211..d84a0536 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ImageLinkMeta.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ImageLinkMeta.swift @@ -1,39 +1,32 @@ -// -// ImageLinkMeta.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** metadata about an image */ -public struct ImageLinkMeta: Codable, Hashable { - - /** image width (in pixels) */ - public var width: Int - /** image height (in pixels) */ - public var height: Int - - public init(width: Int, height: Int) { - self.width = width - self.height = height - } +// MARK: - ImageLinkMeta - public enum CodingKeys: String, CodingKey, CaseIterable { - case width - case height - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(width, forKey: .width) - try container.encode(height, forKey: .height) - } +/// metadata about an image +public struct ImageLinkMeta: Codable, Hashable { + /// image width (in pixels) + public var width: Int + /// image height (in pixels) + public var height: Int + + public init(width: Int, height: Int) { + self.width = width + self.height = height + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case width + case height + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(width, forKey: .width) + try container.encode(height, forKey: .height) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/Links.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/Links.swift index 475c6a11..573ccdef 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/Links.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/Links.swift @@ -1,39 +1,32 @@ -// -// Links.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Links JSON:API object */ -public struct Links: Codable, Hashable { - - /** the link that generated the current response document */ - public var _self: String - /** the next page of data (pagination) */ - public var next: String? - - public init(_self: String, next: String? = nil) { - self._self = _self - self.next = next - } +// MARK: - Links - public enum CodingKeys: String, CodingKey, CaseIterable { - case _self = "self" - case next - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(_self, forKey: ._self) - try container.encodeIfPresent(next, forKey: .next) - } +/// Links JSON:API object +public struct Links: Codable, Hashable { + /// the link that generated the current response document + public var _self: String + /// the next page of data (pagination) + public var next: String? + + public init(_self: String, next: String? = nil) { + self._self = _self + self.next = next + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case _self = "self" + case next + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(_self, forKey: ._self) + try container.encodeIfPresent(next, forKey: .next) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/MultiDataRelationshipDoc.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/MultiDataRelationshipDoc.swift index 687e5482..03bf4b2d 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/MultiDataRelationshipDoc.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/MultiDataRelationshipDoc.swift @@ -1,36 +1,29 @@ -// -// MultiDataRelationshipDoc.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct MultiDataRelationshipDoc: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - MultiDataRelationshipDoc - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct MultiDataRelationshipDoc: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + + public init(data: [ResourceIdentifier]? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsAttributes.swift index d658aeb5..94fe89ef 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsAttributes.swift @@ -1,83 +1,88 @@ -// -// PlaylistsAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsAttributes: Codable, Hashable { +// MARK: - PlaylistsAttributes - /** Playlist name */ - public var name: String - /** Playlist description */ - public var description: String? - /** Indicates if the playlist has a duration and set number of tracks */ - public var bounded: Bool - /** Duration of the playlist expressed in accordance with ISO 8601 */ - public var duration: String? - /** Number of items in the playlist */ - public var numberOfItems: Int? - /** Sharing links to the playlist */ - public var externalLinks: [PlaylistsExternalLink] - /** Datetime of playlist creation (ISO 8601) */ - public var createdAt: Date - /** Datetime of last modification of the playlist (ISO 8601) */ - public var lastModifiedAt: Date - /** Privacy setting of the playlist */ - public var privacy: String - /** The type of the playlist */ - public var playlistType: String - /** Images associated with the playlist */ - public var imageLinks: [PlaylistsImageLink] +public struct PlaylistsAttributes: Codable, Hashable { + /// Playlist name + public var name: String + /// Playlist description + public var description: String? + /// Indicates if the playlist has a duration and set number of tracks + public var bounded: Bool + /// Duration of the playlist expressed in accordance with ISO 8601 + public var duration: String? + /// Number of items in the playlist + public var numberOfItems: Int? + /// Sharing links to the playlist + public var externalLinks: [PlaylistsExternalLink] + /// Datetime of playlist creation (ISO 8601) + public var createdAt: Date + /// Datetime of last modification of the playlist (ISO 8601) + public var lastModifiedAt: Date + /// Privacy setting of the playlist + public var privacy: String + /// The type of the playlist + public var playlistType: String + /// Images associated with the playlist + public var imageLinks: [PlaylistsImageLink] - public init(name: String, description: String? = nil, bounded: Bool, duration: String? = nil, numberOfItems: Int? = nil, externalLinks: [PlaylistsExternalLink], createdAt: Date, lastModifiedAt: Date, privacy: String, playlistType: String, imageLinks: [PlaylistsImageLink]) { - self.name = name - self.description = description - self.bounded = bounded - self.duration = duration - self.numberOfItems = numberOfItems - self.externalLinks = externalLinks - self.createdAt = createdAt - self.lastModifiedAt = lastModifiedAt - self.privacy = privacy - self.playlistType = playlistType - self.imageLinks = imageLinks - } + public init( + name: String, + description: String? = nil, + bounded: Bool, + duration: String? = nil, + numberOfItems: Int? = nil, + externalLinks: [PlaylistsExternalLink], + createdAt: Date, + lastModifiedAt: Date, + privacy: String, + playlistType: String, + imageLinks: [PlaylistsImageLink] + ) { + self.name = name + self.description = description + self.bounded = bounded + self.duration = duration + self.numberOfItems = numberOfItems + self.externalLinks = externalLinks + self.createdAt = createdAt + self.lastModifiedAt = lastModifiedAt + self.privacy = privacy + self.playlistType = playlistType + self.imageLinks = imageLinks + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case name - case description - case bounded - case duration - case numberOfItems - case externalLinks - case createdAt - case lastModifiedAt - case privacy - case playlistType - case imageLinks - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case name + case description + case bounded + case duration + case numberOfItems + case externalLinks + case createdAt + case lastModifiedAt + case privacy + case playlistType + case imageLinks + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(name, forKey: .name) - try container.encodeIfPresent(description, forKey: .description) - try container.encode(bounded, forKey: .bounded) - try container.encodeIfPresent(duration, forKey: .duration) - try container.encodeIfPresent(numberOfItems, forKey: .numberOfItems) - try container.encode(externalLinks, forKey: .externalLinks) - try container.encode(createdAt, forKey: .createdAt) - try container.encode(lastModifiedAt, forKey: .lastModifiedAt) - try container.encode(privacy, forKey: .privacy) - try container.encode(playlistType, forKey: .playlistType) - try container.encode(imageLinks, forKey: .imageLinks) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(name, forKey: .name) + try container.encodeIfPresent(description, forKey: .description) + try container.encode(bounded, forKey: .bounded) + try container.encodeIfPresent(duration, forKey: .duration) + try container.encodeIfPresent(numberOfItems, forKey: .numberOfItems) + try container.encode(externalLinks, forKey: .externalLinks) + try container.encode(createdAt, forKey: .createdAt) + try container.encode(lastModifiedAt, forKey: .lastModifiedAt) + try container.encode(privacy, forKey: .privacy) + try container.encode(playlistType, forKey: .playlistType) + try container.encode(imageLinks, forKey: .imageLinks) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsExternalLink.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsExternalLink.swift index 2f5e71b5..d8ec757a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsExternalLink.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsExternalLink.swift @@ -1,38 +1,31 @@ -// -// PlaylistsExternalLink.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Sharing links to the playlist */ -public struct PlaylistsExternalLink: Codable, Hashable { - - /** link to something that is related to a resource */ - public var href: String - public var meta: ExternalLinkMeta - - public init(href: String, meta: ExternalLinkMeta) { - self.href = href - self.meta = meta - } +// MARK: - PlaylistsExternalLink - public enum CodingKeys: String, CodingKey, CaseIterable { - case href - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(href, forKey: .href) - try container.encode(meta, forKey: .meta) - } +/// Sharing links to the playlist +public struct PlaylistsExternalLink: Codable, Hashable { + /// link to something that is related to a resource + public var href: String + public var meta: ExternalLinkMeta + + public init(href: String, meta: ExternalLinkMeta) { + self.href = href + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case href + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(href, forKey: .href) + try container.encode(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsImageLink.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsImageLink.swift index d4ae59d7..e4914e29 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsImageLink.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsImageLink.swift @@ -1,38 +1,31 @@ -// -// PlaylistsImageLink.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Images associated with the playlist */ -public struct PlaylistsImageLink: Codable, Hashable { - - /** link to an image */ - public var href: String - public var meta: ImageLinkMeta? - - public init(href: String, meta: ImageLinkMeta? = nil) { - self.href = href - self.meta = meta - } +// MARK: - PlaylistsImageLink - public enum CodingKeys: String, CodingKey, CaseIterable { - case href - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(href, forKey: .href) - try container.encodeIfPresent(meta, forKey: .meta) - } +/// Images associated with the playlist +public struct PlaylistsImageLink: Codable, Hashable { + /// link to an image + public var href: String + public var meta: ImageLinkMeta? + + public init(href: String, meta: ImageLinkMeta? = nil) { + self.href = href + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case href + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(href, forKey: .href) + try container.encodeIfPresent(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsMultiDataRelationshipDocument.swift index 9d20ed04..ca8cf604 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsMultiDataRelationshipDocument.swift @@ -1,36 +1,29 @@ -// -// PlaylistsItemsMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsItemsMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [PlaylistsItemsResourceIdentifier]? - public var links: Links? - - public init(data: [PlaylistsItemsResourceIdentifier]? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - PlaylistsItemsMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct PlaylistsItemsMultiDataRelationshipDocument: Codable, Hashable { + public var data: [PlaylistsItemsResourceIdentifier]? + public var links: Links? + + public init(data: [PlaylistsItemsResourceIdentifier]? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifier.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifier.swift index 1277c8d6..30120147 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifier.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifier.swift @@ -1,43 +1,36 @@ -// -// PlaylistsItemsResourceIdentifier.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Resource identifier JSON:API object */ -public struct PlaylistsItemsResourceIdentifier: Codable, Hashable { - - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - public var meta: PlaylistsItemsResourceIdentifierMeta? - - public init(id: String, type: String, meta: PlaylistsItemsResourceIdentifierMeta? = nil) { - self.id = id - self.type = type - self.meta = meta - } +// MARK: - PlaylistsItemsResourceIdentifier - public enum CodingKeys: String, CodingKey, CaseIterable { - case id - case type - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - try container.encodeIfPresent(meta, forKey: .meta) - } +/// Resource identifier JSON:API object +public struct PlaylistsItemsResourceIdentifier: Codable, Hashable { + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + public var meta: PlaylistsItemsResourceIdentifierMeta? + + public init(id: String, type: String, meta: PlaylistsItemsResourceIdentifierMeta? = nil) { + self.id = id + self.type = type + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case type + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + try container.encodeIfPresent(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifierMeta.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifierMeta.swift index 2687721f..2f7d476e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifierMeta.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsItemsResourceIdentifierMeta.swift @@ -1,38 +1,31 @@ -// -// PlaylistsItemsResourceIdentifierMeta.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsItemsResourceIdentifierMeta: Codable, Hashable { - - /** Unique identifier of the item in a playlist */ - public var itemId: String? - /** When the item was added to the playlist */ - public var addedAt: Date? - - public init(itemId: String? = nil, addedAt: Date? = nil) { - self.itemId = itemId - self.addedAt = addedAt - } +// MARK: - PlaylistsItemsResourceIdentifierMeta - public enum CodingKeys: String, CodingKey, CaseIterable { - case itemId - case addedAt - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(itemId, forKey: .itemId) - try container.encodeIfPresent(addedAt, forKey: .addedAt) - } +public struct PlaylistsItemsResourceIdentifierMeta: Codable, Hashable { + /// Unique identifier of the item in a playlist + public var itemId: String? + /// When the item was added to the playlist + public var addedAt: Date? + + public init(itemId: String? = nil, addedAt: Date? = nil) { + self.itemId = itemId + self.addedAt = addedAt + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case itemId + case addedAt + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(itemId, forKey: .itemId) + try container.encodeIfPresent(addedAt, forKey: .addedAt) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataDocument.swift index 2dfd995f..b5832dde 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataDocument.swift @@ -1,40 +1,37 @@ -// -// PlaylistsMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsMultiDataDocument: Codable, Hashable { - - public var data: [PlaylistsResource]? - public var links: Links? - public var included: [PlaylistsSingleDataDocumentIncludedInner]? - - public init(data: [PlaylistsResource]? = nil, links: Links? = nil, included: [PlaylistsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - PlaylistsMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct PlaylistsMultiDataDocument: Codable, Hashable { + public var data: [PlaylistsResource]? + public var links: Links? + public var included: [PlaylistsSingleDataDocumentIncludedInner]? + + public init( + data: [PlaylistsResource]? = nil, + links: Links? = nil, + included: [PlaylistsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocument.swift index 776a581a..09b30bed 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// PlaylistsMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [PlaylistsMultiDataRelationshipDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [PlaylistsMultiDataRelationshipDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - PlaylistsMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct PlaylistsMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [PlaylistsMultiDataRelationshipDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [PlaylistsMultiDataRelationshipDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocumentIncludedInner.swift index 8544125c..e0c47310 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsMultiDataRelationshipDocumentIncludedInner.swift @@ -1,53 +1,53 @@ -// -// PlaylistsMultiDataRelationshipDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - PlaylistsMultiDataRelationshipDocumentIncludedInner + public enum PlaylistsMultiDataRelationshipDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeArtistsResource(ArtistsResource) - case typePlaylistsResource(PlaylistsResource) - case typeTracksResource(TracksResource) - case typeUsersResource(UsersResource) - case typeVideosResource(VideosResource) + case typeArtistsResource(ArtistsResource) + case typePlaylistsResource(PlaylistsResource) + case typeTracksResource(TracksResource) + case typeUsersResource(UsersResource) + case typeVideosResource(VideosResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeArtistsResource(let value): - try container.encode(value) - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeUsersResource(let value): - try container.encode(value) - case .typeVideosResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeArtistsResource(value): + try container.encode(value) + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeUsersResource(value): + try container.encode(value) + case let .typeVideosResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(UsersResource.self) { - self = .typeUsersResource(value) - } else if let value = try? container.decode(VideosResource.self) { - self = .typeVideosResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of PlaylistsMultiDataRelationshipDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(UsersResource.self) { + self = .typeUsersResource(value) + } else if let value = try? container.decode(VideosResource.self) { + self = .typeVideosResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of PlaylistsMultiDataRelationshipDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsRelationships.swift index f0e7fc96..f0ffab3a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsRelationships.swift @@ -1,36 +1,29 @@ -// -// PlaylistsRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsRelationships: Codable, Hashable { - - public var owners: MultiDataRelationshipDoc - public var items: PlaylistsItemsMultiDataRelationshipDocument - - public init(owners: MultiDataRelationshipDoc, items: PlaylistsItemsMultiDataRelationshipDocument) { - self.owners = owners - self.items = items - } +// MARK: - PlaylistsRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case owners - case items - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(owners, forKey: .owners) - try container.encode(items, forKey: .items) - } +public struct PlaylistsRelationships: Codable, Hashable { + public var owners: MultiDataRelationshipDoc + public var items: PlaylistsItemsMultiDataRelationshipDocument + + public init(owners: MultiDataRelationshipDoc, items: PlaylistsItemsMultiDataRelationshipDocument) { + self.owners = owners + self.items = items + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case owners + case items + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(owners, forKey: .owners) + try container.encode(items, forKey: .items) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsResource.swift index 9e4bf456..870106ec 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsResource.swift @@ -1,50 +1,49 @@ -// -// PlaylistsResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsResource: Codable, Hashable { - - public var attributes: PlaylistsAttributes? - public var relationships: PlaylistsRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: PlaylistsAttributes? = nil, relationships: PlaylistsRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - PlaylistsResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct PlaylistsResource: Codable, Hashable { + public var attributes: PlaylistsAttributes? + public var relationships: PlaylistsRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: PlaylistsAttributes? = nil, + relationships: PlaylistsRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocument.swift index fdf5c172..e52fe653 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocument.swift @@ -1,40 +1,37 @@ -// -// PlaylistsSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct PlaylistsSingleDataDocument: Codable, Hashable { - - public var data: PlaylistsResource? - public var links: Links? - public var included: [PlaylistsSingleDataDocumentIncludedInner]? - - public init(data: PlaylistsResource? = nil, links: Links? = nil, included: [PlaylistsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - PlaylistsSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct PlaylistsSingleDataDocument: Codable, Hashable { + public var data: PlaylistsResource? + public var links: Links? + public var included: [PlaylistsSingleDataDocumentIncludedInner]? + + public init( + data: PlaylistsResource? = nil, + links: Links? = nil, + included: [PlaylistsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocumentIncludedInner.swift index 6dc14764..1869b158 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PlaylistsSingleDataDocumentIncludedInner.swift @@ -1,48 +1,48 @@ -// -// PlaylistsSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - PlaylistsSingleDataDocumentIncludedInner + public enum PlaylistsSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeArtistsResource(ArtistsResource) - case typeTracksResource(TracksResource) - case typeUsersResource(UsersResource) - case typeVideosResource(VideosResource) + case typeArtistsResource(ArtistsResource) + case typeTracksResource(TracksResource) + case typeUsersResource(UsersResource) + case typeVideosResource(VideosResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeArtistsResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeUsersResource(let value): - try container.encode(value) - case .typeVideosResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeArtistsResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeUsersResource(value): + try container.encode(value) + case let .typeVideosResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(UsersResource.self) { - self = .typeUsersResource(value) - } else if let value = try? container.decode(VideosResource.self) { - self = .typeVideosResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of PlaylistsSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(UsersResource.self) { + self = .typeUsersResource(value) + } else if let value = try? container.decode(VideosResource.self) { + self = .typeVideosResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of PlaylistsSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PromptColors.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PromptColors.swift index a9cffd05..7f230cb0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PromptColors.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/PromptColors.swift @@ -1,39 +1,32 @@ -// -// PromptColors.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Primary and Secondary color to visually render the pick */ -public struct PromptColors: Codable, Hashable { - - /** Primary color to visually render the pick */ - public var primary: String - /** Secondary color to visually render the pick */ - public var secondary: String - - public init(primary: String, secondary: String) { - self.primary = primary - self.secondary = secondary - } +// MARK: - PromptColors - public enum CodingKeys: String, CodingKey, CaseIterable { - case primary - case secondary - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(primary, forKey: .primary) - try container.encode(secondary, forKey: .secondary) - } +/// Primary and Secondary color to visually render the pick +public struct PromptColors: Codable, Hashable { + /// Primary color to visually render the pick + public var primary: String + /// Secondary color to visually render the pick + public var secondary: String + + public init(primary: String, secondary: String) { + self.primary = primary + self.secondary = secondary + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case primary + case secondary + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(primary, forKey: .primary) + try container.encode(secondary, forKey: .secondary) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersAttributes.swift index eace6ee8..3ba06b96 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersAttributes.swift @@ -1,33 +1,26 @@ -// -// ProvidersAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ProvidersAttributes: Codable, Hashable { +// MARK: - ProvidersAttributes - /** Provider name. Conditionally visible. */ - public var name: String +public struct ProvidersAttributes: Codable, Hashable { + /// Provider name. Conditionally visible. + public var name: String - public init(name: String) { - self.name = name - } + public init(name: String) { + self.name = name + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case name - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case name + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(name, forKey: .name) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(name, forKey: .name) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersMultiDataDocument.swift index 02e1c3c2..0b7bc8d0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersMultiDataDocument.swift @@ -1,36 +1,29 @@ -// -// ProvidersMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ProvidersMultiDataDocument: Codable, Hashable { - - public var data: [ProvidersResource]? - public var links: Links? - - public init(data: [ProvidersResource]? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - ProvidersMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct ProvidersMultiDataDocument: Codable, Hashable { + public var data: [ProvidersResource]? + public var links: Links? + + public init(data: [ProvidersResource]? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersResource.swift index 9ef8653b..8c18751e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersResource.swift @@ -1,46 +1,39 @@ -// -// ProvidersResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ProvidersResource: Codable, Hashable { - - public var attributes: ProvidersAttributes? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: ProvidersAttributes? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.links = links - self.id = id - self.type = type - } +// MARK: - ProvidersResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct ProvidersResource: Codable, Hashable { + public var attributes: ProvidersAttributes? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init(attributes: ProvidersAttributes? = nil, links: Links? = nil, id: String, type: String) { + self.attributes = attributes + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersSingleDataDocument.swift index f2424086..929253fc 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ProvidersSingleDataDocument.swift @@ -1,36 +1,29 @@ -// -// ProvidersSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ProvidersSingleDataDocument: Codable, Hashable { - - public var data: ProvidersResource? - public var links: Links? - - public init(data: ProvidersResource? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - ProvidersSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct ProvidersSingleDataDocument: Codable, Hashable { + public var data: ProvidersResource? + public var links: Links? + + public init(data: ProvidersResource? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceIdentifier.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceIdentifier.swift index ee3c5b6b..7d04abee 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceIdentifier.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceIdentifier.swift @@ -1,39 +1,32 @@ -// -// ResourceIdentifier.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** Resource identifier JSON:API object */ -public struct ResourceIdentifier: Codable, Hashable { - - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(id: String, type: String) { - self.id = id - self.type = type - } +// MARK: - ResourceIdentifier - public enum CodingKeys: String, CodingKey, CaseIterable { - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +/// Resource identifier JSON:API object +public struct ResourceIdentifier: Codable, Hashable { + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init(id: String, type: String) { + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceObjectObject.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceObjectObject.swift index 05d48630..0790c652 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceObjectObject.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/ResourceObjectObject.swift @@ -1,50 +1,43 @@ -// -// ResourceObjectObject.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct ResourceObjectObject: Codable, Hashable { - - public var attributes: AnyCodable? - public var relationships: AnyCodable? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: AnyCodable? = nil, relationships: AnyCodable? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - ResourceObjectObject - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct ResourceObjectObject: Codable, Hashable { + public var attributes: AnyCodable? + public var relationships: AnyCodable? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init(attributes: AnyCodable? = nil, relationships: AnyCodable? = nil, links: Links? = nil, id: String, type: String) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsAttributes.swift index 038b7430..99a49574 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsAttributes.swift @@ -1,38 +1,31 @@ -// -// SearchresultsAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct SearchresultsAttributes: Codable, Hashable { - - /** search request unique tracking number */ - public var trackingId: String - /** 'did you mean' prompt */ - public var didYouMean: String? - - public init(trackingId: String, didYouMean: String? = nil) { - self.trackingId = trackingId - self.didYouMean = didYouMean - } +// MARK: - SearchresultsAttributes - public enum CodingKeys: String, CodingKey, CaseIterable { - case trackingId - case didYouMean - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(trackingId, forKey: .trackingId) - try container.encodeIfPresent(didYouMean, forKey: .didYouMean) - } +public struct SearchresultsAttributes: Codable, Hashable { + /// search request unique tracking number + public var trackingId: String + /// 'did you mean' prompt + public var didYouMean: String? + + public init(trackingId: String, didYouMean: String? = nil) { + self.trackingId = trackingId + self.didYouMean = didYouMean + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case trackingId + case didYouMean + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(trackingId, forKey: .trackingId) + try container.encodeIfPresent(didYouMean, forKey: .didYouMean) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsRelationships.swift index 0be81698..62afe440 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsRelationships.swift @@ -1,52 +1,52 @@ -// -// SearchresultsRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct SearchresultsRelationships: Codable, Hashable { - - public var albums: MultiDataRelationshipDoc - public var artists: MultiDataRelationshipDoc - public var playlists: MultiDataRelationshipDoc - public var videos: MultiDataRelationshipDoc - public var topHits: MultiDataRelationshipDoc - public var tracks: MultiDataRelationshipDoc - - public init(albums: MultiDataRelationshipDoc, artists: MultiDataRelationshipDoc, playlists: MultiDataRelationshipDoc, videos: MultiDataRelationshipDoc, topHits: MultiDataRelationshipDoc, tracks: MultiDataRelationshipDoc) { - self.albums = albums - self.artists = artists - self.playlists = playlists - self.videos = videos - self.topHits = topHits - self.tracks = tracks - } +// MARK: - SearchresultsRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case albums - case artists - case playlists - case videos - case topHits - case tracks - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(albums, forKey: .albums) - try container.encode(artists, forKey: .artists) - try container.encode(playlists, forKey: .playlists) - try container.encode(videos, forKey: .videos) - try container.encode(topHits, forKey: .topHits) - try container.encode(tracks, forKey: .tracks) - } +public struct SearchresultsRelationships: Codable, Hashable { + public var albums: MultiDataRelationshipDoc + public var artists: MultiDataRelationshipDoc + public var playlists: MultiDataRelationshipDoc + public var videos: MultiDataRelationshipDoc + public var topHits: MultiDataRelationshipDoc + public var tracks: MultiDataRelationshipDoc + + public init( + albums: MultiDataRelationshipDoc, + artists: MultiDataRelationshipDoc, + playlists: MultiDataRelationshipDoc, + videos: MultiDataRelationshipDoc, + topHits: MultiDataRelationshipDoc, + tracks: MultiDataRelationshipDoc + ) { + self.albums = albums + self.artists = artists + self.playlists = playlists + self.videos = videos + self.topHits = topHits + self.tracks = tracks + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case albums + case artists + case playlists + case videos + case topHits + case tracks + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(albums, forKey: .albums) + try container.encode(artists, forKey: .artists) + try container.encode(playlists, forKey: .playlists) + try container.encode(videos, forKey: .videos) + try container.encode(topHits, forKey: .topHits) + try container.encode(tracks, forKey: .tracks) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsResource.swift index 134447ea..46245d65 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsResource.swift @@ -1,50 +1,49 @@ -// -// SearchresultsResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct SearchresultsResource: Codable, Hashable { - - public var attributes: SearchresultsAttributes? - public var relationships: SearchresultsRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: SearchresultsAttributes? = nil, relationships: SearchresultsRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - SearchresultsResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct SearchresultsResource: Codable, Hashable { + public var attributes: SearchresultsAttributes? + public var relationships: SearchresultsRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: SearchresultsAttributes? = nil, + relationships: SearchresultsRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocument.swift index 276b2ffb..3e78e686 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocument.swift @@ -1,40 +1,37 @@ -// -// SearchresultsSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct SearchresultsSingleDataDocument: Codable, Hashable { - - public var data: SearchresultsResource? - public var links: Links? - public var included: [SearchresultsSingleDataDocumentIncludedInner]? - - public init(data: SearchresultsResource? = nil, links: Links? = nil, included: [SearchresultsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - SearchresultsSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct SearchresultsSingleDataDocument: Codable, Hashable { + public var data: SearchresultsResource? + public var links: Links? + public var included: [SearchresultsSingleDataDocumentIncludedInner]? + + public init( + data: SearchresultsResource? = nil, + links: Links? = nil, + included: [SearchresultsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocumentIncludedInner.swift index 9fbfa04f..18db4040 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchResultsSingleDataDocumentIncludedInner.swift @@ -1,53 +1,53 @@ -// -// SearchresultsSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - SearchresultsSingleDataDocumentIncludedInner + public enum SearchresultsSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typePlaylistsResource(PlaylistsResource) - case typeTracksResource(TracksResource) - case typeVideosResource(VideosResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typePlaylistsResource(PlaylistsResource) + case typeTracksResource(TracksResource) + case typeVideosResource(VideosResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeVideosResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeVideosResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(VideosResource.self) { - self = .typeVideosResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of SearchresultsSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(VideosResource.self) { + self = .typeVideosResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of SearchresultsSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataDocument.swift index e91b9e71..6d276c0e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataDocument.swift @@ -1,40 +1,37 @@ -// -// SearchresultsMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct SearchresultsMultiDataDocument: Codable, Hashable { - - public var data: [SearchresultsResource]? - public var links: Links? - public var included: [SearchresultsSingleDataDocumentIncludedInner]? - - public init(data: [SearchresultsResource]? = nil, links: Links? = nil, included: [SearchresultsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - SearchresultsMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct SearchresultsMultiDataDocument: Codable, Hashable { + public var data: [SearchresultsResource]? + public var links: Links? + public var included: [SearchresultsSingleDataDocumentIncludedInner]? + + public init( + data: [SearchresultsResource]? = nil, + links: Links? = nil, + included: [SearchresultsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocument.swift index 77f359e8..c5f93153 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// SearchresultsMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct SearchresultsMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [SearchresultsMultiDataRelationshipDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [SearchresultsMultiDataRelationshipDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - SearchresultsMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct SearchresultsMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [SearchresultsMultiDataRelationshipDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [SearchresultsMultiDataRelationshipDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocumentIncludedInner.swift index 0f90ea0f..b8cbbdb9 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SearchresultsMultiDataRelationshipDocumentIncludedInner.swift @@ -1,58 +1,58 @@ -// -// SearchresultsMultiDataRelationshipDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - SearchresultsMultiDataRelationshipDocumentIncludedInner + public enum SearchresultsMultiDataRelationshipDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typePlaylistsResource(PlaylistsResource) - case typeSearchresultsResource(SearchresultsResource) - case typeTracksResource(TracksResource) - case typeVideosResource(VideosResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typePlaylistsResource(PlaylistsResource) + case typeSearchresultsResource(SearchresultsResource) + case typeTracksResource(TracksResource) + case typeVideosResource(VideosResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeSearchresultsResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeVideosResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeSearchresultsResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeVideosResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(SearchresultsResource.self) { - self = .typeSearchresultsResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(VideosResource.self) { - self = .typeVideosResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of SearchresultsMultiDataRelationshipDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(SearchresultsResource.self) { + self = .typeSearchresultsResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(VideosResource.self) { + self = .typeVideosResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of SearchresultsMultiDataRelationshipDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SingletonDataRelationshipDoc.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SingletonDataRelationshipDoc.swift index 3abbb1f9..e827b670 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SingletonDataRelationshipDoc.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/SingletonDataRelationshipDoc.swift @@ -1,36 +1,29 @@ -// -// SingletonDataRelationshipDoc.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct SingletonDataRelationshipDoc: Codable, Hashable { - - public var data: ResourceIdentifier? - public var links: Links? - - public init(data: ResourceIdentifier? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - SingletonDataRelationshipDoc - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct SingletonDataRelationshipDoc: Codable, Hashable { + public var data: ResourceIdentifier? + public var links: Links? + + public init(data: ResourceIdentifier? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksAttributes.swift index 8c1bbba8..dbf16451 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksAttributes.swift @@ -1,82 +1,87 @@ -// -// TracksAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - TracksAttributes + public struct TracksAttributes: Codable, Hashable { + public enum Availability: String, Codable, CaseIterable { + case stream = "STREAM" + case dj = "DJ" + case stem = "STEM" + } - public enum Availability: String, Codable, CaseIterable { - case stream = "STREAM" - case dj = "DJ" - case stem = "STEM" - } - /** Album item's title */ - public var title: String - /** Version of the album's item; complements title */ - public var version: String? - /** ISRC code */ - public var isrc: String - /** Duration expressed in accordance with ISO 8601 */ - public var duration: String - /** Copyright information */ - public var copyright: String? - /** Indicates whether a catalog item consist of any explicit content */ - public var explicit: Bool - /** Track or video popularity (ranged in 0.00 ... 1.00). Conditionally visible */ - public var popularity: Double - /** Defines a catalog item availability e.g. for streaming, DJs, stems */ - public var availability: [Availability]? - public var mediaTags: [String] - /** Represents available links to something that is related to a catalog item, but external to the TIDAL API */ - public var externalLinks: [CatalogueItemExternalLink]? + /// Album item's title + public var title: String + /// Version of the album's item; complements title + public var version: String? + /// ISRC code + public var isrc: String + /// Duration expressed in accordance with ISO 8601 + public var duration: String + /// Copyright information + public var copyright: String? + /// Indicates whether a catalog item consist of any explicit content + public var explicit: Bool + /// Track or video popularity (ranged in 0.00 ... 1.00). Conditionally visible + public var popularity: Double + /// Defines a catalog item availability e.g. for streaming, DJs, stems + public var availability: [Availability]? + public var mediaTags: [String] + /// Represents available links to something that is related to a catalog item, but external to the TIDAL API + public var externalLinks: [CatalogueItemExternalLink]? - public init(title: String, version: String? = nil, isrc: String, duration: String, copyright: String? = nil, explicit: Bool, popularity: Double, availability: [Availability]? = nil, mediaTags: [String], externalLinks: [CatalogueItemExternalLink]? = nil) { - self.title = title - self.version = version - self.isrc = isrc - self.duration = duration - self.copyright = copyright - self.explicit = explicit - self.popularity = popularity - self.availability = availability - self.mediaTags = mediaTags - self.externalLinks = externalLinks - } + public init( + title: String, + version: String? = nil, + isrc: String, + duration: String, + copyright: String? = nil, + explicit: Bool, + popularity: Double, + availability: [Availability]? = nil, + mediaTags: [String], + externalLinks: [CatalogueItemExternalLink]? = nil + ) { + self.title = title + self.version = version + self.isrc = isrc + self.duration = duration + self.copyright = copyright + self.explicit = explicit + self.popularity = popularity + self.availability = availability + self.mediaTags = mediaTags + self.externalLinks = externalLinks + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case title - case version - case isrc - case duration - case copyright - case explicit - case popularity - case availability - case mediaTags - case externalLinks - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case title + case version + case isrc + case duration + case copyright + case explicit + case popularity + case availability + case mediaTags + case externalLinks + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(title, forKey: .title) - try container.encodeIfPresent(version, forKey: .version) - try container.encode(isrc, forKey: .isrc) - try container.encode(duration, forKey: .duration) - try container.encodeIfPresent(copyright, forKey: .copyright) - try container.encode(explicit, forKey: .explicit) - try container.encode(popularity, forKey: .popularity) - try container.encodeIfPresent(availability, forKey: .availability) - try container.encode(mediaTags, forKey: .mediaTags) - try container.encodeIfPresent(externalLinks, forKey: .externalLinks) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(title, forKey: .title) + try container.encodeIfPresent(version, forKey: .version) + try container.encode(isrc, forKey: .isrc) + try container.encode(duration, forKey: .duration) + try container.encodeIfPresent(copyright, forKey: .copyright) + try container.encode(explicit, forKey: .explicit) + try container.encode(popularity, forKey: .popularity) + try container.encodeIfPresent(availability, forKey: .availability) + try container.encode(mediaTags, forKey: .mediaTags) + try container.encodeIfPresent(externalLinks, forKey: .externalLinks) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataDocument.swift index 0dad0323..19622670 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataDocument.swift @@ -1,40 +1,33 @@ -// -// TracksMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct TracksMultiDataDocument: Codable, Hashable { - - public var data: [TracksResource]? - public var links: Links? - public var included: [TracksSingleDataDocumentIncludedInner]? - - public init(data: [TracksResource]? = nil, links: Links? = nil, included: [TracksSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - TracksMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct TracksMultiDataDocument: Codable, Hashable { + public var data: [TracksResource]? + public var links: Links? + public var included: [TracksSingleDataDocumentIncludedInner]? + + public init(data: [TracksResource]? = nil, links: Links? = nil, included: [TracksSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataRelationshipDocument.swift index 9fec30be..b8a1f900 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// TracksMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct TracksMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [TracksSingleDataDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [TracksSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - TracksMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct TracksMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [TracksSingleDataDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [TracksSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksRelationships.swift index c4016b57..e789ec12 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksRelationships.swift @@ -1,48 +1,47 @@ -// -// TracksRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct TracksRelationships: Codable, Hashable { - - public var albums: MultiDataRelationshipDoc - public var artists: MultiDataRelationshipDoc - public var similarTracks: MultiDataRelationshipDoc - public var providers: MultiDataRelationshipDoc - public var radio: MultiDataRelationshipDoc - - public init(albums: MultiDataRelationshipDoc, artists: MultiDataRelationshipDoc, similarTracks: MultiDataRelationshipDoc, providers: MultiDataRelationshipDoc, radio: MultiDataRelationshipDoc) { - self.albums = albums - self.artists = artists - self.similarTracks = similarTracks - self.providers = providers - self.radio = radio - } +// MARK: - TracksRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case albums - case artists - case similarTracks - case providers - case radio - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(albums, forKey: .albums) - try container.encode(artists, forKey: .artists) - try container.encode(similarTracks, forKey: .similarTracks) - try container.encode(providers, forKey: .providers) - try container.encode(radio, forKey: .radio) - } +public struct TracksRelationships: Codable, Hashable { + public var albums: MultiDataRelationshipDoc + public var artists: MultiDataRelationshipDoc + public var similarTracks: MultiDataRelationshipDoc + public var providers: MultiDataRelationshipDoc + public var radio: MultiDataRelationshipDoc + + public init( + albums: MultiDataRelationshipDoc, + artists: MultiDataRelationshipDoc, + similarTracks: MultiDataRelationshipDoc, + providers: MultiDataRelationshipDoc, + radio: MultiDataRelationshipDoc + ) { + self.albums = albums + self.artists = artists + self.similarTracks = similarTracks + self.providers = providers + self.radio = radio + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case albums + case artists + case similarTracks + case providers + case radio + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(albums, forKey: .albums) + try container.encode(artists, forKey: .artists) + try container.encode(similarTracks, forKey: .similarTracks) + try container.encode(providers, forKey: .providers) + try container.encode(radio, forKey: .radio) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksResource.swift index 94f5690c..085144b4 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksResource.swift @@ -1,50 +1,49 @@ -// -// TracksResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct TracksResource: Codable, Hashable { - - public var attributes: TracksAttributes? - public var relationships: TracksRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: TracksAttributes? = nil, relationships: TracksRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - TracksResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct TracksResource: Codable, Hashable { + public var attributes: TracksAttributes? + public var relationships: TracksRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: TracksAttributes? = nil, + relationships: TracksRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocument.swift index 4c3c9eed..40dc6c78 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocument.swift @@ -1,40 +1,33 @@ -// -// TracksSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct TracksSingleDataDocument: Codable, Hashable { - - public var data: TracksResource? - public var links: Links? - public var included: [TracksSingleDataDocumentIncludedInner]? - - public init(data: TracksResource? = nil, links: Links? = nil, included: [TracksSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - TracksSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct TracksSingleDataDocument: Codable, Hashable { + public var data: TracksResource? + public var links: Links? + public var included: [TracksSingleDataDocumentIncludedInner]? + + public init(data: TracksResource? = nil, links: Links? = nil, included: [TracksSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocumentIncludedInner.swift index 570efcfd..7603de2b 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/TracksSingleDataDocumentIncludedInner.swift @@ -1,53 +1,53 @@ -// -// TracksSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - TracksSingleDataDocumentIncludedInner + public enum TracksSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typePlaylistsResource(PlaylistsResource) - case typeProvidersResource(ProvidersResource) - case typeTracksResource(TracksResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typePlaylistsResource(PlaylistsResource) + case typeProvidersResource(ProvidersResource) + case typeTracksResource(TracksResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeProvidersResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeProvidersResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(ProvidersResource.self) { - self = .typeProvidersResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of TracksSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(ProvidersResource.self) { + self = .typeProvidersResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of TracksSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBody.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBody.swift index 33fd8dcc..22ca7b3e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBody.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBody.swift @@ -1,32 +1,25 @@ -// -// UpdatePickRelationshipBody.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UpdatePickRelationshipBody: Codable, Hashable { +// MARK: - UpdatePickRelationshipBody - public var data: UpdatePickRelationshipBodyData? +public struct UpdatePickRelationshipBody: Codable, Hashable { + public var data: UpdatePickRelationshipBodyData? - public init(data: UpdatePickRelationshipBodyData? = nil) { - self.data = data - } + public init(data: UpdatePickRelationshipBodyData? = nil) { + self.data = data + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBodyData.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBodyData.swift index 451c6510..84408056 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBodyData.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdatePickRelationshipBodyData.swift @@ -1,36 +1,29 @@ -// -// UpdatePickRelationshipBodyData.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UpdatePickRelationshipBodyData: Codable, Hashable { - - public var type: String? - public var id: String? - - public init(type: String? = nil, id: String? = nil) { - self.type = type - self.id = id - } +// MARK: - UpdatePickRelationshipBodyData - public enum CodingKeys: String, CodingKey, CaseIterable { - case type - case id - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(type, forKey: .type) - try container.encodeIfPresent(id, forKey: .id) - } +public struct UpdatePickRelationshipBodyData: Codable, Hashable { + public var type: String? + public var id: String? + + public init(type: String? = nil, id: String? = nil) { + self.type = type + self.id = id + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case type + case id + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(type, forKey: .type) + try container.encodeIfPresent(id, forKey: .id) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBody.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBody.swift index 5982871c..ab8d065c 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBody.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBody.swift @@ -1,32 +1,25 @@ -// -// UpdateUserProfileBody.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UpdateUserProfileBody: Codable, Hashable { +// MARK: - UpdateUserProfileBody - public var data: UpdateUserProfileBodyData? +public struct UpdateUserProfileBody: Codable, Hashable { + public var data: UpdateUserProfileBodyData? - public init(data: UpdateUserProfileBodyData? = nil) { - self.data = data - } + public init(data: UpdateUserProfileBodyData? = nil) { + self.data = data + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyData.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyData.swift index 9e1e84fd..146fe506 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyData.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyData.swift @@ -1,32 +1,25 @@ -// -// UpdateUserProfileBodyData.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UpdateUserProfileBodyData: Codable, Hashable { +// MARK: - UpdateUserProfileBodyData - public var attributes: UpdateUserProfileBodyDataAttributes? +public struct UpdateUserProfileBodyData: Codable, Hashable { + public var attributes: UpdateUserProfileBodyDataAttributes? - public init(attributes: UpdateUserProfileBodyDataAttributes? = nil) { - self.attributes = attributes - } + public init(attributes: UpdateUserProfileBodyDataAttributes? = nil) { + self.attributes = attributes + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyDataAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyDataAttributes.swift index 6b1fe282..0259558d 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyDataAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UpdateUserProfileBodyDataAttributes.swift @@ -1,40 +1,33 @@ -// -// UpdateUserProfileBodyDataAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UpdateUserProfileBodyDataAttributes: Codable, Hashable { - - public var handle: String? - public var profileName: String? - public var externalLinks: [UserPublicProfilesExternalLink]? - - public init(handle: String? = nil, profileName: String? = nil, externalLinks: [UserPublicProfilesExternalLink]? = nil) { - self.handle = handle - self.profileName = profileName - self.externalLinks = externalLinks - } +// MARK: - UpdateUserProfileBodyDataAttributes - public enum CodingKeys: String, CodingKey, CaseIterable { - case handle - case profileName - case externalLinks - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(handle, forKey: .handle) - try container.encodeIfPresent(profileName, forKey: .profileName) - try container.encodeIfPresent(externalLinks, forKey: .externalLinks) - } +public struct UpdateUserProfileBodyDataAttributes: Codable, Hashable { + public var handle: String? + public var profileName: String? + public var externalLinks: [UserPublicProfilesExternalLink]? + + public init(handle: String? = nil, profileName: String? = nil, externalLinks: [UserPublicProfilesExternalLink]? = nil) { + self.handle = handle + self.profileName = profileName + self.externalLinks = externalLinks + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case handle + case profileName + case externalLinks + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(handle, forKey: .handle) + try container.encodeIfPresent(profileName, forKey: .profileName) + try container.encodeIfPresent(externalLinks, forKey: .externalLinks) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsAttributes.swift index 986b365a..f1ed8799 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsAttributes.swift @@ -1,37 +1,31 @@ -// -// UserEntitlementsAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserEntitlementsAttributes + public struct UserEntitlementsAttributes: Codable, Hashable { + public enum Entitlements: String, Codable, CaseIterable { + case music = "MUSIC" + case dj = "DJ" + } - public enum Entitlements: String, Codable, CaseIterable { - case music = "MUSIC" - case dj = "DJ" - } - /** entitlements for user */ - public var entitlements: [Entitlements] + /// entitlements for user + public var entitlements: [Entitlements] - public init(entitlements: [Entitlements]) { - self.entitlements = entitlements - } + public init(entitlements: [Entitlements]) { + self.entitlements = entitlements + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case entitlements - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case entitlements + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(entitlements, forKey: .entitlements) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(entitlements, forKey: .entitlements) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsMultiDataDocument.swift index d7d2b7b8..436d32b0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsMultiDataDocument.swift @@ -1,36 +1,29 @@ -// -// UserEntitlementsMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserEntitlementsMultiDataDocument: Codable, Hashable { - - public var data: [UserEntitlementsResource]? - public var links: Links? - - public init(data: [UserEntitlementsResource]? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - UserEntitlementsMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct UserEntitlementsMultiDataDocument: Codable, Hashable { + public var data: [UserEntitlementsResource]? + public var links: Links? + + public init(data: [UserEntitlementsResource]? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsResource.swift index 0e8028b2..1fbdf733 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsResource.swift @@ -1,46 +1,39 @@ -// -// UserEntitlementsResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserEntitlementsResource: Codable, Hashable { - - public var attributes: UserEntitlementsAttributes? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: UserEntitlementsAttributes? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.links = links - self.id = id - self.type = type - } +// MARK: - UserEntitlementsResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct UserEntitlementsResource: Codable, Hashable { + public var attributes: UserEntitlementsAttributes? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init(attributes: UserEntitlementsAttributes? = nil, links: Links? = nil, id: String, type: String) { + self.attributes = attributes + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsSingleDataDocument.swift index e8f4c618..ba181c59 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserEntitlementsSingleDataDocument.swift @@ -1,36 +1,29 @@ -// -// UserEntitlementsSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserEntitlementsSingleDataDocument: Codable, Hashable { - - public var data: UserEntitlementsResource? - public var links: Links? - - public init(data: UserEntitlementsResource? = nil, links: Links? = nil) { - self.data = data - self.links = links - } +// MARK: - UserEntitlementsSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - } +public struct UserEntitlementsSingleDataDocument: Codable, Hashable { + public var data: UserEntitlementsResource? + public var links: Links? + + public init(data: UserEntitlementsResource? = nil, links: Links? = nil) { + self.data = data + self.links = links + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksAttributes.swift index 872ea44a..4bbd3720 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksAttributes.swift @@ -1,59 +1,59 @@ -// -// UserPublicProfilePicksAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilePicksAttributes: Codable, Hashable { - - public enum SupportedContentType: String, Codable, CaseIterable { - case tracks = "TRACKS" - case videos = "VIDEOS" - case albums = "ALBUMS" - case artists = "ARTISTS" - case providers = "PROVIDERS" - } - /** Pick title */ - public var title: String - /** Description of pick */ - public var description: String - /** CatalogueResourceType for supported item for the pick */ - public var supportedContentType: SupportedContentType - public var colors: PromptColors - /** Date of last modification of the pick (ISO 8601) */ - public var lastModifiedAt: Date? - - public init(title: String, description: String, supportedContentType: SupportedContentType, colors: PromptColors, lastModifiedAt: Date? = nil) { - self.title = title - self.description = description - self.supportedContentType = supportedContentType - self.colors = colors - self.lastModifiedAt = lastModifiedAt - } +// MARK: - UserPublicProfilePicksAttributes - public enum CodingKeys: String, CodingKey, CaseIterable { - case title - case description - case supportedContentType - case colors - case lastModifiedAt - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(title, forKey: .title) - try container.encode(description, forKey: .description) - try container.encode(supportedContentType, forKey: .supportedContentType) - try container.encode(colors, forKey: .colors) - try container.encodeIfPresent(lastModifiedAt, forKey: .lastModifiedAt) - } +public struct UserPublicProfilePicksAttributes: Codable, Hashable { + public enum SupportedContentType: String, Codable, CaseIterable { + case tracks = "TRACKS" + case videos = "VIDEOS" + case albums = "ALBUMS" + case artists = "ARTISTS" + case providers = "PROVIDERS" + } + + /// Pick title + public var title: String + /// Description of pick + public var description: String + /// CatalogueResourceType for supported item for the pick + public var supportedContentType: SupportedContentType + public var colors: PromptColors + /// Date of last modification of the pick (ISO 8601) + public var lastModifiedAt: Date? + + public init( + title: String, + description: String, + supportedContentType: SupportedContentType, + colors: PromptColors, + lastModifiedAt: Date? = nil + ) { + self.title = title + self.description = description + self.supportedContentType = supportedContentType + self.colors = colors + self.lastModifiedAt = lastModifiedAt + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case title + case description + case supportedContentType + case colors + case lastModifiedAt + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(title, forKey: .title) + try container.encode(description, forKey: .description) + try container.encode(supportedContentType, forKey: .supportedContentType) + try container.encode(colors, forKey: .colors) + try container.encodeIfPresent(lastModifiedAt, forKey: .lastModifiedAt) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksMultiDataDocument.swift index 84c28a5a..2d1dcd3e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksMultiDataDocument.swift @@ -1,40 +1,37 @@ -// -// UserPublicProfilePicksMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilePicksMultiDataDocument: Codable, Hashable { - - public var data: [UserPublicProfilePicksResource]? - public var links: Links? - public var included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? - - public init(data: [UserPublicProfilePicksResource]? = nil, links: Links? = nil, included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserPublicProfilePicksMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserPublicProfilePicksMultiDataDocument: Codable, Hashable { + public var data: [UserPublicProfilePicksResource]? + public var links: Links? + public var included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? + + public init( + data: [UserPublicProfilePicksResource]? = nil, + links: Links? = nil, + included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksRelationships.swift index d52abeef..594f80e9 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksRelationships.swift @@ -1,36 +1,29 @@ -// -// UserPublicProfilePicksRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilePicksRelationships: Codable, Hashable { - - public var userPublicProfile: SingletonDataRelationshipDoc - public var item: SingletonDataRelationshipDoc - - public init(userPublicProfile: SingletonDataRelationshipDoc, item: SingletonDataRelationshipDoc) { - self.userPublicProfile = userPublicProfile - self.item = item - } +// MARK: - UserPublicProfilePicksRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case userPublicProfile - case item - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(userPublicProfile, forKey: .userPublicProfile) - try container.encode(item, forKey: .item) - } +public struct UserPublicProfilePicksRelationships: Codable, Hashable { + public var userPublicProfile: SingletonDataRelationshipDoc + public var item: SingletonDataRelationshipDoc + + public init(userPublicProfile: SingletonDataRelationshipDoc, item: SingletonDataRelationshipDoc) { + self.userPublicProfile = userPublicProfile + self.item = item + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case userPublicProfile + case item + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(userPublicProfile, forKey: .userPublicProfile) + try container.encode(item, forKey: .item) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksResource.swift index 3ca559bb..18f6c9e8 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksResource.swift @@ -1,50 +1,49 @@ -// -// UserPublicProfilePicksResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilePicksResource: Codable, Hashable { - - public var attributes: UserPublicProfilePicksAttributes? - public var relationships: UserPublicProfilePicksRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: UserPublicProfilePicksAttributes? = nil, relationships: UserPublicProfilePicksRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - UserPublicProfilePicksResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct UserPublicProfilePicksResource: Codable, Hashable { + public var attributes: UserPublicProfilePicksAttributes? + public var relationships: UserPublicProfilePicksRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: UserPublicProfilePicksAttributes? = nil, + relationships: UserPublicProfilePicksRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocument.swift index 0b9d4ac7..15849c54 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocument.swift @@ -1,40 +1,37 @@ -// -// UserPublicProfilePicksSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilePicksSingleDataDocument: Codable, Hashable { - - public var data: UserPublicProfilePicksResource? - public var links: Links? - public var included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? - - public init(data: UserPublicProfilePicksResource? = nil, links: Links? = nil, included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserPublicProfilePicksSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserPublicProfilePicksSingleDataDocument: Codable, Hashable { + public var data: UserPublicProfilePicksResource? + public var links: Links? + public var included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? + + public init( + data: UserPublicProfilePicksResource? = nil, + links: Links? = nil, + included: [UserPublicProfilePicksSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocumentIncludedInner.swift index 7139ab56..b50775f5 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingleDataDocumentIncludedInner.swift @@ -1,48 +1,48 @@ -// -// UserPublicProfilePicksSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserPublicProfilePicksSingleDataDocumentIncludedInner + public enum UserPublicProfilePicksSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typeTracksResource(TracksResource) - case typeUserPublicProfilesResource(UserPublicProfilesResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typeTracksResource(TracksResource) + case typeUserPublicProfilesResource(UserPublicProfilesResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeUserPublicProfilesResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeUserPublicProfilesResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(UserPublicProfilesResource.self) { - self = .typeUserPublicProfilesResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UserPublicProfilePicksSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(UserPublicProfilesResource.self) { + self = .typeUserPublicProfilesResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UserPublicProfilePicksSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocument.swift index d94b4b3f..fb57a299 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// UserPublicProfilePicksSingletonDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilePicksSingletonDataRelationshipDocument: Codable, Hashable { - - public var data: ResourceIdentifier? - public var links: Links? - public var included: [UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner]? - - public init(data: ResourceIdentifier? = nil, links: Links? = nil, included: [UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserPublicProfilePicksSingletonDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserPublicProfilePicksSingletonDataRelationshipDocument: Codable, Hashable { + public var data: ResourceIdentifier? + public var links: Links? + public var included: [UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner]? + + public init( + data: ResourceIdentifier? = nil, + links: Links? = nil, + included: [UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner.swift index e6f8e1fb..d01bb73e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner.swift @@ -1,53 +1,53 @@ -// -// UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner + public enum UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typeTracksResource(TracksResource) - case typeUserPublicProfilePicksResource(UserPublicProfilePicksResource) - case typeUserPublicProfilesResource(UserPublicProfilesResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typeTracksResource(TracksResource) + case typeUserPublicProfilePicksResource(UserPublicProfilePicksResource) + case typeUserPublicProfilesResource(UserPublicProfilesResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typeTracksResource(let value): - try container.encode(value) - case .typeUserPublicProfilePicksResource(let value): - try container.encode(value) - case .typeUserPublicProfilesResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typeTracksResource(value): + try container.encode(value) + case let .typeUserPublicProfilePicksResource(value): + try container.encode(value) + case let .typeUserPublicProfilesResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(TracksResource.self) { - self = .typeTracksResource(value) - } else if let value = try? container.decode(UserPublicProfilePicksResource.self) { - self = .typeUserPublicProfilePicksResource(value) - } else if let value = try? container.decode(UserPublicProfilesResource.self) { - self = .typeUserPublicProfilesResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(TracksResource.self) { + self = .typeTracksResource(value) + } else if let value = try? container.decode(UserPublicProfilePicksResource.self) { + self = .typeUserPublicProfilePicksResource(value) + } else if let value = try? container.decode(UserPublicProfilesResource.self) { + self = .typeUserPublicProfilesResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UserPublicProfilePicksSingletonDataRelationshipDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesAttributes.swift index a5482271..7788ad45 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesAttributes.swift @@ -1,61 +1,62 @@ -// -// UserPublicProfilesAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilesAttributes: Codable, Hashable { - - /** A customizable handle for the user profile */ - public var handle: String? - /** Public Name of the user profile */ - public var profileName: String? - public var picture: UserPublicProfilesImageLink? - public var color: [String] - /** ExternalLinks for the user's profile */ - public var externalLinks: [UserPublicProfilesExternalLink]? - /** Number of followers for the user */ - public var numberOfFollowers: Int? - /** Number of users the user follows */ - public var numberOfFollows: Int? - - public init(handle: String? = nil, profileName: String? = nil, picture: UserPublicProfilesImageLink? = nil, color: [String], externalLinks: [UserPublicProfilesExternalLink]? = nil, numberOfFollowers: Int? = nil, numberOfFollows: Int? = nil) { - self.handle = handle - self.profileName = profileName - self.picture = picture - self.color = color - self.externalLinks = externalLinks - self.numberOfFollowers = numberOfFollowers - self.numberOfFollows = numberOfFollows - } +// MARK: - UserPublicProfilesAttributes - public enum CodingKeys: String, CodingKey, CaseIterable { - case handle - case profileName - case picture - case color - case externalLinks - case numberOfFollowers - case numberOfFollows - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(handle, forKey: .handle) - try container.encodeIfPresent(profileName, forKey: .profileName) - try container.encodeIfPresent(picture, forKey: .picture) - try container.encode(color, forKey: .color) - try container.encodeIfPresent(externalLinks, forKey: .externalLinks) - try container.encodeIfPresent(numberOfFollowers, forKey: .numberOfFollowers) - try container.encodeIfPresent(numberOfFollows, forKey: .numberOfFollows) - } +public struct UserPublicProfilesAttributes: Codable, Hashable { + /// A customizable handle for the user profile + public var handle: String? + /// Public Name of the user profile + public var profileName: String? + public var picture: UserPublicProfilesImageLink? + public var color: [String] + /// ExternalLinks for the user's profile + public var externalLinks: [UserPublicProfilesExternalLink]? + /// Number of followers for the user + public var numberOfFollowers: Int? + /// Number of users the user follows + public var numberOfFollows: Int? + + public init( + handle: String? = nil, + profileName: String? = nil, + picture: UserPublicProfilesImageLink? = nil, + color: [String], + externalLinks: [UserPublicProfilesExternalLink]? = nil, + numberOfFollowers: Int? = nil, + numberOfFollows: Int? = nil + ) { + self.handle = handle + self.profileName = profileName + self.picture = picture + self.color = color + self.externalLinks = externalLinks + self.numberOfFollowers = numberOfFollowers + self.numberOfFollows = numberOfFollows + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case handle + case profileName + case picture + case color + case externalLinks + case numberOfFollowers + case numberOfFollows + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(handle, forKey: .handle) + try container.encodeIfPresent(profileName, forKey: .profileName) + try container.encodeIfPresent(picture, forKey: .picture) + try container.encode(color, forKey: .color) + try container.encodeIfPresent(externalLinks, forKey: .externalLinks) + try container.encodeIfPresent(numberOfFollowers, forKey: .numberOfFollowers) + try container.encodeIfPresent(numberOfFollows, forKey: .numberOfFollows) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLink.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLink.swift index ca2799a6..8f509ae0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLink.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLink.swift @@ -1,37 +1,30 @@ -// -// UserPublicProfilesExternalLink.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilesExternalLink: Codable, Hashable { - - /** link to something that is related to a resource */ - public var href: String - public var meta: UserPublicProfilesExternalLinkMeta - - public init(href: String, meta: UserPublicProfilesExternalLinkMeta) { - self.href = href - self.meta = meta - } +// MARK: - UserPublicProfilesExternalLink - public enum CodingKeys: String, CodingKey, CaseIterable { - case href - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(href, forKey: .href) - try container.encode(meta, forKey: .meta) - } +public struct UserPublicProfilesExternalLink: Codable, Hashable { + /// link to something that is related to a resource + public var href: String + public var meta: UserPublicProfilesExternalLinkMeta + + public init(href: String, meta: UserPublicProfilesExternalLinkMeta) { + self.href = href + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case href + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(href, forKey: .href) + try container.encode(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLinkMeta.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLinkMeta.swift index d5964d38..d86411a7 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLinkMeta.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesExternalLinkMeta.swift @@ -1,51 +1,45 @@ -// -// UserPublicProfilesExternalLinkMeta.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** metadata about an external link */ -public struct UserPublicProfilesExternalLinkMeta: Codable, Hashable { - - public enum ModelType: String, Codable, CaseIterable { - case tidalSharing = "TIDAL_SHARING" - case tidalAutoplayAndroid = "TIDAL_AUTOPLAY_ANDROID" - case tidalAutoplayIos = "TIDAL_AUTOPLAY_IOS" - case tidalAutoplayWeb = "TIDAL_AUTOPLAY_WEB" - case twitter = "TWITTER" - case facebook = "FACEBOOK" - case instagram = "INSTAGRAM" - case tiktok = "TIKTOK" - case snapchat = "SNAPCHAT" - case homepage = "HOMEPAGE" - } - /** external link type */ - public var type: ModelType - /** external link handle */ - public var handle: String - - public init(type: ModelType, handle: String) { - self.type = type - self.handle = handle - } +// MARK: - UserPublicProfilesExternalLinkMeta - public enum CodingKeys: String, CodingKey, CaseIterable { - case type - case handle - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(type, forKey: .type) - try container.encode(handle, forKey: .handle) - } +/// metadata about an external link +public struct UserPublicProfilesExternalLinkMeta: Codable, Hashable { + public enum ModelType: String, Codable, CaseIterable { + case tidalSharing = "TIDAL_SHARING" + case tidalAutoplayAndroid = "TIDAL_AUTOPLAY_ANDROID" + case tidalAutoplayIos = "TIDAL_AUTOPLAY_IOS" + case tidalAutoplayWeb = "TIDAL_AUTOPLAY_WEB" + case twitter = "TWITTER" + case facebook = "FACEBOOK" + case instagram = "INSTAGRAM" + case tiktok = "TIKTOK" + case snapchat = "SNAPCHAT" + case homepage = "HOMEPAGE" + } + + /// external link type + public var type: ModelType + /// external link handle + public var handle: String + + public init(type: ModelType, handle: String) { + self.type = type + self.handle = handle + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case type + case handle + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(type, forKey: .type) + try container.encode(handle, forKey: .handle) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesImageLink.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesImageLink.swift index e7d47eb3..c6112096 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesImageLink.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesImageLink.swift @@ -1,38 +1,31 @@ -// -// UserPublicProfilesImageLink.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** ImageLink to the users image */ -public struct UserPublicProfilesImageLink: Codable, Hashable { - - /** link to an image */ - public var href: String - public var meta: ImageLinkMeta? - - public init(href: String, meta: ImageLinkMeta? = nil) { - self.href = href - self.meta = meta - } +// MARK: - UserPublicProfilesImageLink - public enum CodingKeys: String, CodingKey, CaseIterable { - case href - case meta - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(href, forKey: .href) - try container.encodeIfPresent(meta, forKey: .meta) - } +/// ImageLink to the users image +public struct UserPublicProfilesImageLink: Codable, Hashable { + /// link to an image + public var href: String + public var meta: ImageLinkMeta? + + public init(href: String, meta: ImageLinkMeta? = nil) { + self.href = href + self.meta = meta + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case href + case meta + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(href, forKey: .href) + try container.encodeIfPresent(meta, forKey: .meta) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataDocument.swift index cc639e24..2ed9719e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataDocument.swift @@ -1,40 +1,37 @@ -// -// UserPublicProfilesMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilesMultiDataDocument: Codable, Hashable { - - public var data: [UserPublicProfilesResource]? - public var links: Links? - public var included: [UserPublicProfilesSingleDataDocumentIncludedInner]? - - public init(data: [UserPublicProfilesResource]? = nil, links: Links? = nil, included: [UserPublicProfilesSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserPublicProfilesMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserPublicProfilesMultiDataDocument: Codable, Hashable { + public var data: [UserPublicProfilesResource]? + public var links: Links? + public var included: [UserPublicProfilesSingleDataDocumentIncludedInner]? + + public init( + data: [UserPublicProfilesResource]? = nil, + links: Links? = nil, + included: [UserPublicProfilesSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocument.swift index 5724b35a..23f84fc1 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// UserPublicProfilesMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilesMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [UserPublicProfilesMultiDataRelationshipDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [UserPublicProfilesMultiDataRelationshipDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserPublicProfilesMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserPublicProfilesMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [UserPublicProfilesMultiDataRelationshipDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [UserPublicProfilesMultiDataRelationshipDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocumentIncludedInner.swift index 69e3b76e..b3c6e615 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesMultiDataRelationshipDocumentIncludedInner.swift @@ -1,53 +1,53 @@ -// -// UserPublicProfilesMultiDataRelationshipDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserPublicProfilesMultiDataRelationshipDocumentIncludedInner + public enum UserPublicProfilesMultiDataRelationshipDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeArtistsResource(ArtistsResource) - case typePlaylistsResource(PlaylistsResource) - case typeUserPublicProfilePicksResource(UserPublicProfilePicksResource) - case typeUserPublicProfilesResource(UserPublicProfilesResource) - case typeUsersResource(UsersResource) + case typeArtistsResource(ArtistsResource) + case typePlaylistsResource(PlaylistsResource) + case typeUserPublicProfilePicksResource(UserPublicProfilePicksResource) + case typeUserPublicProfilesResource(UserPublicProfilesResource) + case typeUsersResource(UsersResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeArtistsResource(let value): - try container.encode(value) - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeUserPublicProfilePicksResource(let value): - try container.encode(value) - case .typeUserPublicProfilesResource(let value): - try container.encode(value) - case .typeUsersResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeArtistsResource(value): + try container.encode(value) + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeUserPublicProfilePicksResource(value): + try container.encode(value) + case let .typeUserPublicProfilesResource(value): + try container.encode(value) + case let .typeUsersResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(UserPublicProfilePicksResource.self) { - self = .typeUserPublicProfilePicksResource(value) - } else if let value = try? container.decode(UserPublicProfilesResource.self) { - self = .typeUserPublicProfilesResource(value) - } else if let value = try? container.decode(UsersResource.self) { - self = .typeUsersResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UserPublicProfilesMultiDataRelationshipDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(UserPublicProfilePicksResource.self) { + self = .typeUserPublicProfilePicksResource(value) + } else if let value = try? container.decode(UserPublicProfilesResource.self) { + self = .typeUserPublicProfilesResource(value) + } else if let value = try? container.decode(UsersResource.self) { + self = .typeUsersResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UserPublicProfilesMultiDataRelationshipDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesRelationships.swift index 60454b6f..498a2aa6 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesRelationships.swift @@ -1,44 +1,42 @@ -// -// UserPublicProfilesRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilesRelationships: Codable, Hashable { - - public var followers: MultiDataRelationshipDoc - public var following: MultiDataRelationshipDoc - public var publicPlaylists: MultiDataRelationshipDoc - public var publicPicks: MultiDataRelationshipDoc - - public init(followers: MultiDataRelationshipDoc, following: MultiDataRelationshipDoc, publicPlaylists: MultiDataRelationshipDoc, publicPicks: MultiDataRelationshipDoc) { - self.followers = followers - self.following = following - self.publicPlaylists = publicPlaylists - self.publicPicks = publicPicks - } +// MARK: - UserPublicProfilesRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case followers - case following - case publicPlaylists - case publicPicks - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(followers, forKey: .followers) - try container.encode(following, forKey: .following) - try container.encode(publicPlaylists, forKey: .publicPlaylists) - try container.encode(publicPicks, forKey: .publicPicks) - } +public struct UserPublicProfilesRelationships: Codable, Hashable { + public var followers: MultiDataRelationshipDoc + public var following: MultiDataRelationshipDoc + public var publicPlaylists: MultiDataRelationshipDoc + public var publicPicks: MultiDataRelationshipDoc + + public init( + followers: MultiDataRelationshipDoc, + following: MultiDataRelationshipDoc, + publicPlaylists: MultiDataRelationshipDoc, + publicPicks: MultiDataRelationshipDoc + ) { + self.followers = followers + self.following = following + self.publicPlaylists = publicPlaylists + self.publicPicks = publicPicks + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case followers + case following + case publicPlaylists + case publicPicks + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(followers, forKey: .followers) + try container.encode(following, forKey: .following) + try container.encode(publicPlaylists, forKey: .publicPlaylists) + try container.encode(publicPicks, forKey: .publicPicks) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesResource.swift index efe04e98..5c49afaa 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesResource.swift @@ -1,50 +1,49 @@ -// -// UserPublicProfilesResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilesResource: Codable, Hashable { - - public var attributes: UserPublicProfilesAttributes? - public var relationships: UserPublicProfilesRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: UserPublicProfilesAttributes? = nil, relationships: UserPublicProfilesRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - UserPublicProfilesResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct UserPublicProfilesResource: Codable, Hashable { + public var attributes: UserPublicProfilesAttributes? + public var relationships: UserPublicProfilesRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: UserPublicProfilesAttributes? = nil, + relationships: UserPublicProfilesRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocument.swift index cb8cd137..453e88af 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocument.swift @@ -1,40 +1,37 @@ -// -// UserPublicProfilesSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserPublicProfilesSingleDataDocument: Codable, Hashable { - - public var data: UserPublicProfilesResource? - public var links: Links? - public var included: [UserPublicProfilesSingleDataDocumentIncludedInner]? - - public init(data: UserPublicProfilesResource? = nil, links: Links? = nil, included: [UserPublicProfilesSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserPublicProfilesSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserPublicProfilesSingleDataDocument: Codable, Hashable { + public var data: UserPublicProfilesResource? + public var links: Links? + public var included: [UserPublicProfilesSingleDataDocumentIncludedInner]? + + public init( + data: UserPublicProfilesResource? = nil, + links: Links? = nil, + included: [UserPublicProfilesSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocumentIncludedInner.swift index b114a576..7d4bd40a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserPublicProfilesSingleDataDocumentIncludedInner.swift @@ -1,48 +1,48 @@ -// -// UserPublicProfilesSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserPublicProfilesSingleDataDocumentIncludedInner + public enum UserPublicProfilesSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeArtistsResource(ArtistsResource) - case typePlaylistsResource(PlaylistsResource) - case typeUserPublicProfilePicksResource(UserPublicProfilePicksResource) - case typeUsersResource(UsersResource) + case typeArtistsResource(ArtistsResource) + case typePlaylistsResource(PlaylistsResource) + case typeUserPublicProfilePicksResource(UserPublicProfilePicksResource) + case typeUsersResource(UsersResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeArtistsResource(let value): - try container.encode(value) - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeUserPublicProfilePicksResource(let value): - try container.encode(value) - case .typeUsersResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeArtistsResource(value): + try container.encode(value) + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeUserPublicProfilePicksResource(value): + try container.encode(value) + case let .typeUsersResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(UserPublicProfilePicksResource.self) { - self = .typeUserPublicProfilePicksResource(value) - } else if let value = try? container.decode(UsersResource.self) { - self = .typeUsersResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UserPublicProfilesSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(UserPublicProfilePicksResource.self) { + self = .typeUserPublicProfilePicksResource(value) + } else if let value = try? container.decode(UsersResource.self) { + self = .typeUsersResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UserPublicProfilesSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataDocument.swift index 7e0a5463..f2090faa 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataDocument.swift @@ -1,40 +1,37 @@ -// -// UserRecommendationsMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserRecommendationsMultiDataDocument: Codable, Hashable { - - public var data: [UserRecommendationsResource]? - public var links: Links? - public var included: [UserRecommendationsSingleDataDocumentIncludedInner]? - - public init(data: [UserRecommendationsResource]? = nil, links: Links? = nil, included: [UserRecommendationsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserRecommendationsMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserRecommendationsMultiDataDocument: Codable, Hashable { + public var data: [UserRecommendationsResource]? + public var links: Links? + public var included: [UserRecommendationsSingleDataDocumentIncludedInner]? + + public init( + data: [UserRecommendationsResource]? = nil, + links: Links? = nil, + included: [UserRecommendationsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocument.swift index f7b55fa3..948526ad 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// UserRecommendationsMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserRecommendationsMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [UserRecommendationsMultiDataRelationshipDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [UserRecommendationsMultiDataRelationshipDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserRecommendationsMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserRecommendationsMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [UserRecommendationsMultiDataRelationshipDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [UserRecommendationsMultiDataRelationshipDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocumentIncludedInner.swift index ef5c61fc..a7352ba9 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsMultiDataRelationshipDocumentIncludedInner.swift @@ -1,38 +1,38 @@ -// -// UserRecommendationsMultiDataRelationshipDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserRecommendationsMultiDataRelationshipDocumentIncludedInner + public enum UserRecommendationsMultiDataRelationshipDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typePlaylistsResource(PlaylistsResource) - case typeUserRecommendationsResource(UserRecommendationsResource) + case typePlaylistsResource(PlaylistsResource) + case typeUserRecommendationsResource(UserRecommendationsResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typePlaylistsResource(let value): - try container.encode(value) - case .typeUserRecommendationsResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typePlaylistsResource(value): + try container.encode(value) + case let .typeUserRecommendationsResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else if let value = try? container.decode(UserRecommendationsResource.self) { - self = .typeUserRecommendationsResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UserRecommendationsMultiDataRelationshipDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else if let value = try? container.decode(UserRecommendationsResource.self) { + self = .typeUserRecommendationsResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UserRecommendationsMultiDataRelationshipDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsRelationships.swift index 136718cf..3c92e73e 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsRelationships.swift @@ -1,40 +1,37 @@ -// -// UserRecommendationsRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserRecommendationsRelationships: Codable, Hashable { - - public var discoveryMixes: MultiDataRelationshipDoc - public var newArrivalMixes: MultiDataRelationshipDoc - public var myMixes: MultiDataRelationshipDoc - - public init(discoveryMixes: MultiDataRelationshipDoc, newArrivalMixes: MultiDataRelationshipDoc, myMixes: MultiDataRelationshipDoc) { - self.discoveryMixes = discoveryMixes - self.newArrivalMixes = newArrivalMixes - self.myMixes = myMixes - } +// MARK: - UserRecommendationsRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case discoveryMixes - case newArrivalMixes - case myMixes - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(discoveryMixes, forKey: .discoveryMixes) - try container.encode(newArrivalMixes, forKey: .newArrivalMixes) - try container.encode(myMixes, forKey: .myMixes) - } +public struct UserRecommendationsRelationships: Codable, Hashable { + public var discoveryMixes: MultiDataRelationshipDoc + public var newArrivalMixes: MultiDataRelationshipDoc + public var myMixes: MultiDataRelationshipDoc + + public init( + discoveryMixes: MultiDataRelationshipDoc, + newArrivalMixes: MultiDataRelationshipDoc, + myMixes: MultiDataRelationshipDoc + ) { + self.discoveryMixes = discoveryMixes + self.newArrivalMixes = newArrivalMixes + self.myMixes = myMixes + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case discoveryMixes + case newArrivalMixes + case myMixes + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(discoveryMixes, forKey: .discoveryMixes) + try container.encode(newArrivalMixes, forKey: .newArrivalMixes) + try container.encode(myMixes, forKey: .myMixes) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsResource.swift index 600b01ce..ba0a371a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsResource.swift @@ -1,50 +1,49 @@ -// -// UserRecommendationsResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserRecommendationsResource: Codable, Hashable { - - public var attributes: AnyCodable? - public var relationships: UserRecommendationsRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: AnyCodable? = nil, relationships: UserRecommendationsRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - UserRecommendationsResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct UserRecommendationsResource: Codable, Hashable { + public var attributes: AnyCodable? + public var relationships: UserRecommendationsRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: AnyCodable? = nil, + relationships: UserRecommendationsRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocument.swift index 85771d3a..7a38e95b 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocument.swift @@ -1,40 +1,37 @@ -// -// UserRecommendationsSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UserRecommendationsSingleDataDocument: Codable, Hashable { - - public var data: UserRecommendationsResource? - public var links: Links? - public var included: [UserRecommendationsSingleDataDocumentIncludedInner]? - - public init(data: UserRecommendationsResource? = nil, links: Links? = nil, included: [UserRecommendationsSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UserRecommendationsSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UserRecommendationsSingleDataDocument: Codable, Hashable { + public var data: UserRecommendationsResource? + public var links: Links? + public var included: [UserRecommendationsSingleDataDocumentIncludedInner]? + + public init( + data: UserRecommendationsResource? = nil, + links: Links? = nil, + included: [UserRecommendationsSingleDataDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocumentIncludedInner.swift index 555332bb..4084e6f0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UserRecommendationsSingleDataDocumentIncludedInner.swift @@ -1,33 +1,33 @@ -// -// UserRecommendationsSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UserRecommendationsSingleDataDocumentIncludedInner + public enum UserRecommendationsSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typePlaylistsResource(PlaylistsResource) + case typePlaylistsResource(PlaylistsResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typePlaylistsResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typePlaylistsResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(PlaylistsResource.self) { - self = .typePlaylistsResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UserRecommendationsSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(PlaylistsResource.self) { + self = .typePlaylistsResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UserRecommendationsSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersAttributes.swift index 8d235283..e4cd7bc0 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersAttributes.swift @@ -1,58 +1,58 @@ -// -// UsersAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UsersAttributes: Codable, Hashable { - - /** user name */ - public var username: String - /** ISO 3166-1 alpha-2 country code */ - public var country: String - /** email address */ - public var email: String? - /** Is the email verified */ - public var emailVerified: Bool? - /** Users first name */ - public var firstName: String? - /** Users last name */ - public var lastName: String? - - public init(username: String, country: String, email: String? = nil, emailVerified: Bool? = nil, firstName: String? = nil, lastName: String? = nil) { - self.username = username - self.country = country - self.email = email - self.emailVerified = emailVerified - self.firstName = firstName - self.lastName = lastName - } +// MARK: - UsersAttributes - public enum CodingKeys: String, CodingKey, CaseIterable { - case username - case country - case email - case emailVerified - case firstName - case lastName - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(username, forKey: .username) - try container.encode(country, forKey: .country) - try container.encodeIfPresent(email, forKey: .email) - try container.encodeIfPresent(emailVerified, forKey: .emailVerified) - try container.encodeIfPresent(firstName, forKey: .firstName) - try container.encodeIfPresent(lastName, forKey: .lastName) - } +public struct UsersAttributes: Codable, Hashable { + /// user name + public var username: String + /// ISO 3166-1 alpha-2 country code + public var country: String + /// email address + public var email: String? + /// Is the email verified + public var emailVerified: Bool? + /// Users first name + public var firstName: String? + /// Users last name + public var lastName: String? + + public init( + username: String, + country: String, + email: String? = nil, + emailVerified: Bool? = nil, + firstName: String? = nil, + lastName: String? = nil + ) { + self.username = username + self.country = country + self.email = email + self.emailVerified = emailVerified + self.firstName = firstName + self.lastName = lastName + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case username + case country + case email + case emailVerified + case firstName + case lastName + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(username, forKey: .username) + try container.encode(country, forKey: .country) + try container.encodeIfPresent(email, forKey: .email) + try container.encodeIfPresent(emailVerified, forKey: .emailVerified) + try container.encodeIfPresent(firstName, forKey: .firstName) + try container.encodeIfPresent(lastName, forKey: .lastName) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersMultiDataDocument.swift index 7bc2cbde..5fe05f51 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersMultiDataDocument.swift @@ -1,40 +1,33 @@ -// -// UsersMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UsersMultiDataDocument: Codable, Hashable { - - public var data: [UsersResource]? - public var links: Links? - public var included: [UsersSingleDataDocumentIncludedInner]? - - public init(data: [UsersResource]? = nil, links: Links? = nil, included: [UsersSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UsersMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UsersMultiDataDocument: Codable, Hashable { + public var data: [UsersResource]? + public var links: Links? + public var included: [UsersSingleDataDocumentIncludedInner]? + + public init(data: [UsersResource]? = nil, links: Links? = nil, included: [UsersSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersRelationships.swift index 26f7133e..0b1de483 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersRelationships.swift @@ -1,40 +1,37 @@ -// -// UsersRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UsersRelationships: Codable, Hashable { - - public var entitlements: SingletonDataRelationshipDoc - public var publicProfile: SingletonDataRelationshipDoc - public var recommendations: SingletonDataRelationshipDoc - - public init(entitlements: SingletonDataRelationshipDoc, publicProfile: SingletonDataRelationshipDoc, recommendations: SingletonDataRelationshipDoc) { - self.entitlements = entitlements - self.publicProfile = publicProfile - self.recommendations = recommendations - } +// MARK: - UsersRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case entitlements - case publicProfile - case recommendations - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(entitlements, forKey: .entitlements) - try container.encode(publicProfile, forKey: .publicProfile) - try container.encode(recommendations, forKey: .recommendations) - } +public struct UsersRelationships: Codable, Hashable { + public var entitlements: SingletonDataRelationshipDoc + public var publicProfile: SingletonDataRelationshipDoc + public var recommendations: SingletonDataRelationshipDoc + + public init( + entitlements: SingletonDataRelationshipDoc, + publicProfile: SingletonDataRelationshipDoc, + recommendations: SingletonDataRelationshipDoc + ) { + self.entitlements = entitlements + self.publicProfile = publicProfile + self.recommendations = recommendations + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case entitlements + case publicProfile + case recommendations + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(entitlements, forKey: .entitlements) + try container.encode(publicProfile, forKey: .publicProfile) + try container.encode(recommendations, forKey: .recommendations) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersResource.swift index 0cfea0d1..2368634b 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersResource.swift @@ -1,50 +1,49 @@ -// -// UsersResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UsersResource: Codable, Hashable { - - public var attributes: UsersAttributes? - public var relationships: UsersRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: UsersAttributes? = nil, relationships: UsersRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - UsersResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct UsersResource: Codable, Hashable { + public var attributes: UsersAttributes? + public var relationships: UsersRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: UsersAttributes? = nil, + relationships: UsersRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocument.swift index 4794d21e..9bc6c8bd 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocument.swift @@ -1,40 +1,33 @@ -// -// UsersSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UsersSingleDataDocument: Codable, Hashable { - - public var data: UsersResource? - public var links: Links? - public var included: [UsersSingleDataDocumentIncludedInner]? - - public init(data: UsersResource? = nil, links: Links? = nil, included: [UsersSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UsersSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UsersSingleDataDocument: Codable, Hashable { + public var data: UsersResource? + public var links: Links? + public var included: [UsersSingleDataDocumentIncludedInner]? + + public init(data: UsersResource? = nil, links: Links? = nil, included: [UsersSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocumentIncludedInner.swift index 4cf3af8e..1a23c0ed 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingleDataDocumentIncludedInner.swift @@ -1,43 +1,43 @@ -// -// UsersSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UsersSingleDataDocumentIncludedInner + public enum UsersSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeUserEntitlementsResource(UserEntitlementsResource) - case typeUserPublicProfilesResource(UserPublicProfilesResource) - case typeUserRecommendationsResource(UserRecommendationsResource) + case typeUserEntitlementsResource(UserEntitlementsResource) + case typeUserPublicProfilesResource(UserPublicProfilesResource) + case typeUserRecommendationsResource(UserRecommendationsResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeUserEntitlementsResource(let value): - try container.encode(value) - case .typeUserPublicProfilesResource(let value): - try container.encode(value) - case .typeUserRecommendationsResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeUserEntitlementsResource(value): + try container.encode(value) + case let .typeUserPublicProfilesResource(value): + try container.encode(value) + case let .typeUserRecommendationsResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(UserEntitlementsResource.self) { - self = .typeUserEntitlementsResource(value) - } else if let value = try? container.decode(UserPublicProfilesResource.self) { - self = .typeUserPublicProfilesResource(value) - } else if let value = try? container.decode(UserRecommendationsResource.self) { - self = .typeUserRecommendationsResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UsersSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(UserEntitlementsResource.self) { + self = .typeUserEntitlementsResource(value) + } else if let value = try? container.decode(UserPublicProfilesResource.self) { + self = .typeUserPublicProfilesResource(value) + } else if let value = try? container.decode(UserRecommendationsResource.self) { + self = .typeUserRecommendationsResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UsersSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocument.swift index af771903..95c44100 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// UsersSingletonDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct UsersSingletonDataRelationshipDocument: Codable, Hashable { - - public var data: ResourceIdentifier? - public var links: Links? - public var included: [UsersSingletonDataRelationshipDocumentIncludedInner]? - - public init(data: ResourceIdentifier? = nil, links: Links? = nil, included: [UsersSingletonDataRelationshipDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - UsersSingletonDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct UsersSingletonDataRelationshipDocument: Codable, Hashable { + public var data: ResourceIdentifier? + public var links: Links? + public var included: [UsersSingletonDataRelationshipDocumentIncludedInner]? + + public init( + data: ResourceIdentifier? = nil, + links: Links? = nil, + included: [UsersSingletonDataRelationshipDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocumentIncludedInner.swift index 1b19e6a5..d707c70a 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/UsersSingletonDataRelationshipDocumentIncludedInner.swift @@ -1,48 +1,48 @@ -// -// UsersSingletonDataRelationshipDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - UsersSingletonDataRelationshipDocumentIncludedInner + public enum UsersSingletonDataRelationshipDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeUserEntitlementsResource(UserEntitlementsResource) - case typeUserPublicProfilesResource(UserPublicProfilesResource) - case typeUserRecommendationsResource(UserRecommendationsResource) - case typeUsersResource(UsersResource) + case typeUserEntitlementsResource(UserEntitlementsResource) + case typeUserPublicProfilesResource(UserPublicProfilesResource) + case typeUserRecommendationsResource(UserRecommendationsResource) + case typeUsersResource(UsersResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeUserEntitlementsResource(let value): - try container.encode(value) - case .typeUserPublicProfilesResource(let value): - try container.encode(value) - case .typeUserRecommendationsResource(let value): - try container.encode(value) - case .typeUsersResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeUserEntitlementsResource(value): + try container.encode(value) + case let .typeUserPublicProfilesResource(value): + try container.encode(value) + case let .typeUserRecommendationsResource(value): + try container.encode(value) + case let .typeUsersResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(UserEntitlementsResource.self) { - self = .typeUserEntitlementsResource(value) - } else if let value = try? container.decode(UserPublicProfilesResource.self) { - self = .typeUserPublicProfilesResource(value) - } else if let value = try? container.decode(UserRecommendationsResource.self) { - self = .typeUserRecommendationsResource(value) - } else if let value = try? container.decode(UsersResource.self) { - self = .typeUsersResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of UsersSingletonDataRelationshipDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(UserEntitlementsResource.self) { + self = .typeUserEntitlementsResource(value) + } else if let value = try? container.decode(UserPublicProfilesResource.self) { + self = .typeUserPublicProfilesResource(value) + } else if let value = try? container.decode(UserRecommendationsResource.self) { + self = .typeUserRecommendationsResource(value) + } else if let value = try? container.decode(UsersResource.self) { + self = .typeUsersResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of UsersSingletonDataRelationshipDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideoLinkMeta.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideoLinkMeta.swift index f5ea0912..96897335 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideoLinkMeta.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideoLinkMeta.swift @@ -1,39 +1,32 @@ -// -// VideoLinkMeta.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -/** metadata about a video */ -public struct VideoLinkMeta: Codable, Hashable { - - /** video width (in pixels) */ - public var width: Int - /** video height (in pixels) */ - public var height: Int - - public init(width: Int, height: Int) { - self.width = width - self.height = height - } +// MARK: - VideoLinkMeta - public enum CodingKeys: String, CodingKey, CaseIterable { - case width - case height - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(width, forKey: .width) - try container.encode(height, forKey: .height) - } +/// metadata about a video +public struct VideoLinkMeta: Codable, Hashable { + /// video width (in pixels) + public var width: Int + /// video height (in pixels) + public var height: Int + + public init(width: Int, height: Int) { + self.width = width + self.height = height + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case width + case height + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(width, forKey: .width) + try container.encode(height, forKey: .height) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosAttributes.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosAttributes.swift index fa22ff44..ff29487b 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosAttributes.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosAttributes.swift @@ -1,88 +1,94 @@ -// -// VideosAttributes.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - VideosAttributes + public struct VideosAttributes: Codable, Hashable { + public enum Availability: String, Codable, CaseIterable { + case stream = "STREAM" + case dj = "DJ" + case stem = "STEM" + } - public enum Availability: String, Codable, CaseIterable { - case stream = "STREAM" - case dj = "DJ" - case stem = "STEM" - } - /** Album item's title */ - public var title: String - /** Version of the album's item; complements title */ - public var version: String? - /** ISRC code */ - public var isrc: String - /** Duration expressed in accordance with ISO 8601 */ - public var duration: String - /** Copyright information */ - public var copyright: String? - /** Release date (ISO-8601) */ - public var releaseDate: Date? - /** Indicates whether a catalog item consist of any explicit content */ - public var explicit: Bool - /** Track or video popularity (ranged in 0.00 ... 1.00). Conditionally visible */ - public var popularity: Double - /** Defines a catalog item availability e.g. for streaming, DJs, stems */ - public var availability: [Availability]? - /** Represents available links to, and metadata about, an album item images */ - public var imageLinks: [CatalogueItemImageLink]? - /** Represents available links to something that is related to a catalog item, but external to the TIDAL API */ - public var externalLinks: [CatalogueItemExternalLink]? + /// Album item's title + public var title: String + /// Version of the album's item; complements title + public var version: String? + /// ISRC code + public var isrc: String + /// Duration expressed in accordance with ISO 8601 + public var duration: String + /// Copyright information + public var copyright: String? + /// Release date (ISO-8601) + public var releaseDate: Date? + /// Indicates whether a catalog item consist of any explicit content + public var explicit: Bool + /// Track or video popularity (ranged in 0.00 ... 1.00). Conditionally visible + public var popularity: Double + /// Defines a catalog item availability e.g. for streaming, DJs, stems + public var availability: [Availability]? + /// Represents available links to, and metadata about, an album item images + public var imageLinks: [CatalogueItemImageLink]? + /// Represents available links to something that is related to a catalog item, but external to the TIDAL API + public var externalLinks: [CatalogueItemExternalLink]? - public init(title: String, version: String? = nil, isrc: String, duration: String, copyright: String? = nil, releaseDate: Date? = nil, explicit: Bool, popularity: Double, availability: [Availability]? = nil, imageLinks: [CatalogueItemImageLink]? = nil, externalLinks: [CatalogueItemExternalLink]? = nil) { - self.title = title - self.version = version - self.isrc = isrc - self.duration = duration - self.copyright = copyright - self.releaseDate = releaseDate - self.explicit = explicit - self.popularity = popularity - self.availability = availability - self.imageLinks = imageLinks - self.externalLinks = externalLinks - } + public init( + title: String, + version: String? = nil, + isrc: String, + duration: String, + copyright: String? = nil, + releaseDate: Date? = nil, + explicit: Bool, + popularity: Double, + availability: [Availability]? = nil, + imageLinks: [CatalogueItemImageLink]? = nil, + externalLinks: [CatalogueItemExternalLink]? = nil + ) { + self.title = title + self.version = version + self.isrc = isrc + self.duration = duration + self.copyright = copyright + self.releaseDate = releaseDate + self.explicit = explicit + self.popularity = popularity + self.availability = availability + self.imageLinks = imageLinks + self.externalLinks = externalLinks + } - public enum CodingKeys: String, CodingKey, CaseIterable { - case title - case version - case isrc - case duration - case copyright - case releaseDate - case explicit - case popularity - case availability - case imageLinks - case externalLinks - } + public enum CodingKeys: String, CodingKey, CaseIterable { + case title + case version + case isrc + case duration + case copyright + case releaseDate + case explicit + case popularity + case availability + case imageLinks + case externalLinks + } - // Encodable protocol methods + // Encodable protocol methods - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(title, forKey: .title) - try container.encodeIfPresent(version, forKey: .version) - try container.encode(isrc, forKey: .isrc) - try container.encode(duration, forKey: .duration) - try container.encodeIfPresent(copyright, forKey: .copyright) - try container.encodeIfPresent(releaseDate, forKey: .releaseDate) - try container.encode(explicit, forKey: .explicit) - try container.encode(popularity, forKey: .popularity) - try container.encodeIfPresent(availability, forKey: .availability) - try container.encodeIfPresent(imageLinks, forKey: .imageLinks) - try container.encodeIfPresent(externalLinks, forKey: .externalLinks) - } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(title, forKey: .title) + try container.encodeIfPresent(version, forKey: .version) + try container.encode(isrc, forKey: .isrc) + try container.encode(duration, forKey: .duration) + try container.encodeIfPresent(copyright, forKey: .copyright) + try container.encodeIfPresent(releaseDate, forKey: .releaseDate) + try container.encode(explicit, forKey: .explicit) + try container.encode(popularity, forKey: .popularity) + try container.encodeIfPresent(availability, forKey: .availability) + try container.encodeIfPresent(imageLinks, forKey: .imageLinks) + try container.encodeIfPresent(externalLinks, forKey: .externalLinks) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataDocument.swift index 424bdc2f..2adfce34 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataDocument.swift @@ -1,40 +1,33 @@ -// -// VideosMultiDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct VideosMultiDataDocument: Codable, Hashable { - - public var data: [VideosResource]? - public var links: Links? - public var included: [VideosSingleDataDocumentIncludedInner]? - - public init(data: [VideosResource]? = nil, links: Links? = nil, included: [VideosSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - VideosMultiDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct VideosMultiDataDocument: Codable, Hashable { + public var data: [VideosResource]? + public var links: Links? + public var included: [VideosSingleDataDocumentIncludedInner]? + + public init(data: [VideosResource]? = nil, links: Links? = nil, included: [VideosSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocument.swift index 1ad5cdb1..1c50f8a7 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocument.swift @@ -1,40 +1,37 @@ -// -// VideosMultiDataRelationshipDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct VideosMultiDataRelationshipDocument: Codable, Hashable { - - public var data: [ResourceIdentifier]? - public var links: Links? - public var included: [VideosMultiDataRelationshipDocumentIncludedInner]? - - public init(data: [ResourceIdentifier]? = nil, links: Links? = nil, included: [VideosMultiDataRelationshipDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - VideosMultiDataRelationshipDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct VideosMultiDataRelationshipDocument: Codable, Hashable { + public var data: [ResourceIdentifier]? + public var links: Links? + public var included: [VideosMultiDataRelationshipDocumentIncludedInner]? + + public init( + data: [ResourceIdentifier]? = nil, + links: Links? = nil, + included: [VideosMultiDataRelationshipDocumentIncludedInner]? = nil + ) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocumentIncludedInner.swift index beb3b8bd..8dbf3e81 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosMultiDataRelationshipDocumentIncludedInner.swift @@ -1,48 +1,48 @@ -// -// VideosMultiDataRelationshipDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - VideosMultiDataRelationshipDocumentIncludedInner + public enum VideosMultiDataRelationshipDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typeProvidersResource(ProvidersResource) - case typeVideosResource(VideosResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typeProvidersResource(ProvidersResource) + case typeVideosResource(VideosResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typeProvidersResource(let value): - try container.encode(value) - case .typeVideosResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typeProvidersResource(value): + try container.encode(value) + case let .typeVideosResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(ProvidersResource.self) { - self = .typeProvidersResource(value) - } else if let value = try? container.decode(VideosResource.self) { - self = .typeVideosResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of VideosMultiDataRelationshipDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(ProvidersResource.self) { + self = .typeProvidersResource(value) + } else if let value = try? container.decode(VideosResource.self) { + self = .typeVideosResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of VideosMultiDataRelationshipDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosRelationships.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosRelationships.swift index cd9501df..fbc19103 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosRelationships.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosRelationships.swift @@ -1,40 +1,33 @@ -// -// VideosRelationships.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct VideosRelationships: Codable, Hashable { - - public var albums: MultiDataRelationshipDoc - public var artists: MultiDataRelationshipDoc - public var providers: MultiDataRelationshipDoc - - public init(albums: MultiDataRelationshipDoc, artists: MultiDataRelationshipDoc, providers: MultiDataRelationshipDoc) { - self.albums = albums - self.artists = artists - self.providers = providers - } +// MARK: - VideosRelationships - public enum CodingKeys: String, CodingKey, CaseIterable { - case albums - case artists - case providers - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(albums, forKey: .albums) - try container.encode(artists, forKey: .artists) - try container.encode(providers, forKey: .providers) - } +public struct VideosRelationships: Codable, Hashable { + public var albums: MultiDataRelationshipDoc + public var artists: MultiDataRelationshipDoc + public var providers: MultiDataRelationshipDoc + + public init(albums: MultiDataRelationshipDoc, artists: MultiDataRelationshipDoc, providers: MultiDataRelationshipDoc) { + self.albums = albums + self.artists = artists + self.providers = providers + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case albums + case artists + case providers + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(albums, forKey: .albums) + try container.encode(artists, forKey: .artists) + try container.encode(providers, forKey: .providers) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosResource.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosResource.swift index a1eef54e..44f8e779 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosResource.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosResource.swift @@ -1,50 +1,49 @@ -// -// VideosResource.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct VideosResource: Codable, Hashable { - - public var attributes: VideosAttributes? - public var relationships: VideosRelationships? - public var links: Links? - /** resource unique identifier */ - public var id: String - /** resource unique type */ - public var type: String - - public init(attributes: VideosAttributes? = nil, relationships: VideosRelationships? = nil, links: Links? = nil, id: String, type: String) { - self.attributes = attributes - self.relationships = relationships - self.links = links - self.id = id - self.type = type - } +// MARK: - VideosResource - public enum CodingKeys: String, CodingKey, CaseIterable { - case attributes - case relationships - case links - case id - case type - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(attributes, forKey: .attributes) - try container.encodeIfPresent(relationships, forKey: .relationships) - try container.encodeIfPresent(links, forKey: .links) - try container.encode(id, forKey: .id) - try container.encode(type, forKey: .type) - } +public struct VideosResource: Codable, Hashable { + public var attributes: VideosAttributes? + public var relationships: VideosRelationships? + public var links: Links? + /// resource unique identifier + public var id: String + /// resource unique type + public var type: String + + public init( + attributes: VideosAttributes? = nil, + relationships: VideosRelationships? = nil, + links: Links? = nil, + id: String, + type: String + ) { + self.attributes = attributes + self.relationships = relationships + self.links = links + self.id = id + self.type = type + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case attributes + case relationships + case links + case id + case type + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(attributes, forKey: .attributes) + try container.encodeIfPresent(relationships, forKey: .relationships) + try container.encodeIfPresent(links, forKey: .links) + try container.encode(id, forKey: .id) + try container.encode(type, forKey: .type) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocument.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocument.swift index cf5e7ad5..feaf9a9d 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocument.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocument.swift @@ -1,40 +1,33 @@ -// -// VideosSingleDataDocument.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif -public struct VideosSingleDataDocument: Codable, Hashable { - - public var data: VideosResource? - public var links: Links? - public var included: [VideosSingleDataDocumentIncludedInner]? - - public init(data: VideosResource? = nil, links: Links? = nil, included: [VideosSingleDataDocumentIncludedInner]? = nil) { - self.data = data - self.links = links - self.included = included - } +// MARK: - VideosSingleDataDocument - public enum CodingKeys: String, CodingKey, CaseIterable { - case data - case links - case included - } - - // Encodable protocol methods - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(data, forKey: .data) - try container.encodeIfPresent(links, forKey: .links) - try container.encodeIfPresent(included, forKey: .included) - } +public struct VideosSingleDataDocument: Codable, Hashable { + public var data: VideosResource? + public var links: Links? + public var included: [VideosSingleDataDocumentIncludedInner]? + + public init(data: VideosResource? = nil, links: Links? = nil, included: [VideosSingleDataDocumentIncludedInner]? = nil) { + self.data = data + self.links = links + self.included = included + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case data + case links + case included + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(data, forKey: .data) + try container.encodeIfPresent(links, forKey: .links) + try container.encodeIfPresent(included, forKey: .included) + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocumentIncludedInner.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocumentIncludedInner.swift index 8fdaa422..6e1d2c8d 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocumentIncludedInner.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Models/VideosSingleDataDocumentIncludedInner.swift @@ -1,43 +1,43 @@ -// -// VideosSingleDataDocumentIncludedInner.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if canImport(AnyCodable) -import AnyCodable + import AnyCodable #endif +// MARK: - VideosSingleDataDocumentIncludedInner + public enum VideosSingleDataDocumentIncludedInner: Codable, JSONEncodable, Hashable { - case typeAlbumsResource(AlbumsResource) - case typeArtistsResource(ArtistsResource) - case typeProvidersResource(ProvidersResource) + case typeAlbumsResource(AlbumsResource) + case typeArtistsResource(ArtistsResource) + case typeProvidersResource(ProvidersResource) - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - switch self { - case .typeAlbumsResource(let value): - try container.encode(value) - case .typeArtistsResource(let value): - try container.encode(value) - case .typeProvidersResource(let value): - try container.encode(value) - } - } + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case let .typeAlbumsResource(value): + try container.encode(value) + case let .typeArtistsResource(value): + try container.encode(value) + case let .typeProvidersResource(value): + try container.encode(value) + } + } - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - if let value = try? container.decode(AlbumsResource.self) { - self = .typeAlbumsResource(value) - } else if let value = try? container.decode(ArtistsResource.self) { - self = .typeArtistsResource(value) - } else if let value = try? container.decode(ProvidersResource.self) { - self = .typeProvidersResource(value) - } else { - throw DecodingError.typeMismatch(Self.Type.self, .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of VideosSingleDataDocumentIncludedInner")) - } - } + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let value = try? container.decode(AlbumsResource.self) { + self = .typeAlbumsResource(value) + } else if let value = try? container.decode(ArtistsResource.self) { + self = .typeArtistsResource(value) + } else if let value = try? container.decode(ProvidersResource.self) { + self = .typeProvidersResource(value) + } else { + throw DecodingError.typeMismatch( + Self.Type.self, + .init( + codingPath: decoder.codingPath, + debugDescription: "Unable to decode instance of VideosSingleDataDocumentIncludedInner" + ) + ) + } + } } - diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift index cc328880..de7d8aed 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift @@ -1,56 +1,49 @@ -// -// OpenISO8601DateFormatter.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation -// https://stackoverflow.com/a/50281094/976628 +/// https://stackoverflow.com/a/50281094/976628 public class OpenISO8601DateFormatter: DateFormatter { - static let withoutSeconds: DateFormatter = { - let formatter = DateFormatter() - formatter.calendar = Calendar(identifier: .iso8601) - formatter.locale = Locale(identifier: "en_US_POSIX") - formatter.timeZone = TimeZone(secondsFromGMT: 0) - formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" - return formatter - }() - - static let withoutTime: DateFormatter = { - let formatter = DateFormatter() - formatter.calendar = Calendar(identifier: .iso8601) - formatter.locale = Locale(identifier: "en_US_POSIX") - formatter.timeZone = TimeZone(secondsFromGMT: 0) - formatter.dateFormat = "yyyy-MM-dd" - return formatter - }() - - private func setup() { - calendar = Calendar(identifier: .iso8601) - locale = Locale(identifier: "en_US_POSIX") - timeZone = TimeZone(secondsFromGMT: 0) - dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - } - - override init() { - super.init() - setup() - } - - required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - setup() - } - - override public func date(from string: String) -> Date? { - if let result = super.date(from: string) { - return result - } else if let result = OpenISO8601DateFormatter.withoutSeconds.date(from: string) { - return result - } - - return OpenISO8601DateFormatter.withoutTime.date(from: string) - } + static let withoutSeconds: DateFormatter = { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" + return formatter + }() + + static let withoutTime: DateFormatter = { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd" + return formatter + }() + + private func setup() { + calendar = Calendar(identifier: .iso8601) + locale = Locale(identifier: "en_US_POSIX") + timeZone = TimeZone(secondsFromGMT: 0) + dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + } + + override init() { + super.init() + setup() + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setup() + } + + override public func date(from string: String) -> Date? { + if let result = super.date(from: string) { + return result + } else if let result = OpenISO8601DateFormatter.withoutSeconds.date(from: string) { + return result + } + + return OpenISO8601DateFormatter.withoutTime.date(from: string) + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/SynchronizedDictionary.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/SynchronizedDictionary.swift index fbaa6242..d03272fd 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/SynchronizedDictionary.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/SynchronizedDictionary.swift @@ -1,26 +1,19 @@ -// SynchronizedDictionary.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation -internal struct SynchronizedDictionary { - - private var dictionary = [K: V]() - private let lock = NSRecursiveLock() +struct SynchronizedDictionary { + private var dictionary = [K: V]() + private let lock = NSRecursiveLock() - internal subscript(key: K) -> V? { - get { - lock.lock() - defer { lock.unlock() } - return self.dictionary[key] - } - set { - lock.lock() - defer { lock.unlock() } - self.dictionary[key] = newValue - } - } + subscript(key: K) -> V? { + get { + lock.lock() + defer { lock.unlock() } + return dictionary[key] + } + set { + lock.lock() + defer { lock.unlock() } + dictionary[key] = newValue + } + } } diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/URLSessionImplementations.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/URLSessionImplementations.swift index cbbb21f4..c3ff2672 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -1,670 +1,750 @@ -// URLSessionImplementations.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation #if !os(macOS) -import MobileCoreServices + import MobileCoreServices #endif #if canImport(UniformTypeIdentifiers) -import UniformTypeIdentifiers + import UniformTypeIdentifiers #endif -// Protocol defined for a session data task. This allows mocking out the URLSessionProtocol below since -// you may not want to create or return a real URLSessionDataTask. +// MARK: - URLSessionDataTaskProtocol + +/// Protocol defined for a session data task. This allows mocking out the URLSessionProtocol below since +/// you may not want to create or return a real URLSessionDataTask. public protocol URLSessionDataTaskProtocol { - func resume() + func resume() - var taskIdentifier: Int { get } + var taskIdentifier: Int { get } - var progress: Progress { get } + var progress: Progress { get } - func cancel() + func cancel() } -// Protocol allowing implementations to alter what is returned or to test their implementations. +// MARK: - URLSessionProtocol + +/// Protocol allowing implementations to alter what is returned or to test their implementations. public protocol URLSessionProtocol { - // Task which performs the network fetch. Expected to be from URLSession.dataTask(with:completionHandler:) such that a network request - // is sent off when `.resume()` is called. - func dataTaskFromProtocol(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTaskProtocol + /// Task which performs the network fetch. Expected to be from URLSession.dataTask(with:completionHandler:) such that a network + /// request + /// is sent off when `.resume()` is called. + func dataTaskFromProtocol( + with request: URLRequest, + completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void + ) -> URLSessionDataTaskProtocol } +// MARK: - URLSession + URLSessionProtocol + extension URLSession: URLSessionProtocol { - // Passthrough to URLSession.dataTask(with:completionHandler) since URLSessionDataTask conforms to URLSessionDataTaskProtocol and fetches the network data. - public func dataTaskFromProtocol(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, (any Error)?) -> Void) -> any URLSessionDataTaskProtocol { - return dataTask(with: request, completionHandler: completionHandler) - } + /// Passthrough to URLSession.dataTask(with:completionHandler) since URLSessionDataTask conforms to URLSessionDataTaskProtocol + /// and fetches the network data. + public func dataTaskFromProtocol( + with request: URLRequest, + completionHandler: @escaping @Sendable (Data?, URLResponse?, (any Error)?) -> Void + ) -> any URLSessionDataTaskProtocol { + dataTask(with: request, completionHandler: completionHandler) + } } +// MARK: - URLSessionDataTask + URLSessionDataTaskProtocol + extension URLSessionDataTask: URLSessionDataTaskProtocol {} +// MARK: - URLSessionRequestBuilderFactory + class URLSessionRequestBuilderFactory: RequestBuilderFactory { - func getNonDecodableBuilder() -> RequestBuilder.Type { - return URLSessionRequestBuilder.self - } + func getNonDecodableBuilder() -> RequestBuilder.Type { + URLSessionRequestBuilder.self + } - func getBuilder() -> RequestBuilder.Type { - return URLSessionDecodableRequestBuilder.self - } + func getBuilder() -> RequestBuilder.Type { + URLSessionDecodableRequestBuilder.self + } } -public typealias OpenAPIClientAPIChallengeHandler = ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?)) +public typealias OpenAPIClientAPIChallengeHandler = (URLSession, URLSessionTask, URLAuthenticationChallenge) -> ( + URLSession.AuthChallengeDisposition, + URLCredential? +) -// Store the URLSession's delegate to retain its reference +/// Store the URLSession's delegate to retain its reference private let sessionDelegate = SessionDelegate() -// Store the URLSession to retain its reference +/// Store the URLSession to retain its reference private let defaultURLSession = URLSession(configuration: .default, delegate: sessionDelegate, delegateQueue: nil) -// Store current taskDidReceiveChallenge for every URLSessionTask +/// Store current taskDidReceiveChallenge for every URLSessionTask private var challengeHandlerStore = SynchronizedDictionary() -// Store current URLCredential for every URLSessionTask +/// Store current URLCredential for every URLSessionTask private var credentialStore = SynchronizedDictionary() -open class URLSessionRequestBuilder: RequestBuilder { - - /** - May be assigned if you want to control the authentication challenges. - */ - public var taskDidReceiveChallenge: OpenAPIClientAPIChallengeHandler? - - required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) { - super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication) - } - - /** - May be overridden by a subclass if you want to control the URLSession - configuration. - */ - open func createURLSession() -> URLSessionProtocol { - return defaultURLSession - } - - /** - May be overridden by a subclass if you want to control the Content-Type - that is given to an uploaded form part. - - Return nil to use the default behavior (inferring the Content-Type from - the file extension). Return the desired Content-Type otherwise. - */ - open func contentTypeForFormPart(fileURL: URL) -> String? { - return nil - } - - /** - May be overridden by a subclass if you want to control the URLRequest - configuration (e.g. to override the cache policy). - */ - open func createURLRequest(urlSession: URLSessionProtocol, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { - - guard let url = URL(string: URLString) else { - throw DownloadException.requestMissingURL - } - - var originalRequest = URLRequest(url: url) - - originalRequest.httpMethod = method.rawValue - - buildHeaders().forEach { key, value in - originalRequest.setValue(value, forHTTPHeaderField: key) - } - - let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - - return modifiedRequest - } - - @discardableResult - override open func execute(_ apiResponseQueue: DispatchQueue = OpenAPIClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) -> RequestTask { - let urlSession = createURLSession() - - guard let xMethod = HTTPMethod(rawValue: method) else { - fatalError("Unsupported Http method - \(method)") - } - - let encoding: ParameterEncoding - - switch xMethod { - case .get, .head: - encoding = URLEncoding() - - case .options, .post, .put, .patch, .delete, .trace, .connect: - let contentType = headers["Content-Type"] ?? "application/json" - - if contentType.hasPrefix("application/") && contentType.contains("json") { - encoding = JSONDataEncoding() - } else if contentType.hasPrefix("multipart/form-data") { - encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) - } else if contentType.hasPrefix("application/x-www-form-urlencoded") { - encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ - encoding = OctetStreamEncoding() - } else { - fatalError("Unsupported Media Type - \(contentType)") - } - } - - do { - let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - - var taskIdentifier: Int? - let cleanupRequest = { - if let taskIdentifier = taskIdentifier { - challengeHandlerStore[taskIdentifier] = nil - credentialStore[taskIdentifier] = nil - } - } - - let dataTask = urlSession.dataTaskFromProtocol(with: request) { data, response, error in - apiResponseQueue.async { - self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) - cleanupRequest() - } - } - - onProgressReady?(dataTask.progress) - - taskIdentifier = dataTask.taskIdentifier - challengeHandlerStore[dataTask.taskIdentifier] = taskDidReceiveChallenge - credentialStore[dataTask.taskIdentifier] = credential - - dataTask.resume() - - requestTask.set(task: dataTask) - } catch { - apiResponseQueue.async { - completion(.failure(ErrorResponse.error(415, nil, nil, error))) - } - } - - return requestTask - } - - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - - if let error = error { - completion(.failure(ErrorResponse.error(-1, data, response, error))) - return - } - - guard let httpResponse = response as? HTTPURLResponse else { - completion(.failure(ErrorResponse.error(-2, data, response, DecodableRequestBuilderError.nilHTTPResponse))) - return - } - - guard httpResponse.isStatusCodeSuccessful else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, response, DecodableRequestBuilderError.unsuccessfulHTTPStatusCode))) - return - } - - switch T.self { - case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) - - default: - fatalError("Unsupported Response Body Type - \(String(describing: T.self))") - } - - } - - open func buildHeaders() -> [String: String] { - var httpHeaders: [String: String] = [:] - for (key, value) in OpenAPIClientAPI.customHeaders { - httpHeaders[key] = value - } - for (key, value) in headers { - httpHeaders[key] = value - } - return httpHeaders - } - - fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { - - guard let contentDisposition = contentDisposition else { - return nil - } - - let items = contentDisposition.components(separatedBy: ";") - - var filename: String? - - for contentItem in items { - - let filenameKey = "filename=" - guard let range = contentItem.range(of: filenameKey) else { - continue - } - - filename = contentItem - return filename? - .replacingCharacters(in: range, with: "") - .replacingOccurrences(of: "\"", with: "") - .trimmingCharacters(in: .whitespacesAndNewlines) - } - - return filename - - } - - fileprivate func getPath(from url: URL) throws -> String { - - guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { - throw DownloadException.requestMissingPath - } - - if path.hasPrefix("/") { - path.remove(at: path.startIndex) - } - - return path - - } - - fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { - - guard let url = urlRequest.url else { - throw DownloadException.requestMissingURL - } - - return url - } +// MARK: - URLSessionRequestBuilder +open class URLSessionRequestBuilder: RequestBuilder { + /// May be assigned if you want to control the authentication challenges. + public var taskDidReceiveChallenge: OpenAPIClientAPIChallengeHandler? + + public required init( + method: String, + URLString: String, + parameters: [String: Any]?, + headers: [String: String] = [:], + requiresAuthentication: Bool + ) { + super.init( + method: method, + URLString: URLString, + parameters: parameters, + headers: headers, + requiresAuthentication: requiresAuthentication + ) + } + + /// May be overridden by a subclass if you want to control the URLSession + /// configuration. + open func createURLSession() -> URLSessionProtocol { + defaultURLSession + } + + /// May be overridden by a subclass if you want to control the Content-Type + /// that is given to an uploaded form part. + /// + /// Return nil to use the default behavior (inferring the Content-Type from + /// the file extension). Return the desired Content-Type otherwise. + open func contentTypeForFormPart(fileURL: URL) -> String? { + nil + } + + /// May be overridden by a subclass if you want to control the URLRequest + /// configuration (e.g. to override the cache policy). + open func createURLRequest( + urlSession: URLSessionProtocol, + method: HTTPMethod, + encoding: ParameterEncoding, + headers: [String: String] + ) throws -> URLRequest { + guard let url = URL(string: URLString) else { + throw DownloadException.requestMissingURL + } + + var originalRequest = URLRequest(url: url) + + originalRequest.httpMethod = method.rawValue + + buildHeaders().forEach { key, value in + originalRequest.setValue(value, forHTTPHeaderField: key) + } + + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) + + return modifiedRequest + } + + @discardableResult + override open func execute( + _ apiResponseQueue: DispatchQueue = OpenAPIClientAPI.apiResponseQueue, + _ completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void + ) -> RequestTask { + let urlSession = createURLSession() + + guard let xMethod = HTTPMethod(rawValue: method) else { + fatalError("Unsupported Http method - \(method)") + } + + let encoding: ParameterEncoding + + switch xMethod { + case .get, .head: + encoding = URLEncoding() + + case .options, .post, .put, .patch, .delete, .trace, .connect: + let contentType = headers["Content-Type"] ?? "application/json" + + if contentType.hasPrefix("application/"), contentType.contains("json") { + encoding = JSONDataEncoding() + } else if contentType.hasPrefix("multipart/form-data") { + encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) + } else if contentType.hasPrefix("application/x-www-form-urlencoded") { + encoding = FormURLEncoding() + } else if contentType.hasPrefix("application/octet-stream") { + encoding = OctetStreamEncoding() + } else { + fatalError("Unsupported Media Type - \(contentType)") + } + } + + do { + let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) + + var taskIdentifier: Int? + let cleanupRequest = { + if let taskIdentifier { + challengeHandlerStore[taskIdentifier] = nil + credentialStore[taskIdentifier] = nil + } + } + + let dataTask = urlSession.dataTaskFromProtocol(with: request) { data, response, error in + apiResponseQueue.async { + self.processRequestResponse( + urlRequest: request, + data: data, + response: response, + error: error, + completion: completion + ) + cleanupRequest() + } + } + + onProgressReady?(dataTask.progress) + + taskIdentifier = dataTask.taskIdentifier + challengeHandlerStore[dataTask.taskIdentifier] = taskDidReceiveChallenge + credentialStore[dataTask.taskIdentifier] = credential + + dataTask.resume() + + requestTask.set(task: dataTask) + } catch { + apiResponseQueue.async { + completion(.failure(ErrorResponse.error(415, nil, nil, error))) + } + } + + return requestTask + } + + fileprivate func processRequestResponse( + urlRequest: URLRequest, + data: Data?, + response: URLResponse?, + error: Error?, + completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void + ) { + if let error { + completion(.failure(ErrorResponse.error(-1, data, response, error))) + return + } + + guard let httpResponse = response as? HTTPURLResponse else { + completion(.failure(ErrorResponse.error(-2, data, response, DecodableRequestBuilderError.nilHTTPResponse))) + return + } + + guard httpResponse.isStatusCodeSuccessful else { + completion(.failure(ErrorResponse.error( + httpResponse.statusCode, + data, + response, + DecodableRequestBuilderError.unsuccessfulHTTPStatusCode + ))) + return + } + + switch T.self { + case is Void.Type: + + completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + + default: + fatalError("Unsupported Response Body Type - \(String(describing: T.self))") + } + } + + open func buildHeaders() -> [String: String] { + var httpHeaders: [String: String] = [:] + for (key, value) in OpenAPIClientAPI.customHeaders { + httpHeaders[key] = value + } + for (key, value) in headers { + httpHeaders[key] = value + } + return httpHeaders + } + + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { + guard let contentDisposition else { + return nil + } + + let items = contentDisposition.components(separatedBy: ";") + + var filename: String? + + for contentItem in items { + let filenameKey = "filename=" + guard let range = contentItem.range(of: filenameKey) else { + continue + } + + filename = contentItem + return filename? + .replacingCharacters(in: range, with: "") + .replacingOccurrences(of: "\"", with: "") + .trimmingCharacters(in: .whitespacesAndNewlines) + } + + return filename + } + + fileprivate func getPath(from url: URL) throws -> String { + guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { + throw DownloadException.requestMissingPath + } + + if path.hasPrefix("/") { + path.remove(at: path.startIndex) + } + + return path + } + + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + return url + } } -open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void) { - - if let error = error { - completion(.failure(ErrorResponse.error(-1, data, response, error))) - return - } - - guard let httpResponse = response as? HTTPURLResponse else { - completion(.failure(ErrorResponse.error(-2, data, response, DecodableRequestBuilderError.nilHTTPResponse))) - return - } - - guard httpResponse.isStatusCodeSuccessful else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, response, DecodableRequestBuilderError.unsuccessfulHTTPStatusCode))) - return - } - - switch T.self { - case is String.Type: - - let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - - completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) - - case is URL.Type: - do { - - guard error == nil else { - throw DownloadException.responseFailed - } - - guard let data = data else { - throw DownloadException.responseDataMissing - } +// MARK: - URLSessionDecodableRequestBuilder - let fileManager = FileManager.default - let cachesDirectory = fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0] - let requestURL = try getURL(from: urlRequest) - - var requestPath = try getPath(from: requestURL) - - if let headerFileName = getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { - requestPath = requestPath.appending("/\(headerFileName)") - } else { - requestPath = requestPath.appending("/tmp.OpenAPIClient.\(UUID().uuidString)") - } - - let filePath = cachesDirectory.appendingPathComponent(requestPath) - let directoryPath = filePath.deletingLastPathComponent().path - - try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) - try data.write(to: filePath, options: .atomic) - - completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) - - } catch let requestParserError as DownloadException { - completion(.failure(ErrorResponse.error(400, data, response, requestParserError))) - } catch { - completion(.failure(ErrorResponse.error(400, data, response, error))) - } - - case is Void.Type: - - completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) - - case is Data.Type: - - completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) - - default: - - guard let unwrappedData = data, !unwrappedData.isEmpty else { - if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { - completion(.success(Response(response: httpResponse, body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, bodyData: data))) - } else { - completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, response, DecodableRequestBuilderError.emptyDataResponse))) - } - return - } - - let decodeResult = CodableHelper.decode(T.self, from: unwrappedData) - - switch decodeResult { - case let .success(decodableObj): - completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) - case let .failure(error): - completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, response, error))) - } - } - } +open class URLSessionDecodableRequestBuilder: URLSessionRequestBuilder { + override fileprivate func processRequestResponse( + urlRequest: URLRequest, + data: Data?, + response: URLResponse?, + error: Error?, + completion: @escaping (_ result: Swift.Result, ErrorResponse>) -> Void + ) { + if let error { + completion(.failure(ErrorResponse.error(-1, data, response, error))) + return + } + + guard let httpResponse = response as? HTTPURLResponse else { + completion(.failure(ErrorResponse.error(-2, data, response, DecodableRequestBuilderError.nilHTTPResponse))) + return + } + + guard httpResponse.isStatusCodeSuccessful else { + completion(.failure(ErrorResponse.error( + httpResponse.statusCode, + data, + response, + DecodableRequestBuilderError.unsuccessfulHTTPStatusCode + ))) + return + } + + switch T.self { + case is String.Type: + + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" + + completion(.success(Response(response: httpResponse, body: body as! T, bodyData: data))) + + case is URL.Type: + do { + guard error == nil else { + throw DownloadException.responseFailed + } + + guard let data else { + throw DownloadException.responseDataMissing + } + + let fileManager = FileManager.default + let cachesDirectory = fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0] + let requestURL = try getURL(from: urlRequest) + + var requestPath = try getPath(from: requestURL) + + if let headerFileName = getFileName( + fromContentDisposition: httpResponse + .allHeaderFields["Content-Disposition"] as? String + ) { + requestPath = requestPath.appending("/\(headerFileName)") + } else { + requestPath = requestPath.appending("/tmp.OpenAPIClient.\(UUID().uuidString)") + } + + let filePath = cachesDirectory.appendingPathComponent(requestPath) + let directoryPath = filePath.deletingLastPathComponent().path + + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) + try data.write(to: filePath, options: .atomic) + + completion(.success(Response(response: httpResponse, body: filePath as! T, bodyData: data))) + + } catch let requestParserError as DownloadException { + completion(.failure(ErrorResponse.error(400, data, response, requestParserError))) + } catch { + completion(.failure(ErrorResponse.error(400, data, response, error))) + } + + case is Void.Type: + + completion(.success(Response(response: httpResponse, body: () as! T, bodyData: data))) + + case is Data.Type: + + completion(.success(Response(response: httpResponse, body: data as! T, bodyData: data))) + + default: + + guard let unwrappedData = data, !unwrappedData.isEmpty else { + if let expressibleByNilLiteralType = T.self as? ExpressibleByNilLiteral.Type { + completion(.success(Response( + response: httpResponse, + body: expressibleByNilLiteralType.init(nilLiteral: ()) as! T, + bodyData: data + ))) + } else { + completion(.failure(ErrorResponse.error( + httpResponse.statusCode, + nil, + response, + DecodableRequestBuilderError.emptyDataResponse + ))) + } + return + } + + let decodeResult = CodableHelper.decode(T.self, from: unwrappedData) + + switch decodeResult { + case let .success(decodableObj): + completion(.success(Response(response: httpResponse, body: decodableObj, bodyData: unwrappedData))) + case let .failure(error): + completion(.failure(ErrorResponse.error(httpResponse.statusCode, unwrappedData, response, error))) + } + } + } } -private class SessionDelegate: NSObject, URLSessionTaskDelegate { - func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { - - var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling - - var credential: URLCredential? - - if let taskDidReceiveChallenge = challengeHandlerStore[task.taskIdentifier] { - (disposition, credential) = taskDidReceiveChallenge(session, task, challenge) - } else { - if challenge.previousFailureCount > 0 { - disposition = .rejectProtectionSpace - } else { - credential = credentialStore[task.taskIdentifier] ?? session.configuration.urlCredentialStorage?.defaultCredential(for: challenge.protectionSpace) +// MARK: - SessionDelegate - if credential != nil { - disposition = .useCredential - } - } - } - - completionHandler(disposition, credential) - } +private class SessionDelegate: NSObject, URLSessionTaskDelegate { + func urlSession( + _ session: URLSession, + task: URLSessionTask, + didReceive challenge: URLAuthenticationChallenge, + completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void + ) { + var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling + + var credential: URLCredential? + + if let taskDidReceiveChallenge = challengeHandlerStore[task.taskIdentifier] { + (disposition, credential) = taskDidReceiveChallenge(session, task, challenge) + } else { + if challenge.previousFailureCount > 0 { + disposition = .rejectProtectionSpace + } else { + credential = credentialStore[task.taskIdentifier] ?? session.configuration.urlCredentialStorage? + .defaultCredential(for: challenge.protectionSpace) + + if credential != nil { + disposition = .useCredential + } + } + } + + completionHandler(disposition, credential) + } } +// MARK: - HTTPMethod + public enum HTTPMethod: String { - case options = "OPTIONS" - case get = "GET" - case head = "HEAD" - case post = "POST" - case put = "PUT" - case patch = "PATCH" - case delete = "DELETE" - case trace = "TRACE" - case connect = "CONNECT" + case options = "OPTIONS" + case get = "GET" + case head = "HEAD" + case post = "POST" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" + case trace = "TRACE" + case connect = "CONNECT" } +// MARK: - ParameterEncoding + public protocol ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -private class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { +// MARK: - URLEncoding - var urlRequest = urlRequest +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - guard let parameters = parameters else { return urlRequest } + guard let parameters else { + return urlRequest + } - guard let url = urlRequest.url else { - throw DownloadException.requestMissingURL - } + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } - if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { - urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) - urlRequest.url = urlComponents.url - } + if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { + urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) + urlRequest.url = urlComponents.url + } - return urlRequest - } + return urlRequest + } } -private class FormDataEncoding: ParameterEncoding { - - let contentTypeForFormPart: (_ fileURL: URL) -> String? - - init(contentTypeForFormPart: @escaping (_ fileURL: URL) -> String?) { - self.contentTypeForFormPart = contentTypeForFormPart - } - - func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { - - var urlRequest = urlRequest - - guard let parameters = parameters, !parameters.isEmpty else { - return urlRequest - } - - let boundary = "Boundary-\(UUID().uuidString)" - - urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") - - for (key, value) in parameters { - for value in (value as? Array ?? [value]) { - switch value { - case let fileURL as URL: - - urlRequest = try configureFileUploadRequest( - urlRequest: urlRequest, - boundary: boundary, - name: key, - fileURL: fileURL - ) - - case let string as String: - - if let data = string.data(using: .utf8) { - urlRequest = configureDataUploadRequest( - urlRequest: urlRequest, - boundary: boundary, - name: key, - data: data - ) - } - - case let number as NSNumber: +// MARK: - FormDataEncoding - if let data = number.stringValue.data(using: .utf8) { - urlRequest = configureDataUploadRequest( - urlRequest: urlRequest, - boundary: boundary, - name: key, - data: data - ) - } - - case let data as Data: - - urlRequest = configureDataUploadRequest( - urlRequest: urlRequest, - boundary: boundary, - name: key, - data: data - ) +private class FormDataEncoding: ParameterEncoding { + let contentTypeForFormPart: (_ fileURL: URL) -> String? - case let uuid as UUID: + init(contentTypeForFormPart: @escaping (_ fileURL: URL) -> String?) { + self.contentTypeForFormPart = contentTypeForFormPart + } - if let data = uuid.uuidString.data(using: .utf8) { - urlRequest = configureDataUploadRequest( - urlRequest: urlRequest, - boundary: boundary, - name: key, - data: data - ) - } + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - default: - fatalError("Unprocessable value \(value) with key \(key)") - } - } - } + guard let parameters, !parameters.isEmpty else { + return urlRequest + } - var body = urlRequest.httpBody.orEmpty + let boundary = "Boundary-\(UUID().uuidString)" - body.append("\r\n--\(boundary)--\r\n") + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") - urlRequest.httpBody = body + for (key, value) in parameters { + for value in value as? Array ?? [value] { + switch value { + case let fileURL as URL: - return urlRequest - } + urlRequest = try configureFileUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + fileURL: fileURL + ) - private func configureFileUploadRequest(urlRequest: URLRequest, boundary: String, name: String, fileURL: URL) throws -> URLRequest { + case let string as String: - var urlRequest = urlRequest + if let data = string.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } - var body = urlRequest.httpBody.orEmpty + case let number as NSNumber: - let fileData = try Data(contentsOf: fileURL) + if let data = number.stringValue.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } - let mimetype = contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) + case let data as Data: - let fileName = fileURL.lastPathComponent + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) - // If we already added something then we need an additional newline. - if body.count > 0 { - body.append("\r\n") - } + case let uuid as UUID: - // Value boundary. - body.append("--\(boundary)\r\n") + if let data = uuid.uuidString.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } - // Value headers. - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") - body.append("Content-Type: \(mimetype)\r\n") + default: + fatalError("Unprocessable value \(value) with key \(key)") + } + } + } - // Separate headers and body. - body.append("\r\n") + var body = urlRequest.httpBody.orEmpty - // The value data. - body.append(fileData) + body.append("\r\n--\(boundary)--\r\n") - urlRequest.httpBody = body + urlRequest.httpBody = body - return urlRequest - } + return urlRequest + } - private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { + private func configureFileUploadRequest( + urlRequest: URLRequest, + boundary: String, + name: String, + fileURL: URL + ) throws -> URLRequest { + var urlRequest = urlRequest - var urlRequest = urlRequest + var body = urlRequest.httpBody.orEmpty - var body = urlRequest.httpBody.orEmpty + let fileData = try Data(contentsOf: fileURL) - // If we already added something then we need an additional newline. - if body.count > 0 { - body.append("\r\n") - } + let mimetype = contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) - // Value boundary. - body.append("--\(boundary)\r\n") + let fileName = fileURL.lastPathComponent - // Value headers. - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") + // If we already added something then we need an additional newline. + if !body.isEmpty { + body.append("\r\n") + } + + // Value boundary. + body.append("--\(boundary)\r\n") + + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") + + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(fileData) + + urlRequest.httpBody = body + + return urlRequest + } + + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { + var urlRequest = urlRequest - // Separate headers and body. - body.append("\r\n") + var body = urlRequest.httpBody.orEmpty + + // If we already added something then we need an additional newline. + if !body.isEmpty { + body.append("\r\n") + } + + // Value boundary. + body.append("--\(boundary)\r\n") - // The value data. - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - urlRequest.httpBody = body + // Separate headers and body. + body.append("\r\n") - return urlRequest + // The value data. + body.append(data) - } + urlRequest.httpBody = body - func mimeType(for url: URL) -> String { - let pathExtension = url.pathExtension + return urlRequest + } - if #available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *) { - #if canImport(UniformTypeIdentifiers) - if let utType = UTType(filenameExtension: pathExtension) { - return utType.preferredMIMEType ?? "application/octet-stream" - } - #else - return "application/octet-stream" - #endif - } else { - if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(), - let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() { - return mimetype as String - } - return "application/octet-stream" - } - return "application/octet-stream" - } + func mimeType(for url: URL) -> String { + let pathExtension = url.pathExtension + if #available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *) { + #if canImport(UniformTypeIdentifiers) + if let utType = UTType(filenameExtension: pathExtension) { + return utType.preferredMIMEType ?? "application/octet-stream" + } + #else + return "application/octet-stream" + #endif + } else { + if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)? + .takeRetainedValue(), + let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() + { + return mimetype as String + } + return "application/octet-stream" + } + return "application/octet-stream" + } } -private class FormURLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { +// MARK: - FormURLEncoding - var urlRequest = urlRequest +private class FormURLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + var requestBodyComponents = URLComponents() + requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) - if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { - urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") - } + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") + } - urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) + urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) - return urlRequest - } + return urlRequest + } } -private class OctetStreamEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { - - var urlRequest = urlRequest - - guard let body = parameters?["body"] else { return urlRequest } - - if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { - urlRequest.setValue("application/octet-stream", forHTTPHeaderField: "Content-Type") - } +// MARK: - OctetStreamEncoding - switch body { - case let fileURL as URL: - urlRequest.httpBody = try Data(contentsOf: fileURL) - case let data as Data: - urlRequest.httpBody = data - default: - fatalError("Unprocessable body \(body)") - } - - return urlRequest - } +private class OctetStreamEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest + + guard let body = parameters?["body"] else { return urlRequest } + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/octet-stream", forHTTPHeaderField: "Content-Type") + } + + switch body { + case let fileURL as URL: + urlRequest.httpBody = try Data(contentsOf: fileURL) + case let data as Data: + urlRequest.httpBody = data + default: + fatalError("Unprocessable body \(body)") + } + + return urlRequest + } } private extension Data { - /// Append string to Data - /// - /// Rather than littering my code with calls to `dataUsingEncoding` to convert strings to Data, and then add that data to the Data, this wraps it in a nice convenient little extension to Data. This converts using UTF-8. - /// - /// - parameter string: The string to be added to the `Data`. - - mutating func append(_ string: String) { - if let data = string.data(using: .utf8) { - append(data) - } - } + // Append string to Data + // + // Rather than littering my code with calls to `dataUsingEncoding` to convert strings to Data, and then add that data to the + // Data, this wraps it in a nice convenient little extension to Data. This converts using UTF-8. + // + // - parameter string: The string to be added to the `Data`. + + mutating func append(_ string: String) { + if let data = string.data(using: .utf8) { + append(data) + } + } } -private extension Optional where Wrapped == Data { - var orEmpty: Data { - self ?? Data() - } +private extension Data? { + var orEmpty: Data { + self ?? Data() + } } +// MARK: - JSONDataEncoding + ParameterEncoding + extension JSONDataEncoding: ParameterEncoding {} diff --git a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Validation.swift b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9d..b1bcd943 100644 --- a/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Validation.swift +++ b/Sources/TidalAPI/Generated/OpenAPIClient/Classes/OpenAPIs/Validation.swift @@ -1,161 +1,171 @@ -// Validation.swift -// -// Generated by openapi-generator -// https://openapi-generator.tech -// - import Foundation +// MARK: - StringRule + public struct StringRule { - public var minLength: Int? - public var maxLength: Int? - public var pattern: String? + public var minLength: Int? + public var maxLength: Int? + public var pattern: String? } +// MARK: - NumericRule + public struct NumericRule { - public var minimum: T? - public var exclusiveMinimum = false - public var maximum: T? - public var exclusiveMaximum = false - public var multipleOf: T? + public var minimum: T? + public var exclusiveMinimum = false + public var maximum: T? + public var exclusiveMaximum = false + public var multipleOf: T? } +// MARK: - ArrayRule + public struct ArrayRule { - public var minItems: Int? - public var maxItems: Int? - public var uniqueItems: Bool + public var minItems: Int? + public var maxItems: Int? + public var uniqueItems: Bool } +// MARK: - StringValidationErrorKind + public enum StringValidationErrorKind: Error { - case minLength, maxLength, pattern + case minLength, maxLength, pattern } +// MARK: - NumericValidationErrorKind + public enum NumericValidationErrorKind: Error { - case minimum, maximum, multipleOf + case minimum, maximum, multipleOf } +// MARK: - ArrayValidationErrorKind + public enum ArrayValidationErrorKind: Error { - case minItems, maxItems, uniqueItems + case minItems, maxItems, uniqueItems } +// MARK: - ValidationError + public struct ValidationError: Error { - public fileprivate(set) var kinds: Set + public fileprivate(set) var kinds: Set } -public struct Validator { - /// Validate a string against a rule. - /// - Parameter string: The String you wish to validate. - /// - Parameter rule: The StringRule you wish to use for validation. - /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { - var error = ValidationError(kinds: []) - if let minLength = rule.minLength, !(minLength <= string.count) { - error.kinds.insert(.minLength) - } - if let maxLength = rule.maxLength, !(string.count <= maxLength) { - error.kinds.insert(.maxLength) - } - if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) - .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { - error.kinds.insert(.pattern) - } - } - guard error.kinds.isEmpty else { - throw error - } - return string - } - - /// Validate a integer against a rule. - /// - Parameter numeric: The integer you wish to validate. - /// - Parameter rule: The NumericRule you wish to use for validation. - /// - Returns: A validated integer. - /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { - var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { - error.kinds.insert(.minimum) - } - if rule.exclusiveMinimum, minium >= numeric { - error.kinds.insert(.minimum) - } - } - if let maximum = rule.maximum { - if !rule.exclusiveMaximum, numeric > maximum { - error.kinds.insert(.maximum) - } - if rule.exclusiveMaximum, numeric >= maximum { - error.kinds.insert(.maximum) - } - } - if let multipleOf = rule.multipleOf, !numeric.isMultiple(of: multipleOf) { - error.kinds.insert(.multipleOf) - } - guard error.kinds.isEmpty else { - throw error - } - return numeric - } - - /// Validate a fractional number against a rule. - /// - Parameter numeric: The fractional number you wish to validate. - /// - Parameter rule: The NumericRule you wish to use for validation. - /// - Returns: A validated fractional number. - /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { - var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { - error.kinds.insert(.minimum) - } - if rule.exclusiveMinimum, minium >= numeric { - error.kinds.insert(.minimum) - } - } - if let maximum = rule.maximum { - if !rule.exclusiveMaximum, numeric > maximum { - error.kinds.insert(.maximum) - } - if rule.exclusiveMaximum, numeric >= maximum { - error.kinds.insert(.maximum) - } - } - if let multipleOf = rule.multipleOf, numeric.remainder(dividingBy: multipleOf) != 0 { - error.kinds.insert(.multipleOf) - } - guard error.kinds.isEmpty else { - throw error - } - return numeric - } - - /// Validate a array against a rule. - /// - Parameter array: The Array you wish to validate. - /// - Parameter rule: The ArrayRule you wish to use for validation. - /// - Returns: A validated array. - /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { - var error = ValidationError(kinds: []) - if let minItems = rule.minItems, !(minItems <= array.count) { - error.kinds.insert(.minItems) - } - if let maxItems = rule.maxItems, !(array.count <= maxItems) { - error.kinds.insert(.maxItems) - } - if rule.uniqueItems { - let unique = Set(array) - if unique.count != array.count { - error.kinds.insert(.uniqueItems) - } - } - guard error.kinds.isEmpty else { - throw error - } - return array - } +// MARK: - Validator + +public enum Validator { + /// Validate a string against a rule. + /// - Parameter string: The String you wish to validate. + /// - Parameter rule: The StringRule you wish to use for validation. + /// - Returns: A validated string. + /// - Throws: `ValidationError` if the string is invalid against the rule, + /// `NSError` if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws -> String { + var error = ValidationError(kinds: []) + if let minLength = rule.minLength, !(minLength <= string.count) { + error.kinds.insert(.minLength) + } + if let maxLength = rule.maxLength, !(string.count <= maxLength) { + error.kinds.insert(.maxLength) + } + if let pattern = rule.pattern { + let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + .matches(in: string, range: .init(location: 0, length: string.utf16.count)) + if matches.isEmpty { + error.kinds.insert(.pattern) + } + } + guard error.kinds.isEmpty else { + throw error + } + return string + } + + /// Validate a integer against a rule. + /// - Parameter numeric: The integer you wish to validate. + /// - Parameter rule: The NumericRule you wish to use for validation. + /// - Returns: A validated integer. + /// - Throws: `ValidationError` if the numeric is invalid against the rule. + public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + var error = ValidationError(kinds: []) + if let minium = rule.minimum { + if !rule.exclusiveMinimum, minium > numeric { + error.kinds.insert(.minimum) + } + if rule.exclusiveMinimum, minium >= numeric { + error.kinds.insert(.minimum) + } + } + if let maximum = rule.maximum { + if !rule.exclusiveMaximum, numeric > maximum { + error.kinds.insert(.maximum) + } + if rule.exclusiveMaximum, numeric >= maximum { + error.kinds.insert(.maximum) + } + } + if let multipleOf = rule.multipleOf, !numeric.isMultiple(of: multipleOf) { + error.kinds.insert(.multipleOf) + } + guard error.kinds.isEmpty else { + throw error + } + return numeric + } + + /// Validate a fractional number against a rule. + /// - Parameter numeric: The fractional number you wish to validate. + /// - Parameter rule: The NumericRule you wish to use for validation. + /// - Returns: A validated fractional number. + /// - Throws: `ValidationError` if the numeric is invalid against the rule. + public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + var error = ValidationError(kinds: []) + if let minium = rule.minimum { + if !rule.exclusiveMinimum, minium > numeric { + error.kinds.insert(.minimum) + } + if rule.exclusiveMinimum, minium >= numeric { + error.kinds.insert(.minimum) + } + } + if let maximum = rule.maximum { + if !rule.exclusiveMaximum, numeric > maximum { + error.kinds.insert(.maximum) + } + if rule.exclusiveMaximum, numeric >= maximum { + error.kinds.insert(.maximum) + } + } + if let multipleOf = rule.multipleOf, numeric.remainder(dividingBy: multipleOf) != 0 { + error.kinds.insert(.multipleOf) + } + guard error.kinds.isEmpty else { + throw error + } + return numeric + } + + /// Validate a array against a rule. + /// - Parameter array: The Array you wish to validate. + /// - Parameter rule: The ArrayRule you wish to use for validation. + /// - Returns: A validated array. + /// - Throws: `ValidationError` if the string is invalid against the rule. + public static func validate(_ array: [AnyHashable], against rule: ArrayRule) throws -> [AnyHashable] { + var error = ValidationError(kinds: []) + if let minItems = rule.minItems, !(minItems <= array.count) { + error.kinds.insert(.minItems) + } + if let maxItems = rule.maxItems, !(array.count <= maxItems) { + error.kinds.insert(.maxItems) + } + if rule.uniqueItems { + let unique = Set(array) + if unique.count != array.count { + error.kinds.insert(.uniqueItems) + } + } + guard error.kinds.isEmpty else { + throw error + } + return array + } } diff --git a/Sources/TidalAPI/Utils/OpenAPIClientAPI+Auth.swift b/Sources/TidalAPI/Utils/OpenAPIClientAPI+Auth.swift index dbd8bff1..c025d26f 100644 --- a/Sources/TidalAPI/Utils/OpenAPIClientAPI+Auth.swift +++ b/Sources/TidalAPI/Utils/OpenAPIClientAPI+Auth.swift @@ -1,5 +1,5 @@ import Auth -extension OpenAPIClientAPI { - public static var credentialsProvider: (any CredentialsProvider)? +public extension OpenAPIClientAPI { + static var credentialsProvider: (any CredentialsProvider)? } diff --git a/Sources/TidalAPI/Utils/RequestHelper.swift b/Sources/TidalAPI/Utils/RequestHelper.swift index 3f7df4e0..f7a098ca 100644 --- a/Sources/TidalAPI/Utils/RequestHelper.swift +++ b/Sources/TidalAPI/Utils/RequestHelper.swift @@ -4,14 +4,14 @@ import Foundation enum RequestHelper { private static var retries: [String: Int?] = [:] - + static func createRequest( requestBuilder: @escaping () async throws -> RequestBuilder ) async throws -> T { guard let credentialsProvider = OpenAPIClientAPI.credentialsProvider else { throw TidalAPIError(message: "NO_CREDENTIALS_PROVIDER", url: "Not available") } - + let credentials = try await credentialsProvider.getCredentials() let requestBuilder = try await requestBuilder() let requestURL = requestBuilder.URLString @@ -27,7 +27,7 @@ enum RequestHelper { let request = requestBuilder .addHeader(name: "Authorization", value: "Bearer \(token)") - + do { let result = try await request.execute().body // Clear the retry count for the URL on success @@ -43,20 +43,21 @@ enum RequestHelper { throw TidalError(code: error.localizedDescription) } } - + static func handleErrorResult( _ error: ErrorResponse, urlAttachedToError url: String, requestBuilder: @escaping () async throws -> RequestBuilder ) async throws -> T { func getHttpSubStatus(data: Data?) -> Int? { - guard let data = data else { + guard let data else { return nil } - + do { if let parsedObject = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any], - let subStatus = parsedObject["subStatus"] as? Int { + let subStatus = parsedObject["subStatus"] as? Int + { return subStatus } } catch { @@ -64,18 +65,18 @@ enum RequestHelper { } return nil } - + let currentRetryCount = retries[url] ?? 0 // Default to 0 if nil - + guard let provider = OpenAPIClientAPI.credentialsProvider else { throw TidalAPIError(message: "NO_CREDENTIALS_PROVIDER", url: url) } - + switch error { - case .error(let statusCode, let data, _, _): + case let .error(statusCode, data, _, _): if statusCode == 401 { let subStatus = getHttpSubStatus(data: data) - + do { _ = try await provider.getCredentials(apiErrorSubStatus: subStatus.flatMap(String.init)) } catch { @@ -90,7 +91,7 @@ enum RequestHelper { throw TidalAPIError(error: error, url: url) } } - + if subStatus != nil, OpenAPIClientAPI.credentialsProvider?.isUserLoggedIn == false { throw TidalAPIError( message: "User is not logged in", @@ -99,7 +100,7 @@ enum RequestHelper { subStatus: subStatus ) } - + // Retry the async operation if the retry count is 0 if currentRetryCount == 0 { retries[url] = 1 // Increment retry count to 1 @@ -108,7 +109,7 @@ enum RequestHelper { } } } - + throw TidalAPIError(error: error, url: url) // Propagate the error if not handled or retried } } diff --git a/Sources/TidalAPI/Utils/TidalAPIError.swift b/Sources/TidalAPI/Utils/TidalAPIError.swift index 4bccc1e4..b8f864a1 100644 --- a/Sources/TidalAPI/Utils/TidalAPIError.swift +++ b/Sources/TidalAPI/Utils/TidalAPIError.swift @@ -1,5 +1,7 @@ import Foundation +// MARK: - TidalAPIError + public struct TidalAPIError: LocalizedError, Equatable { let fileID: String let line: UInt @@ -8,7 +10,7 @@ public struct TidalAPIError: LocalizedError, Equatable { public let url: String public var statusCode: Int? public var subStatus: Int? - + public init( fileID: StaticString = #fileID, line: UInt = #line, @@ -26,13 +28,13 @@ public struct TidalAPIError: LocalizedError, Equatable { self.statusCode = statusCode self.subStatus = subStatus } - + public var errorDescription: String { - """ - API Error: \(String(describing: statusCode)) - URL: \(url) - SubStatus: \(String(describing: subStatus)) - """ + """ + API Error: \(String(describing: statusCode)) + URL: \(url) + SubStatus: \(String(describing: subStatus)) + """ } } diff --git a/Tests/EventProducerTests/HelperTests/HeaderHelperTests.swift b/Tests/EventProducerTests/HelperTests/HeaderHelperTests.swift index 587da9f7..685102c6 100644 --- a/Tests/EventProducerTests/HelperTests/HeaderHelperTests.swift +++ b/Tests/EventProducerTests/HelperTests/HeaderHelperTests.swift @@ -7,7 +7,7 @@ import XCTest final class HeaderHelperTests: XCTestCase { private struct MockCredentialsProvider: CredentialsProvider { - var testAccessToken: String? = nil + var testAccessToken: String? let testClientId: String func getCredentials(apiErrorSubStatus: String?) async throws -> Credentials { Credentials( diff --git a/Tests/PlayerTests/Mocks/OfflineEngine/Internal/Storage/OfflineStorageMock.swift b/Tests/PlayerTests/Mocks/OfflineEngine/Internal/Storage/OfflineStorageMock.swift index 7a66b78e..34477a87 100644 --- a/Tests/PlayerTests/Mocks/OfflineEngine/Internal/Storage/OfflineStorageMock.swift +++ b/Tests/PlayerTests/Mocks/OfflineEngine/Internal/Storage/OfflineStorageMock.swift @@ -13,8 +13,8 @@ final class OfflineStorageMock: OfflineStorage { func getAll() throws -> [OfflineEntry] { [] } func clear() {} - - func totalSize() throws -> Int { + + func totalSize() throws -> Int { 0 } } diff --git a/Tests/PlayerTests/Player/Common/Authentication/CredentialsSuccessDataParserTests.swift b/Tests/PlayerTests/Player/Common/Authentication/CredentialsSuccessDataParserTests.swift index aef1b11f..71f8d636 100644 --- a/Tests/PlayerTests/Player/Common/Authentication/CredentialsSuccessDataParserTests.swift +++ b/Tests/PlayerTests/Player/Common/Authentication/CredentialsSuccessDataParserTests.swift @@ -29,7 +29,7 @@ extension CredentialsSuccessDataParserTests { let clientId = credentialsSuccessDataParser.clientIdFromToken(token) XCTAssertEqual(clientId, nil) } - + func test_clientIdFromToken_when_StringRequiresPadding() async throws { let token = "Bearer blabla.eyJjaWQiOjEyMzQ1fQ.blahblah" let clientId = credentialsSuccessDataParser.clientIdFromToken(token) diff --git a/Tests/PlayerTests/Player/PlaybackEngine/Internal/PlayerItemTests.swift b/Tests/PlayerTests/Player/PlaybackEngine/Internal/PlayerItemTests.swift index f25ee7d5..5feb8e45 100644 --- a/Tests/PlayerTests/Player/PlaybackEngine/Internal/PlayerItemTests.swift +++ b/Tests/PlayerTests/Player/PlaybackEngine/Internal/PlayerItemTests.swift @@ -481,7 +481,6 @@ final class PlayerItemTests: XCTestCase { // MARK: - seek - func test_seek() { // GIVEN let playerItem = PlayerItem.mock(