diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7dfb4f1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# This allows generated code to be indexed correctly +*.swift linguist-generated=false \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3b29812 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..4b3e669 --- /dev/null +++ b/Package.swift @@ -0,0 +1,22 @@ +// swift-tools-version: 5.6 +import PackageDescription + +let package = Package( + name: "Plexswift", + platforms: [ + .iOS(.v13) + ], + products: [ + .library( + name: "Plexswift", + targets: ["Plexswift"] + ) + ], + dependencies: [], + targets: [ + .target( + name: "Plexswift", + dependencies: [] + ) + ] +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..ceb46d4 --- /dev/null +++ b/README.md @@ -0,0 +1,124 @@ +# plexswift + + + + + +![Platform](https://img.shields.io/badge/Platform-iOS-lightgray) +![Swift Version](https://img.shields.io/badge/Swift-5.6-orange.svg) + +An Open API Spec for interacting with Plex.tv and Plex Servers + +## Requirements + +The SDK supports iOS 13 and later. + + +## 🏗 **Welcome to your new SDK!** 🏗 + +It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps: +- [ ] 🛠 Make your SDK feel handcrafted by [customizing it](https://www.speakeasyapi.dev/docs/customize-sdks) +- [ ] ♻️ Refine your SDK quickly by iterating locally with the [Speakeasy CLI](https://github.com/speakeasy-api/speakeasy) +- [ ] 🎁 Publish your SDK to package managers by [configuring automatic publishing](https://www.speakeasyapi.dev/docs/productionize-sdks/publish-sdks) +- [ ] ✨ When ready to productionize, delete this section from the README + + +## SDK Installation + +### Swift Package Manager + +You can add `plexswift` to your project directly in Xcode `(File > Add Packages...)` or by adding it to your project's Package.swift file: + +```bash +dependencies: [ + .package(url: "https://github.com/LukeHagar/plexswift.git", .upToNextMajor(from: "0.1.0")) +] +``` + + + +## SDK Example Usage + +### Example + +```swift +import Foundation +import Plexswift + +let client = Client(security: .accessToken("")) + +let response = try await client.server.getServerCapabilities() + +switch response.data { +case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break +case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break +case .empty: + // Handle empty response + break +} + +``` + + + +## Available Resources and Operations + + + + + +## Authentication + +### Global Security Schemes + +The SDK supports the following security scheme globally through the `Shared.Security` type: + +| Name | Type | Scheme | +| -------------- | -------------- | -------------- | +| `.accessToken` | apiKey | API key | + +You can set the appropriate security parameters by passing a `Shared.Security` value for the `security` parameter when initializing the `Client` instance. For example: + +```swift +import Foundation +import Plexswift + +let client = Client(security: .accessToken("")) + +let response = try await client.server.getServerCapabilities() + +switch response.data { +case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break +case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break +case .empty: + // Handle empty response + break +} + +``` + + + + +# Development + +## Maturity + +This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage +to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally +looking for the latest version. + +## Contributions + +While we value open-source contributions to this SDK, this library is generated programmatically. +Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release! + +### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks) diff --git a/RELEASES.md b/RELEASES.md new file mode 100644 index 0000000..1f1f38d --- /dev/null +++ b/RELEASES.md @@ -0,0 +1,11 @@ + + +## 2023-12-30 00:54:12 +### Changes +Based on: +- OpenAPI Doc 0.0.3 +- Speakeasy CLI 1.129.1 (2.223.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [swift v0.1.0] . +### Releases +- [Swift Package Manager v0.1.0] https://github.com/LukeHagar/plexswift/releases/tag/v0.1.0 - . \ No newline at end of file diff --git a/Sources/Plexswift/Client.swift b/Sources/Plexswift/Client.swift new file mode 100644 index 0000000..f476234 --- /dev/null +++ b/Sources/Plexswift/Client.swift @@ -0,0 +1,226 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation +#if os(Linux) +import FoundationNetworking +#endif + +/// An object used to make API calls. +/// +/// ``Client`` is the main object that you interact with to communicate with the API, and is responsible for making the underlying HTTP requests for each API operation and handling the resulting responses. It implements the ``PlexswiftAPI`` protocol to support the available API operations. +/// +/// ### API calls +/// +/// Each API endpoint (or *operation*) is exposed as a method. For instance, the 'getResizedPhoto' operation is exposed as: +/// +/// ```swift +/// func getResizedPhoto(request: Operations.GetResizedPhotoRequest) async throws -> Response +/// ``` +/// +/// ### Request and response objects +/// +/// If an API operation has input parameters, the corresponding API method takes a `request` object, describing these parameters. The request object can either be a primitive value like a `String` or `[String]`, or a Swift `struct` describing the parameters. +/// +/// Each API method also returns a ``Response`` object, which provides information about the result of making the API request. It is generic and parameterised by the resulting data — stored in the ``Response/data`` property — which is determined by each API operation. +/// +/// The ``Response/data`` property defined by each API operation is an enum, and you can `switch` on this value to extract the corresponding value from the response. For example, the 'getResizedPhoto' operation returns a ``Operations/GetResizedPhotoResponse`` value: +/// +/// ```swift +/// let response: Response = ... // Response from API call +/// switch response.data { +/// case .object(let object): +/// // Handle response +/// case .empty: +/// // Handle empty response +/// } +/// ``` +/// +/// In addition to any data returned by a given API operation, each ``Response`` value contains information about the network request, including: +/// - The `contentType` returned by the server. +/// - The `statusCode` representing the HTTP status code returned by making the request +/// - A `httpResponse` value which is the raw [HTTPURLResponse](https://developer.apple.com/documentation/foundation/httpurlresponse) returned from making the underlying network request. +/// +/// These values can be used to debug and/or react to responses returned from executing a given API operation. +/// +/// ### Authentication +/// +/// Calls to the API must be authenticated, and ``Client`` must be initialized with a configured ``Shared/Security`` object to authenticate requests. +/// +/// ### Server overrides +/// +/// By default, API calls are made to `http://10.10.10.47:32400`. This can be configured using the ``use(server:)`` method, passing a ``GlobalServers`` value. +/// +/// ## Topics +/// +/// ### Initializers +/// +/// - ``init(security:)`` +/// +/// ### Configuration +/// +/// - ``use(server:)`` +/// +/// ### API calls +/// +/// These methods allow you to make requests to the API. +/// +/// +/// ### Scoped API calls +/// +/// These properties logically group other parts of the API. +/// +/// - ``server`` +/// - ``media`` +/// - ``activities`` +/// - ``butler`` +/// - ``hubs`` +/// - ``search`` +/// - ``library`` +/// - ``log`` +/// - ``playlists`` +/// - ``security`` +/// - ``sessions`` +/// - ``updater`` +/// - ``video`` +/// +public final class Client { + internal struct APIResponse { + let httpResponse: HTTPURLResponse + let data: Data? + } + + internal typealias ConfigureURLRequest = (_ configuration: URLRequestConfiguration) throws -> Void + internal typealias ResponseHandler = (_ apiResponse: APIResponse) throws -> ResponseObject + + // Underscore-prefix properties so these do not potentially conflict with any operation namespaces. + private lazy var _session = URLSession(configuration: .default) + private var _security: Shared.Security + + private var _selectedServer: GlobalServers? + + /// Creates an API client object with the specified parameters. + public init(security: Shared.Security) { + self._security = security + } + + // MARK: - Configuration + + /// Override the default server used when making connections to the API. + /// + /// By default, API calls are made to `http://10.10.10.47:32400`. Pass one of the values from the ``GlobalServers`` enumeration to override this. + public func use(server: GlobalServers?) { + _selectedServer = server + } + + // MARK: - Internal + + internal func makeRequest( + with server: Server? = nil, + configureRequest: @escaping ConfigureURLRequest, + handleResponse responseHandler: @escaping ResponseHandler + ) async throws -> ResponseType where ResponseType.T == ResponseObject { + return try await withCheckedThrowingContinuation { continuation in + _makeRequest(with: server, configureRequest: configureRequest) { result in + do { + let apiResponse = try result.get() + let responseObject = try responseHandler(apiResponse) + continuation.resume(returning: ResponseType(httpResponse: apiResponse.httpResponse, data: responseObject)) + } catch let error as ServerConversionError { + switch error { + case .internal: + continuation.resume(throwing: PlexswiftError.internalError(error: nil)) + case .missingDefaultServer(let serverType): + continuation.resume(throwing: PlexswiftError.failedToConstructRequestURL(.missingDefaultServer(serverType: serverType))) + case .invalidServerIndex(let serverType, let index): + continuation.resume(throwing: PlexswiftError.failedToConstructRequestURL(.invalidServerIndex(serverType: serverType, index: index))) + case .missingServerParameterSubstitutionKey(let key, let serverString): + continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.missingServerParameterSubstitutionKey(key, serverString: serverString))) + } + } catch let error as URLRequestBuilderError { + switch error { + case .internalError: + continuation.resume(throwing: PlexswiftError.internalError(error: nil)) + case .invalidURL(let urlString): + continuation.resume(throwing: PlexswiftError.failedToConstructRequestURL(.invalidRequestURL(string: urlString))) + case .missingPathParameterSubstitutionKey(let key, let path): + continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.missingPathParameterSubstitutionKey(key, path: path))) + } + } catch let error as SerializationError { + switch error { + case .failedToSerializeData: + continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.failedToSerializeData)) + case .missingRequiredRequestBody: + continuation.resume(throwing: PlexswiftError.failedToConstructRequest(.missingRequiredRequestBody)) + case .invalidSerializationParameter(let type, let format): + continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.invalidSerializationParameter(type: type, format: format))) + } + } catch let error as ResponseHandlerError { + switch error { + case .failedToDecodeResponse: + continuation.resume(throwing: PlexswiftError.failedToHandleResponse(.failedToDecodeResponse)) + case .failedToDecodeJSON(let error): + continuation.resume(throwing: PlexswiftError.failedToHandleResponse(.failedToDeserializeJSON(error))) + } + } catch let error as PlexswiftError { + continuation.resume(throwing: error) + } catch { + continuation.resume(throwing: PlexswiftError.internalError(error: error)) + } + } + } + } + + internal func _makeRequest( + with server: Server? = nil, + configureRequest: ConfigureURLRequest, + completion: @escaping (Result) -> Void + ) { + do { + let builder = URLRequestBuilder( + baseURL: try baseURL(serverOverride: server), + parameterDefaults: nil, + defaultSecurityParameterProviding: _security + ) + try configureRequest(builder) + return makeDataRequest(with: try builder.build(), completion: completion) + } catch { + completion(.failure(error)) + } + } + + // MARK: - Private + + private func baseURL(serverOverride: Server? = nil) throws -> URL { + let server: Server + if let serverOverride { + server = serverOverride + } else if let selectedServer = _selectedServer { + server = try selectedServer.server() + } else { + server = try GlobalServers.default() + } + + guard let url = URL(string: server.urlString) else { + throw PlexswiftError.failedToConstructRequestURL(.invalidServerURL(string: server.urlString)) + } + return url + } + + private func makeDataRequest(with urlRequest: URLRequest, completion: @escaping (Result) -> Void) { + let task = _session.dataTask(with: urlRequest) { data, response, error in + if let error { + completion(.failure(PlexswiftError.failedToMakeNetworkRequest(error: error))) + } else if let httpResponse = response as? HTTPURLResponse { + completion(.success(APIResponse(httpResponse: httpResponse, data: data))) + } else { + completion(.failure(PlexswiftError.internalError(error: nil))) + } + } + task.resume() + } +} + +enum ResponseHandlerError: Swift.Error { + case failedToDecodeJSON(_ error: Swift.Error) + case failedToDecodeResponse +} diff --git a/Sources/Plexswift/Plexswift.docc/Plexswift.md b/Sources/Plexswift/Plexswift.docc/Plexswift.md new file mode 100644 index 0000000..b179ef3 --- /dev/null +++ b/Sources/Plexswift/Plexswift.docc/Plexswift.md @@ -0,0 +1,378 @@ +# ``plexswift`` + +An Open API Spec for interacting with Plex.tv and Plex Servers + +`plexswift` is a Swift library which provides functionality for making requests to the API using a modern, easy-to-use Swift API: + +### SDK Example Usage + +```swift +import Foundation +import Plexswift + +let client = Client(security: .accessToken("")) + +let response = try await client.server.getServerCapabilities() + +switch response.data { +case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break +case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break +case .empty: + // Handle empty response + break +} + +``` + +### Getting started +- ``PlexswiftAPI`` defines the available API operations, including operations which are logically grouped by name (for example under ``PlexswiftAPI/server``). +- ``Client`` is the main object used when making requests to the API, and implements ``PlexswiftAPI`` to provide this functionality. Each available API method is exposed as an `async` function, which you can call and `await` its response and handle any errors that are thrown. +- API methods that require input data take a *request object* describing these parameters, and each method returns a *response object* containing information about the response. You can read more about these in . +- Requests to the API must be authenticated. You can provide authentication credentials by initializing ``Client`` with a ``Shared/Security`` value. +- If an error occurs when making a request to the API, a ``PlexswiftError`` error is thrown with more information about what went wrong. + +## Topics + +### Connecting to the API + +- ``Client`` +- ``GlobalServers`` +- ``Shared/Security`` +- ``Response`` +- ``ResponseWithHeaders`` +- ``ResponseFields`` +- ``ResponseHeaders`` +- ``PlexswiftError`` + +### API operations + +- ``plexswift/PlexswiftAPI`` +- ``ServerAPI`` +- ``MediaAPI`` +- ``ActivitiesAPI`` +- ``ButlerAPI`` +- ``HubsAPI`` +- ``SearchAPI`` +- ``LibraryAPI`` +- ``LogAPI`` +- ``PlaylistsAPI`` +- ``SecurityAPI`` +- ``SessionsAPI`` +- ``UpdaterAPI`` +- ``VideoAPI`` + +### Server configuration + +### Shared models + +### Request objects + +### Response objects +- ``Operations/AddPlaylistContentsResponse`` +- ``Operations/ApplyUpdatesResponse`` +- ``Operations/CancelServerActivitiesResponse`` +- ``Operations/CheckForUpdatesResponse`` +- ``Operations/ClearPlaylistContentsResponse`` +- ``Operations/CreatePlaylistResponse`` +- ``Operations/DeleteLibraryResponse`` +- ``Operations/DeletePlaylistResponse`` +- ``Operations/EnablePaperTrailResponse`` +- ``Operations/GetAvailableClientsResponse`` +- ``Operations/GetButlerTasksResponse`` +- ``Operations/GetCommonLibraryItemsResponse`` +- ``Operations/GetDevicesResponse`` +- ``Operations/GetFileHashResponse`` +- ``Operations/GetGlobalHubsResponse`` +- ``Operations/GetLatestLibraryItemsResponse`` +- ``Operations/GetLibrariesResponse`` +- ``Operations/GetLibraryResponse`` +- ``Operations/GetLibraryHubsResponse`` +- ``Operations/GetLibraryItemsResponse`` +- ``Operations/GetMetadataResponse`` +- ``Operations/GetMetadataChildrenResponse`` +- ``Operations/GetMyPlexAccountResponse`` +- ``Operations/GetOnDeckResponse`` +- ``Operations/GetPlaylistResponse`` +- ``Operations/GetPlaylistContentsResponse`` +- ``Operations/GetPlaylistsResponse`` +- ``Operations/GetRecentlyAddedResponse`` +- ``Operations/GetResizedPhotoResponse`` +- ``Operations/GetSearchResultsResponse`` +- ``Operations/GetServerActivitiesResponse`` +- ``Operations/GetServerCapabilitiesResponse`` +- ``Operations/GetServerIdentityResponse`` +- ``Operations/GetServerListResponse`` +- ``Operations/GetServerPreferencesResponse`` +- ``Operations/GetSessionHistoryResponse`` +- ``Operations/GetSessionsResponse`` +- ``Operations/GetSourceConnectionInformationResponse`` +- ``Operations/GetTimelineResponse`` +- ``Operations/GetTranscodeSessionsResponse`` +- ``Operations/GetTransientTokenResponse`` +- ``Operations/GetUpdateStatusResponse`` +- ``Operations/LogLineResponse`` +- ``Operations/LogMultiLineResponse`` +- ``Operations/MarkPlayedResponse`` +- ``Operations/MarkUnplayedResponse`` +- ``Operations/PerformSearchResponse`` +- ``Operations/PerformVoiceSearchResponse`` +- ``Operations/RefreshLibraryResponse`` +- ``Operations/StartAllTasksResponse`` +- ``Operations/StartTaskResponse`` +- ``Operations/StartUniversalTranscodeResponse`` +- ``Operations/StopAllTasksResponse`` +- ``Operations/StopTaskResponse`` +- ``Operations/StopTranscodeSessionResponse`` +- ``Operations/UpdatePlaylistResponse`` +- ``Operations/UpdatePlayProgressResponse`` +- ``Operations/UploadPlaylistResponse`` + +### Other models +- ``Operations/Activity`` +- ``Operations/AddPlaylistContentsErrors`` +- ``Operations/AddPlaylistContentsRequest`` +- ``Operations/AddPlaylistContentsResponseBody`` +- ``Operations/ApplyUpdatesErrors`` +- ``Operations/ApplyUpdatesRequest`` +- ``Operations/ApplyUpdatesResponseBody`` +- ``Operations/ButlerTask`` +- ``Operations/ButlerTasks`` +- ``Operations/CancelServerActivitiesErrors`` +- ``Operations/CancelServerActivitiesRequest`` +- ``Operations/CancelServerActivitiesResponseBody`` +- ``Operations/CheckForUpdatesErrors`` +- ``Operations/CheckForUpdatesRequest`` +- ``Operations/CheckForUpdatesResponseBody`` +- ``Operations/ClearPlaylistContentsErrors`` +- ``Operations/ClearPlaylistContentsRequest`` +- ``Operations/ClearPlaylistContentsResponseBody`` +- ``Operations/Context`` +- ``Operations/Country`` +- ``Operations/CreatePlaylistErrors`` +- ``Operations/CreatePlaylistRequest`` +- ``Operations/CreatePlaylistResponseBody`` +- ``Operations/DeleteLibraryErrors`` +- ``Operations/DeleteLibraryRequest`` +- ``Operations/DeleteLibraryResponseBody`` +- ``Operations/DeletePlaylistErrors`` +- ``Operations/DeletePlaylistRequest`` +- ``Operations/DeletePlaylistResponseBody`` +- ``Operations/Device`` +- ``Operations/Director`` +- ``Operations/Directory`` +- ``Operations/Download`` +- ``Operations/EnablePaperTrailErrors`` +- ``Operations/EnablePaperTrailResponseBody`` +- ``Operations/Errors`` +- ``Operations/Force`` +- ``Operations/Genre`` +- ``Operations/GetAvailableClientsErrors`` +- ``Operations/GetAvailableClientsMediaContainer`` +- ``Operations/GetAvailableClientsResponseBody`` +- ``Operations/GetButlerTasksButlerResponseBody`` +- ``Operations/GetButlerTasksErrors`` +- ``Operations/GetButlerTasksResponseBody`` +- ``Operations/GetCommonLibraryItemsErrors`` +- ``Operations/GetCommonLibraryItemsRequest`` +- ``Operations/GetCommonLibraryItemsResponseBody`` +- ``Operations/GetDevicesErrors`` +- ``Operations/GetDevicesMediaContainer`` +- ``Operations/GetDevicesResponseBody`` +- ``Operations/GetDevicesServerResponseBody`` +- ``Operations/GetFileHashErrors`` +- ``Operations/GetFileHashRequest`` +- ``Operations/GetFileHashResponseBody`` +- ``Operations/GetGlobalHubsErrors`` +- ``Operations/GetGlobalHubsRequest`` +- ``Operations/GetGlobalHubsResponseBody`` +- ``Operations/GetLatestLibraryItemsErrors`` +- ``Operations/GetLatestLibraryItemsRequest`` +- ``Operations/GetLatestLibraryItemsResponseBody`` +- ``Operations/GetLibrariesErrors`` +- ``Operations/GetLibrariesResponseBody`` +- ``Operations/GetLibraryErrors`` +- ``Operations/GetLibraryRequest`` +- ``Operations/GetLibraryResponseBody`` +- ``Operations/GetLibraryHubsErrors`` +- ``Operations/GetLibraryHubsRequest`` +- ``Operations/GetLibraryHubsResponseBody`` +- ``Operations/GetLibraryItemsErrors`` +- ``Operations/GetLibraryItemsRequest`` +- ``Operations/GetLibraryItemsResponseBody`` +- ``Operations/GetMetadataErrors`` +- ``Operations/GetMetadataRequest`` +- ``Operations/GetMetadataResponseBody`` +- ``Operations/GetMetadataChildrenErrors`` +- ``Operations/GetMetadataChildrenRequest`` +- ``Operations/GetMetadataChildrenResponseBody`` +- ``Operations/GetMyPlexAccountErrors`` +- ``Operations/GetMyPlexAccountResponseBody`` +- ``Operations/GetMyPlexAccountServerResponseBody`` +- ``Operations/GetOnDeckErrors`` +- ``Operations/GetOnDeckLibraryResponseBody`` +- ``Operations/GetOnDeckMedia`` +- ``Operations/GetOnDeckMediaContainer`` +- ``Operations/GetOnDeckMetadata`` +- ``Operations/GetOnDeckPart`` +- ``Operations/GetOnDeckResponseBody`` +- ``Operations/GetPlaylistErrors`` +- ``Operations/GetPlaylistRequest`` +- ``Operations/GetPlaylistResponseBody`` +- ``Operations/GetPlaylistContentsErrors`` +- ``Operations/GetPlaylistContentsRequest`` +- ``Operations/GetPlaylistContentsResponseBody`` +- ``Operations/GetPlaylistsErrors`` +- ``Operations/GetPlaylistsRequest`` +- ``Operations/GetPlaylistsResponseBody`` +- ``Operations/GetRecentlyAddedErrors`` +- ``Operations/GetRecentlyAddedLibraryResponseBody`` +- ``Operations/GetRecentlyAddedMediaContainer`` +- ``Operations/GetRecentlyAddedResponseBody`` +- ``Operations/GetResizedPhotoErrors`` +- ``Operations/GetResizedPhotoRequest`` +- ``Operations/GetResizedPhotoResponseBody`` +- ``Operations/GetSearchResultsCountry`` +- ``Operations/GetSearchResultsDirector`` +- ``Operations/GetSearchResultsErrors`` +- ``Operations/GetSearchResultsGenre`` +- ``Operations/GetSearchResultsMedia`` +- ``Operations/GetSearchResultsMediaContainer`` +- ``Operations/GetSearchResultsMetadata`` +- ``Operations/GetSearchResultsPart`` +- ``Operations/GetSearchResultsRequest`` +- ``Operations/GetSearchResultsResponseBody`` +- ``Operations/GetSearchResultsRole`` +- ``Operations/GetSearchResultsSearchResponseBody`` +- ``Operations/GetSearchResultsWriter`` +- ``Operations/GetServerActivitiesActivitiesResponseBody`` +- ``Operations/GetServerActivitiesErrors`` +- ``Operations/GetServerActivitiesMediaContainer`` +- ``Operations/GetServerActivitiesResponseBody`` +- ``Operations/GetServerCapabilitiesResponseBody`` +- ``Operations/GetServerCapabilitiesServerResponseBody`` +- ``Operations/GetServerIdentityErrors`` +- ``Operations/GetServerIdentityMediaContainer`` +- ``Operations/GetServerIdentityResponseBody`` +- ``Operations/GetServerIdentityServerResponseBody`` +- ``Operations/GetServerListErrors`` +- ``Operations/GetServerListMediaContainer`` +- ``Operations/GetServerListResponseBody`` +- ``Operations/GetServerListServer`` +- ``Operations/GetServerListServerResponseBody`` +- ``Operations/GetServerPreferencesErrors`` +- ``Operations/GetServerPreferencesResponseBody`` +- ``Operations/GetSessionHistoryErrors`` +- ``Operations/GetSessionHistoryResponseBody`` +- ``Operations/GetSessionsErrors`` +- ``Operations/GetSessionsResponseBody`` +- ``Operations/GetSourceConnectionInformationErrors`` +- ``Operations/GetSourceConnectionInformationRequest`` +- ``Operations/GetSourceConnectionInformationResponseBody`` +- ``Operations/GetTimelineErrors`` +- ``Operations/GetTimelineRequest`` +- ``Operations/GetTimelineResponseBody`` +- ``Operations/GetTranscodeSessionsErrors`` +- ``Operations/GetTranscodeSessionsMediaContainer`` +- ``Operations/GetTranscodeSessionsResponseBody`` +- ``Operations/GetTranscodeSessionsSessionsResponseBody`` +- ``Operations/GetTransientTokenErrors`` +- ``Operations/GetTransientTokenRequest`` +- ``Operations/GetTransientTokenResponseBody`` +- ``Operations/GetUpdateStatusErrors`` +- ``Operations/GetUpdateStatusResponseBody`` +- ``Operations/Guids`` +- ``Operations/IncludeDetails`` +- ``Operations/Level`` +- ``Operations/LogLineErrors`` +- ``Operations/LogLineRequest`` +- ``Operations/LogLineResponseBody`` +- ``Operations/LogMultiLineErrors`` +- ``Operations/LogMultiLineResponseBody`` +- ``Operations/MarkPlayedErrors`` +- ``Operations/MarkPlayedRequest`` +- ``Operations/MarkPlayedResponseBody`` +- ``Operations/MarkUnplayedErrors`` +- ``Operations/MarkUnplayedRequest`` +- ``Operations/MarkUnplayedResponseBody`` +- ``Operations/Media`` +- ``Operations/MediaContainer`` +- ``Operations/Metadata`` +- ``Operations/MinSize`` +- ``Operations/MyPlex`` +- ``Operations/OnlyTransient`` +- ``Operations/Part`` +- ``Operations/PathParamTaskName`` +- ``Operations/PerformSearchErrors`` +- ``Operations/PerformSearchRequest`` +- ``Operations/PerformSearchResponseBody`` +- ``Operations/PerformVoiceSearchErrors`` +- ``Operations/PerformVoiceSearchRequest`` +- ``Operations/PerformVoiceSearchResponseBody`` +- ``Operations/PlaylistType`` +- ``Operations/Provider`` +- ``Operations/QueryParamOnlyTransient`` +- ``Operations/QueryParamSmart`` +- ``Operations/QueryParamType`` +- ``Operations/RefreshLibraryErrors`` +- ``Operations/RefreshLibraryRequest`` +- ``Operations/RefreshLibraryResponseBody`` +- ``Operations/ResponseBody`` +- ``Operations/Role`` +- ``Operations/Scope`` +- ``Operations/Server`` +- ``Operations/Skip`` +- ``Operations/Smart`` +- ``Operations/StartAllTasksErrors`` +- ``Operations/StartAllTasksResponseBody`` +- ``Operations/StartTaskErrors`` +- ``Operations/StartTaskRequest`` +- ``Operations/StartTaskResponseBody`` +- ``Operations/StartUniversalTranscodeErrors`` +- ``Operations/StartUniversalTranscodeRequest`` +- ``Operations/StartUniversalTranscodeResponseBody`` +- ``Operations/State`` +- ``Operations/StopAllTasksErrors`` +- ``Operations/StopAllTasksResponseBody`` +- ``Operations/StopTaskErrors`` +- ``Operations/StopTaskRequest`` +- ``Operations/StopTaskResponseBody`` +- ``Operations/StopTranscodeSessionErrors`` +- ``Operations/StopTranscodeSessionRequest`` +- ``Operations/StopTranscodeSessionResponseBody`` +- ``Operations/Stream`` +- ``Operations/TaskName`` +- ``Operations/Tonight`` +- ``Operations/TranscodeSession`` +- ``Operations/TypeModel`` +- ``Operations/UpdatePlaylistErrors`` +- ``Operations/UpdatePlaylistRequest`` +- ``Operations/UpdatePlaylistResponseBody`` +- ``Operations/UpdatePlayProgressErrors`` +- ``Operations/UpdatePlayProgressRequest`` +- ``Operations/UpdatePlayProgressResponseBody`` +- ``Operations/UploadPlaylistErrors`` +- ``Operations/UploadPlaylistRequest`` +- ``Operations/UploadPlaylistResponseBody`` +- ``Operations/Upscale`` +- ``Operations/Writer`` + +### Type groupings +- ``Operations`` +- ``Shared`` + +### Data types + +- ``AnyValue`` +- ``APIValue`` + +### Internal data types + +- ``DateConvertible`` +- ``DateOnly`` +- ``DateTime`` +- ``DecimalSerialized`` +- ``DoubleConvertible`` diff --git a/Sources/Plexswift/configuration/GlobalServer.swift b/Sources/Plexswift/configuration/GlobalServer.swift new file mode 100644 index 0000000..c685049 --- /dev/null +++ b/Sources/Plexswift/configuration/GlobalServer.swift @@ -0,0 +1,51 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +/// The protocol to use when connecting to your plex server. +public enum ServerProtocol: String, Codable, APIValue { + case http = "http" + case https = "https" +} + +/// Describes the available servers that can be used when connecting to the API. +/// +/// These can be passed to ``Client/use(server:)`` to configure the server that is connected to when making API requests. +/// +/// > Note: Some API operations may support further customization of the server that is connected to when making calls to their respective endpoints. See the corresponding documentation for each API operation method to see if this is the case. +public enum GlobalServers: Servers, ServerConvertible { + /// Supported server value. + /// + /// Corresponds to `http://10.10.10.47:32400` + case server1 + /// Supported server value with substituted variables + /// + /// Corresponds to `{protocol}://{ip}:{port}` + case server2(`protocol`: ServerProtocol = .http, ip: String = "10.10.10.47", port: String = "32400") + + /// Defines the raw URL strings for each server option. + /// + /// > Note: You do not need to use these values directly. + /// + /// The available URL strings are defined as: + /// ```swift + /// public static let urlStrings = [ + /// "http://10.10.10.47:32400", + /// "{protocol}://{ip}:{port}" + /// ] + /// ``` + public static let urlStrings = [ + "http://10.10.10.47:32400", + "{protocol}://{ip}:{port}" + ] + + func server() throws -> Server { + switch self { + case .server1: + return try type(of: self).server(at: 0, substituting: nil) + case .server2(let `protocol`, let ip, let port): + return try type(of: self).server(at: 1, substituting: ["protocol": `protocol`.rawValue, "ip": ip, "port": port]) + } + } +} diff --git a/Sources/Plexswift/internal/api/_ActivitiesAPI.swift b/Sources/Plexswift/internal/api/_ActivitiesAPI.swift new file mode 100644 index 0000000..d02d4a7 --- /dev/null +++ b/Sources/Plexswift/internal/api/_ActivitiesAPI.swift @@ -0,0 +1,93 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _ActivitiesAPI: ActivitiesAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getServerActivities() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetServerActivitiesRequest(with: configuration) + }, + handleResponse: handleGetServerActivitiesResponse + ) + } + + public func cancelServerActivities(request: Operations.CancelServerActivitiesRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureCancelServerActivitiesRequest(with: configuration, request: request) + }, + handleResponse: handleCancelServerActivitiesResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetServerActivitiesRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/activities" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureCancelServerActivitiesRequest(with configuration: URLRequestConfiguration, request: Operations.CancelServerActivitiesRequest) throws { + configuration.path = "/activities/{activityUUID}" + configuration.method = .delete + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetServerActivitiesResponse(response: Client.APIResponse) throws -> Operations.GetServerActivitiesResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerActivitiesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerActivitiesActivitiesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleCancelServerActivitiesResponse(response: Client.APIResponse) throws -> Operations.CancelServerActivitiesResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.CancelServerActivitiesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_ButlerAPI.swift b/Sources/Plexswift/internal/api/_ButlerAPI.swift new file mode 100644 index 0000000..c03cf77 --- /dev/null +++ b/Sources/Plexswift/internal/api/_ButlerAPI.swift @@ -0,0 +1,193 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _ButlerAPI: ButlerAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getButlerTasks() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetButlerTasksRequest(with: configuration) + }, + handleResponse: handleGetButlerTasksResponse + ) + } + + public func startAllTasks() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureStartAllTasksRequest(with: configuration) + }, + handleResponse: handleStartAllTasksResponse + ) + } + + public func stopAllTasks() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureStopAllTasksRequest(with: configuration) + }, + handleResponse: handleStopAllTasksResponse + ) + } + + public func startTask(request: Operations.StartTaskRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureStartTaskRequest(with: configuration, request: request) + }, + handleResponse: handleStartTaskResponse + ) + } + + public func stopTask(request: Operations.StopTaskRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureStopTaskRequest(with: configuration, request: request) + }, + handleResponse: handleStopTaskResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetButlerTasksRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/butler" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureStartAllTasksRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/butler" + configuration.method = .post + configuration.telemetryHeader = .userAgent +} + +private func configureStopAllTasksRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/butler" + configuration.method = .delete + configuration.telemetryHeader = .userAgent +} + +private func configureStartTaskRequest(with configuration: URLRequestConfiguration, request: Operations.StartTaskRequest) throws { + configuration.path = "/butler/{taskName}" + configuration.method = .post + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureStopTaskRequest(with configuration: URLRequestConfiguration, request: Operations.StopTaskRequest) throws { + configuration.path = "/butler/{taskName}" + configuration.method = .delete + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetButlerTasksResponse(response: Client.APIResponse) throws -> Operations.GetButlerTasksResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetButlerTasksResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetButlerTasksButlerResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleStartAllTasksResponse(response: Client.APIResponse) throws -> Operations.StartAllTasksResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.StartAllTasksResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleStopAllTasksResponse(response: Client.APIResponse) throws -> Operations.StopAllTasksResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.StopAllTasksResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleStartTaskResponse(response: Client.APIResponse) throws -> Operations.StartTaskResponse { + let httpResponse = response.httpResponse + + if [200, 202, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.StartTaskResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleStopTaskResponse(response: Client.APIResponse) throws -> Operations.StopTaskResponse { + let httpResponse = response.httpResponse + + if [200, 400, 404].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.StopTaskResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_HubsAPI.swift b/Sources/Plexswift/internal/api/_HubsAPI.swift new file mode 100644 index 0000000..bd6a38c --- /dev/null +++ b/Sources/Plexswift/internal/api/_HubsAPI.swift @@ -0,0 +1,87 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _HubsAPI: HubsAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getGlobalHubs(request: Operations.GetGlobalHubsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetGlobalHubsRequest(with: configuration, request: request) + }, + handleResponse: handleGetGlobalHubsResponse + ) + } + + public func getLibraryHubs(request: Operations.GetLibraryHubsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetLibraryHubsRequest(with: configuration, request: request) + }, + handleResponse: handleGetLibraryHubsResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetGlobalHubsRequest(with configuration: URLRequestConfiguration, request: Operations.GetGlobalHubsRequest) throws { + configuration.path = "/hubs" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetLibraryHubsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryHubsRequest) throws { + configuration.path = "/hubs/sections/{sectionId}" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetGlobalHubsResponse(response: Client.APIResponse) throws -> Operations.GetGlobalHubsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetGlobalHubsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetLibraryHubsResponse(response: Client.APIResponse) throws -> Operations.GetLibraryHubsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetLibraryHubsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_LibraryAPI.swift b/Sources/Plexswift/internal/api/_LibraryAPI.swift new file mode 100644 index 0000000..23900b1 --- /dev/null +++ b/Sources/Plexswift/internal/api/_LibraryAPI.swift @@ -0,0 +1,443 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _LibraryAPI: LibraryAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getFileHash(request: Operations.GetFileHashRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetFileHashRequest(with: configuration, request: request) + }, + handleResponse: handleGetFileHashResponse + ) + } + + public func getRecentlyAdded() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetRecentlyAddedRequest(with: configuration) + }, + handleResponse: handleGetRecentlyAddedResponse + ) + } + + public func getLibraries() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetLibrariesRequest(with: configuration) + }, + handleResponse: handleGetLibrariesResponse + ) + } + + public func getLibrary(request: Operations.GetLibraryRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetLibraryRequest(with: configuration, request: request) + }, + handleResponse: handleGetLibraryResponse + ) + } + + public func deleteLibrary(request: Operations.DeleteLibraryRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureDeleteLibraryRequest(with: configuration, request: request) + }, + handleResponse: handleDeleteLibraryResponse + ) + } + + public func getLibraryItems(request: Operations.GetLibraryItemsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetLibraryItemsRequest(with: configuration, request: request) + }, + handleResponse: handleGetLibraryItemsResponse + ) + } + + public func refreshLibrary(request: Operations.RefreshLibraryRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureRefreshLibraryRequest(with: configuration, request: request) + }, + handleResponse: handleRefreshLibraryResponse + ) + } + + public func getLatestLibraryItems(request: Operations.GetLatestLibraryItemsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetLatestLibraryItemsRequest(with: configuration, request: request) + }, + handleResponse: handleGetLatestLibraryItemsResponse + ) + } + + public func getCommonLibraryItems(request: Operations.GetCommonLibraryItemsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetCommonLibraryItemsRequest(with: configuration, request: request) + }, + handleResponse: handleGetCommonLibraryItemsResponse + ) + } + + public func getMetadata(request: Operations.GetMetadataRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetMetadataRequest(with: configuration, request: request) + }, + handleResponse: handleGetMetadataResponse + ) + } + + public func getMetadataChildren(request: Operations.GetMetadataChildrenRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetMetadataChildrenRequest(with: configuration, request: request) + }, + handleResponse: handleGetMetadataChildrenResponse + ) + } + + public func getOnDeck() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetOnDeckRequest(with: configuration) + }, + handleResponse: handleGetOnDeckResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetFileHashRequest(with configuration: URLRequestConfiguration, request: Operations.GetFileHashRequest) throws { + configuration.path = "/library/hashes" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetRecentlyAddedRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/library/recentlyAdded" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetLibrariesRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/library/sections" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryRequest) throws { + configuration.path = "/library/sections/{sectionId}" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureDeleteLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.DeleteLibraryRequest) throws { + configuration.path = "/library/sections/{sectionId}" + configuration.method = .delete + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetLibraryItemsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryItemsRequest) throws { + configuration.path = "/library/sections/{sectionId}/all" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureRefreshLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.RefreshLibraryRequest) throws { + configuration.path = "/library/sections/{sectionId}/refresh" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetLatestLibraryItemsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLatestLibraryItemsRequest) throws { + configuration.path = "/library/sections/{sectionId}/latest" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetCommonLibraryItemsRequest(with configuration: URLRequestConfiguration, request: Operations.GetCommonLibraryItemsRequest) throws { + configuration.path = "/library/sections/{sectionId}/common" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetMetadataRequest(with configuration: URLRequestConfiguration, request: Operations.GetMetadataRequest) throws { + configuration.path = "/library/metadata/{ratingKey}" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetMetadataChildrenRequest(with configuration: URLRequestConfiguration, request: Operations.GetMetadataChildrenRequest) throws { + configuration.path = "/library/metadata/{ratingKey}/children" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetOnDeckRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/library/onDeck" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetFileHashResponse(response: Client.APIResponse) throws -> Operations.GetFileHashResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetFileHashResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetRecentlyAddedResponse(response: Client.APIResponse) throws -> Operations.GetRecentlyAddedResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetRecentlyAddedResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetRecentlyAddedLibraryResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetLibrariesResponse(response: Client.APIResponse) throws -> Operations.GetLibrariesResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetLibrariesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetLibraryResponse(response: Client.APIResponse) throws -> Operations.GetLibraryResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetLibraryResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleDeleteLibraryResponse(response: Client.APIResponse) throws -> Operations.DeleteLibraryResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.DeleteLibraryResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetLibraryItemsResponse(response: Client.APIResponse) throws -> Operations.GetLibraryItemsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetLibraryItemsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleRefreshLibraryResponse(response: Client.APIResponse) throws -> Operations.RefreshLibraryResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.RefreshLibraryResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetLatestLibraryItemsResponse(response: Client.APIResponse) throws -> Operations.GetLatestLibraryItemsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetLatestLibraryItemsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetCommonLibraryItemsResponse(response: Client.APIResponse) throws -> Operations.GetCommonLibraryItemsResponse { + let httpResponse = response.httpResponse + + if [200, 400, 404].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetCommonLibraryItemsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetMetadataResponse(response: Client.APIResponse) throws -> Operations.GetMetadataResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetMetadataResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetMetadataChildrenResponse(response: Client.APIResponse) throws -> Operations.GetMetadataChildrenResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetMetadataChildrenResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetOnDeckResponse(response: Client.APIResponse) throws -> Operations.GetOnDeckResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetOnDeckResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetOnDeckLibraryResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_LogAPI.swift b/Sources/Plexswift/internal/api/_LogAPI.swift new file mode 100644 index 0000000..09330f9 --- /dev/null +++ b/Sources/Plexswift/internal/api/_LogAPI.swift @@ -0,0 +1,118 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _LogAPI: LogAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func logLine(request: Operations.LogLineRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureLogLineRequest(with: configuration, request: request) + }, + handleResponse: handleLogLineResponse + ) + } + + public func logMultiLine() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureLogMultiLineRequest(with: configuration) + }, + handleResponse: handleLogMultiLineResponse + ) + } + + public func enablePaperTrail() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureEnablePaperTrailRequest(with: configuration) + }, + handleResponse: handleEnablePaperTrailResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureLogLineRequest(with configuration: URLRequestConfiguration, request: Operations.LogLineRequest) throws { + configuration.path = "/log" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureLogMultiLineRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/log" + configuration.method = .post + configuration.telemetryHeader = .userAgent +} + +private func configureEnablePaperTrailRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/log/networked" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleLogLineResponse(response: Client.APIResponse) throws -> Operations.LogLineResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.LogLineResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleLogMultiLineResponse(response: Client.APIResponse) throws -> Operations.LogMultiLineResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.LogMultiLineResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleEnablePaperTrailResponse(response: Client.APIResponse) throws -> Operations.EnablePaperTrailResponse { + let httpResponse = response.httpResponse + + if [200, 400, 403].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.EnablePaperTrailResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_MediaAPI.swift b/Sources/Plexswift/internal/api/_MediaAPI.swift new file mode 100644 index 0000000..30f7ee0 --- /dev/null +++ b/Sources/Plexswift/internal/api/_MediaAPI.swift @@ -0,0 +1,120 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _MediaAPI: MediaAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func markPlayed(request: Operations.MarkPlayedRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureMarkPlayedRequest(with: configuration, request: request) + }, + handleResponse: handleMarkPlayedResponse + ) + } + + public func markUnplayed(request: Operations.MarkUnplayedRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureMarkUnplayedRequest(with: configuration, request: request) + }, + handleResponse: handleMarkUnplayedResponse + ) + } + + public func updatePlayProgress(request: Operations.UpdatePlayProgressRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureUpdatePlayProgressRequest(with: configuration, request: request) + }, + handleResponse: handleUpdatePlayProgressResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureMarkPlayedRequest(with configuration: URLRequestConfiguration, request: Operations.MarkPlayedRequest) throws { + configuration.path = "/:/scrobble" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureMarkUnplayedRequest(with configuration: URLRequestConfiguration, request: Operations.MarkUnplayedRequest) throws { + configuration.path = "/:/unscrobble" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureUpdatePlayProgressRequest(with configuration: URLRequestConfiguration, request: Operations.UpdatePlayProgressRequest) throws { + configuration.path = "/:/progress" + configuration.method = .post + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleMarkPlayedResponse(response: Client.APIResponse) throws -> Operations.MarkPlayedResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.MarkPlayedResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleMarkUnplayedResponse(response: Client.APIResponse) throws -> Operations.MarkUnplayedResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.MarkUnplayedResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleUpdatePlayProgressResponse(response: Client.APIResponse) throws -> Operations.UpdatePlayProgressResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.UpdatePlayProgressResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_PlaylistsAPI.swift b/Sources/Plexswift/internal/api/_PlaylistsAPI.swift new file mode 100644 index 0000000..7747738 --- /dev/null +++ b/Sources/Plexswift/internal/api/_PlaylistsAPI.swift @@ -0,0 +1,326 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _PlaylistsAPI: PlaylistsAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func createPlaylist(request: Operations.CreatePlaylistRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureCreatePlaylistRequest(with: configuration, request: request) + }, + handleResponse: handleCreatePlaylistResponse + ) + } + + public func getPlaylists(request: Operations.GetPlaylistsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetPlaylistsRequest(with: configuration, request: request) + }, + handleResponse: handleGetPlaylistsResponse + ) + } + + public func getPlaylist(request: Operations.GetPlaylistRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetPlaylistRequest(with: configuration, request: request) + }, + handleResponse: handleGetPlaylistResponse + ) + } + + public func deletePlaylist(request: Operations.DeletePlaylistRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureDeletePlaylistRequest(with: configuration, request: request) + }, + handleResponse: handleDeletePlaylistResponse + ) + } + + public func updatePlaylist(request: Operations.UpdatePlaylistRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureUpdatePlaylistRequest(with: configuration, request: request) + }, + handleResponse: handleUpdatePlaylistResponse + ) + } + + public func getPlaylistContents(request: Operations.GetPlaylistContentsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetPlaylistContentsRequest(with: configuration, request: request) + }, + handleResponse: handleGetPlaylistContentsResponse + ) + } + + public func clearPlaylistContents(request: Operations.ClearPlaylistContentsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureClearPlaylistContentsRequest(with: configuration, request: request) + }, + handleResponse: handleClearPlaylistContentsResponse + ) + } + + public func addPlaylistContents(request: Operations.AddPlaylistContentsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureAddPlaylistContentsRequest(with: configuration, request: request) + }, + handleResponse: handleAddPlaylistContentsResponse + ) + } + + public func uploadPlaylist(request: Operations.UploadPlaylistRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureUploadPlaylistRequest(with: configuration, request: request) + }, + handleResponse: handleUploadPlaylistResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureCreatePlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.CreatePlaylistRequest) throws { + configuration.path = "/playlists" + configuration.method = .post + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetPlaylistsRequest(with configuration: URLRequestConfiguration, request: Operations.GetPlaylistsRequest) throws { + configuration.path = "/playlists/all" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetPlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.GetPlaylistRequest) throws { + configuration.path = "/playlists/{playlistID}" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureDeletePlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.DeletePlaylistRequest) throws { + configuration.path = "/playlists/{playlistID}" + configuration.method = .delete + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureUpdatePlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.UpdatePlaylistRequest) throws { + configuration.path = "/playlists/{playlistID}" + configuration.method = .put + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetPlaylistContentsRequest(with configuration: URLRequestConfiguration, request: Operations.GetPlaylistContentsRequest) throws { + configuration.path = "/playlists/{playlistID}/items" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureClearPlaylistContentsRequest(with configuration: URLRequestConfiguration, request: Operations.ClearPlaylistContentsRequest) throws { + configuration.path = "/playlists/{playlistID}/items" + configuration.method = .delete + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureAddPlaylistContentsRequest(with configuration: URLRequestConfiguration, request: Operations.AddPlaylistContentsRequest) throws { + configuration.path = "/playlists/{playlistID}/items" + configuration.method = .put + configuration.pathParameterSerializable = request + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureUploadPlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.UploadPlaylistRequest) throws { + configuration.path = "/playlists/upload" + configuration.method = .post + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleCreatePlaylistResponse(response: Client.APIResponse) throws -> Operations.CreatePlaylistResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.CreatePlaylistResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetPlaylistsResponse(response: Client.APIResponse) throws -> Operations.GetPlaylistsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetPlaylistsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetPlaylistResponse(response: Client.APIResponse) throws -> Operations.GetPlaylistResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetPlaylistResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleDeletePlaylistResponse(response: Client.APIResponse) throws -> Operations.DeletePlaylistResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.DeletePlaylistResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleUpdatePlaylistResponse(response: Client.APIResponse) throws -> Operations.UpdatePlaylistResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.UpdatePlaylistResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetPlaylistContentsResponse(response: Client.APIResponse) throws -> Operations.GetPlaylistContentsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetPlaylistContentsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleClearPlaylistContentsResponse(response: Client.APIResponse) throws -> Operations.ClearPlaylistContentsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.ClearPlaylistContentsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleAddPlaylistContentsResponse(response: Client.APIResponse) throws -> Operations.AddPlaylistContentsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.AddPlaylistContentsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleUploadPlaylistResponse(response: Client.APIResponse) throws -> Operations.UploadPlaylistResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.UploadPlaylistResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_SearchAPI.swift b/Sources/Plexswift/internal/api/_SearchAPI.swift new file mode 100644 index 0000000..eae9e2b --- /dev/null +++ b/Sources/Plexswift/internal/api/_SearchAPI.swift @@ -0,0 +1,128 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _SearchAPI: SearchAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func performSearch(request: Operations.PerformSearchRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configurePerformSearchRequest(with: configuration, request: request) + }, + handleResponse: handlePerformSearchResponse + ) + } + + public func performVoiceSearch(request: Operations.PerformVoiceSearchRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configurePerformVoiceSearchRequest(with: configuration, request: request) + }, + handleResponse: handlePerformVoiceSearchResponse + ) + } + + public func getSearchResults(request: Operations.GetSearchResultsRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetSearchResultsRequest(with: configuration, request: request) + }, + handleResponse: handleGetSearchResultsResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configurePerformSearchRequest(with configuration: URLRequestConfiguration, request: Operations.PerformSearchRequest) throws { + configuration.path = "/hubs/search" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configurePerformVoiceSearchRequest(with configuration: URLRequestConfiguration, request: Operations.PerformVoiceSearchRequest) throws { + configuration.path = "/hubs/search/voice" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetSearchResultsRequest(with configuration: URLRequestConfiguration, request: Operations.GetSearchResultsRequest) throws { + configuration.path = "/search" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handlePerformSearchResponse(response: Client.APIResponse) throws -> Operations.PerformSearchResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.PerformSearchResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handlePerformVoiceSearchResponse(response: Client.APIResponse) throws -> Operations.PerformVoiceSearchResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.PerformVoiceSearchResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetSearchResultsResponse(response: Client.APIResponse) throws -> Operations.GetSearchResultsResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetSearchResultsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetSearchResultsSearchResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_SecurityAPI.swift b/Sources/Plexswift/internal/api/_SecurityAPI.swift new file mode 100644 index 0000000..d5319fe --- /dev/null +++ b/Sources/Plexswift/internal/api/_SecurityAPI.swift @@ -0,0 +1,86 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _SecurityAPI: SecurityAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getTransientToken(request: Operations.GetTransientTokenRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetTransientTokenRequest(with: configuration, request: request) + }, + handleResponse: handleGetTransientTokenResponse + ) + } + + public func getSourceConnectionInformation(request: Operations.GetSourceConnectionInformationRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetSourceConnectionInformationRequest(with: configuration, request: request) + }, + handleResponse: handleGetSourceConnectionInformationResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetTransientTokenRequest(with configuration: URLRequestConfiguration, request: Operations.GetTransientTokenRequest) throws { + configuration.path = "/security/token" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetSourceConnectionInformationRequest(with configuration: URLRequestConfiguration, request: Operations.GetSourceConnectionInformationRequest) throws { + configuration.path = "/security/resources" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetTransientTokenResponse(response: Client.APIResponse) throws -> Operations.GetTransientTokenResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetTransientTokenResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetSourceConnectionInformationResponse(response: Client.APIResponse) throws -> Operations.GetSourceConnectionInformationResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetSourceConnectionInformationResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_ServerAPI.swift b/Sources/Plexswift/internal/api/_ServerAPI.swift new file mode 100644 index 0000000..3316839 --- /dev/null +++ b/Sources/Plexswift/internal/api/_ServerAPI.swift @@ -0,0 +1,331 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _ServerAPI: ServerAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getServerCapabilities() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetServerCapabilitiesRequest(with: configuration) + }, + handleResponse: handleGetServerCapabilitiesResponse + ) + } + + public func getServerPreferences() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetServerPreferencesRequest(with: configuration) + }, + handleResponse: handleGetServerPreferencesResponse + ) + } + + public func getAvailableClients() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetAvailableClientsRequest(with: configuration) + }, + handleResponse: handleGetAvailableClientsResponse + ) + } + + public func getDevices() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetDevicesRequest(with: configuration) + }, + handleResponse: handleGetDevicesResponse + ) + } + + public func getServerIdentity() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetServerIdentityRequest(with: configuration) + }, + handleResponse: handleGetServerIdentityResponse + ) + } + + public func getMyPlexAccount() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetMyPlexAccountRequest(with: configuration) + }, + handleResponse: handleGetMyPlexAccountResponse + ) + } + + public func getResizedPhoto(request: Operations.GetResizedPhotoRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetResizedPhotoRequest(with: configuration, request: request) + }, + handleResponse: handleGetResizedPhotoResponse + ) + } + + public func getServerList() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetServerListRequest(with: configuration) + }, + handleResponse: handleGetServerListResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetServerCapabilitiesRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetServerPreferencesRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/:/prefs" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetAvailableClientsRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/clients" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetDevicesRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/devices" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetServerIdentityRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/identity" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetMyPlexAccountRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/myplex/account" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetResizedPhotoRequest(with configuration: URLRequestConfiguration, request: Operations.GetResizedPhotoRequest) throws { + configuration.path = "/photo/:/transcode" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetServerListRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/servers" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetServerCapabilitiesResponse(response: Client.APIResponse) throws -> Operations.GetServerCapabilitiesResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerCapabilitiesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerCapabilitiesServerResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetServerPreferencesResponse(response: Client.APIResponse) throws -> Operations.GetServerPreferencesResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetServerPreferencesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetAvailableClientsResponse(response: Client.APIResponse) throws -> Operations.GetAvailableClientsResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .responseBodies(try JSONDecoder().decode([Operations.ResponseBody].self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetAvailableClientsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetDevicesResponse(response: Client.APIResponse) throws -> Operations.GetDevicesResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetDevicesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetDevicesServerResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetServerIdentityResponse(response: Client.APIResponse) throws -> Operations.GetServerIdentityResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerIdentityResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerIdentityServerResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetMyPlexAccountResponse(response: Client.APIResponse) throws -> Operations.GetMyPlexAccountResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetMyPlexAccountResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetMyPlexAccountServerResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetResizedPhotoResponse(response: Client.APIResponse) throws -> Operations.GetResizedPhotoResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetResizedPhotoResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetServerListResponse(response: Client.APIResponse) throws -> Operations.GetServerListResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerListResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerListServerResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_SessionsAPI.swift b/Sources/Plexswift/internal/api/_SessionsAPI.swift new file mode 100644 index 0000000..c4a1736 --- /dev/null +++ b/Sources/Plexswift/internal/api/_SessionsAPI.swift @@ -0,0 +1,159 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _SessionsAPI: SessionsAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getSessions() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetSessionsRequest(with: configuration) + }, + handleResponse: handleGetSessionsResponse + ) + } + + public func getSessionHistory() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetSessionHistoryRequest(with: configuration) + }, + handleResponse: handleGetSessionHistoryResponse + ) + } + + public func getTranscodeSessions() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetTranscodeSessionsRequest(with: configuration) + }, + handleResponse: handleGetTranscodeSessionsResponse + ) + } + + public func stopTranscodeSession(request: Operations.StopTranscodeSessionRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureStopTranscodeSessionRequest(with: configuration, request: request) + }, + handleResponse: handleStopTranscodeSessionResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetSessionsRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/status/sessions" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetSessionHistoryRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/status/sessions/history/all" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureGetTranscodeSessionsRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/transcode/sessions" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureStopTranscodeSessionRequest(with configuration: URLRequestConfiguration, request: Operations.StopTranscodeSessionRequest) throws { + configuration.path = "/transcode/sessions/{sessionKey}" + configuration.method = .delete + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetSessionsResponse(response: Client.APIResponse) throws -> Operations.GetSessionsResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetSessionsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetSessionHistoryResponse(response: Client.APIResponse) throws -> Operations.GetSessionHistoryResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetSessionHistoryResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetTranscodeSessionsResponse(response: Client.APIResponse) throws -> Operations.GetTranscodeSessionsResponse { + let httpResponse = response.httpResponse + + if httpResponse.statusCode == 200 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetTranscodeSessionsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } else if httpResponse.statusCode == 400 { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetTranscodeSessionsSessionsResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleStopTranscodeSessionResponse(response: Client.APIResponse) throws -> Operations.StopTranscodeSessionResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.StopTranscodeSessionResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_UpdaterAPI.swift b/Sources/Plexswift/internal/api/_UpdaterAPI.swift new file mode 100644 index 0000000..c7b5dd1 --- /dev/null +++ b/Sources/Plexswift/internal/api/_UpdaterAPI.swift @@ -0,0 +1,119 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _UpdaterAPI: UpdaterAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func getUpdateStatus() async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetUpdateStatusRequest(with: configuration) + }, + handleResponse: handleGetUpdateStatusResponse + ) + } + + public func checkForUpdates(request: Operations.CheckForUpdatesRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureCheckForUpdatesRequest(with: configuration, request: request) + }, + handleResponse: handleCheckForUpdatesResponse + ) + } + + public func applyUpdates(request: Operations.ApplyUpdatesRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureApplyUpdatesRequest(with: configuration, request: request) + }, + handleResponse: handleApplyUpdatesResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureGetUpdateStatusRequest(with configuration: URLRequestConfiguration) throws { + configuration.path = "/updater/status" + configuration.method = .get + configuration.telemetryHeader = .userAgent +} + +private func configureCheckForUpdatesRequest(with configuration: URLRequestConfiguration, request: Operations.CheckForUpdatesRequest) throws { + configuration.path = "/updater/check" + configuration.method = .put + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureApplyUpdatesRequest(with configuration: URLRequestConfiguration, request: Operations.ApplyUpdatesRequest) throws { + configuration.path = "/updater/apply" + configuration.method = .put + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleGetUpdateStatusResponse(response: Client.APIResponse) throws -> Operations.GetUpdateStatusResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetUpdateStatusResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleCheckForUpdatesResponse(response: Client.APIResponse) throws -> Operations.CheckForUpdatesResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.CheckForUpdatesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleApplyUpdatesResponse(response: Client.APIResponse) throws -> Operations.ApplyUpdatesResponse { + let httpResponse = response.httpResponse + + if [200, 400, 500].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.ApplyUpdatesResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/api/_VideoAPI.swift b/Sources/Plexswift/internal/api/_VideoAPI.swift new file mode 100644 index 0000000..833abee --- /dev/null +++ b/Sources/Plexswift/internal/api/_VideoAPI.swift @@ -0,0 +1,86 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +class _VideoAPI: VideoAPI { + private let client: Client + + init(client: Client) { + self.client = client + } + + public func startUniversalTranscode(request: Operations.StartUniversalTranscodeRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureStartUniversalTranscodeRequest(with: configuration, request: request) + }, + handleResponse: handleStartUniversalTranscodeResponse + ) + } + + public func getTimeline(request: Operations.GetTimelineRequest) async throws -> Response { + return try await client.makeRequest( + configureRequest: { configuration in + try configureGetTimelineRequest(with: configuration, request: request) + }, + handleResponse: handleGetTimelineResponse + ) + } + +} + +// MARK: - Request Configuration + +private func configureStartUniversalTranscodeRequest(with configuration: URLRequestConfiguration, request: Operations.StartUniversalTranscodeRequest) throws { + configuration.path = "/video/:/transcode/universal/start.mpd" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +private func configureGetTimelineRequest(with configuration: URLRequestConfiguration, request: Operations.GetTimelineRequest) throws { + configuration.path = "/:/timeline" + configuration.method = .get + configuration.queryParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + +// MARK: - Response Handlers + +private func handleStartUniversalTranscodeResponse(response: Client.APIResponse) throws -> Operations.StartUniversalTranscodeResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.StartUniversalTranscodeResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + +private func handleGetTimelineResponse(response: Client.APIResponse) throws -> Operations.GetTimelineResponse { + let httpResponse = response.httpResponse + + if [200, 400].contains(httpResponse.statusCode) { + return .empty + } else if httpResponse.statusCode == 401 { + if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { + do { + return .object(try JSONDecoder().decode(Operations.GetTimelineResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + diff --git a/Sources/Plexswift/internal/models/AddPlaylistContentsRequest+Serialization.swift b/Sources/Plexswift/internal/models/AddPlaylistContentsRequest+Serialization.swift new file mode 100644 index 0000000..9712025 --- /dev/null +++ b/Sources/Plexswift/internal/models/AddPlaylistContentsRequest+Serialization.swift @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.AddPlaylistContentsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.AddPlaylistContentsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.AddPlaylistContentsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} + +extension Operations.AddPlaylistContentsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: playQueueIDWrapper, named: "playQueueID", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: uri, named: "uri", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/ApplyUpdatesRequest+Serialization.swift b/Sources/Plexswift/internal/models/ApplyUpdatesRequest+Serialization.swift new file mode 100644 index 0000000..59f37ca --- /dev/null +++ b/Sources/Plexswift/internal/models/ApplyUpdatesRequest+Serialization.swift @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.ApplyUpdatesRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.ApplyUpdatesRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.ApplyUpdatesRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: skip, named: "skip", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: tonight, named: "tonight", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/CancelServerActivitiesRequest+Serialization.swift b/Sources/Plexswift/internal/models/CancelServerActivitiesRequest+Serialization.swift new file mode 100644 index 0000000..80583e8 --- /dev/null +++ b/Sources/Plexswift/internal/models/CancelServerActivitiesRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.CancelServerActivitiesRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.CancelServerActivitiesRequest", format: format.formatDescription) + } + } +} + +extension Operations.CancelServerActivitiesRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "activityUUID": try activityUUID.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/CheckForUpdatesRequest+Serialization.swift b/Sources/Plexswift/internal/models/CheckForUpdatesRequest+Serialization.swift new file mode 100644 index 0000000..98e2399 --- /dev/null +++ b/Sources/Plexswift/internal/models/CheckForUpdatesRequest+Serialization.swift @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.CheckForUpdatesRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.CheckForUpdatesRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.CheckForUpdatesRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: download, named: "download", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/ClearPlaylistContentsRequest+Serialization.swift b/Sources/Plexswift/internal/models/ClearPlaylistContentsRequest+Serialization.swift new file mode 100644 index 0000000..b24200c --- /dev/null +++ b/Sources/Plexswift/internal/models/ClearPlaylistContentsRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.ClearPlaylistContentsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.ClearPlaylistContentsRequest", format: format.formatDescription) + } + } +} + +extension Operations.ClearPlaylistContentsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/CreatePlaylistRequest+Serialization.swift b/Sources/Plexswift/internal/models/CreatePlaylistRequest+Serialization.swift new file mode 100644 index 0000000..b708457 --- /dev/null +++ b/Sources/Plexswift/internal/models/CreatePlaylistRequest+Serialization.swift @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.CreatePlaylistRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.CreatePlaylistRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.CreatePlaylistRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: smart, named: "smart", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: title, named: "title", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: type, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if playQueueID != nil { + try builder.addQueryParameters(from: playQueueIDWrapper, named: "playQueueID", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + try builder.addQueryParameters(from: uri, named: "uri", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/DeleteLibraryRequest+Serialization.swift b/Sources/Plexswift/internal/models/DeleteLibraryRequest+Serialization.swift new file mode 100644 index 0000000..72e36cf --- /dev/null +++ b/Sources/Plexswift/internal/models/DeleteLibraryRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.DeleteLibraryRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.DeleteLibraryRequest", format: format.formatDescription) + } + } +} + +extension Operations.DeleteLibraryRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/DeletePlaylistRequest+Serialization.swift b/Sources/Plexswift/internal/models/DeletePlaylistRequest+Serialization.swift new file mode 100644 index 0000000..f929fb4 --- /dev/null +++ b/Sources/Plexswift/internal/models/DeletePlaylistRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.DeletePlaylistRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.DeletePlaylistRequest", format: format.formatDescription) + } + } +} + +extension Operations.DeletePlaylistRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/Download+Serialization.swift b/Sources/Plexswift/internal/models/Download+Serialization.swift new file mode 100644 index 0000000..520fbe0 --- /dev/null +++ b/Sources/Plexswift/internal/models/Download+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Download: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/Force+Serialization.swift b/Sources/Plexswift/internal/models/Force+Serialization.swift new file mode 100644 index 0000000..de5913f --- /dev/null +++ b/Sources/Plexswift/internal/models/Force+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Force: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/GetCommonLibraryItemsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetCommonLibraryItemsRequest+Serialization.swift new file mode 100644 index 0000000..8250662 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetCommonLibraryItemsRequest+Serialization.swift @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetCommonLibraryItemsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetCommonLibraryItemsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetCommonLibraryItemsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} + +extension Operations.GetCommonLibraryItemsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: typeWrapper, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: filter, named: "filter", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetFileHashRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetFileHashRequest+Serialization.swift new file mode 100644 index 0000000..44b6905 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetFileHashRequest+Serialization.swift @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetFileHashRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetFileHashRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetFileHashRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: url, named: "url", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if type != nil { + try builder.addQueryParameters(from: typeWrapper, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetGlobalHubsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetGlobalHubsRequest+Serialization.swift new file mode 100644 index 0000000..d5184d0 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetGlobalHubsRequest+Serialization.swift @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetGlobalHubsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetGlobalHubsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetGlobalHubsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + if count != nil { + try builder.addQueryParameters(from: countWrapper, named: "count", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + try builder.addQueryParameters(from: onlyTransient, named: "onlyTransient", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetLatestLibraryItemsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetLatestLibraryItemsRequest+Serialization.swift new file mode 100644 index 0000000..d1dbdde --- /dev/null +++ b/Sources/Plexswift/internal/models/GetLatestLibraryItemsRequest+Serialization.swift @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetLatestLibraryItemsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetLatestLibraryItemsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetLatestLibraryItemsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} + +extension Operations.GetLatestLibraryItemsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: typeWrapper, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: filter, named: "filter", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetLibraryHubsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetLibraryHubsRequest+Serialization.swift new file mode 100644 index 0000000..03a1427 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetLibraryHubsRequest+Serialization.swift @@ -0,0 +1,40 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetLibraryHubsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetLibraryHubsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetLibraryHubsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} + +extension Operations.GetLibraryHubsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + if count != nil { + try builder.addQueryParameters(from: countWrapper, named: "count", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + try builder.addQueryParameters(from: onlyTransient, named: "onlyTransient", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift new file mode 100644 index 0000000..b832a0a --- /dev/null +++ b/Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift @@ -0,0 +1,40 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetLibraryItemsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetLibraryItemsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetLibraryItemsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} + +extension Operations.GetLibraryItemsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: filter, named: "filter", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if type != nil { + try builder.addQueryParameters(from: typeWrapper, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetLibraryRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetLibraryRequest+Serialization.swift new file mode 100644 index 0000000..5c59ca0 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetLibraryRequest+Serialization.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetLibraryRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetLibraryRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetLibraryRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} + +extension Operations.GetLibraryRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: includeDetails, named: "includeDetails", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetMetadataChildrenRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetMetadataChildrenRequest+Serialization.swift new file mode 100644 index 0000000..d0d8004 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetMetadataChildrenRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetMetadataChildrenRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetMetadataChildrenRequest", format: format.formatDescription) + } + } +} + +extension Operations.GetMetadataChildrenRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "ratingKey": try ratingKeyWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/GetMetadataRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetMetadataRequest+Serialization.swift new file mode 100644 index 0000000..7bd9b36 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetMetadataRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetMetadataRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetMetadataRequest", format: format.formatDescription) + } + } +} + +extension Operations.GetMetadataRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "ratingKey": try ratingKeyWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/GetPlaylistContentsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetPlaylistContentsRequest+Serialization.swift new file mode 100644 index 0000000..9c7f2fa --- /dev/null +++ b/Sources/Plexswift/internal/models/GetPlaylistContentsRequest+Serialization.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetPlaylistContentsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetPlaylistContentsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetPlaylistContentsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} + +extension Operations.GetPlaylistContentsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: typeWrapper, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetPlaylistRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetPlaylistRequest+Serialization.swift new file mode 100644 index 0000000..5d87638 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetPlaylistRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetPlaylistRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetPlaylistRequest", format: format.formatDescription) + } + } +} + +extension Operations.GetPlaylistRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/GetPlaylistsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetPlaylistsRequest+Serialization.swift new file mode 100644 index 0000000..e3669a7 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetPlaylistsRequest+Serialization.swift @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetPlaylistsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetPlaylistsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetPlaylistsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: playlistType, named: "playlistType", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: smart, named: "smart", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetResizedPhotoRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetResizedPhotoRequest+Serialization.swift new file mode 100644 index 0000000..a5c1f1f --- /dev/null +++ b/Sources/Plexswift/internal/models/GetResizedPhotoRequest+Serialization.swift @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetResizedPhotoRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetResizedPhotoRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetResizedPhotoRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: blurWrapper, named: "blur", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: heightWrapper, named: "height", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: minSize, named: "minSize", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: opacity, named: "opacity", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: upscale, named: "upscale", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: url, named: "url", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: widthWrapper, named: "width", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetSearchResultsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetSearchResultsRequest+Serialization.swift new file mode 100644 index 0000000..36926c9 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetSearchResultsRequest+Serialization.swift @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetSearchResultsRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetSearchResultsRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetSearchResultsRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: query, named: "query", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetSourceConnectionInformationRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetSourceConnectionInformationRequest+Serialization.swift new file mode 100644 index 0000000..2e58a04 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetSourceConnectionInformationRequest+Serialization.swift @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetSourceConnectionInformationRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetSourceConnectionInformationRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetSourceConnectionInformationRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: source, named: "source", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetTimelineRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetTimelineRequest+Serialization.swift new file mode 100644 index 0000000..3558d05 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetTimelineRequest+Serialization.swift @@ -0,0 +1,36 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetTimelineRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetTimelineRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetTimelineRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: context, named: "context", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: durationWrapper, named: "duration", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: hasMDEWrapper, named: "hasMDE", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: key, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: playBackTimeWrapper, named: "playBackTime", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: playQueueItemIDWrapper, named: "playQueueItemID", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: ratingKeyWrapper, named: "ratingKey", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: rowWrapper, named: "row", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: state, named: "state", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: timeWrapper, named: "time", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/GetTransientTokenRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetTransientTokenRequest+Serialization.swift new file mode 100644 index 0000000..29ca8cd --- /dev/null +++ b/Sources/Plexswift/internal/models/GetTransientTokenRequest+Serialization.swift @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.GetTransientTokenRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetTransientTokenRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.GetTransientTokenRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: scope, named: "scope", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: type, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/IncludeDetails+Serialization.swift b/Sources/Plexswift/internal/models/IncludeDetails+Serialization.swift new file mode 100644 index 0000000..47565cb --- /dev/null +++ b/Sources/Plexswift/internal/models/IncludeDetails+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.IncludeDetails: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/Level+Serialization.swift b/Sources/Plexswift/internal/models/Level+Serialization.swift new file mode 100644 index 0000000..3d8ca8c --- /dev/null +++ b/Sources/Plexswift/internal/models/Level+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Level: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/LogLineRequest+Serialization.swift b/Sources/Plexswift/internal/models/LogLineRequest+Serialization.swift new file mode 100644 index 0000000..ad1ee47 --- /dev/null +++ b/Sources/Plexswift/internal/models/LogLineRequest+Serialization.swift @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.LogLineRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.LogLineRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.LogLineRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: level, named: "level", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: message, named: "message", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: source, named: "source", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/MarkPlayedRequest+Serialization.swift b/Sources/Plexswift/internal/models/MarkPlayedRequest+Serialization.swift new file mode 100644 index 0000000..d62a7d2 --- /dev/null +++ b/Sources/Plexswift/internal/models/MarkPlayedRequest+Serialization.swift @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.MarkPlayedRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.MarkPlayedRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.MarkPlayedRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: keyWrapper, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/MarkUnplayedRequest+Serialization.swift b/Sources/Plexswift/internal/models/MarkUnplayedRequest+Serialization.swift new file mode 100644 index 0000000..058d0ab --- /dev/null +++ b/Sources/Plexswift/internal/models/MarkUnplayedRequest+Serialization.swift @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.MarkUnplayedRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.MarkUnplayedRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.MarkUnplayedRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: keyWrapper, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/MinSize+Serialization.swift b/Sources/Plexswift/internal/models/MinSize+Serialization.swift new file mode 100644 index 0000000..5fbfa07 --- /dev/null +++ b/Sources/Plexswift/internal/models/MinSize+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.MinSize: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/OnlyTransient+Serialization.swift b/Sources/Plexswift/internal/models/OnlyTransient+Serialization.swift new file mode 100644 index 0000000..b2e3a6d --- /dev/null +++ b/Sources/Plexswift/internal/models/OnlyTransient+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.OnlyTransient: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/PathParamTaskName+Serialization.swift b/Sources/Plexswift/internal/models/PathParamTaskName+Serialization.swift new file mode 100644 index 0000000..58a0fe4 --- /dev/null +++ b/Sources/Plexswift/internal/models/PathParamTaskName+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.PathParamTaskName: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/PerformSearchRequest+Serialization.swift b/Sources/Plexswift/internal/models/PerformSearchRequest+Serialization.swift new file mode 100644 index 0000000..776412e --- /dev/null +++ b/Sources/Plexswift/internal/models/PerformSearchRequest+Serialization.swift @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.PerformSearchRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.PerformSearchRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.PerformSearchRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: query, named: "query", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if limit != nil { + try builder.addQueryParameters(from: limitWrapper, named: "limit", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + if sectionId != nil { + try builder.addQueryParameters(from: sectionIdWrapper, named: "sectionId", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/PerformVoiceSearchRequest+Serialization.swift b/Sources/Plexswift/internal/models/PerformVoiceSearchRequest+Serialization.swift new file mode 100644 index 0000000..3572928 --- /dev/null +++ b/Sources/Plexswift/internal/models/PerformVoiceSearchRequest+Serialization.swift @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.PerformVoiceSearchRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.PerformVoiceSearchRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.PerformVoiceSearchRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: query, named: "query", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if limit != nil { + try builder.addQueryParameters(from: limitWrapper, named: "limit", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + if sectionId != nil { + try builder.addQueryParameters(from: sectionIdWrapper, named: "sectionId", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/PlaylistType+Serialization.swift b/Sources/Plexswift/internal/models/PlaylistType+Serialization.swift new file mode 100644 index 0000000..73ba482 --- /dev/null +++ b/Sources/Plexswift/internal/models/PlaylistType+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.PlaylistType: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/QueryParamOnlyTransient+Serialization.swift b/Sources/Plexswift/internal/models/QueryParamOnlyTransient+Serialization.swift new file mode 100644 index 0000000..19d0840 --- /dev/null +++ b/Sources/Plexswift/internal/models/QueryParamOnlyTransient+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.QueryParamOnlyTransient: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/QueryParamSmart+Serialization.swift b/Sources/Plexswift/internal/models/QueryParamSmart+Serialization.swift new file mode 100644 index 0000000..fd65c5c --- /dev/null +++ b/Sources/Plexswift/internal/models/QueryParamSmart+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.QueryParamSmart: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/QueryParamType+Serialization.swift b/Sources/Plexswift/internal/models/QueryParamType+Serialization.swift new file mode 100644 index 0000000..b5fbf4c --- /dev/null +++ b/Sources/Plexswift/internal/models/QueryParamType+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.QueryParamType: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/RefreshLibraryRequest+Serialization.swift b/Sources/Plexswift/internal/models/RefreshLibraryRequest+Serialization.swift new file mode 100644 index 0000000..9d1a0de --- /dev/null +++ b/Sources/Plexswift/internal/models/RefreshLibraryRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.RefreshLibraryRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.RefreshLibraryRequest", format: format.formatDescription) + } + } +} + +extension Operations.RefreshLibraryRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/Scope+Serialization.swift b/Sources/Plexswift/internal/models/Scope+Serialization.swift new file mode 100644 index 0000000..97d3d18 --- /dev/null +++ b/Sources/Plexswift/internal/models/Scope+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Scope: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/Security+Serialization.swift b/Sources/Plexswift/internal/models/Security+Serialization.swift new file mode 100644 index 0000000..432a3e3 --- /dev/null +++ b/Sources/Plexswift/internal/models/Security+Serialization.swift @@ -0,0 +1,13 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Shared.Security: SecurityParameterProviding { + func securityParameters() -> [SecurityParameter] { + switch self { + case .accessToken(let value): + return [.apiKey(name: "X-Plex-Token", value: value)] + } + } +} diff --git a/Sources/Plexswift/internal/models/Skip+Serialization.swift b/Sources/Plexswift/internal/models/Skip+Serialization.swift new file mode 100644 index 0000000..908f34b --- /dev/null +++ b/Sources/Plexswift/internal/models/Skip+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Skip: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/Smart+Serialization.swift b/Sources/Plexswift/internal/models/Smart+Serialization.swift new file mode 100644 index 0000000..fc08986 --- /dev/null +++ b/Sources/Plexswift/internal/models/Smart+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Smart: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/StartTaskRequest+Serialization.swift b/Sources/Plexswift/internal/models/StartTaskRequest+Serialization.swift new file mode 100644 index 0000000..6d73658 --- /dev/null +++ b/Sources/Plexswift/internal/models/StartTaskRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.StartTaskRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.StartTaskRequest", format: format.formatDescription) + } + } +} + +extension Operations.StartTaskRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "taskName": try taskName.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/StartUniversalTranscodeRequest+Serialization.swift b/Sources/Plexswift/internal/models/StartUniversalTranscodeRequest+Serialization.swift new file mode 100644 index 0000000..4e05cf8 --- /dev/null +++ b/Sources/Plexswift/internal/models/StartUniversalTranscodeRequest+Serialization.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.StartUniversalTranscodeRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.StartUniversalTranscodeRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.StartUniversalTranscodeRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: hasMDEWrapper, named: "hasMDE", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: mediaIndexWrapper, named: "mediaIndex", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: partIndexWrapper, named: "partIndex", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: path, named: "path", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: `protocol`, named: "protocol", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if addDebugOverlay != nil { + try builder.addQueryParameters(from: addDebugOverlayWrapper, named: "addDebugOverlay", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + if audioBoost != nil { + try builder.addQueryParameters(from: audioBoostWrapper, named: "audioBoost", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + if autoAdjustQuality != nil { + try builder.addQueryParameters(from: autoAdjustQualityWrapper, named: "autoAdjustQuality", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + if directPlay != nil { + try builder.addQueryParameters(from: directPlayWrapper, named: "directPlay", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + if directStream != nil { + try builder.addQueryParameters(from: directStreamWrapper, named: "directStream", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + if fastSeek != nil { + try builder.addQueryParameters(from: fastSeekWrapper, named: "fastSeek", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + try builder.addQueryParameters(from: location, named: "location", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if mediaBufferSize != nil { + try builder.addQueryParameters(from: mediaBufferSizeWrapper, named: "mediaBufferSize", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + try builder.addQueryParameters(from: session, named: "session", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: subtites, named: "subtites", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + if subtitleSize != nil { + try builder.addQueryParameters(from: subtitleSizeWrapper, named: "subtitleSize", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + } + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/State+Serialization.swift b/Sources/Plexswift/internal/models/State+Serialization.swift new file mode 100644 index 0000000..193eab7 --- /dev/null +++ b/Sources/Plexswift/internal/models/State+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.State: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/StopTaskRequest+Serialization.swift b/Sources/Plexswift/internal/models/StopTaskRequest+Serialization.swift new file mode 100644 index 0000000..22d098e --- /dev/null +++ b/Sources/Plexswift/internal/models/StopTaskRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.StopTaskRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.StopTaskRequest", format: format.formatDescription) + } + } +} + +extension Operations.StopTaskRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "taskName": try taskName.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/StopTranscodeSessionRequest+Serialization.swift b/Sources/Plexswift/internal/models/StopTranscodeSessionRequest+Serialization.swift new file mode 100644 index 0000000..14d3e65 --- /dev/null +++ b/Sources/Plexswift/internal/models/StopTranscodeSessionRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.StopTranscodeSessionRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.StopTranscodeSessionRequest", format: format.formatDescription) + } + } +} + +extension Operations.StopTranscodeSessionRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sessionKey": try sessionKey.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/TaskName+Serialization.swift b/Sources/Plexswift/internal/models/TaskName+Serialization.swift new file mode 100644 index 0000000..e191cdc --- /dev/null +++ b/Sources/Plexswift/internal/models/TaskName+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.TaskName: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/Tonight+Serialization.swift b/Sources/Plexswift/internal/models/Tonight+Serialization.swift new file mode 100644 index 0000000..446dbd6 --- /dev/null +++ b/Sources/Plexswift/internal/models/Tonight+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Tonight: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/TypeModel+Serialization.swift b/Sources/Plexswift/internal/models/TypeModel+Serialization.swift new file mode 100644 index 0000000..ee1f54d --- /dev/null +++ b/Sources/Plexswift/internal/models/TypeModel+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.TypeModel: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/internal/models/UpdatePlayProgressRequest+Serialization.swift b/Sources/Plexswift/internal/models/UpdatePlayProgressRequest+Serialization.swift new file mode 100644 index 0000000..2c0eff0 --- /dev/null +++ b/Sources/Plexswift/internal/models/UpdatePlayProgressRequest+Serialization.swift @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.UpdatePlayProgressRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.UpdatePlayProgressRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.UpdatePlayProgressRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: key, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: state, named: "state", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: timeWrapper, named: "time", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/UpdatePlaylistRequest+Serialization.swift b/Sources/Plexswift/internal/models/UpdatePlaylistRequest+Serialization.swift new file mode 100644 index 0000000..90c6e7a --- /dev/null +++ b/Sources/Plexswift/internal/models/UpdatePlaylistRequest+Serialization.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.UpdatePlaylistRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .path: + return try serializePathParameterSerializable(self, with: format) + case .query, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.UpdatePlaylistRequest", format: format.formatDescription) + } + } +} + +extension Operations.UpdatePlaylistRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/UploadPlaylistRequest+Serialization.swift b/Sources/Plexswift/internal/models/UploadPlaylistRequest+Serialization.swift new file mode 100644 index 0000000..143439a --- /dev/null +++ b/Sources/Plexswift/internal/models/UploadPlaylistRequest+Serialization.swift @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.UploadPlaylistRequest: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + switch format { + case .query: + return try serializeQueryParameterSerializable(self, with: format) + case .path, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.UploadPlaylistRequest", format: format.formatDescription) + } + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try serializedQueryParameters(with: nil, formatOverride: format) + } +} + +extension Operations.UploadPlaylistRequest: QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] { + let builder = QueryParameterBuilder() + try builder.addQueryParameters(from: force, named: "force", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + try builder.addQueryParameters(from: path, named: "path", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults) + return builder.build() + } +} diff --git a/Sources/Plexswift/internal/models/Upscale+Serialization.swift b/Sources/Plexswift/internal/models/Upscale+Serialization.swift new file mode 100644 index 0000000..b3da9c1 --- /dev/null +++ b/Sources/Plexswift/internal/models/Upscale+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Upscale: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try rawValue.serialize(with: format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} diff --git a/Sources/Plexswift/models/ModelScopes.swift b/Sources/Plexswift/models/ModelScopes.swift new file mode 100644 index 0000000..17a84a2 --- /dev/null +++ b/Sources/Plexswift/models/ModelScopes.swift @@ -0,0 +1,13 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +/// Top-level type used for grouping operations models +/// +/// > Note: You do not need to interact with this type directly. +public enum Operations {} + +/// Top-level type used for grouping shared models +/// +/// > Note: You do not need to interact with this type directly. +public enum Shared {} diff --git a/Sources/Plexswift/models/operations/Activity.swift b/Sources/Plexswift/models/operations/Activity.swift new file mode 100644 index 0000000..32ef466 --- /dev/null +++ b/Sources/Plexswift/models/operations/Activity.swift @@ -0,0 +1,83 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Activity { + public let cancellable: Bool? + public let context: Operations.Context? + @DecimalSerialized + public private(set) var progress: Double? + public let subtitle: String? + public let title: String? + public let type: String? + @DecimalSerialized + public private(set) var userID: Double? + public let uuid: String? + + /// Creates an object with the specified parameters + /// + /// + public init(cancellable: Bool? = nil, context: Operations.Context? = nil, progress: Double? = nil, subtitle: String? = nil, title: String? = nil, type: String? = nil, userID: Double? = nil, uuid: String? = nil) { + self.cancellable = cancellable + self.context = context + self._progress = DecimalSerialized(wrappedValue: progress) + self.subtitle = subtitle + self.title = title + self.type = type + self._userID = DecimalSerialized(wrappedValue: userID) + self.uuid = uuid + } + } +} + +extension Operations.Activity: Codable { + enum CodingKeys: String, CodingKey { + case cancellable + case context = "Context" + case progress + case subtitle + case title + case type + case userID + case uuid + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.cancellable = try container.decodeIfPresent(Bool.self, forKey: .cancellable) + self.context = try container.decodeIfPresent(Operations.Context.self, forKey: .context) + self._progress = try container.decodeIfPresent(DecimalSerialized.self, forKey: .progress) ?? DecimalSerialized(wrappedValue: nil) + self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle) + self.title = try container.decodeIfPresent(String.self, forKey: .title) + self.type = try container.decodeIfPresent(String.self, forKey: .type) + self._userID = try container.decodeIfPresent(DecimalSerialized.self, forKey: .userID) ?? DecimalSerialized(wrappedValue: nil) + self.uuid = try container.decodeIfPresent(String.self, forKey: .uuid) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.cancellable, forKey: .cancellable) + try container.encodeIfPresent(self.context, forKey: .context) + if self.progress != nil { + try container.encode(self._progress, forKey: .progress) + } + try container.encodeIfPresent(self.subtitle, forKey: .subtitle) + try container.encodeIfPresent(self.title, forKey: .title) + try container.encodeIfPresent(self.type, forKey: .type) + if self.userID != nil { + try container.encode(self._userID, forKey: .userID) + } + try container.encodeIfPresent(self.uuid, forKey: .uuid) + } +} + +extension Operations.Activity { + var userIDWrapper: DecimalSerialized { + return _userID + } + var progressWrapper: DecimalSerialized { + return _progress + } +} diff --git a/Sources/Plexswift/models/operations/AddPlaylistContentsErrors.swift b/Sources/Plexswift/models/operations/AddPlaylistContentsErrors.swift new file mode 100644 index 0000000..6193c4c --- /dev/null +++ b/Sources/Plexswift/models/operations/AddPlaylistContentsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct AddPlaylistContentsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.AddPlaylistContentsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.AddPlaylistContentsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/AddPlaylistContentsRequest.swift b/Sources/Plexswift/models/operations/AddPlaylistContentsRequest.swift new file mode 100644 index 0000000..3ba4669 --- /dev/null +++ b/Sources/Plexswift/models/operations/AddPlaylistContentsRequest.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct AddPlaylistContentsRequest: APIValue { + /// the ID of the playlist + @DecimalSerialized + public private(set) var playlistID: Double + /// the play queue to add to a playlist + @DecimalSerialized + public private(set) var playQueueID: Double + /// the content URI for the playlist + public let uri: String + + /// Creates an object with the specified parameters + /// + /// - Parameter playlistID: the ID of the playlist + /// - Parameter playQueueID: the play queue to add to a playlist + /// - Parameter uri: the content URI for the playlist + /// + public init(playlistID: Double, playQueueID: Double, uri: String) { + self._playlistID = DecimalSerialized(wrappedValue: playlistID) + self._playQueueID = DecimalSerialized(wrappedValue: playQueueID) + self.uri = uri + } + } +} +extension Operations.AddPlaylistContentsRequest { + var playlistIDWrapper: DecimalSerialized { + return _playlistID + } + var playQueueIDWrapper: DecimalSerialized { + return _playQueueID + } +} diff --git a/Sources/Plexswift/models/operations/AddPlaylistContentsResponse.swift b/Sources/Plexswift/models/operations/AddPlaylistContentsResponse.swift new file mode 100644 index 0000000..980c2a8 --- /dev/null +++ b/Sources/Plexswift/models/operations/AddPlaylistContentsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum AddPlaylistContentsResponse { + case empty + case object(Operations.AddPlaylistContentsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.AddPlaylistContentsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/AddPlaylistContentsResponseBody.swift b/Sources/Plexswift/models/operations/AddPlaylistContentsResponseBody.swift new file mode 100644 index 0000000..687b409 --- /dev/null +++ b/Sources/Plexswift/models/operations/AddPlaylistContentsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct AddPlaylistContentsResponseBody { + public let errors: [Operations.AddPlaylistContentsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.AddPlaylistContentsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.AddPlaylistContentsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/ApplyUpdatesErrors.swift b/Sources/Plexswift/models/operations/ApplyUpdatesErrors.swift new file mode 100644 index 0000000..0e19064 --- /dev/null +++ b/Sources/Plexswift/models/operations/ApplyUpdatesErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct ApplyUpdatesErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.ApplyUpdatesErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.ApplyUpdatesErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/ApplyUpdatesRequest.swift b/Sources/Plexswift/models/operations/ApplyUpdatesRequest.swift new file mode 100644 index 0000000..4fb8af9 --- /dev/null +++ b/Sources/Plexswift/models/operations/ApplyUpdatesRequest.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct ApplyUpdatesRequest: APIValue { + /// Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. + public let skip: Operations.Skip? + /// Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install + public let tonight: Operations.Tonight? + + /// Creates an object with the specified parameters + /// + /// - Parameter skip: Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. + /// - Parameter tonight: Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install + /// + public init(skip: Operations.Skip? = nil, tonight: Operations.Tonight? = nil) { + self.skip = skip + self.tonight = tonight + } + } +} diff --git a/Sources/Plexswift/models/operations/ApplyUpdatesResponse.swift b/Sources/Plexswift/models/operations/ApplyUpdatesResponse.swift new file mode 100644 index 0000000..1bde175 --- /dev/null +++ b/Sources/Plexswift/models/operations/ApplyUpdatesResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum ApplyUpdatesResponse { + case empty + case object(Operations.ApplyUpdatesResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.ApplyUpdatesResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/ApplyUpdatesResponseBody.swift b/Sources/Plexswift/models/operations/ApplyUpdatesResponseBody.swift new file mode 100644 index 0000000..a4e84c5 --- /dev/null +++ b/Sources/Plexswift/models/operations/ApplyUpdatesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct ApplyUpdatesResponseBody { + public let errors: [Operations.ApplyUpdatesErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.ApplyUpdatesErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.ApplyUpdatesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/ButlerTask.swift b/Sources/Plexswift/models/operations/ButlerTask.swift new file mode 100644 index 0000000..307829b --- /dev/null +++ b/Sources/Plexswift/models/operations/ButlerTask.swift @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct ButlerTask { + public let description: String? + public let enabled: Bool? + @DecimalSerialized + public private(set) var interval: Double? + public let name: String? + public let scheduleRandomized: Bool? + public let title: String? + + /// Creates an object with the specified parameters + /// + /// + public init(description: String? = nil, enabled: Bool? = nil, interval: Double? = nil, name: String? = nil, scheduleRandomized: Bool? = nil, title: String? = nil) { + self.description = description + self.enabled = enabled + self._interval = DecimalSerialized(wrappedValue: interval) + self.name = name + self.scheduleRandomized = scheduleRandomized + self.title = title + } + } +} + +extension Operations.ButlerTask: Codable { + enum CodingKeys: String, CodingKey { + case description + case enabled + case interval + case name + case scheduleRandomized + case title + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.description = try container.decodeIfPresent(String.self, forKey: .description) + self.enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) + self._interval = try container.decodeIfPresent(DecimalSerialized.self, forKey: .interval) ?? DecimalSerialized(wrappedValue: nil) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.scheduleRandomized = try container.decodeIfPresent(Bool.self, forKey: .scheduleRandomized) + self.title = try container.decodeIfPresent(String.self, forKey: .title) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.description, forKey: .description) + try container.encodeIfPresent(self.enabled, forKey: .enabled) + if self.interval != nil { + try container.encode(self._interval, forKey: .interval) + } + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.scheduleRandomized, forKey: .scheduleRandomized) + try container.encodeIfPresent(self.title, forKey: .title) + } +} + +extension Operations.ButlerTask { + var intervalWrapper: DecimalSerialized { + return _interval + } +} diff --git a/Sources/Plexswift/models/operations/ButlerTasks.swift b/Sources/Plexswift/models/operations/ButlerTasks.swift new file mode 100644 index 0000000..8b0628b --- /dev/null +++ b/Sources/Plexswift/models/operations/ButlerTasks.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct ButlerTasks { + public let butlerTask: [Operations.ButlerTask]? + + /// Creates an object with the specified parameters + /// + /// + public init(butlerTask: [Operations.ButlerTask]? = nil) { + self.butlerTask = butlerTask + } + } +} + +extension Operations.ButlerTasks: Codable { + enum CodingKeys: String, CodingKey { + case butlerTask = "ButlerTask" + } +} + diff --git a/Sources/Plexswift/models/operations/CancelServerActivitiesErrors.swift b/Sources/Plexswift/models/operations/CancelServerActivitiesErrors.swift new file mode 100644 index 0000000..986b1b8 --- /dev/null +++ b/Sources/Plexswift/models/operations/CancelServerActivitiesErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct CancelServerActivitiesErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.CancelServerActivitiesErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.CancelServerActivitiesErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/CancelServerActivitiesRequest.swift b/Sources/Plexswift/models/operations/CancelServerActivitiesRequest.swift new file mode 100644 index 0000000..aafd1e2 --- /dev/null +++ b/Sources/Plexswift/models/operations/CancelServerActivitiesRequest.swift @@ -0,0 +1,19 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct CancelServerActivitiesRequest: APIValue { + /// The UUID of the activity to cancel. + public let activityUUID: String + + /// Creates an object with the specified parameters + /// + /// - Parameter activityUUID: The UUID of the activity to cancel. + /// + public init(activityUUID: String) { + self.activityUUID = activityUUID + } + } +} diff --git a/Sources/Plexswift/models/operations/CancelServerActivitiesResponse.swift b/Sources/Plexswift/models/operations/CancelServerActivitiesResponse.swift new file mode 100644 index 0000000..a58ea73 --- /dev/null +++ b/Sources/Plexswift/models/operations/CancelServerActivitiesResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum CancelServerActivitiesResponse { + case empty + case object(Operations.CancelServerActivitiesResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.CancelServerActivitiesResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/CancelServerActivitiesResponseBody.swift b/Sources/Plexswift/models/operations/CancelServerActivitiesResponseBody.swift new file mode 100644 index 0000000..e3965cb --- /dev/null +++ b/Sources/Plexswift/models/operations/CancelServerActivitiesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct CancelServerActivitiesResponseBody { + public let errors: [Operations.CancelServerActivitiesErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.CancelServerActivitiesErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.CancelServerActivitiesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/CheckForUpdatesErrors.swift b/Sources/Plexswift/models/operations/CheckForUpdatesErrors.swift new file mode 100644 index 0000000..567c5cd --- /dev/null +++ b/Sources/Plexswift/models/operations/CheckForUpdatesErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct CheckForUpdatesErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.CheckForUpdatesErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.CheckForUpdatesErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/CheckForUpdatesRequest.swift b/Sources/Plexswift/models/operations/CheckForUpdatesRequest.swift new file mode 100644 index 0000000..26099c5 --- /dev/null +++ b/Sources/Plexswift/models/operations/CheckForUpdatesRequest.swift @@ -0,0 +1,19 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct CheckForUpdatesRequest: APIValue { + /// Indicate that you want to start download any updates found. + public let download: Operations.Download? + + /// Creates an object with the specified parameters + /// + /// - Parameter download: Indicate that you want to start download any updates found. + /// + public init(download: Operations.Download? = nil) { + self.download = download + } + } +} diff --git a/Sources/Plexswift/models/operations/CheckForUpdatesResponse.swift b/Sources/Plexswift/models/operations/CheckForUpdatesResponse.swift new file mode 100644 index 0000000..88aaf44 --- /dev/null +++ b/Sources/Plexswift/models/operations/CheckForUpdatesResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum CheckForUpdatesResponse { + case empty + case object(Operations.CheckForUpdatesResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.CheckForUpdatesResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/CheckForUpdatesResponseBody.swift b/Sources/Plexswift/models/operations/CheckForUpdatesResponseBody.swift new file mode 100644 index 0000000..7d7076e --- /dev/null +++ b/Sources/Plexswift/models/operations/CheckForUpdatesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct CheckForUpdatesResponseBody { + public let errors: [Operations.CheckForUpdatesErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.CheckForUpdatesErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.CheckForUpdatesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/ClearPlaylistContentsErrors.swift b/Sources/Plexswift/models/operations/ClearPlaylistContentsErrors.swift new file mode 100644 index 0000000..5d2a9c6 --- /dev/null +++ b/Sources/Plexswift/models/operations/ClearPlaylistContentsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct ClearPlaylistContentsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.ClearPlaylistContentsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.ClearPlaylistContentsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/ClearPlaylistContentsRequest.swift b/Sources/Plexswift/models/operations/ClearPlaylistContentsRequest.swift new file mode 100644 index 0000000..36024da --- /dev/null +++ b/Sources/Plexswift/models/operations/ClearPlaylistContentsRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct ClearPlaylistContentsRequest: APIValue { + /// the ID of the playlist + @DecimalSerialized + public private(set) var playlistID: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter playlistID: the ID of the playlist + /// + public init(playlistID: Double) { + self._playlistID = DecimalSerialized(wrappedValue: playlistID) + } + } +} +extension Operations.ClearPlaylistContentsRequest { + var playlistIDWrapper: DecimalSerialized { + return _playlistID + } +} diff --git a/Sources/Plexswift/models/operations/ClearPlaylistContentsResponse.swift b/Sources/Plexswift/models/operations/ClearPlaylistContentsResponse.swift new file mode 100644 index 0000000..4ff7584 --- /dev/null +++ b/Sources/Plexswift/models/operations/ClearPlaylistContentsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum ClearPlaylistContentsResponse { + case empty + case object(Operations.ClearPlaylistContentsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.ClearPlaylistContentsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/ClearPlaylistContentsResponseBody.swift b/Sources/Plexswift/models/operations/ClearPlaylistContentsResponseBody.swift new file mode 100644 index 0000000..0541233 --- /dev/null +++ b/Sources/Plexswift/models/operations/ClearPlaylistContentsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct ClearPlaylistContentsResponseBody { + public let errors: [Operations.ClearPlaylistContentsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.ClearPlaylistContentsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.ClearPlaylistContentsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/Context.swift b/Sources/Plexswift/models/operations/Context.swift new file mode 100644 index 0000000..afda430 --- /dev/null +++ b/Sources/Plexswift/models/operations/Context.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Context { + public let librarySectionID: String? + + /// Creates an object with the specified parameters + /// + /// + public init(librarySectionID: String? = nil) { + self.librarySectionID = librarySectionID + } + } +} + +extension Operations.Context: Codable { + enum CodingKeys: String, CodingKey { + case librarySectionID + } +} + diff --git a/Sources/Plexswift/models/operations/Country.swift b/Sources/Plexswift/models/operations/Country.swift new file mode 100644 index 0000000..c1c9262 --- /dev/null +++ b/Sources/Plexswift/models/operations/Country.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Country { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.Country: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/CreatePlaylistErrors.swift b/Sources/Plexswift/models/operations/CreatePlaylistErrors.swift new file mode 100644 index 0000000..10da4d8 --- /dev/null +++ b/Sources/Plexswift/models/operations/CreatePlaylistErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct CreatePlaylistErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.CreatePlaylistErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.CreatePlaylistErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/CreatePlaylistRequest.swift b/Sources/Plexswift/models/operations/CreatePlaylistRequest.swift new file mode 100644 index 0000000..42f7f3c --- /dev/null +++ b/Sources/Plexswift/models/operations/CreatePlaylistRequest.swift @@ -0,0 +1,41 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct CreatePlaylistRequest: APIValue { + /// whether the playlist is smart or not + public let smart: Operations.Smart + /// name of the playlist + public let title: String + /// type of playlist to create + public let type: Operations.TypeModel + /// the play queue to copy to a playlist + @DecimalSerialized + public private(set) var playQueueID: Double? + /// the content URI for the playlist + public let uri: String? + + /// Creates an object with the specified parameters + /// + /// - Parameter smart: whether the playlist is smart or not + /// - Parameter title: name of the playlist + /// - Parameter type: type of playlist to create + /// - Parameter playQueueID: the play queue to copy to a playlist + /// - Parameter uri: the content URI for the playlist + /// + public init(smart: Operations.Smart, title: String, type: Operations.TypeModel, playQueueID: Double? = nil, uri: String? = nil) { + self.smart = smart + self.title = title + self.type = type + self._playQueueID = DecimalSerialized(wrappedValue: playQueueID) + self.uri = uri + } + } +} +extension Operations.CreatePlaylistRequest { + var playQueueIDWrapper: DecimalSerialized { + return _playQueueID + } +} diff --git a/Sources/Plexswift/models/operations/CreatePlaylistResponse.swift b/Sources/Plexswift/models/operations/CreatePlaylistResponse.swift new file mode 100644 index 0000000..2282e6a --- /dev/null +++ b/Sources/Plexswift/models/operations/CreatePlaylistResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum CreatePlaylistResponse { + case empty + case object(Operations.CreatePlaylistResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.CreatePlaylistResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/CreatePlaylistResponseBody.swift b/Sources/Plexswift/models/operations/CreatePlaylistResponseBody.swift new file mode 100644 index 0000000..f83cdfe --- /dev/null +++ b/Sources/Plexswift/models/operations/CreatePlaylistResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct CreatePlaylistResponseBody { + public let errors: [Operations.CreatePlaylistErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.CreatePlaylistErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.CreatePlaylistResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/DeleteLibraryErrors.swift b/Sources/Plexswift/models/operations/DeleteLibraryErrors.swift new file mode 100644 index 0000000..837de55 --- /dev/null +++ b/Sources/Plexswift/models/operations/DeleteLibraryErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct DeleteLibraryErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.DeleteLibraryErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.DeleteLibraryErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/DeleteLibraryRequest.swift b/Sources/Plexswift/models/operations/DeleteLibraryRequest.swift new file mode 100644 index 0000000..2dd3589 --- /dev/null +++ b/Sources/Plexswift/models/operations/DeleteLibraryRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct DeleteLibraryRequest: APIValue { + /// the Id of the library to query + @DecimalSerialized + public private(set) var sectionId: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to query + /// + public init(sectionId: Double) { + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + } + } +} +extension Operations.DeleteLibraryRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } +} diff --git a/Sources/Plexswift/models/operations/DeleteLibraryResponse.swift b/Sources/Plexswift/models/operations/DeleteLibraryResponse.swift new file mode 100644 index 0000000..aca4a6c --- /dev/null +++ b/Sources/Plexswift/models/operations/DeleteLibraryResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum DeleteLibraryResponse { + case empty + case object(Operations.DeleteLibraryResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.DeleteLibraryResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/DeleteLibraryResponseBody.swift b/Sources/Plexswift/models/operations/DeleteLibraryResponseBody.swift new file mode 100644 index 0000000..1c750c6 --- /dev/null +++ b/Sources/Plexswift/models/operations/DeleteLibraryResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct DeleteLibraryResponseBody { + public let errors: [Operations.DeleteLibraryErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.DeleteLibraryErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.DeleteLibraryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/DeletePlaylistErrors.swift b/Sources/Plexswift/models/operations/DeletePlaylistErrors.swift new file mode 100644 index 0000000..c85aed2 --- /dev/null +++ b/Sources/Plexswift/models/operations/DeletePlaylistErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct DeletePlaylistErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.DeletePlaylistErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.DeletePlaylistErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/DeletePlaylistRequest.swift b/Sources/Plexswift/models/operations/DeletePlaylistRequest.swift new file mode 100644 index 0000000..163bce4 --- /dev/null +++ b/Sources/Plexswift/models/operations/DeletePlaylistRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct DeletePlaylistRequest: APIValue { + /// the ID of the playlist + @DecimalSerialized + public private(set) var playlistID: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter playlistID: the ID of the playlist + /// + public init(playlistID: Double) { + self._playlistID = DecimalSerialized(wrappedValue: playlistID) + } + } +} +extension Operations.DeletePlaylistRequest { + var playlistIDWrapper: DecimalSerialized { + return _playlistID + } +} diff --git a/Sources/Plexswift/models/operations/DeletePlaylistResponse.swift b/Sources/Plexswift/models/operations/DeletePlaylistResponse.swift new file mode 100644 index 0000000..91a5198 --- /dev/null +++ b/Sources/Plexswift/models/operations/DeletePlaylistResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum DeletePlaylistResponse { + case empty + case object(Operations.DeletePlaylistResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.DeletePlaylistResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/DeletePlaylistResponseBody.swift b/Sources/Plexswift/models/operations/DeletePlaylistResponseBody.swift new file mode 100644 index 0000000..585ea7d --- /dev/null +++ b/Sources/Plexswift/models/operations/DeletePlaylistResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct DeletePlaylistResponseBody { + public let errors: [Operations.DeletePlaylistErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.DeletePlaylistErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.DeletePlaylistResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/Device.swift b/Sources/Plexswift/models/operations/Device.swift new file mode 100644 index 0000000..fc25e0b --- /dev/null +++ b/Sources/Plexswift/models/operations/Device.swift @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Device { + public let clientIdentifier: String? + @DecimalSerialized + public private(set) var createdAt: Double? + @DecimalSerialized + public private(set) var id: Double? + public let name: String? + public let platform: String? + + /// Creates an object with the specified parameters + /// + /// + public init(clientIdentifier: String? = nil, createdAt: Double? = nil, id: Double? = nil, name: String? = nil, platform: String? = nil) { + self.clientIdentifier = clientIdentifier + self._createdAt = DecimalSerialized(wrappedValue: createdAt) + self._id = DecimalSerialized(wrappedValue: id) + self.name = name + self.platform = platform + } + } +} + +extension Operations.Device: Codable { + enum CodingKeys: String, CodingKey { + case clientIdentifier + case createdAt + case id + case name + case platform + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.clientIdentifier = try container.decodeIfPresent(String.self, forKey: .clientIdentifier) + self._createdAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .createdAt) ?? DecimalSerialized(wrappedValue: nil) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self.platform = try container.decodeIfPresent(String.self, forKey: .platform) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.clientIdentifier, forKey: .clientIdentifier) + if self.createdAt != nil { + try container.encode(self._createdAt, forKey: .createdAt) + } + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + try container.encodeIfPresent(self.name, forKey: .name) + try container.encodeIfPresent(self.platform, forKey: .platform) + } +} + +extension Operations.Device { + var idWrapper: DecimalSerialized { + return _id + } + var createdAtWrapper: DecimalSerialized { + return _createdAt + } +} diff --git a/Sources/Plexswift/models/operations/Director.swift b/Sources/Plexswift/models/operations/Director.swift new file mode 100644 index 0000000..b60d46e --- /dev/null +++ b/Sources/Plexswift/models/operations/Director.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Director { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.Director: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/Directory.swift b/Sources/Plexswift/models/operations/Directory.swift new file mode 100644 index 0000000..11a6224 --- /dev/null +++ b/Sources/Plexswift/models/operations/Directory.swift @@ -0,0 +1,52 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Directory { + @DecimalSerialized + public private(set) var count: Double? + public let key: String? + public let title: String? + + /// Creates an object with the specified parameters + /// + /// + public init(count: Double? = nil, key: String? = nil, title: String? = nil) { + self._count = DecimalSerialized(wrappedValue: count) + self.key = key + self.title = title + } + } +} + +extension Operations.Directory: Codable { + enum CodingKeys: String, CodingKey { + case count + case key + case title + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._count = try container.decodeIfPresent(DecimalSerialized.self, forKey: .count) ?? DecimalSerialized(wrappedValue: nil) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self.title = try container.decodeIfPresent(String.self, forKey: .title) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.count != nil { + try container.encode(self._count, forKey: .count) + } + try container.encodeIfPresent(self.key, forKey: .key) + try container.encodeIfPresent(self.title, forKey: .title) + } +} + +extension Operations.Directory { + var countWrapper: DecimalSerialized { + return _count + } +} diff --git a/Sources/Plexswift/models/operations/Download.swift b/Sources/Plexswift/models/operations/Download.swift new file mode 100644 index 0000000..0447c4d --- /dev/null +++ b/Sources/Plexswift/models/operations/Download.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Indicate that you want to start download any updates found. + public enum Download: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/EnablePaperTrailErrors.swift b/Sources/Plexswift/models/operations/EnablePaperTrailErrors.swift new file mode 100644 index 0000000..eaf0884 --- /dev/null +++ b/Sources/Plexswift/models/operations/EnablePaperTrailErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct EnablePaperTrailErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.EnablePaperTrailErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.EnablePaperTrailErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/EnablePaperTrailResponse.swift b/Sources/Plexswift/models/operations/EnablePaperTrailResponse.swift new file mode 100644 index 0000000..10786cc --- /dev/null +++ b/Sources/Plexswift/models/operations/EnablePaperTrailResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum EnablePaperTrailResponse { + case empty + case object(Operations.EnablePaperTrailResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.EnablePaperTrailResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/EnablePaperTrailResponseBody.swift b/Sources/Plexswift/models/operations/EnablePaperTrailResponseBody.swift new file mode 100644 index 0000000..829bf57 --- /dev/null +++ b/Sources/Plexswift/models/operations/EnablePaperTrailResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct EnablePaperTrailResponseBody { + public let errors: [Operations.EnablePaperTrailErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.EnablePaperTrailErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.EnablePaperTrailResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/Errors.swift b/Sources/Plexswift/models/operations/Errors.swift new file mode 100644 index 0000000..d96b5bd --- /dev/null +++ b/Sources/Plexswift/models/operations/Errors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Errors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.Errors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.Errors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/Force.swift b/Sources/Plexswift/models/operations/Force.swift new file mode 100644 index 0000000..4cd0672 --- /dev/null +++ b/Sources/Plexswift/models/operations/Force.swift @@ -0,0 +1,13 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// force overwriting of duplicate playlists. By default, a playlist file uploaded with the same path will overwrite the existing playlist. + /// The `force` argument is used to disable overwriting. If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. + /// + public enum Force: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/Genre.swift b/Sources/Plexswift/models/operations/Genre.swift new file mode 100644 index 0000000..2f1afe5 --- /dev/null +++ b/Sources/Plexswift/models/operations/Genre.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Genre { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.Genre: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetAvailableClientsErrors.swift b/Sources/Plexswift/models/operations/GetAvailableClientsErrors.swift new file mode 100644 index 0000000..bad8616 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetAvailableClientsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetAvailableClientsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetAvailableClientsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetAvailableClientsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetAvailableClientsMediaContainer.swift b/Sources/Plexswift/models/operations/GetAvailableClientsMediaContainer.swift new file mode 100644 index 0000000..bdd448e --- /dev/null +++ b/Sources/Plexswift/models/operations/GetAvailableClientsMediaContainer.swift @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetAvailableClientsMediaContainer { + public let server: [Operations.Server]? + @DecimalSerialized + public private(set) var size: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(server: [Operations.Server]? = nil, size: Double? = nil) { + self.server = server + self._size = DecimalSerialized(wrappedValue: size) + } + } +} + +extension Operations.GetAvailableClientsMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case server = "Server" + case size + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.server = try container.decodeIfPresent([Operations.Server].self, forKey: .server) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.server, forKey: .server) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + } +} + +extension Operations.GetAvailableClientsMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetAvailableClientsResponse.swift b/Sources/Plexswift/models/operations/GetAvailableClientsResponse.swift new file mode 100644 index 0000000..b97ec0f --- /dev/null +++ b/Sources/Plexswift/models/operations/GetAvailableClientsResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetAvailableClientsResponse { + case empty + case object(Operations.GetAvailableClientsResponseBody) + case responseBodies([Operations.ResponseBody]) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetAvailableClientsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func responseBodies() throws -> [Operations.ResponseBody] { + guard case .responseBodies(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetAvailableClientsResponseBody.swift b/Sources/Plexswift/models/operations/GetAvailableClientsResponseBody.swift new file mode 100644 index 0000000..d0cd22d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetAvailableClientsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetAvailableClientsResponseBody { + public let errors: [Operations.GetAvailableClientsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetAvailableClientsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetAvailableClientsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetButlerTasksButlerResponseBody.swift b/Sources/Plexswift/models/operations/GetButlerTasksButlerResponseBody.swift new file mode 100644 index 0000000..f4df845 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetButlerTasksButlerResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetButlerTasksButlerResponseBody { + public let errors: [Operations.GetButlerTasksErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetButlerTasksErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetButlerTasksButlerResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetButlerTasksErrors.swift b/Sources/Plexswift/models/operations/GetButlerTasksErrors.swift new file mode 100644 index 0000000..47401fd --- /dev/null +++ b/Sources/Plexswift/models/operations/GetButlerTasksErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetButlerTasksErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetButlerTasksErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetButlerTasksErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetButlerTasksResponse.swift b/Sources/Plexswift/models/operations/GetButlerTasksResponse.swift new file mode 100644 index 0000000..f9136ca --- /dev/null +++ b/Sources/Plexswift/models/operations/GetButlerTasksResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetButlerTasksResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetButlerTasksResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetButlerTasksButlerResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetButlerTasksResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetButlerTasksButlerResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetButlerTasksResponseBody.swift b/Sources/Plexswift/models/operations/GetButlerTasksResponseBody.swift new file mode 100644 index 0000000..42320c3 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetButlerTasksResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// All butler tasks + public struct GetButlerTasksResponseBody { + public let butlerTasks: Operations.ButlerTasks? + + /// Creates an object with the specified parameters + /// + /// + public init(butlerTasks: Operations.ButlerTasks? = nil) { + self.butlerTasks = butlerTasks + } + } +} + +extension Operations.GetButlerTasksResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case butlerTasks = "ButlerTasks" + } +} + diff --git a/Sources/Plexswift/models/operations/GetCommonLibraryItemsErrors.swift b/Sources/Plexswift/models/operations/GetCommonLibraryItemsErrors.swift new file mode 100644 index 0000000..e417fcb --- /dev/null +++ b/Sources/Plexswift/models/operations/GetCommonLibraryItemsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetCommonLibraryItemsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetCommonLibraryItemsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetCommonLibraryItemsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetCommonLibraryItemsRequest.swift b/Sources/Plexswift/models/operations/GetCommonLibraryItemsRequest.swift new file mode 100644 index 0000000..cce9c9f --- /dev/null +++ b/Sources/Plexswift/models/operations/GetCommonLibraryItemsRequest.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetCommonLibraryItemsRequest: APIValue { + /// the Id of the library to query + @DecimalSerialized + public private(set) var sectionId: Double + /// item type + @DecimalSerialized + public private(set) var type: Double + /// the filter parameter + public let filter: String? + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to query + /// - Parameter type: item type + /// - Parameter filter: the filter parameter + /// + public init(sectionId: Double, type: Double, filter: String? = nil) { + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + self._type = DecimalSerialized(wrappedValue: type) + self.filter = filter + } + } +} +extension Operations.GetCommonLibraryItemsRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } + var typeWrapper: DecimalSerialized { + return _type + } +} diff --git a/Sources/Plexswift/models/operations/GetCommonLibraryItemsResponse.swift b/Sources/Plexswift/models/operations/GetCommonLibraryItemsResponse.swift new file mode 100644 index 0000000..d14ddb5 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetCommonLibraryItemsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetCommonLibraryItemsResponse { + case empty + case object(Operations.GetCommonLibraryItemsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetCommonLibraryItemsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetCommonLibraryItemsResponseBody.swift b/Sources/Plexswift/models/operations/GetCommonLibraryItemsResponseBody.swift new file mode 100644 index 0000000..7209c87 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetCommonLibraryItemsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetCommonLibraryItemsResponseBody { + public let errors: [Operations.GetCommonLibraryItemsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetCommonLibraryItemsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetCommonLibraryItemsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetDevicesErrors.swift b/Sources/Plexswift/models/operations/GetDevicesErrors.swift new file mode 100644 index 0000000..84fbc59 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetDevicesErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetDevicesErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetDevicesErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetDevicesErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetDevicesMediaContainer.swift b/Sources/Plexswift/models/operations/GetDevicesMediaContainer.swift new file mode 100644 index 0000000..d08deb4 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetDevicesMediaContainer.swift @@ -0,0 +1,52 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetDevicesMediaContainer { + public let device: [Operations.Device]? + public let identifier: String? + @DecimalSerialized + public private(set) var size: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(device: [Operations.Device]? = nil, identifier: String? = nil, size: Double? = nil) { + self.device = device + self.identifier = identifier + self._size = DecimalSerialized(wrappedValue: size) + } + } +} + +extension Operations.GetDevicesMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case device = "Device" + case identifier + case size + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.device = try container.decodeIfPresent([Operations.Device].self, forKey: .device) + self.identifier = try container.decodeIfPresent(String.self, forKey: .identifier) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.device, forKey: .device) + try container.encodeIfPresent(self.identifier, forKey: .identifier) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + } +} + +extension Operations.GetDevicesMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetDevicesResponse.swift b/Sources/Plexswift/models/operations/GetDevicesResponse.swift new file mode 100644 index 0000000..5245aa3 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetDevicesResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetDevicesResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetDevicesResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetDevicesServerResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetDevicesResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetDevicesServerResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetDevicesResponseBody.swift b/Sources/Plexswift/models/operations/GetDevicesResponseBody.swift new file mode 100644 index 0000000..ffd1c26 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetDevicesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Devices + public struct GetDevicesResponseBody { + public let mediaContainer: Operations.GetDevicesMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetDevicesMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetDevicesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetDevicesServerResponseBody.swift b/Sources/Plexswift/models/operations/GetDevicesServerResponseBody.swift new file mode 100644 index 0000000..861eb37 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetDevicesServerResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetDevicesServerResponseBody { + public let errors: [Operations.GetDevicesErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetDevicesErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetDevicesServerResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetFileHashErrors.swift b/Sources/Plexswift/models/operations/GetFileHashErrors.swift new file mode 100644 index 0000000..1c7d6f0 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetFileHashErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetFileHashErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetFileHashErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetFileHashErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetFileHashRequest.swift b/Sources/Plexswift/models/operations/GetFileHashRequest.swift new file mode 100644 index 0000000..43d3042 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetFileHashRequest.swift @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetFileHashRequest: APIValue { + /// This is the path to the local file, must be prefixed by `file://` + public let url: String + /// Item type + @DecimalSerialized + public private(set) var type: Double? + + /// Creates an object with the specified parameters + /// + /// - Parameter url: This is the path to the local file, must be prefixed by `file://` + /// - Parameter type: Item type + /// + public init(url: String, type: Double? = nil) { + self.url = url + self._type = DecimalSerialized(wrappedValue: type) + } + } +} +extension Operations.GetFileHashRequest { + var typeWrapper: DecimalSerialized { + return _type + } +} diff --git a/Sources/Plexswift/models/operations/GetFileHashResponse.swift b/Sources/Plexswift/models/operations/GetFileHashResponse.swift new file mode 100644 index 0000000..5bbb24d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetFileHashResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetFileHashResponse { + case empty + case object(Operations.GetFileHashResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetFileHashResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetFileHashResponseBody.swift b/Sources/Plexswift/models/operations/GetFileHashResponseBody.swift new file mode 100644 index 0000000..c53bb93 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetFileHashResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetFileHashResponseBody { + public let errors: [Operations.GetFileHashErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetFileHashErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetFileHashResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetGlobalHubsErrors.swift b/Sources/Plexswift/models/operations/GetGlobalHubsErrors.swift new file mode 100644 index 0000000..cca3898 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetGlobalHubsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetGlobalHubsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetGlobalHubsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetGlobalHubsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetGlobalHubsRequest.swift b/Sources/Plexswift/models/operations/GetGlobalHubsRequest.swift new file mode 100644 index 0000000..949ca40 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetGlobalHubsRequest.swift @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetGlobalHubsRequest: APIValue { + /// The number of items to return with each hub. + @DecimalSerialized + public private(set) var count: Double? + /// Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). + public let onlyTransient: Operations.OnlyTransient? + + /// Creates an object with the specified parameters + /// + /// - Parameter count: The number of items to return with each hub. + /// - Parameter onlyTransient: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). + /// + public init(count: Double? = nil, onlyTransient: Operations.OnlyTransient? = nil) { + self._count = DecimalSerialized(wrappedValue: count) + self.onlyTransient = onlyTransient + } + } +} +extension Operations.GetGlobalHubsRequest { + var countWrapper: DecimalSerialized { + return _count + } +} diff --git a/Sources/Plexswift/models/operations/GetGlobalHubsResponse.swift b/Sources/Plexswift/models/operations/GetGlobalHubsResponse.swift new file mode 100644 index 0000000..fde422d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetGlobalHubsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetGlobalHubsResponse { + case empty + case object(Operations.GetGlobalHubsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetGlobalHubsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetGlobalHubsResponseBody.swift b/Sources/Plexswift/models/operations/GetGlobalHubsResponseBody.swift new file mode 100644 index 0000000..d6f7db6 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetGlobalHubsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetGlobalHubsResponseBody { + public let errors: [Operations.GetGlobalHubsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetGlobalHubsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetGlobalHubsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetLatestLibraryItemsErrors.swift b/Sources/Plexswift/models/operations/GetLatestLibraryItemsErrors.swift new file mode 100644 index 0000000..8021b9d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLatestLibraryItemsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLatestLibraryItemsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetLatestLibraryItemsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetLatestLibraryItemsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetLatestLibraryItemsRequest.swift b/Sources/Plexswift/models/operations/GetLatestLibraryItemsRequest.swift new file mode 100644 index 0000000..d7f6186 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLatestLibraryItemsRequest.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLatestLibraryItemsRequest: APIValue { + /// the Id of the library to query + @DecimalSerialized + public private(set) var sectionId: Double + /// item type + @DecimalSerialized + public private(set) var type: Double + /// the filter parameter + public let filter: String? + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to query + /// - Parameter type: item type + /// - Parameter filter: the filter parameter + /// + public init(sectionId: Double, type: Double, filter: String? = nil) { + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + self._type = DecimalSerialized(wrappedValue: type) + self.filter = filter + } + } +} +extension Operations.GetLatestLibraryItemsRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } + var typeWrapper: DecimalSerialized { + return _type + } +} diff --git a/Sources/Plexswift/models/operations/GetLatestLibraryItemsResponse.swift b/Sources/Plexswift/models/operations/GetLatestLibraryItemsResponse.swift new file mode 100644 index 0000000..cd33e2a --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLatestLibraryItemsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetLatestLibraryItemsResponse { + case empty + case object(Operations.GetLatestLibraryItemsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetLatestLibraryItemsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetLatestLibraryItemsResponseBody.swift b/Sources/Plexswift/models/operations/GetLatestLibraryItemsResponseBody.swift new file mode 100644 index 0000000..adb1a6d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLatestLibraryItemsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetLatestLibraryItemsResponseBody { + public let errors: [Operations.GetLatestLibraryItemsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetLatestLibraryItemsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetLatestLibraryItemsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibrariesErrors.swift b/Sources/Plexswift/models/operations/GetLibrariesErrors.swift new file mode 100644 index 0000000..8a3e157 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibrariesErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibrariesErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetLibrariesErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetLibrariesErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetLibrariesResponse.swift b/Sources/Plexswift/models/operations/GetLibrariesResponse.swift new file mode 100644 index 0000000..b34c2e2 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibrariesResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetLibrariesResponse { + case empty + case object(Operations.GetLibrariesResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetLibrariesResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetLibrariesResponseBody.swift b/Sources/Plexswift/models/operations/GetLibrariesResponseBody.swift new file mode 100644 index 0000000..bc2752b --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibrariesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetLibrariesResponseBody { + public let errors: [Operations.GetLibrariesErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetLibrariesErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetLibrariesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryErrors.swift b/Sources/Plexswift/models/operations/GetLibraryErrors.swift new file mode 100644 index 0000000..4149c36 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetLibraryErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetLibraryErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryHubsErrors.swift b/Sources/Plexswift/models/operations/GetLibraryHubsErrors.swift new file mode 100644 index 0000000..e8e6bd2 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryHubsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryHubsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetLibraryHubsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetLibraryHubsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryHubsRequest.swift b/Sources/Plexswift/models/operations/GetLibraryHubsRequest.swift new file mode 100644 index 0000000..e6955c9 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryHubsRequest.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryHubsRequest: APIValue { + /// the Id of the library to query + @DecimalSerialized + public private(set) var sectionId: Double + /// The number of items to return with each hub. + @DecimalSerialized + public private(set) var count: Double? + /// Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). + public let onlyTransient: Operations.QueryParamOnlyTransient? + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to query + /// - Parameter count: The number of items to return with each hub. + /// - Parameter onlyTransient: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). + /// + public init(sectionId: Double, count: Double? = nil, onlyTransient: Operations.QueryParamOnlyTransient? = nil) { + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + self._count = DecimalSerialized(wrappedValue: count) + self.onlyTransient = onlyTransient + } + } +} +extension Operations.GetLibraryHubsRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } + var countWrapper: DecimalSerialized { + return _count + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryHubsResponse.swift b/Sources/Plexswift/models/operations/GetLibraryHubsResponse.swift new file mode 100644 index 0000000..63692c4 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryHubsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetLibraryHubsResponse { + case empty + case object(Operations.GetLibraryHubsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetLibraryHubsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryHubsResponseBody.swift b/Sources/Plexswift/models/operations/GetLibraryHubsResponseBody.swift new file mode 100644 index 0000000..a625ffa --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryHubsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetLibraryHubsResponseBody { + public let errors: [Operations.GetLibraryHubsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetLibraryHubsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetLibraryHubsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsErrors.swift b/Sources/Plexswift/models/operations/GetLibraryItemsErrors.swift new file mode 100644 index 0000000..f963dd7 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetLibraryItemsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetLibraryItemsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift b/Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift new file mode 100644 index 0000000..4e99e6e --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsRequest: APIValue { + /// the Id of the library to query + @DecimalSerialized + public private(set) var sectionId: Double + /// the filter parameter + public let filter: String? + /// item type + @DecimalSerialized + public private(set) var type: Double? + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to query + /// - Parameter filter: the filter parameter + /// - Parameter type: item type + /// + public init(sectionId: Double, filter: String? = nil, type: Double? = nil) { + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + self.filter = filter + self._type = DecimalSerialized(wrappedValue: type) + } + } +} +extension Operations.GetLibraryItemsRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } + var typeWrapper: DecimalSerialized { + return _type + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift b/Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift new file mode 100644 index 0000000..b39b7c7 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetLibraryItemsResponse { + case empty + case object(Operations.GetLibraryItemsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetLibraryItemsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsResponseBody.swift b/Sources/Plexswift/models/operations/GetLibraryItemsResponseBody.swift new file mode 100644 index 0000000..f0a4a29 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetLibraryItemsResponseBody { + public let errors: [Operations.GetLibraryItemsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetLibraryItemsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetLibraryItemsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryRequest.swift b/Sources/Plexswift/models/operations/GetLibraryRequest.swift new file mode 100644 index 0000000..2f33d5c --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryRequest.swift @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryRequest: APIValue { + /// the Id of the library to query + @DecimalSerialized + public private(set) var sectionId: Double + /// Whether or not to include details for a section (types, filters, and sorts). + /// Only exists for backwards compatibility, media providers other than the server libraries have it on always. + /// + public let includeDetails: Operations.IncludeDetails? + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to query + /// - Parameter includeDetails: Whether or not to include details for a section (types, filters, and sorts). + /// Only exists for backwards compatibility, media providers other than the server libraries have it on always. + /// + /// + public init(sectionId: Double, includeDetails: Operations.IncludeDetails? = nil) { + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + self.includeDetails = includeDetails + } + } +} +extension Operations.GetLibraryRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryResponse.swift b/Sources/Plexswift/models/operations/GetLibraryResponse.swift new file mode 100644 index 0000000..db49765 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetLibraryResponse { + case empty + case object(Operations.GetLibraryResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetLibraryResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryResponseBody.swift b/Sources/Plexswift/models/operations/GetLibraryResponseBody.swift new file mode 100644 index 0000000..163fcde --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetLibraryResponseBody { + public let errors: [Operations.GetLibraryErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetLibraryErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetLibraryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetMetadataChildrenErrors.swift b/Sources/Plexswift/models/operations/GetMetadataChildrenErrors.swift new file mode 100644 index 0000000..ec97688 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataChildrenErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetMetadataChildrenErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetMetadataChildrenErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetMetadataChildrenErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetMetadataChildrenRequest.swift b/Sources/Plexswift/models/operations/GetMetadataChildrenRequest.swift new file mode 100644 index 0000000..f13a3a1 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataChildrenRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetMetadataChildrenRequest: APIValue { + /// the id of the library item to return the children of. + @DecimalSerialized + public private(set) var ratingKey: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter ratingKey: the id of the library item to return the children of. + /// + public init(ratingKey: Double) { + self._ratingKey = DecimalSerialized(wrappedValue: ratingKey) + } + } +} +extension Operations.GetMetadataChildrenRequest { + var ratingKeyWrapper: DecimalSerialized { + return _ratingKey + } +} diff --git a/Sources/Plexswift/models/operations/GetMetadataChildrenResponse.swift b/Sources/Plexswift/models/operations/GetMetadataChildrenResponse.swift new file mode 100644 index 0000000..adf91b3 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataChildrenResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetMetadataChildrenResponse { + case empty + case object(Operations.GetMetadataChildrenResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetMetadataChildrenResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetMetadataChildrenResponseBody.swift b/Sources/Plexswift/models/operations/GetMetadataChildrenResponseBody.swift new file mode 100644 index 0000000..9489591 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataChildrenResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetMetadataChildrenResponseBody { + public let errors: [Operations.GetMetadataChildrenErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetMetadataChildrenErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetMetadataChildrenResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetMetadataErrors.swift b/Sources/Plexswift/models/operations/GetMetadataErrors.swift new file mode 100644 index 0000000..8d184a9 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetMetadataErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetMetadataErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetMetadataErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetMetadataRequest.swift b/Sources/Plexswift/models/operations/GetMetadataRequest.swift new file mode 100644 index 0000000..47b2410 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetMetadataRequest: APIValue { + /// the id of the library item to return the children of. + @DecimalSerialized + public private(set) var ratingKey: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter ratingKey: the id of the library item to return the children of. + /// + public init(ratingKey: Double) { + self._ratingKey = DecimalSerialized(wrappedValue: ratingKey) + } + } +} +extension Operations.GetMetadataRequest { + var ratingKeyWrapper: DecimalSerialized { + return _ratingKey + } +} diff --git a/Sources/Plexswift/models/operations/GetMetadataResponse.swift b/Sources/Plexswift/models/operations/GetMetadataResponse.swift new file mode 100644 index 0000000..faa8e55 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetMetadataResponse { + case empty + case object(Operations.GetMetadataResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetMetadataResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetMetadataResponseBody.swift b/Sources/Plexswift/models/operations/GetMetadataResponseBody.swift new file mode 100644 index 0000000..cda3f7c --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMetadataResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetMetadataResponseBody { + public let errors: [Operations.GetMetadataErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetMetadataErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetMetadataResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetMyPlexAccountErrors.swift b/Sources/Plexswift/models/operations/GetMyPlexAccountErrors.swift new file mode 100644 index 0000000..90bda09 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMyPlexAccountErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetMyPlexAccountErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetMyPlexAccountErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetMyPlexAccountErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetMyPlexAccountResponse.swift b/Sources/Plexswift/models/operations/GetMyPlexAccountResponse.swift new file mode 100644 index 0000000..f8b03e7 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMyPlexAccountResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetMyPlexAccountResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetMyPlexAccountResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetMyPlexAccountServerResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetMyPlexAccountResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetMyPlexAccountServerResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetMyPlexAccountResponseBody.swift b/Sources/Plexswift/models/operations/GetMyPlexAccountResponseBody.swift new file mode 100644 index 0000000..b287fa7 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMyPlexAccountResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// MyPlex Account + public struct GetMyPlexAccountResponseBody { + public let myPlex: Operations.MyPlex? + + /// Creates an object with the specified parameters + /// + /// + public init(myPlex: Operations.MyPlex? = nil) { + self.myPlex = myPlex + } + } +} + +extension Operations.GetMyPlexAccountResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case myPlex = "MyPlex" + } +} + diff --git a/Sources/Plexswift/models/operations/GetMyPlexAccountServerResponseBody.swift b/Sources/Plexswift/models/operations/GetMyPlexAccountServerResponseBody.swift new file mode 100644 index 0000000..7591fd3 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetMyPlexAccountServerResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetMyPlexAccountServerResponseBody { + public let errors: [Operations.GetMyPlexAccountErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetMyPlexAccountErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetMyPlexAccountServerResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetOnDeckErrors.swift b/Sources/Plexswift/models/operations/GetOnDeckErrors.swift new file mode 100644 index 0000000..dfef9a4 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetOnDeckErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetOnDeckErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetOnDeckErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetOnDeckLibraryResponseBody.swift b/Sources/Plexswift/models/operations/GetOnDeckLibraryResponseBody.swift new file mode 100644 index 0000000..de90087 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckLibraryResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetOnDeckLibraryResponseBody { + public let errors: [Operations.GetOnDeckErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetOnDeckErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetOnDeckLibraryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetOnDeckMedia.swift b/Sources/Plexswift/models/operations/GetOnDeckMedia.swift new file mode 100644 index 0000000..66398fc --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckMedia.swift @@ -0,0 +1,148 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetOnDeckMedia { + @DecimalSerialized + public private(set) var aspectRatio: Double? + @DecimalSerialized + public private(set) var audioChannels: Double? + public let audioCodec: String? + public let audioProfile: String? + @DecimalSerialized + public private(set) var bitrate: Double? + public let container: String? + @DecimalSerialized + public private(set) var duration: Double? + @DecimalSerialized + public private(set) var height: Double? + @DecimalSerialized + public private(set) var id: Double? + public let part: [Operations.GetOnDeckPart]? + public let videoCodec: String? + public let videoFrameRate: String? + public let videoProfile: String? + public let videoResolution: String? + @DecimalSerialized + public private(set) var width: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(aspectRatio: Double? = nil, audioChannels: Double? = nil, audioCodec: String? = nil, audioProfile: String? = nil, bitrate: Double? = nil, container: String? = nil, duration: Double? = nil, height: Double? = nil, id: Double? = nil, part: [Operations.GetOnDeckPart]? = nil, videoCodec: String? = nil, videoFrameRate: String? = nil, videoProfile: String? = nil, videoResolution: String? = nil, width: Double? = nil) { + self._aspectRatio = DecimalSerialized(wrappedValue: aspectRatio) + self._audioChannels = DecimalSerialized(wrappedValue: audioChannels) + self.audioCodec = audioCodec + self.audioProfile = audioProfile + self._bitrate = DecimalSerialized(wrappedValue: bitrate) + self.container = container + self._duration = DecimalSerialized(wrappedValue: duration) + self._height = DecimalSerialized(wrappedValue: height) + self._id = DecimalSerialized(wrappedValue: id) + self.part = part + self.videoCodec = videoCodec + self.videoFrameRate = videoFrameRate + self.videoProfile = videoProfile + self.videoResolution = videoResolution + self._width = DecimalSerialized(wrappedValue: width) + } + } +} + +extension Operations.GetOnDeckMedia: Codable { + enum CodingKeys: String, CodingKey { + case aspectRatio + case audioChannels + case audioCodec + case audioProfile + case bitrate + case container + case duration + case height + case id + case part = "Part" + case videoCodec + case videoFrameRate + case videoProfile + case videoResolution + case width + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._aspectRatio = try container.decodeIfPresent(DecimalSerialized.self, forKey: .aspectRatio) ?? DecimalSerialized(wrappedValue: nil) + self._audioChannels = try container.decodeIfPresent(DecimalSerialized.self, forKey: .audioChannels) ?? DecimalSerialized(wrappedValue: nil) + self.audioCodec = try container.decodeIfPresent(String.self, forKey: .audioCodec) + self.audioProfile = try container.decodeIfPresent(String.self, forKey: .audioProfile) + self._bitrate = try container.decodeIfPresent(DecimalSerialized.self, forKey: .bitrate) ?? DecimalSerialized(wrappedValue: nil) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self._height = try container.decodeIfPresent(DecimalSerialized.self, forKey: .height) ?? DecimalSerialized(wrappedValue: nil) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self.part = try container.decodeIfPresent([Operations.GetOnDeckPart].self, forKey: .part) + self.videoCodec = try container.decodeIfPresent(String.self, forKey: .videoCodec) + self.videoFrameRate = try container.decodeIfPresent(String.self, forKey: .videoFrameRate) + self.videoProfile = try container.decodeIfPresent(String.self, forKey: .videoProfile) + self.videoResolution = try container.decodeIfPresent(String.self, forKey: .videoResolution) + self._width = try container.decodeIfPresent(DecimalSerialized.self, forKey: .width) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.aspectRatio != nil { + try container.encode(self._aspectRatio, forKey: .aspectRatio) + } + if self.audioChannels != nil { + try container.encode(self._audioChannels, forKey: .audioChannels) + } + try container.encodeIfPresent(self.audioCodec, forKey: .audioCodec) + try container.encodeIfPresent(self.audioProfile, forKey: .audioProfile) + if self.bitrate != nil { + try container.encode(self._bitrate, forKey: .bitrate) + } + try container.encodeIfPresent(self.container, forKey: .container) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + if self.height != nil { + try container.encode(self._height, forKey: .height) + } + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + try container.encodeIfPresent(self.part, forKey: .part) + try container.encodeIfPresent(self.videoCodec, forKey: .videoCodec) + try container.encodeIfPresent(self.videoFrameRate, forKey: .videoFrameRate) + try container.encodeIfPresent(self.videoProfile, forKey: .videoProfile) + try container.encodeIfPresent(self.videoResolution, forKey: .videoResolution) + if self.width != nil { + try container.encode(self._width, forKey: .width) + } + } +} + +extension Operations.GetOnDeckMedia { + var idWrapper: DecimalSerialized { + return _id + } + var durationWrapper: DecimalSerialized { + return _duration + } + var bitrateWrapper: DecimalSerialized { + return _bitrate + } + var widthWrapper: DecimalSerialized { + return _width + } + var heightWrapper: DecimalSerialized { + return _height + } + var aspectRatioWrapper: DecimalSerialized { + return _aspectRatio + } + var audioChannelsWrapper: DecimalSerialized { + return _audioChannels + } +} diff --git a/Sources/Plexswift/models/operations/GetOnDeckMediaContainer.swift b/Sources/Plexswift/models/operations/GetOnDeckMediaContainer.swift new file mode 100644 index 0000000..2c46400 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckMediaContainer.swift @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetOnDeckMediaContainer { + public let allowSync: Bool? + public let identifier: String? + public let mediaTagPrefix: String? + @DecimalSerialized + public private(set) var mediaTagVersion: Double? + public let metadata: [Operations.GetOnDeckMetadata]? + public let mixedParents: Bool? + @DecimalSerialized + public private(set) var size: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(allowSync: Bool? = nil, identifier: String? = nil, mediaTagPrefix: String? = nil, mediaTagVersion: Double? = nil, metadata: [Operations.GetOnDeckMetadata]? = nil, mixedParents: Bool? = nil, size: Double? = nil) { + self.allowSync = allowSync + self.identifier = identifier + self.mediaTagPrefix = mediaTagPrefix + self._mediaTagVersion = DecimalSerialized(wrappedValue: mediaTagVersion) + self.metadata = metadata + self.mixedParents = mixedParents + self._size = DecimalSerialized(wrappedValue: size) + } + } +} + +extension Operations.GetOnDeckMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case allowSync + case identifier + case mediaTagPrefix + case mediaTagVersion + case metadata = "Metadata" + case mixedParents + case size + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync) + self.identifier = try container.decodeIfPresent(String.self, forKey: .identifier) + self.mediaTagPrefix = try container.decodeIfPresent(String.self, forKey: .mediaTagPrefix) + self._mediaTagVersion = try container.decodeIfPresent(DecimalSerialized.self, forKey: .mediaTagVersion) ?? DecimalSerialized(wrappedValue: nil) + self.metadata = try container.decodeIfPresent([Operations.GetOnDeckMetadata].self, forKey: .metadata) + self.mixedParents = try container.decodeIfPresent(Bool.self, forKey: .mixedParents) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.allowSync, forKey: .allowSync) + try container.encodeIfPresent(self.identifier, forKey: .identifier) + try container.encodeIfPresent(self.mediaTagPrefix, forKey: .mediaTagPrefix) + if self.mediaTagVersion != nil { + try container.encode(self._mediaTagVersion, forKey: .mediaTagVersion) + } + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.mixedParents, forKey: .mixedParents) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + } +} + +extension Operations.GetOnDeckMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } + var mediaTagVersionWrapper: DecimalSerialized { + return _mediaTagVersion + } +} diff --git a/Sources/Plexswift/models/operations/GetOnDeckMetadata.swift b/Sources/Plexswift/models/operations/GetOnDeckMetadata.swift new file mode 100644 index 0000000..09a0e5e --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckMetadata.swift @@ -0,0 +1,283 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetOnDeckMetadata { + @DecimalSerialized + public private(set) var addedAt: Double? + public let allowSync: Bool? + public let art: String? + public let contentRating: String? + @DecimalSerialized + public private(set) var duration: Double? + public let grandparentArt: String? + public let grandparentGuid: String? + public let grandparentKey: String? + @DecimalSerialized + public private(set) var grandparentRatingKey: Double? + public let grandparentTheme: String? + public let grandparentThumb: String? + public let grandparentTitle: String? + public let guid: String? + public let guids: [Operations.Guids]? + @DecimalSerialized + public private(set) var index: Double? + public let key: String? + @DecimalSerialized + public private(set) var lastViewedAt: Double? + @DecimalSerialized + public private(set) var librarySectionID: Double? + public let librarySectionKey: String? + public let librarySectionTitle: String? + public let librarySectionUUID: String? + public let media: [Operations.GetOnDeckMedia]? + @DateTime + public private(set) var originallyAvailableAt: Date? + public let parentGuid: String? + @DecimalSerialized + public private(set) var parentIndex: Double? + public let parentKey: String? + @DecimalSerialized + public private(set) var parentRatingKey: Double? + public let parentThumb: String? + public let parentTitle: String? + @DecimalSerialized + public private(set) var ratingKey: Double? + public let summary: String? + public let thumb: String? + public let title: String? + public let type: String? + @DecimalSerialized + public private(set) var updatedAt: Double? + @DecimalSerialized + public private(set) var year: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(addedAt: Double? = nil, allowSync: Bool? = nil, art: String? = nil, contentRating: String? = nil, duration: Double? = nil, grandparentArt: String? = nil, grandparentGuid: String? = nil, grandparentKey: String? = nil, grandparentRatingKey: Double? = nil, grandparentTheme: String? = nil, grandparentThumb: String? = nil, grandparentTitle: String? = nil, guid: String? = nil, guids: [Operations.Guids]? = nil, index: Double? = nil, key: String? = nil, lastViewedAt: Double? = nil, librarySectionID: Double? = nil, librarySectionKey: String? = nil, librarySectionTitle: String? = nil, librarySectionUUID: String? = nil, media: [Operations.GetOnDeckMedia]? = nil, originallyAvailableAt: Date? = nil, parentGuid: String? = nil, parentIndex: Double? = nil, parentKey: String? = nil, parentRatingKey: Double? = nil, parentThumb: String? = nil, parentTitle: String? = nil, ratingKey: Double? = nil, summary: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, updatedAt: Double? = nil, year: Double? = nil) { + self._addedAt = DecimalSerialized(wrappedValue: addedAt) + self.allowSync = allowSync + self.art = art + self.contentRating = contentRating + self._duration = DecimalSerialized(wrappedValue: duration) + self.grandparentArt = grandparentArt + self.grandparentGuid = grandparentGuid + self.grandparentKey = grandparentKey + self._grandparentRatingKey = DecimalSerialized(wrappedValue: grandparentRatingKey) + self.grandparentTheme = grandparentTheme + self.grandparentThumb = grandparentThumb + self.grandparentTitle = grandparentTitle + self.guid = guid + self.guids = guids + self._index = DecimalSerialized(wrappedValue: index) + self.key = key + self._lastViewedAt = DecimalSerialized(wrappedValue: lastViewedAt) + self._librarySectionID = DecimalSerialized(wrappedValue: librarySectionID) + self.librarySectionKey = librarySectionKey + self.librarySectionTitle = librarySectionTitle + self.librarySectionUUID = librarySectionUUID + self.media = media + self._originallyAvailableAt = DateTime(wrappedValue: originallyAvailableAt) + self.parentGuid = parentGuid + self._parentIndex = DecimalSerialized(wrappedValue: parentIndex) + self.parentKey = parentKey + self._parentRatingKey = DecimalSerialized(wrappedValue: parentRatingKey) + self.parentThumb = parentThumb + self.parentTitle = parentTitle + self._ratingKey = DecimalSerialized(wrappedValue: ratingKey) + self.summary = summary + self.thumb = thumb + self.title = title + self.type = type + self._updatedAt = DecimalSerialized(wrappedValue: updatedAt) + self._year = DecimalSerialized(wrappedValue: year) + } + } +} + +extension Operations.GetOnDeckMetadata: Codable { + enum CodingKeys: String, CodingKey { + case addedAt + case allowSync + case art + case contentRating + case duration + case grandparentArt + case grandparentGuid + case grandparentKey + case grandparentRatingKey + case grandparentTheme + case grandparentThumb + case grandparentTitle + case guid + case guids = "Guid" + case index + case key + case lastViewedAt + case librarySectionID + case librarySectionKey + case librarySectionTitle + case librarySectionUUID + case media = "Media" + case originallyAvailableAt + case parentGuid + case parentIndex + case parentKey + case parentRatingKey + case parentThumb + case parentTitle + case ratingKey + case summary + case thumb + case title + case type + case updatedAt + case year + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._addedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .addedAt) ?? DecimalSerialized(wrappedValue: nil) + self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync) + self.art = try container.decodeIfPresent(String.self, forKey: .art) + self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.grandparentArt = try container.decodeIfPresent(String.self, forKey: .grandparentArt) + self.grandparentGuid = try container.decodeIfPresent(String.self, forKey: .grandparentGuid) + self.grandparentKey = try container.decodeIfPresent(String.self, forKey: .grandparentKey) + self._grandparentRatingKey = try container.decodeIfPresent(DecimalSerialized.self, forKey: .grandparentRatingKey) ?? DecimalSerialized(wrappedValue: nil) + self.grandparentTheme = try container.decodeIfPresent(String.self, forKey: .grandparentTheme) + self.grandparentThumb = try container.decodeIfPresent(String.self, forKey: .grandparentThumb) + self.grandparentTitle = try container.decodeIfPresent(String.self, forKey: .grandparentTitle) + self.guid = try container.decodeIfPresent(String.self, forKey: .guid) + self.guids = try container.decodeIfPresent([Operations.Guids].self, forKey: .guids) + self._index = try container.decodeIfPresent(DecimalSerialized.self, forKey: .index) ?? DecimalSerialized(wrappedValue: nil) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self._lastViewedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .lastViewedAt) ?? DecimalSerialized(wrappedValue: nil) + self._librarySectionID = try container.decodeIfPresent(DecimalSerialized.self, forKey: .librarySectionID) ?? DecimalSerialized(wrappedValue: nil) + self.librarySectionKey = try container.decodeIfPresent(String.self, forKey: .librarySectionKey) + self.librarySectionTitle = try container.decodeIfPresent(String.self, forKey: .librarySectionTitle) + self.librarySectionUUID = try container.decodeIfPresent(String.self, forKey: .librarySectionUUID) + self.media = try container.decodeIfPresent([Operations.GetOnDeckMedia].self, forKey: .media) + self._originallyAvailableAt = try container.decodeIfPresent(DateTime.self, forKey: .originallyAvailableAt) ?? DateTime(wrappedValue: nil) + self.parentGuid = try container.decodeIfPresent(String.self, forKey: .parentGuid) + self._parentIndex = try container.decodeIfPresent(DecimalSerialized.self, forKey: .parentIndex) ?? DecimalSerialized(wrappedValue: nil) + self.parentKey = try container.decodeIfPresent(String.self, forKey: .parentKey) + self._parentRatingKey = try container.decodeIfPresent(DecimalSerialized.self, forKey: .parentRatingKey) ?? DecimalSerialized(wrappedValue: nil) + self.parentThumb = try container.decodeIfPresent(String.self, forKey: .parentThumb) + self.parentTitle = try container.decodeIfPresent(String.self, forKey: .parentTitle) + self._ratingKey = try container.decodeIfPresent(DecimalSerialized.self, forKey: .ratingKey) ?? DecimalSerialized(wrappedValue: nil) + self.summary = try container.decodeIfPresent(String.self, forKey: .summary) + self.thumb = try container.decodeIfPresent(String.self, forKey: .thumb) + self.title = try container.decodeIfPresent(String.self, forKey: .title) + self.type = try container.decodeIfPresent(String.self, forKey: .type) + self._updatedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .updatedAt) ?? DecimalSerialized(wrappedValue: nil) + self._year = try container.decodeIfPresent(DecimalSerialized.self, forKey: .year) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.addedAt != nil { + try container.encode(self._addedAt, forKey: .addedAt) + } + try container.encodeIfPresent(self.allowSync, forKey: .allowSync) + try container.encodeIfPresent(self.art, forKey: .art) + try container.encodeIfPresent(self.contentRating, forKey: .contentRating) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.grandparentArt, forKey: .grandparentArt) + try container.encodeIfPresent(self.grandparentGuid, forKey: .grandparentGuid) + try container.encodeIfPresent(self.grandparentKey, forKey: .grandparentKey) + if self.grandparentRatingKey != nil { + try container.encode(self._grandparentRatingKey, forKey: .grandparentRatingKey) + } + try container.encodeIfPresent(self.grandparentTheme, forKey: .grandparentTheme) + try container.encodeIfPresent(self.grandparentThumb, forKey: .grandparentThumb) + try container.encodeIfPresent(self.grandparentTitle, forKey: .grandparentTitle) + try container.encodeIfPresent(self.guid, forKey: .guid) + try container.encodeIfPresent(self.guids, forKey: .guids) + if self.index != nil { + try container.encode(self._index, forKey: .index) + } + try container.encodeIfPresent(self.key, forKey: .key) + if self.lastViewedAt != nil { + try container.encode(self._lastViewedAt, forKey: .lastViewedAt) + } + if self.librarySectionID != nil { + try container.encode(self._librarySectionID, forKey: .librarySectionID) + } + try container.encodeIfPresent(self.librarySectionKey, forKey: .librarySectionKey) + try container.encodeIfPresent(self.librarySectionTitle, forKey: .librarySectionTitle) + try container.encodeIfPresent(self.librarySectionUUID, forKey: .librarySectionUUID) + try container.encodeIfPresent(self.media, forKey: .media) + if self.originallyAvailableAt != nil { + try container.encode(self._originallyAvailableAt, forKey: .originallyAvailableAt) + } + try container.encodeIfPresent(self.parentGuid, forKey: .parentGuid) + if self.parentIndex != nil { + try container.encode(self._parentIndex, forKey: .parentIndex) + } + try container.encodeIfPresent(self.parentKey, forKey: .parentKey) + if self.parentRatingKey != nil { + try container.encode(self._parentRatingKey, forKey: .parentRatingKey) + } + try container.encodeIfPresent(self.parentThumb, forKey: .parentThumb) + try container.encodeIfPresent(self.parentTitle, forKey: .parentTitle) + if self.ratingKey != nil { + try container.encode(self._ratingKey, forKey: .ratingKey) + } + try container.encodeIfPresent(self.summary, forKey: .summary) + try container.encodeIfPresent(self.thumb, forKey: .thumb) + try container.encodeIfPresent(self.title, forKey: .title) + try container.encodeIfPresent(self.type, forKey: .type) + if self.updatedAt != nil { + try container.encode(self._updatedAt, forKey: .updatedAt) + } + if self.year != nil { + try container.encode(self._year, forKey: .year) + } + } +} + +extension Operations.GetOnDeckMetadata { + var librarySectionIDWrapper: DecimalSerialized { + return _librarySectionID + } + var ratingKeyWrapper: DecimalSerialized { + return _ratingKey + } + var parentRatingKeyWrapper: DecimalSerialized { + return _parentRatingKey + } + var grandparentRatingKeyWrapper: DecimalSerialized { + return _grandparentRatingKey + } + var indexWrapper: DecimalSerialized { + return _index + } + var parentIndexWrapper: DecimalSerialized { + return _parentIndex + } + var lastViewedAtWrapper: DecimalSerialized { + return _lastViewedAt + } + var yearWrapper: DecimalSerialized { + return _year + } + var durationWrapper: DecimalSerialized { + return _duration + } + var originallyAvailableAtWrapper: DateTime { + return _originallyAvailableAt + } + var addedAtWrapper: DecimalSerialized { + return _addedAt + } + var updatedAtWrapper: DecimalSerialized { + return _updatedAt + } +} diff --git a/Sources/Plexswift/models/operations/GetOnDeckPart.swift b/Sources/Plexswift/models/operations/GetOnDeckPart.swift new file mode 100644 index 0000000..1372ecd --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckPart.swift @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetOnDeckPart { + public let audioProfile: String? + public let container: String? + @DecimalSerialized + public private(set) var duration: Double? + public let file: String? + @DecimalSerialized + public private(set) var id: Double? + public let key: String? + @DecimalSerialized + public private(set) var size: Double? + public let stream: [Operations.Stream]? + public let videoProfile: String? + + /// Creates an object with the specified parameters + /// + /// + public init(audioProfile: String? = nil, container: String? = nil, duration: Double? = nil, file: String? = nil, id: Double? = nil, key: String? = nil, size: Double? = nil, stream: [Operations.Stream]? = nil, videoProfile: String? = nil) { + self.audioProfile = audioProfile + self.container = container + self._duration = DecimalSerialized(wrappedValue: duration) + self.file = file + self._id = DecimalSerialized(wrappedValue: id) + self.key = key + self._size = DecimalSerialized(wrappedValue: size) + self.stream = stream + self.videoProfile = videoProfile + } + } +} + +extension Operations.GetOnDeckPart: Codable { + enum CodingKeys: String, CodingKey { + case audioProfile + case container + case duration + case file + case id + case key + case size + case stream = "Stream" + case videoProfile + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.audioProfile = try container.decodeIfPresent(String.self, forKey: .audioProfile) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.file = try container.decodeIfPresent(String.self, forKey: .file) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + self.stream = try container.decodeIfPresent([Operations.Stream].self, forKey: .stream) + self.videoProfile = try container.decodeIfPresent(String.self, forKey: .videoProfile) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.audioProfile, forKey: .audioProfile) + try container.encodeIfPresent(self.container, forKey: .container) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.file, forKey: .file) + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + try container.encodeIfPresent(self.key, forKey: .key) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + try container.encodeIfPresent(self.stream, forKey: .stream) + try container.encodeIfPresent(self.videoProfile, forKey: .videoProfile) + } +} + +extension Operations.GetOnDeckPart { + var idWrapper: DecimalSerialized { + return _id + } + var durationWrapper: DecimalSerialized { + return _duration + } + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetOnDeckResponse.swift b/Sources/Plexswift/models/operations/GetOnDeckResponse.swift new file mode 100644 index 0000000..94876e1 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetOnDeckResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetOnDeckResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetOnDeckLibraryResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetOnDeckResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetOnDeckLibraryResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetOnDeckResponseBody.swift b/Sources/Plexswift/models/operations/GetOnDeckResponseBody.swift new file mode 100644 index 0000000..cdc6cb9 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetOnDeckResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The on Deck content + public struct GetOnDeckResponseBody { + public let mediaContainer: Operations.GetOnDeckMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetOnDeckMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetOnDeckResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetPlaylistContentsErrors.swift b/Sources/Plexswift/models/operations/GetPlaylistContentsErrors.swift new file mode 100644 index 0000000..72b7089 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistContentsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetPlaylistContentsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetPlaylistContentsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetPlaylistContentsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistContentsRequest.swift b/Sources/Plexswift/models/operations/GetPlaylistContentsRequest.swift new file mode 100644 index 0000000..9878d65 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistContentsRequest.swift @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetPlaylistContentsRequest: APIValue { + /// the ID of the playlist + @DecimalSerialized + public private(set) var playlistID: Double + /// the metadata type of the item to return + @DecimalSerialized + public private(set) var type: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter playlistID: the ID of the playlist + /// - Parameter type: the metadata type of the item to return + /// + public init(playlistID: Double, type: Double) { + self._playlistID = DecimalSerialized(wrappedValue: playlistID) + self._type = DecimalSerialized(wrappedValue: type) + } + } +} +extension Operations.GetPlaylistContentsRequest { + var playlistIDWrapper: DecimalSerialized { + return _playlistID + } + var typeWrapper: DecimalSerialized { + return _type + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistContentsResponse.swift b/Sources/Plexswift/models/operations/GetPlaylistContentsResponse.swift new file mode 100644 index 0000000..6ce987c --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistContentsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetPlaylistContentsResponse { + case empty + case object(Operations.GetPlaylistContentsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetPlaylistContentsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistContentsResponseBody.swift b/Sources/Plexswift/models/operations/GetPlaylistContentsResponseBody.swift new file mode 100644 index 0000000..20bd95d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistContentsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetPlaylistContentsResponseBody { + public let errors: [Operations.GetPlaylistContentsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetPlaylistContentsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetPlaylistContentsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetPlaylistErrors.swift b/Sources/Plexswift/models/operations/GetPlaylistErrors.swift new file mode 100644 index 0000000..ea9de89 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetPlaylistErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetPlaylistErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetPlaylistErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistRequest.swift b/Sources/Plexswift/models/operations/GetPlaylistRequest.swift new file mode 100644 index 0000000..e730a37 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetPlaylistRequest: APIValue { + /// the ID of the playlist + @DecimalSerialized + public private(set) var playlistID: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter playlistID: the ID of the playlist + /// + public init(playlistID: Double) { + self._playlistID = DecimalSerialized(wrappedValue: playlistID) + } + } +} +extension Operations.GetPlaylistRequest { + var playlistIDWrapper: DecimalSerialized { + return _playlistID + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistResponse.swift b/Sources/Plexswift/models/operations/GetPlaylistResponse.swift new file mode 100644 index 0000000..752fd41 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetPlaylistResponse { + case empty + case object(Operations.GetPlaylistResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetPlaylistResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistResponseBody.swift b/Sources/Plexswift/models/operations/GetPlaylistResponseBody.swift new file mode 100644 index 0000000..cbad768 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetPlaylistResponseBody { + public let errors: [Operations.GetPlaylistErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetPlaylistErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetPlaylistResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetPlaylistsErrors.swift b/Sources/Plexswift/models/operations/GetPlaylistsErrors.swift new file mode 100644 index 0000000..2dadc7e --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetPlaylistsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetPlaylistsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetPlaylistsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistsRequest.swift b/Sources/Plexswift/models/operations/GetPlaylistsRequest.swift new file mode 100644 index 0000000..4b5f174 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistsRequest.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetPlaylistsRequest: APIValue { + /// limit to a type of playlist. + public let playlistType: Operations.PlaylistType? + /// type of playlists to return (default is all). + public let smart: Operations.QueryParamSmart? + + /// Creates an object with the specified parameters + /// + /// - Parameter playlistType: limit to a type of playlist. + /// - Parameter smart: type of playlists to return (default is all). + /// + public init(playlistType: Operations.PlaylistType? = nil, smart: Operations.QueryParamSmart? = nil) { + self.playlistType = playlistType + self.smart = smart + } + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistsResponse.swift b/Sources/Plexswift/models/operations/GetPlaylistsResponse.swift new file mode 100644 index 0000000..8abfe07 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetPlaylistsResponse { + case empty + case object(Operations.GetPlaylistsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetPlaylistsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetPlaylistsResponseBody.swift b/Sources/Plexswift/models/operations/GetPlaylistsResponseBody.swift new file mode 100644 index 0000000..864899b --- /dev/null +++ b/Sources/Plexswift/models/operations/GetPlaylistsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetPlaylistsResponseBody { + public let errors: [Operations.GetPlaylistsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetPlaylistsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetPlaylistsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetRecentlyAddedErrors.swift b/Sources/Plexswift/models/operations/GetRecentlyAddedErrors.swift new file mode 100644 index 0000000..ece12e2 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetRecentlyAddedErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetRecentlyAddedErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetRecentlyAddedErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetRecentlyAddedErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetRecentlyAddedLibraryResponseBody.swift b/Sources/Plexswift/models/operations/GetRecentlyAddedLibraryResponseBody.swift new file mode 100644 index 0000000..a0a7c3d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetRecentlyAddedLibraryResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetRecentlyAddedLibraryResponseBody { + public let errors: [Operations.GetRecentlyAddedErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetRecentlyAddedErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetRecentlyAddedLibraryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetRecentlyAddedMediaContainer.swift b/Sources/Plexswift/models/operations/GetRecentlyAddedMediaContainer.swift new file mode 100644 index 0000000..a6a49d4 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetRecentlyAddedMediaContainer.swift @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetRecentlyAddedMediaContainer { + public let allowSync: Bool? + public let identifier: String? + public let mediaTagPrefix: String? + @DecimalSerialized + public private(set) var mediaTagVersion: Double? + public let metadata: [Operations.Metadata]? + public let mixedParents: Bool? + @DecimalSerialized + public private(set) var size: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(allowSync: Bool? = nil, identifier: String? = nil, mediaTagPrefix: String? = nil, mediaTagVersion: Double? = nil, metadata: [Operations.Metadata]? = nil, mixedParents: Bool? = nil, size: Double? = nil) { + self.allowSync = allowSync + self.identifier = identifier + self.mediaTagPrefix = mediaTagPrefix + self._mediaTagVersion = DecimalSerialized(wrappedValue: mediaTagVersion) + self.metadata = metadata + self.mixedParents = mixedParents + self._size = DecimalSerialized(wrappedValue: size) + } + } +} + +extension Operations.GetRecentlyAddedMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case allowSync + case identifier + case mediaTagPrefix + case mediaTagVersion + case metadata = "Metadata" + case mixedParents + case size + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync) + self.identifier = try container.decodeIfPresent(String.self, forKey: .identifier) + self.mediaTagPrefix = try container.decodeIfPresent(String.self, forKey: .mediaTagPrefix) + self._mediaTagVersion = try container.decodeIfPresent(DecimalSerialized.self, forKey: .mediaTagVersion) ?? DecimalSerialized(wrappedValue: nil) + self.metadata = try container.decodeIfPresent([Operations.Metadata].self, forKey: .metadata) + self.mixedParents = try container.decodeIfPresent(Bool.self, forKey: .mixedParents) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.allowSync, forKey: .allowSync) + try container.encodeIfPresent(self.identifier, forKey: .identifier) + try container.encodeIfPresent(self.mediaTagPrefix, forKey: .mediaTagPrefix) + if self.mediaTagVersion != nil { + try container.encode(self._mediaTagVersion, forKey: .mediaTagVersion) + } + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.mixedParents, forKey: .mixedParents) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + } +} + +extension Operations.GetRecentlyAddedMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } + var mediaTagVersionWrapper: DecimalSerialized { + return _mediaTagVersion + } +} diff --git a/Sources/Plexswift/models/operations/GetRecentlyAddedResponse.swift b/Sources/Plexswift/models/operations/GetRecentlyAddedResponse.swift new file mode 100644 index 0000000..287bedb --- /dev/null +++ b/Sources/Plexswift/models/operations/GetRecentlyAddedResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetRecentlyAddedResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetRecentlyAddedResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetRecentlyAddedLibraryResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetRecentlyAddedResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetRecentlyAddedLibraryResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetRecentlyAddedResponseBody.swift b/Sources/Plexswift/models/operations/GetRecentlyAddedResponseBody.swift new file mode 100644 index 0000000..e6808cf --- /dev/null +++ b/Sources/Plexswift/models/operations/GetRecentlyAddedResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The recently added content + public struct GetRecentlyAddedResponseBody { + public let mediaContainer: Operations.GetRecentlyAddedMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetRecentlyAddedMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetRecentlyAddedResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetResizedPhotoErrors.swift b/Sources/Plexswift/models/operations/GetResizedPhotoErrors.swift new file mode 100644 index 0000000..9275a5e --- /dev/null +++ b/Sources/Plexswift/models/operations/GetResizedPhotoErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetResizedPhotoErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetResizedPhotoErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetResizedPhotoErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetResizedPhotoRequest.swift b/Sources/Plexswift/models/operations/GetResizedPhotoRequest.swift new file mode 100644 index 0000000..f54377d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetResizedPhotoRequest.swift @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetResizedPhotoRequest: APIValue { + /// The width for the resized photo + @DecimalSerialized + public private(set) var blur: Double + /// The height for the resized photo + @DecimalSerialized + public private(set) var height: Double + /// images are always scaled proportionally. A value of '1' in minSize will make the smaller native dimension the dimension resized against. + public let minSize: Operations.MinSize + /// The opacity for the resized photo + public let opacity: Int + /// allow images to be resized beyond native dimensions. + public let upscale: Operations.Upscale + /// path to image within Plex + public let url: String + /// The width for the resized photo + @DecimalSerialized + public private(set) var width: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter blur: The width for the resized photo + /// - Parameter height: The height for the resized photo + /// - Parameter minSize: images are always scaled proportionally. A value of '1' in minSize will make the smaller native dimension the dimension resized against. + /// - Parameter opacity: The opacity for the resized photo + /// - Parameter upscale: allow images to be resized beyond native dimensions. + /// - Parameter url: path to image within Plex + /// - Parameter width: The width for the resized photo + /// + public init(blur: Double, height: Double, minSize: Operations.MinSize, opacity: Int, upscale: Operations.Upscale, url: String, width: Double) { + self._blur = DecimalSerialized(wrappedValue: blur) + self._height = DecimalSerialized(wrappedValue: height) + self.minSize = minSize + self.opacity = opacity + self.upscale = upscale + self.url = url + self._width = DecimalSerialized(wrappedValue: width) + } + } +} +extension Operations.GetResizedPhotoRequest { + var widthWrapper: DecimalSerialized { + return _width + } + var heightWrapper: DecimalSerialized { + return _height + } + var blurWrapper: DecimalSerialized { + return _blur + } +} diff --git a/Sources/Plexswift/models/operations/GetResizedPhotoResponse.swift b/Sources/Plexswift/models/operations/GetResizedPhotoResponse.swift new file mode 100644 index 0000000..7d45c50 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetResizedPhotoResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetResizedPhotoResponse { + case empty + case object(Operations.GetResizedPhotoResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetResizedPhotoResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetResizedPhotoResponseBody.swift b/Sources/Plexswift/models/operations/GetResizedPhotoResponseBody.swift new file mode 100644 index 0000000..7339e10 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetResizedPhotoResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetResizedPhotoResponseBody { + public let errors: [Operations.GetResizedPhotoErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetResizedPhotoErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetResizedPhotoResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetSearchResultsCountry.swift b/Sources/Plexswift/models/operations/GetSearchResultsCountry.swift new file mode 100644 index 0000000..7538cf6 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsCountry.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsCountry { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetSearchResultsCountry: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetSearchResultsDirector.swift b/Sources/Plexswift/models/operations/GetSearchResultsDirector.swift new file mode 100644 index 0000000..230066f --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsDirector.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsDirector { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetSearchResultsDirector: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetSearchResultsErrors.swift b/Sources/Plexswift/models/operations/GetSearchResultsErrors.swift new file mode 100644 index 0000000..7cea7a8 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetSearchResultsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetSearchResultsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetSearchResultsGenre.swift b/Sources/Plexswift/models/operations/GetSearchResultsGenre.swift new file mode 100644 index 0000000..9eef7f0 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsGenre.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsGenre { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetSearchResultsGenre: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetSearchResultsMedia.swift b/Sources/Plexswift/models/operations/GetSearchResultsMedia.swift new file mode 100644 index 0000000..fdfb093 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsMedia.swift @@ -0,0 +1,154 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsMedia { + @DecimalSerialized + public private(set) var aspectRatio: Double? + @DecimalSerialized + public private(set) var audioChannels: Double? + public let audioCodec: String? + public let audioProfile: String? + @DecimalSerialized + public private(set) var bitrate: Double? + public let container: String? + @DecimalSerialized + public private(set) var duration: Double? + @DecimalSerialized + public private(set) var height: Double? + @DecimalSerialized + public private(set) var id: Double? + public let part: [Operations.GetSearchResultsPart]? + public let videoCodec: String? + public let videoFrameRate: String? + public let videoProfile: String? + @DecimalSerialized + public private(set) var videoResolution: Double? + @DecimalSerialized + public private(set) var width: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(aspectRatio: Double? = nil, audioChannels: Double? = nil, audioCodec: String? = nil, audioProfile: String? = nil, bitrate: Double? = nil, container: String? = nil, duration: Double? = nil, height: Double? = nil, id: Double? = nil, part: [Operations.GetSearchResultsPart]? = nil, videoCodec: String? = nil, videoFrameRate: String? = nil, videoProfile: String? = nil, videoResolution: Double? = nil, width: Double? = nil) { + self._aspectRatio = DecimalSerialized(wrappedValue: aspectRatio) + self._audioChannels = DecimalSerialized(wrappedValue: audioChannels) + self.audioCodec = audioCodec + self.audioProfile = audioProfile + self._bitrate = DecimalSerialized(wrappedValue: bitrate) + self.container = container + self._duration = DecimalSerialized(wrappedValue: duration) + self._height = DecimalSerialized(wrappedValue: height) + self._id = DecimalSerialized(wrappedValue: id) + self.part = part + self.videoCodec = videoCodec + self.videoFrameRate = videoFrameRate + self.videoProfile = videoProfile + self._videoResolution = DecimalSerialized(wrappedValue: videoResolution) + self._width = DecimalSerialized(wrappedValue: width) + } + } +} + +extension Operations.GetSearchResultsMedia: Codable { + enum CodingKeys: String, CodingKey { + case aspectRatio + case audioChannels + case audioCodec + case audioProfile + case bitrate + case container + case duration + case height + case id + case part = "Part" + case videoCodec + case videoFrameRate + case videoProfile + case videoResolution + case width + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._aspectRatio = try container.decodeIfPresent(DecimalSerialized.self, forKey: .aspectRatio) ?? DecimalSerialized(wrappedValue: nil) + self._audioChannels = try container.decodeIfPresent(DecimalSerialized.self, forKey: .audioChannels) ?? DecimalSerialized(wrappedValue: nil) + self.audioCodec = try container.decodeIfPresent(String.self, forKey: .audioCodec) + self.audioProfile = try container.decodeIfPresent(String.self, forKey: .audioProfile) + self._bitrate = try container.decodeIfPresent(DecimalSerialized.self, forKey: .bitrate) ?? DecimalSerialized(wrappedValue: nil) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self._height = try container.decodeIfPresent(DecimalSerialized.self, forKey: .height) ?? DecimalSerialized(wrappedValue: nil) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self.part = try container.decodeIfPresent([Operations.GetSearchResultsPart].self, forKey: .part) + self.videoCodec = try container.decodeIfPresent(String.self, forKey: .videoCodec) + self.videoFrameRate = try container.decodeIfPresent(String.self, forKey: .videoFrameRate) + self.videoProfile = try container.decodeIfPresent(String.self, forKey: .videoProfile) + self._videoResolution = try container.decodeIfPresent(DecimalSerialized.self, forKey: .videoResolution) ?? DecimalSerialized(wrappedValue: nil) + self._width = try container.decodeIfPresent(DecimalSerialized.self, forKey: .width) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.aspectRatio != nil { + try container.encode(self._aspectRatio, forKey: .aspectRatio) + } + if self.audioChannels != nil { + try container.encode(self._audioChannels, forKey: .audioChannels) + } + try container.encodeIfPresent(self.audioCodec, forKey: .audioCodec) + try container.encodeIfPresent(self.audioProfile, forKey: .audioProfile) + if self.bitrate != nil { + try container.encode(self._bitrate, forKey: .bitrate) + } + try container.encodeIfPresent(self.container, forKey: .container) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + if self.height != nil { + try container.encode(self._height, forKey: .height) + } + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + try container.encodeIfPresent(self.part, forKey: .part) + try container.encodeIfPresent(self.videoCodec, forKey: .videoCodec) + try container.encodeIfPresent(self.videoFrameRate, forKey: .videoFrameRate) + try container.encodeIfPresent(self.videoProfile, forKey: .videoProfile) + if self.videoResolution != nil { + try container.encode(self._videoResolution, forKey: .videoResolution) + } + if self.width != nil { + try container.encode(self._width, forKey: .width) + } + } +} + +extension Operations.GetSearchResultsMedia { + var idWrapper: DecimalSerialized { + return _id + } + var durationWrapper: DecimalSerialized { + return _duration + } + var bitrateWrapper: DecimalSerialized { + return _bitrate + } + var widthWrapper: DecimalSerialized { + return _width + } + var heightWrapper: DecimalSerialized { + return _height + } + var aspectRatioWrapper: DecimalSerialized { + return _aspectRatio + } + var audioChannelsWrapper: DecimalSerialized { + return _audioChannels + } + var videoResolutionWrapper: DecimalSerialized { + return _videoResolution + } +} diff --git a/Sources/Plexswift/models/operations/GetSearchResultsMediaContainer.swift b/Sources/Plexswift/models/operations/GetSearchResultsMediaContainer.swift new file mode 100644 index 0000000..6f7dac0 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsMediaContainer.swift @@ -0,0 +1,73 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsMediaContainer { + public let identifier: String? + public let mediaTagPrefix: String? + @DecimalSerialized + public private(set) var mediaTagVersion: Double? + public let metadata: [Operations.GetSearchResultsMetadata]? + public let provider: [Operations.Provider]? + @DecimalSerialized + public private(set) var size: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(identifier: String? = nil, mediaTagPrefix: String? = nil, mediaTagVersion: Double? = nil, metadata: [Operations.GetSearchResultsMetadata]? = nil, provider: [Operations.Provider]? = nil, size: Double? = nil) { + self.identifier = identifier + self.mediaTagPrefix = mediaTagPrefix + self._mediaTagVersion = DecimalSerialized(wrappedValue: mediaTagVersion) + self.metadata = metadata + self.provider = provider + self._size = DecimalSerialized(wrappedValue: size) + } + } +} + +extension Operations.GetSearchResultsMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case identifier + case mediaTagPrefix + case mediaTagVersion + case metadata = "Metadata" + case provider = "Provider" + case size + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.identifier = try container.decodeIfPresent(String.self, forKey: .identifier) + self.mediaTagPrefix = try container.decodeIfPresent(String.self, forKey: .mediaTagPrefix) + self._mediaTagVersion = try container.decodeIfPresent(DecimalSerialized.self, forKey: .mediaTagVersion) ?? DecimalSerialized(wrappedValue: nil) + self.metadata = try container.decodeIfPresent([Operations.GetSearchResultsMetadata].self, forKey: .metadata) + self.provider = try container.decodeIfPresent([Operations.Provider].self, forKey: .provider) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.identifier, forKey: .identifier) + try container.encodeIfPresent(self.mediaTagPrefix, forKey: .mediaTagPrefix) + if self.mediaTagVersion != nil { + try container.encode(self._mediaTagVersion, forKey: .mediaTagVersion) + } + try container.encodeIfPresent(self.metadata, forKey: .metadata) + try container.encodeIfPresent(self.provider, forKey: .provider) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + } +} + +extension Operations.GetSearchResultsMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } + var mediaTagVersionWrapper: DecimalSerialized { + return _mediaTagVersion + } +} diff --git a/Sources/Plexswift/models/operations/GetSearchResultsMetadata.swift b/Sources/Plexswift/models/operations/GetSearchResultsMetadata.swift new file mode 100644 index 0000000..c1b1b2b --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsMetadata.swift @@ -0,0 +1,255 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsMetadata { + @DecimalSerialized + public private(set) var addedAt: Double? + public let allowSync: Bool? + public let art: String? + @DecimalSerialized + public private(set) var audienceRating: Double? + public let audienceRatingImage: String? + public let chapterSource: String? + public let contentRating: String? + public let country: [Operations.GetSearchResultsCountry]? + public let director: [Operations.GetSearchResultsDirector]? + @DecimalSerialized + public private(set) var duration: Double? + public let genre: [Operations.GetSearchResultsGenre]? + public let guid: String? + public let key: String? + @DecimalSerialized + public private(set) var librarySectionID: Double? + public let librarySectionTitle: String? + public let librarySectionUUID: String? + public let media: [Operations.GetSearchResultsMedia]? + @DateTime + public private(set) var originallyAvailableAt: Date? + public let personal: Bool? + public let primaryExtraKey: String? + @DecimalSerialized + public private(set) var rating: Double? + public let ratingImage: String? + @DecimalSerialized + public private(set) var ratingKey: Double? + public let role: [Operations.GetSearchResultsRole]? + public let sourceTitle: String? + public let studio: String? + public let summary: String? + public let tagline: String? + public let thumb: String? + public let title: String? + public let type: String? + @DecimalSerialized + public private(set) var updatedAt: Double? + public let writer: [Operations.GetSearchResultsWriter]? + @DecimalSerialized + public private(set) var year: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(addedAt: Double? = nil, allowSync: Bool? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, chapterSource: String? = nil, contentRating: String? = nil, country: [Operations.GetSearchResultsCountry]? = nil, director: [Operations.GetSearchResultsDirector]? = nil, duration: Double? = nil, genre: [Operations.GetSearchResultsGenre]? = nil, guid: String? = nil, key: String? = nil, librarySectionID: Double? = nil, librarySectionTitle: String? = nil, librarySectionUUID: String? = nil, media: [Operations.GetSearchResultsMedia]? = nil, originallyAvailableAt: Date? = nil, personal: Bool? = nil, primaryExtraKey: String? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: Double? = nil, role: [Operations.GetSearchResultsRole]? = nil, sourceTitle: String? = nil, studio: String? = nil, summary: String? = nil, tagline: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, updatedAt: Double? = nil, writer: [Operations.GetSearchResultsWriter]? = nil, year: Double? = nil) { + self._addedAt = DecimalSerialized(wrappedValue: addedAt) + self.allowSync = allowSync + self.art = art + self._audienceRating = DecimalSerialized(wrappedValue: audienceRating) + self.audienceRatingImage = audienceRatingImage + self.chapterSource = chapterSource + self.contentRating = contentRating + self.country = country + self.director = director + self._duration = DecimalSerialized(wrappedValue: duration) + self.genre = genre + self.guid = guid + self.key = key + self._librarySectionID = DecimalSerialized(wrappedValue: librarySectionID) + self.librarySectionTitle = librarySectionTitle + self.librarySectionUUID = librarySectionUUID + self.media = media + self._originallyAvailableAt = DateTime(wrappedValue: originallyAvailableAt) + self.personal = personal + self.primaryExtraKey = primaryExtraKey + self._rating = DecimalSerialized(wrappedValue: rating) + self.ratingImage = ratingImage + self._ratingKey = DecimalSerialized(wrappedValue: ratingKey) + self.role = role + self.sourceTitle = sourceTitle + self.studio = studio + self.summary = summary + self.tagline = tagline + self.thumb = thumb + self.title = title + self.type = type + self._updatedAt = DecimalSerialized(wrappedValue: updatedAt) + self.writer = writer + self._year = DecimalSerialized(wrappedValue: year) + } + } +} + +extension Operations.GetSearchResultsMetadata: Codable { + enum CodingKeys: String, CodingKey { + case addedAt + case allowSync + case art + case audienceRating + case audienceRatingImage + case chapterSource + case contentRating + case country = "Country" + case director = "Director" + case duration + case genre = "Genre" + case guid + case key + case librarySectionID + case librarySectionTitle + case librarySectionUUID + case media = "Media" + case originallyAvailableAt + case personal + case primaryExtraKey + case rating + case ratingImage + case ratingKey + case role = "Role" + case sourceTitle + case studio + case summary + case tagline + case thumb + case title + case type + case updatedAt + case writer = "Writer" + case year + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._addedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .addedAt) ?? DecimalSerialized(wrappedValue: nil) + self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync) + self.art = try container.decodeIfPresent(String.self, forKey: .art) + self._audienceRating = try container.decodeIfPresent(DecimalSerialized.self, forKey: .audienceRating) ?? DecimalSerialized(wrappedValue: nil) + self.audienceRatingImage = try container.decodeIfPresent(String.self, forKey: .audienceRatingImage) + self.chapterSource = try container.decodeIfPresent(String.self, forKey: .chapterSource) + self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating) + self.country = try container.decodeIfPresent([Operations.GetSearchResultsCountry].self, forKey: .country) + self.director = try container.decodeIfPresent([Operations.GetSearchResultsDirector].self, forKey: .director) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.genre = try container.decodeIfPresent([Operations.GetSearchResultsGenre].self, forKey: .genre) + self.guid = try container.decodeIfPresent(String.self, forKey: .guid) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self._librarySectionID = try container.decodeIfPresent(DecimalSerialized.self, forKey: .librarySectionID) ?? DecimalSerialized(wrappedValue: nil) + self.librarySectionTitle = try container.decodeIfPresent(String.self, forKey: .librarySectionTitle) + self.librarySectionUUID = try container.decodeIfPresent(String.self, forKey: .librarySectionUUID) + self.media = try container.decodeIfPresent([Operations.GetSearchResultsMedia].self, forKey: .media) + self._originallyAvailableAt = try container.decodeIfPresent(DateTime.self, forKey: .originallyAvailableAt) ?? DateTime(wrappedValue: nil) + self.personal = try container.decodeIfPresent(Bool.self, forKey: .personal) + self.primaryExtraKey = try container.decodeIfPresent(String.self, forKey: .primaryExtraKey) + self._rating = try container.decodeIfPresent(DecimalSerialized.self, forKey: .rating) ?? DecimalSerialized(wrappedValue: nil) + self.ratingImage = try container.decodeIfPresent(String.self, forKey: .ratingImage) + self._ratingKey = try container.decodeIfPresent(DecimalSerialized.self, forKey: .ratingKey) ?? DecimalSerialized(wrappedValue: nil) + self.role = try container.decodeIfPresent([Operations.GetSearchResultsRole].self, forKey: .role) + self.sourceTitle = try container.decodeIfPresent(String.self, forKey: .sourceTitle) + self.studio = try container.decodeIfPresent(String.self, forKey: .studio) + self.summary = try container.decodeIfPresent(String.self, forKey: .summary) + self.tagline = try container.decodeIfPresent(String.self, forKey: .tagline) + self.thumb = try container.decodeIfPresent(String.self, forKey: .thumb) + self.title = try container.decodeIfPresent(String.self, forKey: .title) + self.type = try container.decodeIfPresent(String.self, forKey: .type) + self._updatedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .updatedAt) ?? DecimalSerialized(wrappedValue: nil) + self.writer = try container.decodeIfPresent([Operations.GetSearchResultsWriter].self, forKey: .writer) + self._year = try container.decodeIfPresent(DecimalSerialized.self, forKey: .year) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.addedAt != nil { + try container.encode(self._addedAt, forKey: .addedAt) + } + try container.encodeIfPresent(self.allowSync, forKey: .allowSync) + try container.encodeIfPresent(self.art, forKey: .art) + if self.audienceRating != nil { + try container.encode(self._audienceRating, forKey: .audienceRating) + } + try container.encodeIfPresent(self.audienceRatingImage, forKey: .audienceRatingImage) + try container.encodeIfPresent(self.chapterSource, forKey: .chapterSource) + try container.encodeIfPresent(self.contentRating, forKey: .contentRating) + try container.encodeIfPresent(self.country, forKey: .country) + try container.encodeIfPresent(self.director, forKey: .director) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.genre, forKey: .genre) + try container.encodeIfPresent(self.guid, forKey: .guid) + try container.encodeIfPresent(self.key, forKey: .key) + if self.librarySectionID != nil { + try container.encode(self._librarySectionID, forKey: .librarySectionID) + } + try container.encodeIfPresent(self.librarySectionTitle, forKey: .librarySectionTitle) + try container.encodeIfPresent(self.librarySectionUUID, forKey: .librarySectionUUID) + try container.encodeIfPresent(self.media, forKey: .media) + if self.originallyAvailableAt != nil { + try container.encode(self._originallyAvailableAt, forKey: .originallyAvailableAt) + } + try container.encodeIfPresent(self.personal, forKey: .personal) + try container.encodeIfPresent(self.primaryExtraKey, forKey: .primaryExtraKey) + if self.rating != nil { + try container.encode(self._rating, forKey: .rating) + } + try container.encodeIfPresent(self.ratingImage, forKey: .ratingImage) + if self.ratingKey != nil { + try container.encode(self._ratingKey, forKey: .ratingKey) + } + try container.encodeIfPresent(self.role, forKey: .role) + try container.encodeIfPresent(self.sourceTitle, forKey: .sourceTitle) + try container.encodeIfPresent(self.studio, forKey: .studio) + try container.encodeIfPresent(self.summary, forKey: .summary) + try container.encodeIfPresent(self.tagline, forKey: .tagline) + try container.encodeIfPresent(self.thumb, forKey: .thumb) + try container.encodeIfPresent(self.title, forKey: .title) + try container.encodeIfPresent(self.type, forKey: .type) + if self.updatedAt != nil { + try container.encode(self._updatedAt, forKey: .updatedAt) + } + try container.encodeIfPresent(self.writer, forKey: .writer) + if self.year != nil { + try container.encode(self._year, forKey: .year) + } + } +} + +extension Operations.GetSearchResultsMetadata { + var librarySectionIDWrapper: DecimalSerialized { + return _librarySectionID + } + var ratingKeyWrapper: DecimalSerialized { + return _ratingKey + } + var ratingWrapper: DecimalSerialized { + return _rating + } + var audienceRatingWrapper: DecimalSerialized { + return _audienceRating + } + var yearWrapper: DecimalSerialized { + return _year + } + var durationWrapper: DecimalSerialized { + return _duration + } + var originallyAvailableAtWrapper: DateTime { + return _originallyAvailableAt + } + var addedAtWrapper: DecimalSerialized { + return _addedAt + } + var updatedAtWrapper: DecimalSerialized { + return _updatedAt + } +} diff --git a/Sources/Plexswift/models/operations/GetSearchResultsPart.swift b/Sources/Plexswift/models/operations/GetSearchResultsPart.swift new file mode 100644 index 0000000..491afc7 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsPart.swift @@ -0,0 +1,89 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsPart { + public let audioProfile: String? + public let container: String? + @DecimalSerialized + public private(set) var duration: Double? + public let file: String? + @DecimalSerialized + public private(set) var id: Double? + public let key: String? + @DecimalSerialized + public private(set) var size: Double? + public let videoProfile: String? + + /// Creates an object with the specified parameters + /// + /// + public init(audioProfile: String? = nil, container: String? = nil, duration: Double? = nil, file: String? = nil, id: Double? = nil, key: String? = nil, size: Double? = nil, videoProfile: String? = nil) { + self.audioProfile = audioProfile + self.container = container + self._duration = DecimalSerialized(wrappedValue: duration) + self.file = file + self._id = DecimalSerialized(wrappedValue: id) + self.key = key + self._size = DecimalSerialized(wrappedValue: size) + self.videoProfile = videoProfile + } + } +} + +extension Operations.GetSearchResultsPart: Codable { + enum CodingKeys: String, CodingKey { + case audioProfile + case container + case duration + case file + case id + case key + case size + case videoProfile + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.audioProfile = try container.decodeIfPresent(String.self, forKey: .audioProfile) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.file = try container.decodeIfPresent(String.self, forKey: .file) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + self.videoProfile = try container.decodeIfPresent(String.self, forKey: .videoProfile) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.audioProfile, forKey: .audioProfile) + try container.encodeIfPresent(self.container, forKey: .container) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.file, forKey: .file) + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + try container.encodeIfPresent(self.key, forKey: .key) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + try container.encodeIfPresent(self.videoProfile, forKey: .videoProfile) + } +} + +extension Operations.GetSearchResultsPart { + var idWrapper: DecimalSerialized { + return _id + } + var durationWrapper: DecimalSerialized { + return _duration + } + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetSearchResultsRequest.swift b/Sources/Plexswift/models/operations/GetSearchResultsRequest.swift new file mode 100644 index 0000000..2a13c28 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsRequest.swift @@ -0,0 +1,19 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsRequest: APIValue { + /// The search query string to use + public let query: String + + /// Creates an object with the specified parameters + /// + /// - Parameter query: The search query string to use + /// + public init(query: String) { + self.query = query + } + } +} diff --git a/Sources/Plexswift/models/operations/GetSearchResultsResponse.swift b/Sources/Plexswift/models/operations/GetSearchResultsResponse.swift new file mode 100644 index 0000000..1eca68c --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetSearchResultsResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetSearchResultsResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetSearchResultsSearchResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetSearchResultsResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetSearchResultsSearchResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetSearchResultsResponseBody.swift b/Sources/Plexswift/models/operations/GetSearchResultsResponseBody.swift new file mode 100644 index 0000000..66baea1 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Search Results + public struct GetSearchResultsResponseBody { + public let mediaContainer: Operations.GetSearchResultsMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetSearchResultsMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetSearchResultsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetSearchResultsRole.swift b/Sources/Plexswift/models/operations/GetSearchResultsRole.swift new file mode 100644 index 0000000..5dfffc2 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsRole.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsRole { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetSearchResultsRole: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetSearchResultsSearchResponseBody.swift b/Sources/Plexswift/models/operations/GetSearchResultsSearchResponseBody.swift new file mode 100644 index 0000000..40e1002 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsSearchResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetSearchResultsSearchResponseBody { + public let errors: [Operations.GetSearchResultsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetSearchResultsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetSearchResultsSearchResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetSearchResultsWriter.swift b/Sources/Plexswift/models/operations/GetSearchResultsWriter.swift new file mode 100644 index 0000000..bf4f813 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSearchResultsWriter.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSearchResultsWriter { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetSearchResultsWriter: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerActivitiesActivitiesResponseBody.swift b/Sources/Plexswift/models/operations/GetServerActivitiesActivitiesResponseBody.swift new file mode 100644 index 0000000..9bbed62 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerActivitiesActivitiesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetServerActivitiesActivitiesResponseBody { + public let errors: [Operations.GetServerActivitiesErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetServerActivitiesErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetServerActivitiesActivitiesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerActivitiesErrors.swift b/Sources/Plexswift/models/operations/GetServerActivitiesErrors.swift new file mode 100644 index 0000000..dcd0096 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerActivitiesErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerActivitiesErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetServerActivitiesErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetServerActivitiesErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetServerActivitiesMediaContainer.swift b/Sources/Plexswift/models/operations/GetServerActivitiesMediaContainer.swift new file mode 100644 index 0000000..67d7d9d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerActivitiesMediaContainer.swift @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerActivitiesMediaContainer { + public let activity: [Operations.Activity]? + @DecimalSerialized + public private(set) var size: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(activity: [Operations.Activity]? = nil, size: Double? = nil) { + self.activity = activity + self._size = DecimalSerialized(wrappedValue: size) + } + } +} + +extension Operations.GetServerActivitiesMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case activity = "Activity" + case size + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.activity = try container.decodeIfPresent([Operations.Activity].self, forKey: .activity) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.activity, forKey: .activity) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + } +} + +extension Operations.GetServerActivitiesMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetServerActivitiesResponse.swift b/Sources/Plexswift/models/operations/GetServerActivitiesResponse.swift new file mode 100644 index 0000000..6a1b8ef --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerActivitiesResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetServerActivitiesResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetServerActivitiesResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetServerActivitiesActivitiesResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetServerActivitiesResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetServerActivitiesActivitiesResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetServerActivitiesResponseBody.swift b/Sources/Plexswift/models/operations/GetServerActivitiesResponseBody.swift new file mode 100644 index 0000000..3cf7e26 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerActivitiesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The Server Activities + public struct GetServerActivitiesResponseBody { + public let mediaContainer: Operations.GetServerActivitiesMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetServerActivitiesMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetServerActivitiesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerCapabilitiesResponse.swift b/Sources/Plexswift/models/operations/GetServerCapabilitiesResponse.swift new file mode 100644 index 0000000..b384b7c --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerCapabilitiesResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetServerCapabilitiesResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetServerCapabilitiesResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetServerCapabilitiesServerResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetServerCapabilitiesResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetServerCapabilitiesServerResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetServerCapabilitiesResponseBody.swift b/Sources/Plexswift/models/operations/GetServerCapabilitiesResponseBody.swift new file mode 100644 index 0000000..133d381 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerCapabilitiesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The Server Capabilities + public struct GetServerCapabilitiesResponseBody { + public let mediaContainer: Operations.MediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.MediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetServerCapabilitiesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerCapabilitiesServerResponseBody.swift b/Sources/Plexswift/models/operations/GetServerCapabilitiesServerResponseBody.swift new file mode 100644 index 0000000..6c4952a --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerCapabilitiesServerResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetServerCapabilitiesServerResponseBody { + public let errors: [Operations.Errors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.Errors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetServerCapabilitiesServerResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerIdentityErrors.swift b/Sources/Plexswift/models/operations/GetServerIdentityErrors.swift new file mode 100644 index 0000000..bfdfd35 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerIdentityErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerIdentityErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetServerIdentityErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetServerIdentityErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetServerIdentityMediaContainer.swift b/Sources/Plexswift/models/operations/GetServerIdentityMediaContainer.swift new file mode 100644 index 0000000..d808206 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerIdentityMediaContainer.swift @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerIdentityMediaContainer { + public let claimed: Bool? + public let machineIdentifier: String? + @DecimalSerialized + public private(set) var size: Double? + public let version: String? + + /// Creates an object with the specified parameters + /// + /// + public init(claimed: Bool? = nil, machineIdentifier: String? = nil, size: Double? = nil, version: String? = nil) { + self.claimed = claimed + self.machineIdentifier = machineIdentifier + self._size = DecimalSerialized(wrappedValue: size) + self.version = version + } + } +} + +extension Operations.GetServerIdentityMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case claimed + case machineIdentifier + case size + case version + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.claimed = try container.decodeIfPresent(Bool.self, forKey: .claimed) + self.machineIdentifier = try container.decodeIfPresent(String.self, forKey: .machineIdentifier) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + self.version = try container.decodeIfPresent(String.self, forKey: .version) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.claimed, forKey: .claimed) + try container.encodeIfPresent(self.machineIdentifier, forKey: .machineIdentifier) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + try container.encodeIfPresent(self.version, forKey: .version) + } +} + +extension Operations.GetServerIdentityMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetServerIdentityResponse.swift b/Sources/Plexswift/models/operations/GetServerIdentityResponse.swift new file mode 100644 index 0000000..caf8943 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerIdentityResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetServerIdentityResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetServerIdentityResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetServerIdentityServerResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetServerIdentityResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetServerIdentityServerResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetServerIdentityResponseBody.swift b/Sources/Plexswift/models/operations/GetServerIdentityResponseBody.swift new file mode 100644 index 0000000..603def2 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerIdentityResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The Transcode Sessions + public struct GetServerIdentityResponseBody { + public let mediaContainer: Operations.GetServerIdentityMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetServerIdentityMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetServerIdentityResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerIdentityServerResponseBody.swift b/Sources/Plexswift/models/operations/GetServerIdentityServerResponseBody.swift new file mode 100644 index 0000000..10e9465 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerIdentityServerResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetServerIdentityServerResponseBody { + public let errors: [Operations.GetServerIdentityErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetServerIdentityErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetServerIdentityServerResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerListErrors.swift b/Sources/Plexswift/models/operations/GetServerListErrors.swift new file mode 100644 index 0000000..be79391 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerListErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerListErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetServerListErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetServerListErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetServerListMediaContainer.swift b/Sources/Plexswift/models/operations/GetServerListMediaContainer.swift new file mode 100644 index 0000000..8ea70ef --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerListMediaContainer.swift @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerListMediaContainer { + public let server: [Operations.GetServerListServer]? + @DecimalSerialized + public private(set) var size: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(server: [Operations.GetServerListServer]? = nil, size: Double? = nil) { + self.server = server + self._size = DecimalSerialized(wrappedValue: size) + } + } +} + +extension Operations.GetServerListMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case server = "Server" + case size + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.server = try container.decodeIfPresent([Operations.GetServerListServer].self, forKey: .server) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.server, forKey: .server) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + } +} + +extension Operations.GetServerListMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetServerListResponse.swift b/Sources/Plexswift/models/operations/GetServerListResponse.swift new file mode 100644 index 0000000..147ab46 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerListResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetServerListResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetServerListResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetServerListServerResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetServerListResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetServerListServerResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetServerListResponseBody.swift b/Sources/Plexswift/models/operations/GetServerListResponseBody.swift new file mode 100644 index 0000000..fee00e8 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerListResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// List of Servers + public struct GetServerListResponseBody { + public let mediaContainer: Operations.GetServerListMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetServerListMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetServerListResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerListServer.swift b/Sources/Plexswift/models/operations/GetServerListServer.swift new file mode 100644 index 0000000..321f2f3 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerListServer.swift @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerListServer { + public let address: String? + public let host: String? + public let machineIdentifier: String? + public let name: String? + @DecimalSerialized + public private(set) var port: Double? + public let version: String? + + /// Creates an object with the specified parameters + /// + /// + public init(address: String? = nil, host: String? = nil, machineIdentifier: String? = nil, name: String? = nil, port: Double? = nil, version: String? = nil) { + self.address = address + self.host = host + self.machineIdentifier = machineIdentifier + self.name = name + self._port = DecimalSerialized(wrappedValue: port) + self.version = version + } + } +} + +extension Operations.GetServerListServer: Codable { + enum CodingKeys: String, CodingKey { + case address + case host + case machineIdentifier + case name + case port + case version + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.address = try container.decodeIfPresent(String.self, forKey: .address) + self.host = try container.decodeIfPresent(String.self, forKey: .host) + self.machineIdentifier = try container.decodeIfPresent(String.self, forKey: .machineIdentifier) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self._port = try container.decodeIfPresent(DecimalSerialized.self, forKey: .port) ?? DecimalSerialized(wrappedValue: nil) + self.version = try container.decodeIfPresent(String.self, forKey: .version) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.address, forKey: .address) + try container.encodeIfPresent(self.host, forKey: .host) + try container.encodeIfPresent(self.machineIdentifier, forKey: .machineIdentifier) + try container.encodeIfPresent(self.name, forKey: .name) + if self.port != nil { + try container.encode(self._port, forKey: .port) + } + try container.encodeIfPresent(self.version, forKey: .version) + } +} + +extension Operations.GetServerListServer { + var portWrapper: DecimalSerialized { + return _port + } +} diff --git a/Sources/Plexswift/models/operations/GetServerListServerResponseBody.swift b/Sources/Plexswift/models/operations/GetServerListServerResponseBody.swift new file mode 100644 index 0000000..e593acf --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerListServerResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetServerListServerResponseBody { + public let errors: [Operations.GetServerListErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetServerListErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetServerListServerResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetServerPreferencesErrors.swift b/Sources/Plexswift/models/operations/GetServerPreferencesErrors.swift new file mode 100644 index 0000000..3515a80 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerPreferencesErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetServerPreferencesErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetServerPreferencesErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetServerPreferencesErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetServerPreferencesResponse.swift b/Sources/Plexswift/models/operations/GetServerPreferencesResponse.swift new file mode 100644 index 0000000..a924bc6 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerPreferencesResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetServerPreferencesResponse { + case empty + case object(Operations.GetServerPreferencesResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetServerPreferencesResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetServerPreferencesResponseBody.swift b/Sources/Plexswift/models/operations/GetServerPreferencesResponseBody.swift new file mode 100644 index 0000000..142ca62 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetServerPreferencesResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetServerPreferencesResponseBody { + public let errors: [Operations.GetServerPreferencesErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetServerPreferencesErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetServerPreferencesResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetSessionHistoryErrors.swift b/Sources/Plexswift/models/operations/GetSessionHistoryErrors.swift new file mode 100644 index 0000000..8105ba3 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSessionHistoryErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSessionHistoryErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetSessionHistoryErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetSessionHistoryErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetSessionHistoryResponse.swift b/Sources/Plexswift/models/operations/GetSessionHistoryResponse.swift new file mode 100644 index 0000000..64d071b --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSessionHistoryResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetSessionHistoryResponse { + case empty + case object(Operations.GetSessionHistoryResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetSessionHistoryResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetSessionHistoryResponseBody.swift b/Sources/Plexswift/models/operations/GetSessionHistoryResponseBody.swift new file mode 100644 index 0000000..fd1cabd --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSessionHistoryResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetSessionHistoryResponseBody { + public let errors: [Operations.GetSessionHistoryErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetSessionHistoryErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetSessionHistoryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetSessionsErrors.swift b/Sources/Plexswift/models/operations/GetSessionsErrors.swift new file mode 100644 index 0000000..4b2088d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSessionsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSessionsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetSessionsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetSessionsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetSessionsResponse.swift b/Sources/Plexswift/models/operations/GetSessionsResponse.swift new file mode 100644 index 0000000..f5838aa --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSessionsResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetSessionsResponse { + case empty + case object(Operations.GetSessionsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetSessionsResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetSessionsResponseBody.swift b/Sources/Plexswift/models/operations/GetSessionsResponseBody.swift new file mode 100644 index 0000000..6b45bdf --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSessionsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetSessionsResponseBody { + public let errors: [Operations.GetSessionsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetSessionsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetSessionsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetSourceConnectionInformationErrors.swift b/Sources/Plexswift/models/operations/GetSourceConnectionInformationErrors.swift new file mode 100644 index 0000000..b77a12d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSourceConnectionInformationErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSourceConnectionInformationErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetSourceConnectionInformationErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetSourceConnectionInformationErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetSourceConnectionInformationRequest.swift b/Sources/Plexswift/models/operations/GetSourceConnectionInformationRequest.swift new file mode 100644 index 0000000..4a7e7a6 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSourceConnectionInformationRequest.swift @@ -0,0 +1,19 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetSourceConnectionInformationRequest: APIValue { + /// The source identifier with an included prefix. + public let source: String + + /// Creates an object with the specified parameters + /// + /// - Parameter source: The source identifier with an included prefix. + /// + public init(source: String) { + self.source = source + } + } +} diff --git a/Sources/Plexswift/models/operations/GetSourceConnectionInformationResponse.swift b/Sources/Plexswift/models/operations/GetSourceConnectionInformationResponse.swift new file mode 100644 index 0000000..6cec0aa --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSourceConnectionInformationResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetSourceConnectionInformationResponse { + case empty + case object(Operations.GetSourceConnectionInformationResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetSourceConnectionInformationResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetSourceConnectionInformationResponseBody.swift b/Sources/Plexswift/models/operations/GetSourceConnectionInformationResponseBody.swift new file mode 100644 index 0000000..706d652 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetSourceConnectionInformationResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetSourceConnectionInformationResponseBody { + public let errors: [Operations.GetSourceConnectionInformationErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetSourceConnectionInformationErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetSourceConnectionInformationResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetTimelineErrors.swift b/Sources/Plexswift/models/operations/GetTimelineErrors.swift new file mode 100644 index 0000000..c213d45 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTimelineErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetTimelineErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetTimelineErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetTimelineErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetTimelineRequest.swift b/Sources/Plexswift/models/operations/GetTimelineRequest.swift new file mode 100644 index 0000000..9e93abb --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTimelineRequest.swift @@ -0,0 +1,85 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetTimelineRequest: APIValue { + /// The context of the media item + public let context: String + /// The duration of the media item + @DecimalSerialized + public private(set) var duration: Double + /// Whether the media item has MDE + @DecimalSerialized + public private(set) var hasMDE: Double + /// The key of the media item to get the timeline for + public let key: String + /// The playback time of the media item + @DecimalSerialized + public private(set) var playBackTime: Double + /// The play queue item ID of the media item + @DecimalSerialized + public private(set) var playQueueItemID: Double + /// The rating key of the media item + @DecimalSerialized + public private(set) var ratingKey: Double + /// The row of the media item + @DecimalSerialized + public private(set) var row: Double + /// The state of the media item + public let state: Operations.State + /// The time of the media item + @DecimalSerialized + public private(set) var time: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter context: The context of the media item + /// - Parameter duration: The duration of the media item + /// - Parameter hasMDE: Whether the media item has MDE + /// - Parameter key: The key of the media item to get the timeline for + /// - Parameter playBackTime: The playback time of the media item + /// - Parameter playQueueItemID: The play queue item ID of the media item + /// - Parameter ratingKey: The rating key of the media item + /// - Parameter row: The row of the media item + /// - Parameter state: The state of the media item + /// - Parameter time: The time of the media item + /// + public init(context: String, duration: Double, hasMDE: Double, key: String, playBackTime: Double, playQueueItemID: Double, ratingKey: Double, row: Double, state: Operations.State, time: Double) { + self.context = context + self._duration = DecimalSerialized(wrappedValue: duration) + self._hasMDE = DecimalSerialized(wrappedValue: hasMDE) + self.key = key + self._playBackTime = DecimalSerialized(wrappedValue: playBackTime) + self._playQueueItemID = DecimalSerialized(wrappedValue: playQueueItemID) + self._ratingKey = DecimalSerialized(wrappedValue: ratingKey) + self._row = DecimalSerialized(wrappedValue: row) + self.state = state + self._time = DecimalSerialized(wrappedValue: time) + } + } +} +extension Operations.GetTimelineRequest { + var ratingKeyWrapper: DecimalSerialized { + return _ratingKey + } + var hasMDEWrapper: DecimalSerialized { + return _hasMDE + } + var timeWrapper: DecimalSerialized { + return _time + } + var durationWrapper: DecimalSerialized { + return _duration + } + var playQueueItemIDWrapper: DecimalSerialized { + return _playQueueItemID + } + var playBackTimeWrapper: DecimalSerialized { + return _playBackTime + } + var rowWrapper: DecimalSerialized { + return _row + } +} diff --git a/Sources/Plexswift/models/operations/GetTimelineResponse.swift b/Sources/Plexswift/models/operations/GetTimelineResponse.swift new file mode 100644 index 0000000..a42b52c --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTimelineResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetTimelineResponse { + case empty + case object(Operations.GetTimelineResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetTimelineResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetTimelineResponseBody.swift b/Sources/Plexswift/models/operations/GetTimelineResponseBody.swift new file mode 100644 index 0000000..c1b26b7 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTimelineResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetTimelineResponseBody { + public let errors: [Operations.GetTimelineErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetTimelineErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetTimelineResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetTranscodeSessionsErrors.swift b/Sources/Plexswift/models/operations/GetTranscodeSessionsErrors.swift new file mode 100644 index 0000000..b113f60 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTranscodeSessionsErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetTranscodeSessionsErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetTranscodeSessionsErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetTranscodeSessionsErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetTranscodeSessionsMediaContainer.swift b/Sources/Plexswift/models/operations/GetTranscodeSessionsMediaContainer.swift new file mode 100644 index 0000000..eb3f606 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTranscodeSessionsMediaContainer.swift @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetTranscodeSessionsMediaContainer { + @DecimalSerialized + public private(set) var size: Double? + public let transcodeSession: [Operations.TranscodeSession]? + + /// Creates an object with the specified parameters + /// + /// + public init(size: Double? = nil, transcodeSession: [Operations.TranscodeSession]? = nil) { + self._size = DecimalSerialized(wrappedValue: size) + self.transcodeSession = transcodeSession + } + } +} + +extension Operations.GetTranscodeSessionsMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case size + case transcodeSession = "TranscodeSession" + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + self.transcodeSession = try container.decodeIfPresent([Operations.TranscodeSession].self, forKey: .transcodeSession) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + try container.encodeIfPresent(self.transcodeSession, forKey: .transcodeSession) + } +} + +extension Operations.GetTranscodeSessionsMediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } +} diff --git a/Sources/Plexswift/models/operations/GetTranscodeSessionsResponse.swift b/Sources/Plexswift/models/operations/GetTranscodeSessionsResponse.swift new file mode 100644 index 0000000..f1e84bd --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTranscodeSessionsResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetTranscodeSessionsResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetTranscodeSessionsResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetTranscodeSessionsSessionsResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetTranscodeSessionsResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetTranscodeSessionsSessionsResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetTranscodeSessionsResponseBody.swift b/Sources/Plexswift/models/operations/GetTranscodeSessionsResponseBody.swift new file mode 100644 index 0000000..c24b6bc --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTranscodeSessionsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The Transcode Sessions + public struct GetTranscodeSessionsResponseBody { + public let mediaContainer: Operations.GetTranscodeSessionsMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetTranscodeSessionsMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetTranscodeSessionsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetTranscodeSessionsSessionsResponseBody.swift b/Sources/Plexswift/models/operations/GetTranscodeSessionsSessionsResponseBody.swift new file mode 100644 index 0000000..70ddee1 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTranscodeSessionsSessionsResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetTranscodeSessionsSessionsResponseBody { + public let errors: [Operations.GetTranscodeSessionsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetTranscodeSessionsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetTranscodeSessionsSessionsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetTransientTokenErrors.swift b/Sources/Plexswift/models/operations/GetTransientTokenErrors.swift new file mode 100644 index 0000000..6919294 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTransientTokenErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetTransientTokenErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetTransientTokenErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetTransientTokenErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetTransientTokenRequest.swift b/Sources/Plexswift/models/operations/GetTransientTokenRequest.swift new file mode 100644 index 0000000..b94bde5 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTransientTokenRequest.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetTransientTokenRequest: APIValue { + /// `all` - This is the only supported `scope` parameter. + public let scope: Operations.Scope + /// `delegation` - This is the only supported `type` parameter. + public let type: Operations.QueryParamType + + /// Creates an object with the specified parameters + /// + /// - Parameter scope: `all` - This is the only supported `scope` parameter. + /// - Parameter type: `delegation` - This is the only supported `type` parameter. + /// + public init(scope: Operations.Scope, type: Operations.QueryParamType) { + self.scope = scope + self.type = type + } + } +} diff --git a/Sources/Plexswift/models/operations/GetTransientTokenResponse.swift b/Sources/Plexswift/models/operations/GetTransientTokenResponse.swift new file mode 100644 index 0000000..91c3c4d --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTransientTokenResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetTransientTokenResponse { + case empty + case object(Operations.GetTransientTokenResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetTransientTokenResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetTransientTokenResponseBody.swift b/Sources/Plexswift/models/operations/GetTransientTokenResponseBody.swift new file mode 100644 index 0000000..ac7797b --- /dev/null +++ b/Sources/Plexswift/models/operations/GetTransientTokenResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetTransientTokenResponseBody { + public let errors: [Operations.GetTransientTokenErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetTransientTokenErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetTransientTokenResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetUpdateStatusErrors.swift b/Sources/Plexswift/models/operations/GetUpdateStatusErrors.swift new file mode 100644 index 0000000..43c9a30 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetUpdateStatusErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetUpdateStatusErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.GetUpdateStatusErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.GetUpdateStatusErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/GetUpdateStatusResponse.swift b/Sources/Plexswift/models/operations/GetUpdateStatusResponse.swift new file mode 100644 index 0000000..3fa4ff3 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetUpdateStatusResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetUpdateStatusResponse { + case empty + case object(Operations.GetUpdateStatusResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.GetUpdateStatusResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/GetUpdateStatusResponseBody.swift b/Sources/Plexswift/models/operations/GetUpdateStatusResponseBody.swift new file mode 100644 index 0000000..be51488 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetUpdateStatusResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct GetUpdateStatusResponseBody { + public let errors: [Operations.GetUpdateStatusErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetUpdateStatusErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetUpdateStatusResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/Guids.swift b/Sources/Plexswift/models/operations/Guids.swift new file mode 100644 index 0000000..c9a3baa --- /dev/null +++ b/Sources/Plexswift/models/operations/Guids.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Guids { + public let id: String? + + /// Creates an object with the specified parameters + /// + /// + public init(id: String? = nil) { + self.id = id + } + } +} + +extension Operations.Guids: Codable { + enum CodingKeys: String, CodingKey { + case id + } +} + diff --git a/Sources/Plexswift/models/operations/IncludeDetails.swift b/Sources/Plexswift/models/operations/IncludeDetails.swift new file mode 100644 index 0000000..69028e1 --- /dev/null +++ b/Sources/Plexswift/models/operations/IncludeDetails.swift @@ -0,0 +1,13 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Whether or not to include details for a section (types, filters, and sorts). + /// Only exists for backwards compatibility, media providers other than the server libraries have it on always. + /// + public enum IncludeDetails: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/Level.swift b/Sources/Plexswift/models/operations/Level.swift new file mode 100644 index 0000000..ec67ffc --- /dev/null +++ b/Sources/Plexswift/models/operations/Level.swift @@ -0,0 +1,20 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// An integer log level to write to the PMS log with. + /// 0: Error + /// 1: Warning + /// 2: Info + /// 3: Debug + /// 4: Verbose + /// + public enum Level: Int, Codable, APIValue { + case zero = 0 + case one = 1 + case two = 2 + case three = 3 + case four = 4 + } +} diff --git a/Sources/Plexswift/models/operations/LogLineErrors.swift b/Sources/Plexswift/models/operations/LogLineErrors.swift new file mode 100644 index 0000000..0d83670 --- /dev/null +++ b/Sources/Plexswift/models/operations/LogLineErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct LogLineErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.LogLineErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.LogLineErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/LogLineRequest.swift b/Sources/Plexswift/models/operations/LogLineRequest.swift new file mode 100644 index 0000000..873777a --- /dev/null +++ b/Sources/Plexswift/models/operations/LogLineRequest.swift @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct LogLineRequest: APIValue { + /// An integer log level to write to the PMS log with. + /// 0: Error + /// 1: Warning + /// 2: Info + /// 3: Debug + /// 4: Verbose + /// + public let level: Operations.Level + /// The text of the message to write to the log. + public let message: String + /// a string indicating the source of the message. + public let source: String + + /// Creates an object with the specified parameters + /// + /// - Parameter level: An integer log level to write to the PMS log with. + /// 0: Error + /// 1: Warning + /// 2: Info + /// 3: Debug + /// 4: Verbose + /// + /// - Parameter message: The text of the message to write to the log. + /// - Parameter source: a string indicating the source of the message. + /// + public init(level: Operations.Level, message: String, source: String) { + self.level = level + self.message = message + self.source = source + } + } +} diff --git a/Sources/Plexswift/models/operations/LogLineResponse.swift b/Sources/Plexswift/models/operations/LogLineResponse.swift new file mode 100644 index 0000000..782d67d --- /dev/null +++ b/Sources/Plexswift/models/operations/LogLineResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum LogLineResponse { + case empty + case object(Operations.LogLineResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.LogLineResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/LogLineResponseBody.swift b/Sources/Plexswift/models/operations/LogLineResponseBody.swift new file mode 100644 index 0000000..4e5e42d --- /dev/null +++ b/Sources/Plexswift/models/operations/LogLineResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct LogLineResponseBody { + public let errors: [Operations.LogLineErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.LogLineErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.LogLineResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/LogMultiLineErrors.swift b/Sources/Plexswift/models/operations/LogMultiLineErrors.swift new file mode 100644 index 0000000..ca82867 --- /dev/null +++ b/Sources/Plexswift/models/operations/LogMultiLineErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct LogMultiLineErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.LogMultiLineErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.LogMultiLineErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/LogMultiLineResponse.swift b/Sources/Plexswift/models/operations/LogMultiLineResponse.swift new file mode 100644 index 0000000..c5cde35 --- /dev/null +++ b/Sources/Plexswift/models/operations/LogMultiLineResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum LogMultiLineResponse { + case empty + case object(Operations.LogMultiLineResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.LogMultiLineResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/LogMultiLineResponseBody.swift b/Sources/Plexswift/models/operations/LogMultiLineResponseBody.swift new file mode 100644 index 0000000..e327f79 --- /dev/null +++ b/Sources/Plexswift/models/operations/LogMultiLineResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct LogMultiLineResponseBody { + public let errors: [Operations.LogMultiLineErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.LogMultiLineErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.LogMultiLineResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/MarkPlayedErrors.swift b/Sources/Plexswift/models/operations/MarkPlayedErrors.swift new file mode 100644 index 0000000..7083c37 --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkPlayedErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct MarkPlayedErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.MarkPlayedErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.MarkPlayedErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/MarkPlayedRequest.swift b/Sources/Plexswift/models/operations/MarkPlayedRequest.swift new file mode 100644 index 0000000..8875081 --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkPlayedRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct MarkPlayedRequest: APIValue { + /// The media key to mark as played + @DecimalSerialized + public private(set) var key: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter key: The media key to mark as played + /// + public init(key: Double) { + self._key = DecimalSerialized(wrappedValue: key) + } + } +} +extension Operations.MarkPlayedRequest { + var keyWrapper: DecimalSerialized { + return _key + } +} diff --git a/Sources/Plexswift/models/operations/MarkPlayedResponse.swift b/Sources/Plexswift/models/operations/MarkPlayedResponse.swift new file mode 100644 index 0000000..ecbd04d --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkPlayedResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum MarkPlayedResponse { + case empty + case object(Operations.MarkPlayedResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.MarkPlayedResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/MarkPlayedResponseBody.swift b/Sources/Plexswift/models/operations/MarkPlayedResponseBody.swift new file mode 100644 index 0000000..3ea9060 --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkPlayedResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct MarkPlayedResponseBody { + public let errors: [Operations.MarkPlayedErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.MarkPlayedErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.MarkPlayedResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/MarkUnplayedErrors.swift b/Sources/Plexswift/models/operations/MarkUnplayedErrors.swift new file mode 100644 index 0000000..c857183 --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkUnplayedErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct MarkUnplayedErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.MarkUnplayedErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.MarkUnplayedErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/MarkUnplayedRequest.swift b/Sources/Plexswift/models/operations/MarkUnplayedRequest.swift new file mode 100644 index 0000000..07bf400 --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkUnplayedRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct MarkUnplayedRequest: APIValue { + /// The media key to mark as Unplayed + @DecimalSerialized + public private(set) var key: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter key: The media key to mark as Unplayed + /// + public init(key: Double) { + self._key = DecimalSerialized(wrappedValue: key) + } + } +} +extension Operations.MarkUnplayedRequest { + var keyWrapper: DecimalSerialized { + return _key + } +} diff --git a/Sources/Plexswift/models/operations/MarkUnplayedResponse.swift b/Sources/Plexswift/models/operations/MarkUnplayedResponse.swift new file mode 100644 index 0000000..6891038 --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkUnplayedResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum MarkUnplayedResponse { + case empty + case object(Operations.MarkUnplayedResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.MarkUnplayedResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/MarkUnplayedResponseBody.swift b/Sources/Plexswift/models/operations/MarkUnplayedResponseBody.swift new file mode 100644 index 0000000..e7f9c08 --- /dev/null +++ b/Sources/Plexswift/models/operations/MarkUnplayedResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct MarkUnplayedResponseBody { + public let errors: [Operations.MarkUnplayedErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.MarkUnplayedErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.MarkUnplayedResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/Media.swift b/Sources/Plexswift/models/operations/Media.swift new file mode 100644 index 0000000..c24b1d4 --- /dev/null +++ b/Sources/Plexswift/models/operations/Media.swift @@ -0,0 +1,165 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Media { + @DecimalSerialized + public private(set) var aspectRatio: Double? + @DecimalSerialized + public private(set) var audioChannels: Double? + public let audioCodec: String? + @DecimalSerialized + public private(set) var bitrate: Double? + public let container: String? + @DecimalSerialized + public private(set) var duration: Double? + public let has64bitOffsets: Bool? + @DecimalSerialized + public private(set) var height: Double? + @DecimalSerialized + public private(set) var id: Double? + @DecimalSerialized + public private(set) var optimizedForStreaming: Double? + public let part: [Operations.Part]? + public let videoCodec: String? + public let videoFrameRate: String? + public let videoProfile: String? + @DecimalSerialized + public private(set) var videoResolution: Double? + @DecimalSerialized + public private(set) var width: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(aspectRatio: Double? = nil, audioChannels: Double? = nil, audioCodec: String? = nil, bitrate: Double? = nil, container: String? = nil, duration: Double? = nil, has64bitOffsets: Bool? = nil, height: Double? = nil, id: Double? = nil, optimizedForStreaming: Double? = nil, part: [Operations.Part]? = nil, videoCodec: String? = nil, videoFrameRate: String? = nil, videoProfile: String? = nil, videoResolution: Double? = nil, width: Double? = nil) { + self._aspectRatio = DecimalSerialized(wrappedValue: aspectRatio) + self._audioChannels = DecimalSerialized(wrappedValue: audioChannels) + self.audioCodec = audioCodec + self._bitrate = DecimalSerialized(wrappedValue: bitrate) + self.container = container + self._duration = DecimalSerialized(wrappedValue: duration) + self.has64bitOffsets = has64bitOffsets + self._height = DecimalSerialized(wrappedValue: height) + self._id = DecimalSerialized(wrappedValue: id) + self._optimizedForStreaming = DecimalSerialized(wrappedValue: optimizedForStreaming) + self.part = part + self.videoCodec = videoCodec + self.videoFrameRate = videoFrameRate + self.videoProfile = videoProfile + self._videoResolution = DecimalSerialized(wrappedValue: videoResolution) + self._width = DecimalSerialized(wrappedValue: width) + } + } +} + +extension Operations.Media: Codable { + enum CodingKeys: String, CodingKey { + case aspectRatio + case audioChannels + case audioCodec + case bitrate + case container + case duration + case has64bitOffsets + case height + case id + case optimizedForStreaming + case part = "Part" + case videoCodec + case videoFrameRate + case videoProfile + case videoResolution + case width + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._aspectRatio = try container.decodeIfPresent(DecimalSerialized.self, forKey: .aspectRatio) ?? DecimalSerialized(wrappedValue: nil) + self._audioChannels = try container.decodeIfPresent(DecimalSerialized.self, forKey: .audioChannels) ?? DecimalSerialized(wrappedValue: nil) + self.audioCodec = try container.decodeIfPresent(String.self, forKey: .audioCodec) + self._bitrate = try container.decodeIfPresent(DecimalSerialized.self, forKey: .bitrate) ?? DecimalSerialized(wrappedValue: nil) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.has64bitOffsets = try container.decodeIfPresent(Bool.self, forKey: .has64bitOffsets) + self._height = try container.decodeIfPresent(DecimalSerialized.self, forKey: .height) ?? DecimalSerialized(wrappedValue: nil) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self._optimizedForStreaming = try container.decodeIfPresent(DecimalSerialized.self, forKey: .optimizedForStreaming) ?? DecimalSerialized(wrappedValue: nil) + self.part = try container.decodeIfPresent([Operations.Part].self, forKey: .part) + self.videoCodec = try container.decodeIfPresent(String.self, forKey: .videoCodec) + self.videoFrameRate = try container.decodeIfPresent(String.self, forKey: .videoFrameRate) + self.videoProfile = try container.decodeIfPresent(String.self, forKey: .videoProfile) + self._videoResolution = try container.decodeIfPresent(DecimalSerialized.self, forKey: .videoResolution) ?? DecimalSerialized(wrappedValue: nil) + self._width = try container.decodeIfPresent(DecimalSerialized.self, forKey: .width) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.aspectRatio != nil { + try container.encode(self._aspectRatio, forKey: .aspectRatio) + } + if self.audioChannels != nil { + try container.encode(self._audioChannels, forKey: .audioChannels) + } + try container.encodeIfPresent(self.audioCodec, forKey: .audioCodec) + if self.bitrate != nil { + try container.encode(self._bitrate, forKey: .bitrate) + } + try container.encodeIfPresent(self.container, forKey: .container) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.has64bitOffsets, forKey: .has64bitOffsets) + if self.height != nil { + try container.encode(self._height, forKey: .height) + } + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + if self.optimizedForStreaming != nil { + try container.encode(self._optimizedForStreaming, forKey: .optimizedForStreaming) + } + try container.encodeIfPresent(self.part, forKey: .part) + try container.encodeIfPresent(self.videoCodec, forKey: .videoCodec) + try container.encodeIfPresent(self.videoFrameRate, forKey: .videoFrameRate) + try container.encodeIfPresent(self.videoProfile, forKey: .videoProfile) + if self.videoResolution != nil { + try container.encode(self._videoResolution, forKey: .videoResolution) + } + if self.width != nil { + try container.encode(self._width, forKey: .width) + } + } +} + +extension Operations.Media { + var idWrapper: DecimalSerialized { + return _id + } + var durationWrapper: DecimalSerialized { + return _duration + } + var bitrateWrapper: DecimalSerialized { + return _bitrate + } + var widthWrapper: DecimalSerialized { + return _width + } + var heightWrapper: DecimalSerialized { + return _height + } + var aspectRatioWrapper: DecimalSerialized { + return _aspectRatio + } + var audioChannelsWrapper: DecimalSerialized { + return _audioChannels + } + var videoResolutionWrapper: DecimalSerialized { + return _videoResolution + } + var optimizedForStreamingWrapper: DecimalSerialized { + return _optimizedForStreaming + } +} diff --git a/Sources/Plexswift/models/operations/MediaContainer.swift b/Sources/Plexswift/models/operations/MediaContainer.swift new file mode 100644 index 0000000..ad83387 --- /dev/null +++ b/Sources/Plexswift/models/operations/MediaContainer.swift @@ -0,0 +1,334 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct MediaContainer { + public let allowCameraUpload: Bool? + public let allowChannelAccess: Bool? + public let allowMediaDeletion: Bool? + public let allowSharing: Bool? + public let allowSync: Bool? + public let allowTuners: Bool? + public let backgroundProcessing: Bool? + public let certificate: Bool? + public let companionProxy: Bool? + public let countryCode: String? + public let diagnostics: String? + public let directory: [Operations.Directory]? + public let eventStream: Bool? + public let friendlyName: String? + public let hubSearch: Bool? + public let itemClusters: Bool? + @DecimalSerialized + public private(set) var livetv: Double? + public let machineIdentifier: String? + public let mediaProviders: Bool? + public let multiuser: Bool? + @DecimalSerialized + public private(set) var musicAnalysis: Double? + public let myPlex: Bool? + public let myPlexMappingState: String? + public let myPlexSigninState: String? + public let myPlexSubscription: Bool? + public let myPlexUsername: String? + @DecimalSerialized + public private(set) var offlineTranscode: Double? + public let ownerFeatures: String? + public let photoAutoTag: Bool? + public let platform: String? + public let platformVersion: String? + public let pluginHost: Bool? + public let pushNotifications: Bool? + public let readOnlyLibraries: Bool? + @DecimalSerialized + public private(set) var size: Double? + @DecimalSerialized + public private(set) var streamingBrainABRVersion: Double? + @DecimalSerialized + public private(set) var streamingBrainVersion: Double? + public let sync: Bool? + @DecimalSerialized + public private(set) var transcoderActiveVideoSessions: Double? + public let transcoderAudio: Bool? + public let transcoderLyrics: Bool? + public let transcoderPhoto: Bool? + public let transcoderSubtitles: Bool? + public let transcoderVideo: Bool? + public let transcoderVideoBitrates: String? + public let transcoderVideoQualities: String? + public let transcoderVideoResolutions: String? + @DecimalSerialized + public private(set) var updatedAt: Double? + public let updater: Bool? + public let version: String? + public let voiceSearch: Bool? + + /// Creates an object with the specified parameters + /// + /// + public init(allowCameraUpload: Bool? = nil, allowChannelAccess: Bool? = nil, allowMediaDeletion: Bool? = nil, allowSharing: Bool? = nil, allowSync: Bool? = nil, allowTuners: Bool? = nil, backgroundProcessing: Bool? = nil, certificate: Bool? = nil, companionProxy: Bool? = nil, countryCode: String? = nil, diagnostics: String? = nil, directory: [Operations.Directory]? = nil, eventStream: Bool? = nil, friendlyName: String? = nil, hubSearch: Bool? = nil, itemClusters: Bool? = nil, livetv: Double? = nil, machineIdentifier: String? = nil, mediaProviders: Bool? = nil, multiuser: Bool? = nil, musicAnalysis: Double? = nil, myPlex: Bool? = nil, myPlexMappingState: String? = nil, myPlexSigninState: String? = nil, myPlexSubscription: Bool? = nil, myPlexUsername: String? = nil, offlineTranscode: Double? = nil, ownerFeatures: String? = nil, photoAutoTag: Bool? = nil, platform: String? = nil, platformVersion: String? = nil, pluginHost: Bool? = nil, pushNotifications: Bool? = nil, readOnlyLibraries: Bool? = nil, size: Double? = nil, streamingBrainABRVersion: Double? = nil, streamingBrainVersion: Double? = nil, sync: Bool? = nil, transcoderActiveVideoSessions: Double? = nil, transcoderAudio: Bool? = nil, transcoderLyrics: Bool? = nil, transcoderPhoto: Bool? = nil, transcoderSubtitles: Bool? = nil, transcoderVideo: Bool? = nil, transcoderVideoBitrates: String? = nil, transcoderVideoQualities: String? = nil, transcoderVideoResolutions: String? = nil, updatedAt: Double? = nil, updater: Bool? = nil, version: String? = nil, voiceSearch: Bool? = nil) { + self.allowCameraUpload = allowCameraUpload + self.allowChannelAccess = allowChannelAccess + self.allowMediaDeletion = allowMediaDeletion + self.allowSharing = allowSharing + self.allowSync = allowSync + self.allowTuners = allowTuners + self.backgroundProcessing = backgroundProcessing + self.certificate = certificate + self.companionProxy = companionProxy + self.countryCode = countryCode + self.diagnostics = diagnostics + self.directory = directory + self.eventStream = eventStream + self.friendlyName = friendlyName + self.hubSearch = hubSearch + self.itemClusters = itemClusters + self._livetv = DecimalSerialized(wrappedValue: livetv) + self.machineIdentifier = machineIdentifier + self.mediaProviders = mediaProviders + self.multiuser = multiuser + self._musicAnalysis = DecimalSerialized(wrappedValue: musicAnalysis) + self.myPlex = myPlex + self.myPlexMappingState = myPlexMappingState + self.myPlexSigninState = myPlexSigninState + self.myPlexSubscription = myPlexSubscription + self.myPlexUsername = myPlexUsername + self._offlineTranscode = DecimalSerialized(wrappedValue: offlineTranscode) + self.ownerFeatures = ownerFeatures + self.photoAutoTag = photoAutoTag + self.platform = platform + self.platformVersion = platformVersion + self.pluginHost = pluginHost + self.pushNotifications = pushNotifications + self.readOnlyLibraries = readOnlyLibraries + self._size = DecimalSerialized(wrappedValue: size) + self._streamingBrainABRVersion = DecimalSerialized(wrappedValue: streamingBrainABRVersion) + self._streamingBrainVersion = DecimalSerialized(wrappedValue: streamingBrainVersion) + self.sync = sync + self._transcoderActiveVideoSessions = DecimalSerialized(wrappedValue: transcoderActiveVideoSessions) + self.transcoderAudio = transcoderAudio + self.transcoderLyrics = transcoderLyrics + self.transcoderPhoto = transcoderPhoto + self.transcoderSubtitles = transcoderSubtitles + self.transcoderVideo = transcoderVideo + self.transcoderVideoBitrates = transcoderVideoBitrates + self.transcoderVideoQualities = transcoderVideoQualities + self.transcoderVideoResolutions = transcoderVideoResolutions + self._updatedAt = DecimalSerialized(wrappedValue: updatedAt) + self.updater = updater + self.version = version + self.voiceSearch = voiceSearch + } + } +} + +extension Operations.MediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case allowCameraUpload + case allowChannelAccess + case allowMediaDeletion + case allowSharing + case allowSync + case allowTuners + case backgroundProcessing + case certificate + case companionProxy + case countryCode + case diagnostics + case directory = "Directory" + case eventStream + case friendlyName + case hubSearch + case itemClusters + case livetv + case machineIdentifier + case mediaProviders + case multiuser + case musicAnalysis + case myPlex + case myPlexMappingState + case myPlexSigninState + case myPlexSubscription + case myPlexUsername + case offlineTranscode + case ownerFeatures + case photoAutoTag + case platform + case platformVersion + case pluginHost + case pushNotifications + case readOnlyLibraries + case size + case streamingBrainABRVersion + case streamingBrainVersion + case sync + case transcoderActiveVideoSessions + case transcoderAudio + case transcoderLyrics + case transcoderPhoto + case transcoderSubtitles + case transcoderVideo + case transcoderVideoBitrates + case transcoderVideoQualities + case transcoderVideoResolutions + case updatedAt + case updater + case version + case voiceSearch + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.allowCameraUpload = try container.decodeIfPresent(Bool.self, forKey: .allowCameraUpload) + self.allowChannelAccess = try container.decodeIfPresent(Bool.self, forKey: .allowChannelAccess) + self.allowMediaDeletion = try container.decodeIfPresent(Bool.self, forKey: .allowMediaDeletion) + self.allowSharing = try container.decodeIfPresent(Bool.self, forKey: .allowSharing) + self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync) + self.allowTuners = try container.decodeIfPresent(Bool.self, forKey: .allowTuners) + self.backgroundProcessing = try container.decodeIfPresent(Bool.self, forKey: .backgroundProcessing) + self.certificate = try container.decodeIfPresent(Bool.self, forKey: .certificate) + self.companionProxy = try container.decodeIfPresent(Bool.self, forKey: .companionProxy) + self.countryCode = try container.decodeIfPresent(String.self, forKey: .countryCode) + self.diagnostics = try container.decodeIfPresent(String.self, forKey: .diagnostics) + self.directory = try container.decodeIfPresent([Operations.Directory].self, forKey: .directory) + self.eventStream = try container.decodeIfPresent(Bool.self, forKey: .eventStream) + self.friendlyName = try container.decodeIfPresent(String.self, forKey: .friendlyName) + self.hubSearch = try container.decodeIfPresent(Bool.self, forKey: .hubSearch) + self.itemClusters = try container.decodeIfPresent(Bool.self, forKey: .itemClusters) + self._livetv = try container.decodeIfPresent(DecimalSerialized.self, forKey: .livetv) ?? DecimalSerialized(wrappedValue: nil) + self.machineIdentifier = try container.decodeIfPresent(String.self, forKey: .machineIdentifier) + self.mediaProviders = try container.decodeIfPresent(Bool.self, forKey: .mediaProviders) + self.multiuser = try container.decodeIfPresent(Bool.self, forKey: .multiuser) + self._musicAnalysis = try container.decodeIfPresent(DecimalSerialized.self, forKey: .musicAnalysis) ?? DecimalSerialized(wrappedValue: nil) + self.myPlex = try container.decodeIfPresent(Bool.self, forKey: .myPlex) + self.myPlexMappingState = try container.decodeIfPresent(String.self, forKey: .myPlexMappingState) + self.myPlexSigninState = try container.decodeIfPresent(String.self, forKey: .myPlexSigninState) + self.myPlexSubscription = try container.decodeIfPresent(Bool.self, forKey: .myPlexSubscription) + self.myPlexUsername = try container.decodeIfPresent(String.self, forKey: .myPlexUsername) + self._offlineTranscode = try container.decodeIfPresent(DecimalSerialized.self, forKey: .offlineTranscode) ?? DecimalSerialized(wrappedValue: nil) + self.ownerFeatures = try container.decodeIfPresent(String.self, forKey: .ownerFeatures) + self.photoAutoTag = try container.decodeIfPresent(Bool.self, forKey: .photoAutoTag) + self.platform = try container.decodeIfPresent(String.self, forKey: .platform) + self.platformVersion = try container.decodeIfPresent(String.self, forKey: .platformVersion) + self.pluginHost = try container.decodeIfPresent(Bool.self, forKey: .pluginHost) + self.pushNotifications = try container.decodeIfPresent(Bool.self, forKey: .pushNotifications) + self.readOnlyLibraries = try container.decodeIfPresent(Bool.self, forKey: .readOnlyLibraries) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + self._streamingBrainABRVersion = try container.decodeIfPresent(DecimalSerialized.self, forKey: .streamingBrainABRVersion) ?? DecimalSerialized(wrappedValue: nil) + self._streamingBrainVersion = try container.decodeIfPresent(DecimalSerialized.self, forKey: .streamingBrainVersion) ?? DecimalSerialized(wrappedValue: nil) + self.sync = try container.decodeIfPresent(Bool.self, forKey: .sync) + self._transcoderActiveVideoSessions = try container.decodeIfPresent(DecimalSerialized.self, forKey: .transcoderActiveVideoSessions) ?? DecimalSerialized(wrappedValue: nil) + self.transcoderAudio = try container.decodeIfPresent(Bool.self, forKey: .transcoderAudio) + self.transcoderLyrics = try container.decodeIfPresent(Bool.self, forKey: .transcoderLyrics) + self.transcoderPhoto = try container.decodeIfPresent(Bool.self, forKey: .transcoderPhoto) + self.transcoderSubtitles = try container.decodeIfPresent(Bool.self, forKey: .transcoderSubtitles) + self.transcoderVideo = try container.decodeIfPresent(Bool.self, forKey: .transcoderVideo) + self.transcoderVideoBitrates = try container.decodeIfPresent(String.self, forKey: .transcoderVideoBitrates) + self.transcoderVideoQualities = try container.decodeIfPresent(String.self, forKey: .transcoderVideoQualities) + self.transcoderVideoResolutions = try container.decodeIfPresent(String.self, forKey: .transcoderVideoResolutions) + self._updatedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .updatedAt) ?? DecimalSerialized(wrappedValue: nil) + self.updater = try container.decodeIfPresent(Bool.self, forKey: .updater) + self.version = try container.decodeIfPresent(String.self, forKey: .version) + self.voiceSearch = try container.decodeIfPresent(Bool.self, forKey: .voiceSearch) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.allowCameraUpload, forKey: .allowCameraUpload) + try container.encodeIfPresent(self.allowChannelAccess, forKey: .allowChannelAccess) + try container.encodeIfPresent(self.allowMediaDeletion, forKey: .allowMediaDeletion) + try container.encodeIfPresent(self.allowSharing, forKey: .allowSharing) + try container.encodeIfPresent(self.allowSync, forKey: .allowSync) + try container.encodeIfPresent(self.allowTuners, forKey: .allowTuners) + try container.encodeIfPresent(self.backgroundProcessing, forKey: .backgroundProcessing) + try container.encodeIfPresent(self.certificate, forKey: .certificate) + try container.encodeIfPresent(self.companionProxy, forKey: .companionProxy) + try container.encodeIfPresent(self.countryCode, forKey: .countryCode) + try container.encodeIfPresent(self.diagnostics, forKey: .diagnostics) + try container.encodeIfPresent(self.directory, forKey: .directory) + try container.encodeIfPresent(self.eventStream, forKey: .eventStream) + try container.encodeIfPresent(self.friendlyName, forKey: .friendlyName) + try container.encodeIfPresent(self.hubSearch, forKey: .hubSearch) + try container.encodeIfPresent(self.itemClusters, forKey: .itemClusters) + if self.livetv != nil { + try container.encode(self._livetv, forKey: .livetv) + } + try container.encodeIfPresent(self.machineIdentifier, forKey: .machineIdentifier) + try container.encodeIfPresent(self.mediaProviders, forKey: .mediaProviders) + try container.encodeIfPresent(self.multiuser, forKey: .multiuser) + if self.musicAnalysis != nil { + try container.encode(self._musicAnalysis, forKey: .musicAnalysis) + } + try container.encodeIfPresent(self.myPlex, forKey: .myPlex) + try container.encodeIfPresent(self.myPlexMappingState, forKey: .myPlexMappingState) + try container.encodeIfPresent(self.myPlexSigninState, forKey: .myPlexSigninState) + try container.encodeIfPresent(self.myPlexSubscription, forKey: .myPlexSubscription) + try container.encodeIfPresent(self.myPlexUsername, forKey: .myPlexUsername) + if self.offlineTranscode != nil { + try container.encode(self._offlineTranscode, forKey: .offlineTranscode) + } + try container.encodeIfPresent(self.ownerFeatures, forKey: .ownerFeatures) + try container.encodeIfPresent(self.photoAutoTag, forKey: .photoAutoTag) + try container.encodeIfPresent(self.platform, forKey: .platform) + try container.encodeIfPresent(self.platformVersion, forKey: .platformVersion) + try container.encodeIfPresent(self.pluginHost, forKey: .pluginHost) + try container.encodeIfPresent(self.pushNotifications, forKey: .pushNotifications) + try container.encodeIfPresent(self.readOnlyLibraries, forKey: .readOnlyLibraries) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + if self.streamingBrainABRVersion != nil { + try container.encode(self._streamingBrainABRVersion, forKey: .streamingBrainABRVersion) + } + if self.streamingBrainVersion != nil { + try container.encode(self._streamingBrainVersion, forKey: .streamingBrainVersion) + } + try container.encodeIfPresent(self.sync, forKey: .sync) + if self.transcoderActiveVideoSessions != nil { + try container.encode(self._transcoderActiveVideoSessions, forKey: .transcoderActiveVideoSessions) + } + try container.encodeIfPresent(self.transcoderAudio, forKey: .transcoderAudio) + try container.encodeIfPresent(self.transcoderLyrics, forKey: .transcoderLyrics) + try container.encodeIfPresent(self.transcoderPhoto, forKey: .transcoderPhoto) + try container.encodeIfPresent(self.transcoderSubtitles, forKey: .transcoderSubtitles) + try container.encodeIfPresent(self.transcoderVideo, forKey: .transcoderVideo) + try container.encodeIfPresent(self.transcoderVideoBitrates, forKey: .transcoderVideoBitrates) + try container.encodeIfPresent(self.transcoderVideoQualities, forKey: .transcoderVideoQualities) + try container.encodeIfPresent(self.transcoderVideoResolutions, forKey: .transcoderVideoResolutions) + if self.updatedAt != nil { + try container.encode(self._updatedAt, forKey: .updatedAt) + } + try container.encodeIfPresent(self.updater, forKey: .updater) + try container.encodeIfPresent(self.version, forKey: .version) + try container.encodeIfPresent(self.voiceSearch, forKey: .voiceSearch) + } +} + +extension Operations.MediaContainer { + var sizeWrapper: DecimalSerialized { + return _size + } + var livetvWrapper: DecimalSerialized { + return _livetv + } + var musicAnalysisWrapper: DecimalSerialized { + return _musicAnalysis + } + var offlineTranscodeWrapper: DecimalSerialized { + return _offlineTranscode + } + var streamingBrainABRVersionWrapper: DecimalSerialized { + return _streamingBrainABRVersion + } + var streamingBrainVersionWrapper: DecimalSerialized { + return _streamingBrainVersion + } + var transcoderActiveVideoSessionsWrapper: DecimalSerialized { + return _transcoderActiveVideoSessions + } + var updatedAtWrapper: DecimalSerialized { + return _updatedAt + } +} diff --git a/Sources/Plexswift/models/operations/Metadata.swift b/Sources/Plexswift/models/operations/Metadata.swift new file mode 100644 index 0000000..29b1779 --- /dev/null +++ b/Sources/Plexswift/models/operations/Metadata.swift @@ -0,0 +1,245 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Metadata { + @DecimalSerialized + public private(set) var addedAt: Double? + public let allowSync: Bool? + public let art: String? + @DecimalSerialized + public private(set) var audienceRating: Double? + public let audienceRatingImage: String? + public let chapterSource: String? + public let contentRating: String? + public let country: [Operations.Country]? + public let director: [Operations.Director]? + @DecimalSerialized + public private(set) var duration: Double? + public let genre: [Operations.Genre]? + public let guid: String? + public let key: String? + @DecimalSerialized + public private(set) var librarySectionID: Double? + public let librarySectionTitle: String? + public let librarySectionUUID: String? + public let media: [Operations.Media]? + @DateTime + public private(set) var originallyAvailableAt: Date? + public let primaryExtraKey: String? + @DecimalSerialized + public private(set) var rating: Double? + public let ratingImage: String? + @DecimalSerialized + public private(set) var ratingKey: Double? + public let role: [Operations.Role]? + public let studio: String? + public let summary: String? + public let tagline: String? + public let thumb: String? + public let title: String? + public let type: String? + @DecimalSerialized + public private(set) var updatedAt: Double? + public let writer: [Operations.Writer]? + @DecimalSerialized + public private(set) var year: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(addedAt: Double? = nil, allowSync: Bool? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, chapterSource: String? = nil, contentRating: String? = nil, country: [Operations.Country]? = nil, director: [Operations.Director]? = nil, duration: Double? = nil, genre: [Operations.Genre]? = nil, guid: String? = nil, key: String? = nil, librarySectionID: Double? = nil, librarySectionTitle: String? = nil, librarySectionUUID: String? = nil, media: [Operations.Media]? = nil, originallyAvailableAt: Date? = nil, primaryExtraKey: String? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: Double? = nil, role: [Operations.Role]? = nil, studio: String? = nil, summary: String? = nil, tagline: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, updatedAt: Double? = nil, writer: [Operations.Writer]? = nil, year: Double? = nil) { + self._addedAt = DecimalSerialized(wrappedValue: addedAt) + self.allowSync = allowSync + self.art = art + self._audienceRating = DecimalSerialized(wrappedValue: audienceRating) + self.audienceRatingImage = audienceRatingImage + self.chapterSource = chapterSource + self.contentRating = contentRating + self.country = country + self.director = director + self._duration = DecimalSerialized(wrappedValue: duration) + self.genre = genre + self.guid = guid + self.key = key + self._librarySectionID = DecimalSerialized(wrappedValue: librarySectionID) + self.librarySectionTitle = librarySectionTitle + self.librarySectionUUID = librarySectionUUID + self.media = media + self._originallyAvailableAt = DateTime(wrappedValue: originallyAvailableAt) + self.primaryExtraKey = primaryExtraKey + self._rating = DecimalSerialized(wrappedValue: rating) + self.ratingImage = ratingImage + self._ratingKey = DecimalSerialized(wrappedValue: ratingKey) + self.role = role + self.studio = studio + self.summary = summary + self.tagline = tagline + self.thumb = thumb + self.title = title + self.type = type + self._updatedAt = DecimalSerialized(wrappedValue: updatedAt) + self.writer = writer + self._year = DecimalSerialized(wrappedValue: year) + } + } +} + +extension Operations.Metadata: Codable { + enum CodingKeys: String, CodingKey { + case addedAt + case allowSync + case art + case audienceRating + case audienceRatingImage + case chapterSource + case contentRating + case country = "Country" + case director = "Director" + case duration + case genre = "Genre" + case guid + case key + case librarySectionID + case librarySectionTitle + case librarySectionUUID + case media = "Media" + case originallyAvailableAt + case primaryExtraKey + case rating + case ratingImage + case ratingKey + case role = "Role" + case studio + case summary + case tagline + case thumb + case title + case type + case updatedAt + case writer = "Writer" + case year + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._addedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .addedAt) ?? DecimalSerialized(wrappedValue: nil) + self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync) + self.art = try container.decodeIfPresent(String.self, forKey: .art) + self._audienceRating = try container.decodeIfPresent(DecimalSerialized.self, forKey: .audienceRating) ?? DecimalSerialized(wrappedValue: nil) + self.audienceRatingImage = try container.decodeIfPresent(String.self, forKey: .audienceRatingImage) + self.chapterSource = try container.decodeIfPresent(String.self, forKey: .chapterSource) + self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating) + self.country = try container.decodeIfPresent([Operations.Country].self, forKey: .country) + self.director = try container.decodeIfPresent([Operations.Director].self, forKey: .director) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.genre = try container.decodeIfPresent([Operations.Genre].self, forKey: .genre) + self.guid = try container.decodeIfPresent(String.self, forKey: .guid) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self._librarySectionID = try container.decodeIfPresent(DecimalSerialized.self, forKey: .librarySectionID) ?? DecimalSerialized(wrappedValue: nil) + self.librarySectionTitle = try container.decodeIfPresent(String.self, forKey: .librarySectionTitle) + self.librarySectionUUID = try container.decodeIfPresent(String.self, forKey: .librarySectionUUID) + self.media = try container.decodeIfPresent([Operations.Media].self, forKey: .media) + self._originallyAvailableAt = try container.decodeIfPresent(DateTime.self, forKey: .originallyAvailableAt) ?? DateTime(wrappedValue: nil) + self.primaryExtraKey = try container.decodeIfPresent(String.self, forKey: .primaryExtraKey) + self._rating = try container.decodeIfPresent(DecimalSerialized.self, forKey: .rating) ?? DecimalSerialized(wrappedValue: nil) + self.ratingImage = try container.decodeIfPresent(String.self, forKey: .ratingImage) + self._ratingKey = try container.decodeIfPresent(DecimalSerialized.self, forKey: .ratingKey) ?? DecimalSerialized(wrappedValue: nil) + self.role = try container.decodeIfPresent([Operations.Role].self, forKey: .role) + self.studio = try container.decodeIfPresent(String.self, forKey: .studio) + self.summary = try container.decodeIfPresent(String.self, forKey: .summary) + self.tagline = try container.decodeIfPresent(String.self, forKey: .tagline) + self.thumb = try container.decodeIfPresent(String.self, forKey: .thumb) + self.title = try container.decodeIfPresent(String.self, forKey: .title) + self.type = try container.decodeIfPresent(String.self, forKey: .type) + self._updatedAt = try container.decodeIfPresent(DecimalSerialized.self, forKey: .updatedAt) ?? DecimalSerialized(wrappedValue: nil) + self.writer = try container.decodeIfPresent([Operations.Writer].self, forKey: .writer) + self._year = try container.decodeIfPresent(DecimalSerialized.self, forKey: .year) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.addedAt != nil { + try container.encode(self._addedAt, forKey: .addedAt) + } + try container.encodeIfPresent(self.allowSync, forKey: .allowSync) + try container.encodeIfPresent(self.art, forKey: .art) + if self.audienceRating != nil { + try container.encode(self._audienceRating, forKey: .audienceRating) + } + try container.encodeIfPresent(self.audienceRatingImage, forKey: .audienceRatingImage) + try container.encodeIfPresent(self.chapterSource, forKey: .chapterSource) + try container.encodeIfPresent(self.contentRating, forKey: .contentRating) + try container.encodeIfPresent(self.country, forKey: .country) + try container.encodeIfPresent(self.director, forKey: .director) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.genre, forKey: .genre) + try container.encodeIfPresent(self.guid, forKey: .guid) + try container.encodeIfPresent(self.key, forKey: .key) + if self.librarySectionID != nil { + try container.encode(self._librarySectionID, forKey: .librarySectionID) + } + try container.encodeIfPresent(self.librarySectionTitle, forKey: .librarySectionTitle) + try container.encodeIfPresent(self.librarySectionUUID, forKey: .librarySectionUUID) + try container.encodeIfPresent(self.media, forKey: .media) + if self.originallyAvailableAt != nil { + try container.encode(self._originallyAvailableAt, forKey: .originallyAvailableAt) + } + try container.encodeIfPresent(self.primaryExtraKey, forKey: .primaryExtraKey) + if self.rating != nil { + try container.encode(self._rating, forKey: .rating) + } + try container.encodeIfPresent(self.ratingImage, forKey: .ratingImage) + if self.ratingKey != nil { + try container.encode(self._ratingKey, forKey: .ratingKey) + } + try container.encodeIfPresent(self.role, forKey: .role) + try container.encodeIfPresent(self.studio, forKey: .studio) + try container.encodeIfPresent(self.summary, forKey: .summary) + try container.encodeIfPresent(self.tagline, forKey: .tagline) + try container.encodeIfPresent(self.thumb, forKey: .thumb) + try container.encodeIfPresent(self.title, forKey: .title) + try container.encodeIfPresent(self.type, forKey: .type) + if self.updatedAt != nil { + try container.encode(self._updatedAt, forKey: .updatedAt) + } + try container.encodeIfPresent(self.writer, forKey: .writer) + if self.year != nil { + try container.encode(self._year, forKey: .year) + } + } +} + +extension Operations.Metadata { + var librarySectionIDWrapper: DecimalSerialized { + return _librarySectionID + } + var ratingKeyWrapper: DecimalSerialized { + return _ratingKey + } + var ratingWrapper: DecimalSerialized { + return _rating + } + var audienceRatingWrapper: DecimalSerialized { + return _audienceRating + } + var yearWrapper: DecimalSerialized { + return _year + } + var durationWrapper: DecimalSerialized { + return _duration + } + var originallyAvailableAtWrapper: DateTime { + return _originallyAvailableAt + } + var addedAtWrapper: DecimalSerialized { + return _addedAt + } + var updatedAtWrapper: DecimalSerialized { + return _updatedAt + } +} diff --git a/Sources/Plexswift/models/operations/MinSize.swift b/Sources/Plexswift/models/operations/MinSize.swift new file mode 100644 index 0000000..54c1b9a --- /dev/null +++ b/Sources/Plexswift/models/operations/MinSize.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// images are always scaled proportionally. A value of '1' in minSize will make the smaller native dimension the dimension resized against. + public enum MinSize: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/MyPlex.swift b/Sources/Plexswift/models/operations/MyPlex.swift new file mode 100644 index 0000000..cebc3f4 --- /dev/null +++ b/Sources/Plexswift/models/operations/MyPlex.swift @@ -0,0 +1,103 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct MyPlex { + public let authToken: String? + public let mappingError: String? + public let mappingState: String? + public let privateAddress: String? + @DecimalSerialized + public private(set) var privatePort: Double? + public let publicAddress: String? + @DecimalSerialized + public private(set) var publicPort: Double? + public let signInState: String? + public let subscriptionActive: Bool? + public let subscriptionFeatures: String? + public let subscriptionState: String? + public let username: String? + + /// Creates an object with the specified parameters + /// + /// + public init(authToken: String? = nil, mappingError: String? = nil, mappingState: String? = nil, privateAddress: String? = nil, privatePort: Double? = nil, publicAddress: String? = nil, publicPort: Double? = nil, signInState: String? = nil, subscriptionActive: Bool? = nil, subscriptionFeatures: String? = nil, subscriptionState: String? = nil, username: String? = nil) { + self.authToken = authToken + self.mappingError = mappingError + self.mappingState = mappingState + self.privateAddress = privateAddress + self._privatePort = DecimalSerialized(wrappedValue: privatePort) + self.publicAddress = publicAddress + self._publicPort = DecimalSerialized(wrappedValue: publicPort) + self.signInState = signInState + self.subscriptionActive = subscriptionActive + self.subscriptionFeatures = subscriptionFeatures + self.subscriptionState = subscriptionState + self.username = username + } + } +} + +extension Operations.MyPlex: Codable { + enum CodingKeys: String, CodingKey { + case authToken + case mappingError + case mappingState + case privateAddress + case privatePort + case publicAddress + case publicPort + case signInState + case subscriptionActive + case subscriptionFeatures + case subscriptionState + case username + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.authToken = try container.decodeIfPresent(String.self, forKey: .authToken) + self.mappingError = try container.decodeIfPresent(String.self, forKey: .mappingError) + self.mappingState = try container.decodeIfPresent(String.self, forKey: .mappingState) + self.privateAddress = try container.decodeIfPresent(String.self, forKey: .privateAddress) + self._privatePort = try container.decodeIfPresent(DecimalSerialized.self, forKey: .privatePort) ?? DecimalSerialized(wrappedValue: nil) + self.publicAddress = try container.decodeIfPresent(String.self, forKey: .publicAddress) + self._publicPort = try container.decodeIfPresent(DecimalSerialized.self, forKey: .publicPort) ?? DecimalSerialized(wrappedValue: nil) + self.signInState = try container.decodeIfPresent(String.self, forKey: .signInState) + self.subscriptionActive = try container.decodeIfPresent(Bool.self, forKey: .subscriptionActive) + self.subscriptionFeatures = try container.decodeIfPresent(String.self, forKey: .subscriptionFeatures) + self.subscriptionState = try container.decodeIfPresent(String.self, forKey: .subscriptionState) + self.username = try container.decodeIfPresent(String.self, forKey: .username) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.authToken, forKey: .authToken) + try container.encodeIfPresent(self.mappingError, forKey: .mappingError) + try container.encodeIfPresent(self.mappingState, forKey: .mappingState) + try container.encodeIfPresent(self.privateAddress, forKey: .privateAddress) + if self.privatePort != nil { + try container.encode(self._privatePort, forKey: .privatePort) + } + try container.encodeIfPresent(self.publicAddress, forKey: .publicAddress) + if self.publicPort != nil { + try container.encode(self._publicPort, forKey: .publicPort) + } + try container.encodeIfPresent(self.signInState, forKey: .signInState) + try container.encodeIfPresent(self.subscriptionActive, forKey: .subscriptionActive) + try container.encodeIfPresent(self.subscriptionFeatures, forKey: .subscriptionFeatures) + try container.encodeIfPresent(self.subscriptionState, forKey: .subscriptionState) + try container.encodeIfPresent(self.username, forKey: .username) + } +} + +extension Operations.MyPlex { + var publicPortWrapper: DecimalSerialized { + return _publicPort + } + var privatePortWrapper: DecimalSerialized { + return _privatePort + } +} diff --git a/Sources/Plexswift/models/operations/OnlyTransient.swift b/Sources/Plexswift/models/operations/OnlyTransient.swift new file mode 100644 index 0000000..c83f8c1 --- /dev/null +++ b/Sources/Plexswift/models/operations/OnlyTransient.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). + public enum OnlyTransient: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/Part.swift b/Sources/Plexswift/models/operations/Part.swift new file mode 100644 index 0000000..180e16b --- /dev/null +++ b/Sources/Plexswift/models/operations/Part.swift @@ -0,0 +1,105 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Part { + public let container: String? + @DecimalSerialized + public private(set) var duration: Double? + public let file: String? + public let has64bitOffsets: Bool? + @DecimalSerialized + public private(set) var hasThumbnail: Double? + @DecimalSerialized + public private(set) var id: Double? + public let key: String? + public let optimizedForStreaming: Bool? + @DecimalSerialized + public private(set) var size: Double? + public let videoProfile: String? + + /// Creates an object with the specified parameters + /// + /// + public init(container: String? = nil, duration: Double? = nil, file: String? = nil, has64bitOffsets: Bool? = nil, hasThumbnail: Double? = nil, id: Double? = nil, key: String? = nil, optimizedForStreaming: Bool? = nil, size: Double? = nil, videoProfile: String? = nil) { + self.container = container + self._duration = DecimalSerialized(wrappedValue: duration) + self.file = file + self.has64bitOffsets = has64bitOffsets + self._hasThumbnail = DecimalSerialized(wrappedValue: hasThumbnail) + self._id = DecimalSerialized(wrappedValue: id) + self.key = key + self.optimizedForStreaming = optimizedForStreaming + self._size = DecimalSerialized(wrappedValue: size) + self.videoProfile = videoProfile + } + } +} + +extension Operations.Part: Codable { + enum CodingKeys: String, CodingKey { + case container + case duration + case file + case has64bitOffsets + case hasThumbnail + case id + case key + case optimizedForStreaming + case size + case videoProfile + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.file = try container.decodeIfPresent(String.self, forKey: .file) + self.has64bitOffsets = try container.decodeIfPresent(Bool.self, forKey: .has64bitOffsets) + self._hasThumbnail = try container.decodeIfPresent(DecimalSerialized.self, forKey: .hasThumbnail) ?? DecimalSerialized(wrappedValue: nil) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self.optimizedForStreaming = try container.decodeIfPresent(Bool.self, forKey: .optimizedForStreaming) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + self.videoProfile = try container.decodeIfPresent(String.self, forKey: .videoProfile) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.container, forKey: .container) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.file, forKey: .file) + try container.encodeIfPresent(self.has64bitOffsets, forKey: .has64bitOffsets) + if self.hasThumbnail != nil { + try container.encode(self._hasThumbnail, forKey: .hasThumbnail) + } + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + try container.encodeIfPresent(self.key, forKey: .key) + try container.encodeIfPresent(self.optimizedForStreaming, forKey: .optimizedForStreaming) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + try container.encodeIfPresent(self.videoProfile, forKey: .videoProfile) + } +} + +extension Operations.Part { + var idWrapper: DecimalSerialized { + return _id + } + var durationWrapper: DecimalSerialized { + return _duration + } + var sizeWrapper: DecimalSerialized { + return _size + } + var hasThumbnailWrapper: DecimalSerialized { + return _hasThumbnail + } +} diff --git a/Sources/Plexswift/models/operations/PathParamTaskName.swift b/Sources/Plexswift/models/operations/PathParamTaskName.swift new file mode 100644 index 0000000..e9f9d64 --- /dev/null +++ b/Sources/Plexswift/models/operations/PathParamTaskName.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The name of the task to be started. + public enum PathParamTaskName: String, Codable, APIValue { + case backupDatabase = "BackupDatabase" + case buildGracenoteCollections = "BuildGracenoteCollections" + case checkForUpdates = "CheckForUpdates" + case cleanOldBundles = "CleanOldBundles" + case cleanOldCacheFiles = "CleanOldCacheFiles" + case deepMediaAnalysis = "DeepMediaAnalysis" + case generateAutoTags = "GenerateAutoTags" + case generateChapterThumbs = "GenerateChapterThumbs" + case generateMediaIndexFiles = "GenerateMediaIndexFiles" + case optimizeDatabase = "OptimizeDatabase" + case refreshLibraries = "RefreshLibraries" + case refreshLocalMedia = "RefreshLocalMedia" + case refreshPeriodicMetadata = "RefreshPeriodicMetadata" + case upgradeMediaAnalysis = "UpgradeMediaAnalysis" + } +} diff --git a/Sources/Plexswift/models/operations/PerformSearchErrors.swift b/Sources/Plexswift/models/operations/PerformSearchErrors.swift new file mode 100644 index 0000000..d78ee2e --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformSearchErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct PerformSearchErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.PerformSearchErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.PerformSearchErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/PerformSearchRequest.swift b/Sources/Plexswift/models/operations/PerformSearchRequest.swift new file mode 100644 index 0000000..e53ba8c --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformSearchRequest.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct PerformSearchRequest: APIValue { + /// The query term + public let query: String + /// The number of items to return per hub + @DecimalSerialized + public private(set) var limit: Double? + /// This gives context to the search, and can result in re-ordering of search result hubs + @DecimalSerialized + public private(set) var sectionId: Double? + + /// Creates an object with the specified parameters + /// + /// - Parameter query: The query term + /// - Parameter limit: The number of items to return per hub + /// - Parameter sectionId: This gives context to the search, and can result in re-ordering of search result hubs + /// + public init(query: String, limit: Double? = nil, sectionId: Double? = nil) { + self.query = query + self._limit = DecimalSerialized(wrappedValue: limit) + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + } + } +} +extension Operations.PerformSearchRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } + var limitWrapper: DecimalSerialized { + return _limit + } +} diff --git a/Sources/Plexswift/models/operations/PerformSearchResponse.swift b/Sources/Plexswift/models/operations/PerformSearchResponse.swift new file mode 100644 index 0000000..e22bbfe --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformSearchResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum PerformSearchResponse { + case empty + case object(Operations.PerformSearchResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.PerformSearchResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/PerformSearchResponseBody.swift b/Sources/Plexswift/models/operations/PerformSearchResponseBody.swift new file mode 100644 index 0000000..42a2930 --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformSearchResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct PerformSearchResponseBody { + public let errors: [Operations.PerformSearchErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.PerformSearchErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.PerformSearchResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/PerformVoiceSearchErrors.swift b/Sources/Plexswift/models/operations/PerformVoiceSearchErrors.swift new file mode 100644 index 0000000..48f5e35 --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformVoiceSearchErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct PerformVoiceSearchErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.PerformVoiceSearchErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.PerformVoiceSearchErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/PerformVoiceSearchRequest.swift b/Sources/Plexswift/models/operations/PerformVoiceSearchRequest.swift new file mode 100644 index 0000000..d9a7768 --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformVoiceSearchRequest.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct PerformVoiceSearchRequest: APIValue { + /// The query term + public let query: String + /// The number of items to return per hub + @DecimalSerialized + public private(set) var limit: Double? + /// This gives context to the search, and can result in re-ordering of search result hubs + @DecimalSerialized + public private(set) var sectionId: Double? + + /// Creates an object with the specified parameters + /// + /// - Parameter query: The query term + /// - Parameter limit: The number of items to return per hub + /// - Parameter sectionId: This gives context to the search, and can result in re-ordering of search result hubs + /// + public init(query: String, limit: Double? = nil, sectionId: Double? = nil) { + self.query = query + self._limit = DecimalSerialized(wrappedValue: limit) + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + } + } +} +extension Operations.PerformVoiceSearchRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } + var limitWrapper: DecimalSerialized { + return _limit + } +} diff --git a/Sources/Plexswift/models/operations/PerformVoiceSearchResponse.swift b/Sources/Plexswift/models/operations/PerformVoiceSearchResponse.swift new file mode 100644 index 0000000..bc87aed --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformVoiceSearchResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum PerformVoiceSearchResponse { + case empty + case object(Operations.PerformVoiceSearchResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.PerformVoiceSearchResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/PerformVoiceSearchResponseBody.swift b/Sources/Plexswift/models/operations/PerformVoiceSearchResponseBody.swift new file mode 100644 index 0000000..c0e4afb --- /dev/null +++ b/Sources/Plexswift/models/operations/PerformVoiceSearchResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct PerformVoiceSearchResponseBody { + public let errors: [Operations.PerformVoiceSearchErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.PerformVoiceSearchErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.PerformVoiceSearchResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/PlaylistType.swift b/Sources/Plexswift/models/operations/PlaylistType.swift new file mode 100644 index 0000000..0316a72 --- /dev/null +++ b/Sources/Plexswift/models/operations/PlaylistType.swift @@ -0,0 +1,12 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// limit to a type of playlist. + public enum PlaylistType: String, Codable, APIValue { + case audio = "audio" + case video = "video" + case photo = "photo" + } +} diff --git a/Sources/Plexswift/models/operations/Provider.swift b/Sources/Plexswift/models/operations/Provider.swift new file mode 100644 index 0000000..42d9c4a --- /dev/null +++ b/Sources/Plexswift/models/operations/Provider.swift @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Provider { + public let key: String? + public let title: String? + public let type: String? + + /// Creates an object with the specified parameters + /// + /// + public init(key: String? = nil, title: String? = nil, type: String? = nil) { + self.key = key + self.title = title + self.type = type + } + } +} + +extension Operations.Provider: Codable { + enum CodingKeys: String, CodingKey { + case key + case title + case type + } +} + diff --git a/Sources/Plexswift/models/operations/QueryParamOnlyTransient.swift b/Sources/Plexswift/models/operations/QueryParamOnlyTransient.swift new file mode 100644 index 0000000..6dfe630 --- /dev/null +++ b/Sources/Plexswift/models/operations/QueryParamOnlyTransient.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). + public enum QueryParamOnlyTransient: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/QueryParamSmart.swift b/Sources/Plexswift/models/operations/QueryParamSmart.swift new file mode 100644 index 0000000..adc6baa --- /dev/null +++ b/Sources/Plexswift/models/operations/QueryParamSmart.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// type of playlists to return (default is all). + public enum QueryParamSmart: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/QueryParamType.swift b/Sources/Plexswift/models/operations/QueryParamType.swift new file mode 100644 index 0000000..af75474 --- /dev/null +++ b/Sources/Plexswift/models/operations/QueryParamType.swift @@ -0,0 +1,10 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// `delegation` - This is the only supported `type` parameter. + public enum QueryParamType: String, Codable, APIValue { + case delegation = "delegation" + } +} diff --git a/Sources/Plexswift/models/operations/RefreshLibraryErrors.swift b/Sources/Plexswift/models/operations/RefreshLibraryErrors.swift new file mode 100644 index 0000000..1f4926f --- /dev/null +++ b/Sources/Plexswift/models/operations/RefreshLibraryErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct RefreshLibraryErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.RefreshLibraryErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.RefreshLibraryErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/RefreshLibraryRequest.swift b/Sources/Plexswift/models/operations/RefreshLibraryRequest.swift new file mode 100644 index 0000000..1dbb9bd --- /dev/null +++ b/Sources/Plexswift/models/operations/RefreshLibraryRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct RefreshLibraryRequest: APIValue { + /// the Id of the library to refresh + @DecimalSerialized + public private(set) var sectionId: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to refresh + /// + public init(sectionId: Double) { + self._sectionId = DecimalSerialized(wrappedValue: sectionId) + } + } +} +extension Operations.RefreshLibraryRequest { + var sectionIdWrapper: DecimalSerialized { + return _sectionId + } +} diff --git a/Sources/Plexswift/models/operations/RefreshLibraryResponse.swift b/Sources/Plexswift/models/operations/RefreshLibraryResponse.swift new file mode 100644 index 0000000..1b1fec7 --- /dev/null +++ b/Sources/Plexswift/models/operations/RefreshLibraryResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum RefreshLibraryResponse { + case empty + case object(Operations.RefreshLibraryResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.RefreshLibraryResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/RefreshLibraryResponseBody.swift b/Sources/Plexswift/models/operations/RefreshLibraryResponseBody.swift new file mode 100644 index 0000000..900b534 --- /dev/null +++ b/Sources/Plexswift/models/operations/RefreshLibraryResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct RefreshLibraryResponseBody { + public let errors: [Operations.RefreshLibraryErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.RefreshLibraryErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.RefreshLibraryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/ResponseBody.swift b/Sources/Plexswift/models/operations/ResponseBody.swift new file mode 100644 index 0000000..68e9e85 --- /dev/null +++ b/Sources/Plexswift/models/operations/ResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct ResponseBody { + public let mediaContainer: Operations.GetAvailableClientsMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetAvailableClientsMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.ResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/Role.swift b/Sources/Plexswift/models/operations/Role.swift new file mode 100644 index 0000000..5cbeef2 --- /dev/null +++ b/Sources/Plexswift/models/operations/Role.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Role { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.Role: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/Scope.swift b/Sources/Plexswift/models/operations/Scope.swift new file mode 100644 index 0000000..941f8e1 --- /dev/null +++ b/Sources/Plexswift/models/operations/Scope.swift @@ -0,0 +1,10 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// `all` - This is the only supported `scope` parameter. + public enum Scope: String, Codable, APIValue { + case all = "all" + } +} diff --git a/Sources/Plexswift/models/operations/Server.swift b/Sources/Plexswift/models/operations/Server.swift new file mode 100644 index 0000000..81e213c --- /dev/null +++ b/Sources/Plexswift/models/operations/Server.swift @@ -0,0 +1,98 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Server { + public let address: String? + public let deviceClass: String? + public let host: String? + public let machineIdentifier: String? + public let name: String? + @DecimalSerialized + public private(set) var port: Double? + public let product: String? + public let `protocol`: String? + public let protocolCapabilities: String? + @DecimalSerialized + public private(set) var protocolVersion: Double? + public let version: String? + + /// Creates an object with the specified parameters + /// + /// + public init(address: String? = nil, deviceClass: String? = nil, host: String? = nil, machineIdentifier: String? = nil, name: String? = nil, port: Double? = nil, product: String? = nil, `protocol`: String? = nil, protocolCapabilities: String? = nil, protocolVersion: Double? = nil, version: String? = nil) { + self.address = address + self.deviceClass = deviceClass + self.host = host + self.machineIdentifier = machineIdentifier + self.name = name + self._port = DecimalSerialized(wrappedValue: port) + self.product = product + self.`protocol` = `protocol` + self.protocolCapabilities = protocolCapabilities + self._protocolVersion = DecimalSerialized(wrappedValue: protocolVersion) + self.version = version + } + } +} + +extension Operations.Server: Codable { + enum CodingKeys: String, CodingKey { + case address + case deviceClass + case host + case machineIdentifier + case name + case port + case product + case `protocol` = "protocol" + case protocolCapabilities + case protocolVersion + case version + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.address = try container.decodeIfPresent(String.self, forKey: .address) + self.deviceClass = try container.decodeIfPresent(String.self, forKey: .deviceClass) + self.host = try container.decodeIfPresent(String.self, forKey: .host) + self.machineIdentifier = try container.decodeIfPresent(String.self, forKey: .machineIdentifier) + self.name = try container.decodeIfPresent(String.self, forKey: .name) + self._port = try container.decodeIfPresent(DecimalSerialized.self, forKey: .port) ?? DecimalSerialized(wrappedValue: nil) + self.product = try container.decodeIfPresent(String.self, forKey: .product) + self.`protocol` = try container.decodeIfPresent(String.self, forKey: .`protocol`) + self.protocolCapabilities = try container.decodeIfPresent(String.self, forKey: .protocolCapabilities) + self._protocolVersion = try container.decodeIfPresent(DecimalSerialized.self, forKey: .protocolVersion) ?? DecimalSerialized(wrappedValue: nil) + self.version = try container.decodeIfPresent(String.self, forKey: .version) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.address, forKey: .address) + try container.encodeIfPresent(self.deviceClass, forKey: .deviceClass) + try container.encodeIfPresent(self.host, forKey: .host) + try container.encodeIfPresent(self.machineIdentifier, forKey: .machineIdentifier) + try container.encodeIfPresent(self.name, forKey: .name) + if self.port != nil { + try container.encode(self._port, forKey: .port) + } + try container.encodeIfPresent(self.product, forKey: .product) + try container.encodeIfPresent(self.`protocol`, forKey: .`protocol`) + try container.encodeIfPresent(self.protocolCapabilities, forKey: .protocolCapabilities) + if self.protocolVersion != nil { + try container.encode(self._protocolVersion, forKey: .protocolVersion) + } + try container.encodeIfPresent(self.version, forKey: .version) + } +} + +extension Operations.Server { + var portWrapper: DecimalSerialized { + return _port + } + var protocolVersionWrapper: DecimalSerialized { + return _protocolVersion + } +} diff --git a/Sources/Plexswift/models/operations/Skip.swift b/Sources/Plexswift/models/operations/Skip.swift new file mode 100644 index 0000000..7b014e9 --- /dev/null +++ b/Sources/Plexswift/models/operations/Skip.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. + public enum Skip: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/Smart.swift b/Sources/Plexswift/models/operations/Smart.swift new file mode 100644 index 0000000..f51a741 --- /dev/null +++ b/Sources/Plexswift/models/operations/Smart.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// whether the playlist is smart or not + public enum Smart: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/StartAllTasksErrors.swift b/Sources/Plexswift/models/operations/StartAllTasksErrors.swift new file mode 100644 index 0000000..b14f548 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartAllTasksErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StartAllTasksErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.StartAllTasksErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.StartAllTasksErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/StartAllTasksResponse.swift b/Sources/Plexswift/models/operations/StartAllTasksResponse.swift new file mode 100644 index 0000000..98d09b6 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartAllTasksResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum StartAllTasksResponse { + case empty + case object(Operations.StartAllTasksResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.StartAllTasksResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/StartAllTasksResponseBody.swift b/Sources/Plexswift/models/operations/StartAllTasksResponseBody.swift new file mode 100644 index 0000000..cebc072 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartAllTasksResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct StartAllTasksResponseBody { + public let errors: [Operations.StartAllTasksErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.StartAllTasksErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.StartAllTasksResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/StartTaskErrors.swift b/Sources/Plexswift/models/operations/StartTaskErrors.swift new file mode 100644 index 0000000..5504583 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartTaskErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StartTaskErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.StartTaskErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.StartTaskErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/StartTaskRequest.swift b/Sources/Plexswift/models/operations/StartTaskRequest.swift new file mode 100644 index 0000000..bc05212 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartTaskRequest.swift @@ -0,0 +1,19 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StartTaskRequest: APIValue { + /// the name of the task to be started. + public let taskName: Operations.TaskName + + /// Creates an object with the specified parameters + /// + /// - Parameter taskName: the name of the task to be started. + /// + public init(taskName: Operations.TaskName) { + self.taskName = taskName + } + } +} diff --git a/Sources/Plexswift/models/operations/StartTaskResponse.swift b/Sources/Plexswift/models/operations/StartTaskResponse.swift new file mode 100644 index 0000000..9527d94 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartTaskResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum StartTaskResponse { + case empty + case object(Operations.StartTaskResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.StartTaskResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/StartTaskResponseBody.swift b/Sources/Plexswift/models/operations/StartTaskResponseBody.swift new file mode 100644 index 0000000..b17376d --- /dev/null +++ b/Sources/Plexswift/models/operations/StartTaskResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct StartTaskResponseBody { + public let errors: [Operations.StartTaskErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.StartTaskErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.StartTaskResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/StartUniversalTranscodeErrors.swift b/Sources/Plexswift/models/operations/StartUniversalTranscodeErrors.swift new file mode 100644 index 0000000..b9f5fcc --- /dev/null +++ b/Sources/Plexswift/models/operations/StartUniversalTranscodeErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StartUniversalTranscodeErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.StartUniversalTranscodeErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.StartUniversalTranscodeErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/StartUniversalTranscodeRequest.swift b/Sources/Plexswift/models/operations/StartUniversalTranscodeRequest.swift new file mode 100644 index 0000000..6a14053 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartUniversalTranscodeRequest.swift @@ -0,0 +1,125 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StartUniversalTranscodeRequest: APIValue { + /// Whether the media item has MDE + @DecimalSerialized + public private(set) var hasMDE: Double + /// The index of the media item to transcode + @DecimalSerialized + public private(set) var mediaIndex: Double + /// The index of the part to transcode + @DecimalSerialized + public private(set) var partIndex: Double + /// The path to the media item to transcode + public let path: String + /// The protocol to use for the transcode session + public let `protocol`: String + /// Whether to add a debug overlay or not + @DecimalSerialized + public private(set) var addDebugOverlay: Double? + /// The audio boost + @DecimalSerialized + public private(set) var audioBoost: Double? + /// Whether to auto adjust quality or not + @DecimalSerialized + public private(set) var autoAdjustQuality: Double? + /// Whether to use direct play or not + @DecimalSerialized + public private(set) var directPlay: Double? + /// Whether to use direct stream or not + @DecimalSerialized + public private(set) var directStream: Double? + /// Whether to use fast seek or not + @DecimalSerialized + public private(set) var fastSeek: Double? + /// The location of the transcode session + public let location: String? + /// The size of the media buffer + @DecimalSerialized + public private(set) var mediaBufferSize: Double? + /// The session ID + public let session: String? + /// The subtitles + public let subtites: String? + /// The size of the subtitles + @DecimalSerialized + public private(set) var subtitleSize: Double? + + /// Creates an object with the specified parameters + /// + /// - Parameter hasMDE: Whether the media item has MDE + /// - Parameter mediaIndex: The index of the media item to transcode + /// - Parameter partIndex: The index of the part to transcode + /// - Parameter path: The path to the media item to transcode + /// - Parameter `protocol`: The protocol to use for the transcode session + /// - Parameter addDebugOverlay: Whether to add a debug overlay or not + /// - Parameter audioBoost: The audio boost + /// - Parameter autoAdjustQuality: Whether to auto adjust quality or not + /// - Parameter directPlay: Whether to use direct play or not + /// - Parameter directStream: Whether to use direct stream or not + /// - Parameter fastSeek: Whether to use fast seek or not + /// - Parameter location: The location of the transcode session + /// - Parameter mediaBufferSize: The size of the media buffer + /// - Parameter session: The session ID + /// - Parameter subtites: The subtitles + /// - Parameter subtitleSize: The size of the subtitles + /// + public init(hasMDE: Double, mediaIndex: Double, partIndex: Double, path: String, `protocol`: String, addDebugOverlay: Double? = nil, audioBoost: Double? = nil, autoAdjustQuality: Double? = nil, directPlay: Double? = nil, directStream: Double? = nil, fastSeek: Double? = nil, location: String? = nil, mediaBufferSize: Double? = nil, session: String? = nil, subtites: String? = nil, subtitleSize: Double? = nil) { + self._hasMDE = DecimalSerialized(wrappedValue: hasMDE) + self._mediaIndex = DecimalSerialized(wrappedValue: mediaIndex) + self._partIndex = DecimalSerialized(wrappedValue: partIndex) + self.path = path + self.`protocol` = `protocol` + self._addDebugOverlay = DecimalSerialized(wrappedValue: addDebugOverlay) + self._audioBoost = DecimalSerialized(wrappedValue: audioBoost) + self._autoAdjustQuality = DecimalSerialized(wrappedValue: autoAdjustQuality) + self._directPlay = DecimalSerialized(wrappedValue: directPlay) + self._directStream = DecimalSerialized(wrappedValue: directStream) + self._fastSeek = DecimalSerialized(wrappedValue: fastSeek) + self.location = location + self._mediaBufferSize = DecimalSerialized(wrappedValue: mediaBufferSize) + self.session = session + self.subtites = subtites + self._subtitleSize = DecimalSerialized(wrappedValue: subtitleSize) + } + } +} +extension Operations.StartUniversalTranscodeRequest { + var hasMDEWrapper: DecimalSerialized { + return _hasMDE + } + var mediaIndexWrapper: DecimalSerialized { + return _mediaIndex + } + var partIndexWrapper: DecimalSerialized { + return _partIndex + } + var fastSeekWrapper: DecimalSerialized { + return _fastSeek + } + var directPlayWrapper: DecimalSerialized { + return _directPlay + } + var directStreamWrapper: DecimalSerialized { + return _directStream + } + var subtitleSizeWrapper: DecimalSerialized { + return _subtitleSize + } + var audioBoostWrapper: DecimalSerialized { + return _audioBoost + } + var mediaBufferSizeWrapper: DecimalSerialized { + return _mediaBufferSize + } + var addDebugOverlayWrapper: DecimalSerialized { + return _addDebugOverlay + } + var autoAdjustQualityWrapper: DecimalSerialized { + return _autoAdjustQuality + } +} diff --git a/Sources/Plexswift/models/operations/StartUniversalTranscodeResponse.swift b/Sources/Plexswift/models/operations/StartUniversalTranscodeResponse.swift new file mode 100644 index 0000000..d45c3fd --- /dev/null +++ b/Sources/Plexswift/models/operations/StartUniversalTranscodeResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum StartUniversalTranscodeResponse { + case empty + case object(Operations.StartUniversalTranscodeResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.StartUniversalTranscodeResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/StartUniversalTranscodeResponseBody.swift b/Sources/Plexswift/models/operations/StartUniversalTranscodeResponseBody.swift new file mode 100644 index 0000000..e669659 --- /dev/null +++ b/Sources/Plexswift/models/operations/StartUniversalTranscodeResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct StartUniversalTranscodeResponseBody { + public let errors: [Operations.StartUniversalTranscodeErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.StartUniversalTranscodeErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.StartUniversalTranscodeResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/State.swift b/Sources/Plexswift/models/operations/State.swift new file mode 100644 index 0000000..8f9fec5 --- /dev/null +++ b/Sources/Plexswift/models/operations/State.swift @@ -0,0 +1,12 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// The state of the media item + public enum State: String, Codable, APIValue { + case playing = "playing" + case paused = "paused" + case stopped = "stopped" + } +} diff --git a/Sources/Plexswift/models/operations/StopAllTasksErrors.swift b/Sources/Plexswift/models/operations/StopAllTasksErrors.swift new file mode 100644 index 0000000..78d53fc --- /dev/null +++ b/Sources/Plexswift/models/operations/StopAllTasksErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StopAllTasksErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.StopAllTasksErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.StopAllTasksErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/StopAllTasksResponse.swift b/Sources/Plexswift/models/operations/StopAllTasksResponse.swift new file mode 100644 index 0000000..7f41f69 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopAllTasksResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum StopAllTasksResponse { + case empty + case object(Operations.StopAllTasksResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.StopAllTasksResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/StopAllTasksResponseBody.swift b/Sources/Plexswift/models/operations/StopAllTasksResponseBody.swift new file mode 100644 index 0000000..8e69945 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopAllTasksResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct StopAllTasksResponseBody { + public let errors: [Operations.StopAllTasksErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.StopAllTasksErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.StopAllTasksResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/StopTaskErrors.swift b/Sources/Plexswift/models/operations/StopTaskErrors.swift new file mode 100644 index 0000000..762ef36 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTaskErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StopTaskErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.StopTaskErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.StopTaskErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/StopTaskRequest.swift b/Sources/Plexswift/models/operations/StopTaskRequest.swift new file mode 100644 index 0000000..431f5e6 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTaskRequest.swift @@ -0,0 +1,19 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StopTaskRequest: APIValue { + /// The name of the task to be started. + public let taskName: Operations.PathParamTaskName + + /// Creates an object with the specified parameters + /// + /// - Parameter taskName: The name of the task to be started. + /// + public init(taskName: Operations.PathParamTaskName) { + self.taskName = taskName + } + } +} diff --git a/Sources/Plexswift/models/operations/StopTaskResponse.swift b/Sources/Plexswift/models/operations/StopTaskResponse.swift new file mode 100644 index 0000000..de41d97 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTaskResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum StopTaskResponse { + case empty + case object(Operations.StopTaskResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.StopTaskResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/StopTaskResponseBody.swift b/Sources/Plexswift/models/operations/StopTaskResponseBody.swift new file mode 100644 index 0000000..2797541 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTaskResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct StopTaskResponseBody { + public let errors: [Operations.StopTaskErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.StopTaskErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.StopTaskResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/StopTranscodeSessionErrors.swift b/Sources/Plexswift/models/operations/StopTranscodeSessionErrors.swift new file mode 100644 index 0000000..1b64caf --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTranscodeSessionErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StopTranscodeSessionErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.StopTranscodeSessionErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.StopTranscodeSessionErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/StopTranscodeSessionRequest.swift b/Sources/Plexswift/models/operations/StopTranscodeSessionRequest.swift new file mode 100644 index 0000000..13352e6 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTranscodeSessionRequest.swift @@ -0,0 +1,19 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct StopTranscodeSessionRequest: APIValue { + /// the Key of the transcode session to stop + public let sessionKey: String + + /// Creates an object with the specified parameters + /// + /// - Parameter sessionKey: the Key of the transcode session to stop + /// + public init(sessionKey: String) { + self.sessionKey = sessionKey + } + } +} diff --git a/Sources/Plexswift/models/operations/StopTranscodeSessionResponse.swift b/Sources/Plexswift/models/operations/StopTranscodeSessionResponse.swift new file mode 100644 index 0000000..b185940 --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTranscodeSessionResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum StopTranscodeSessionResponse { + case empty + case object(Operations.StopTranscodeSessionResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.StopTranscodeSessionResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/StopTranscodeSessionResponseBody.swift b/Sources/Plexswift/models/operations/StopTranscodeSessionResponseBody.swift new file mode 100644 index 0000000..35b0d8b --- /dev/null +++ b/Sources/Plexswift/models/operations/StopTranscodeSessionResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct StopTranscodeSessionResponseBody { + public let errors: [Operations.StopTranscodeSessionErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.StopTranscodeSessionErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.StopTranscodeSessionResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/Stream.swift b/Sources/Plexswift/models/operations/Stream.swift new file mode 100644 index 0000000..4c7f196 --- /dev/null +++ b/Sources/Plexswift/models/operations/Stream.swift @@ -0,0 +1,218 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Stream { + @DecimalSerialized + public private(set) var bitDepth: Double? + @DecimalSerialized + public private(set) var bitrate: Double? + public let chromaLocation: String? + public let chromaSubsampling: String? + public let codec: String? + @DecimalSerialized + public private(set) var codedHeight: Double? + @DecimalSerialized + public private(set) var codedWidth: Double? + public let colorRange: String? + public let `default`: Bool? + public let displayTitle: String? + public let extendedDisplayTitle: String? + @DecimalSerialized + public private(set) var frameRate: Double? + @DecimalSerialized + public private(set) var height: Double? + @DecimalSerialized + public private(set) var id: Double? + @DecimalSerialized + public private(set) var index: Double? + public let language: String? + public let languageCode: String? + public let languageTag: String? + @DecimalSerialized + public private(set) var level: Double? + public let profile: String? + @DecimalSerialized + public private(set) var refFrames: Double? + @DecimalSerialized + public private(set) var streamType: Double? + @DecimalSerialized + public private(set) var width: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(bitDepth: Double? = nil, bitrate: Double? = nil, chromaLocation: String? = nil, chromaSubsampling: String? = nil, codec: String? = nil, codedHeight: Double? = nil, codedWidth: Double? = nil, colorRange: String? = nil, `default`: Bool? = nil, displayTitle: String? = nil, extendedDisplayTitle: String? = nil, frameRate: Double? = nil, height: Double? = nil, id: Double? = nil, index: Double? = nil, language: String? = nil, languageCode: String? = nil, languageTag: String? = nil, level: Double? = nil, profile: String? = nil, refFrames: Double? = nil, streamType: Double? = nil, width: Double? = nil) { + self._bitDepth = DecimalSerialized(wrappedValue: bitDepth) + self._bitrate = DecimalSerialized(wrappedValue: bitrate) + self.chromaLocation = chromaLocation + self.chromaSubsampling = chromaSubsampling + self.codec = codec + self._codedHeight = DecimalSerialized(wrappedValue: codedHeight) + self._codedWidth = DecimalSerialized(wrappedValue: codedWidth) + self.colorRange = colorRange + self.`default` = `default` + self.displayTitle = displayTitle + self.extendedDisplayTitle = extendedDisplayTitle + self._frameRate = DecimalSerialized(wrappedValue: frameRate) + self._height = DecimalSerialized(wrappedValue: height) + self._id = DecimalSerialized(wrappedValue: id) + self._index = DecimalSerialized(wrappedValue: index) + self.language = language + self.languageCode = languageCode + self.languageTag = languageTag + self._level = DecimalSerialized(wrappedValue: level) + self.profile = profile + self._refFrames = DecimalSerialized(wrappedValue: refFrames) + self._streamType = DecimalSerialized(wrappedValue: streamType) + self._width = DecimalSerialized(wrappedValue: width) + } + } +} + +extension Operations.Stream: Codable { + enum CodingKeys: String, CodingKey { + case bitDepth + case bitrate + case chromaLocation + case chromaSubsampling + case codec + case codedHeight + case codedWidth + case colorRange + case `default` = "default" + case displayTitle + case extendedDisplayTitle + case frameRate + case height + case id + case index + case language + case languageCode + case languageTag + case level + case profile + case refFrames + case streamType + case width + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._bitDepth = try container.decodeIfPresent(DecimalSerialized.self, forKey: .bitDepth) ?? DecimalSerialized(wrappedValue: nil) + self._bitrate = try container.decodeIfPresent(DecimalSerialized.self, forKey: .bitrate) ?? DecimalSerialized(wrappedValue: nil) + self.chromaLocation = try container.decodeIfPresent(String.self, forKey: .chromaLocation) + self.chromaSubsampling = try container.decodeIfPresent(String.self, forKey: .chromaSubsampling) + self.codec = try container.decodeIfPresent(String.self, forKey: .codec) + self._codedHeight = try container.decodeIfPresent(DecimalSerialized.self, forKey: .codedHeight) ?? DecimalSerialized(wrappedValue: nil) + self._codedWidth = try container.decodeIfPresent(DecimalSerialized.self, forKey: .codedWidth) ?? DecimalSerialized(wrappedValue: nil) + self.colorRange = try container.decodeIfPresent(String.self, forKey: .colorRange) + self.`default` = try container.decodeIfPresent(Bool.self, forKey: .`default`) + self.displayTitle = try container.decodeIfPresent(String.self, forKey: .displayTitle) + self.extendedDisplayTitle = try container.decodeIfPresent(String.self, forKey: .extendedDisplayTitle) + self._frameRate = try container.decodeIfPresent(DecimalSerialized.self, forKey: .frameRate) ?? DecimalSerialized(wrappedValue: nil) + self._height = try container.decodeIfPresent(DecimalSerialized.self, forKey: .height) ?? DecimalSerialized(wrappedValue: nil) + self._id = try container.decodeIfPresent(DecimalSerialized.self, forKey: .id) ?? DecimalSerialized(wrappedValue: nil) + self._index = try container.decodeIfPresent(DecimalSerialized.self, forKey: .index) ?? DecimalSerialized(wrappedValue: nil) + self.language = try container.decodeIfPresent(String.self, forKey: .language) + self.languageCode = try container.decodeIfPresent(String.self, forKey: .languageCode) + self.languageTag = try container.decodeIfPresent(String.self, forKey: .languageTag) + self._level = try container.decodeIfPresent(DecimalSerialized.self, forKey: .level) ?? DecimalSerialized(wrappedValue: nil) + self.profile = try container.decodeIfPresent(String.self, forKey: .profile) + self._refFrames = try container.decodeIfPresent(DecimalSerialized.self, forKey: .refFrames) ?? DecimalSerialized(wrappedValue: nil) + self._streamType = try container.decodeIfPresent(DecimalSerialized.self, forKey: .streamType) ?? DecimalSerialized(wrappedValue: nil) + self._width = try container.decodeIfPresent(DecimalSerialized.self, forKey: .width) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.bitDepth != nil { + try container.encode(self._bitDepth, forKey: .bitDepth) + } + if self.bitrate != nil { + try container.encode(self._bitrate, forKey: .bitrate) + } + try container.encodeIfPresent(self.chromaLocation, forKey: .chromaLocation) + try container.encodeIfPresent(self.chromaSubsampling, forKey: .chromaSubsampling) + try container.encodeIfPresent(self.codec, forKey: .codec) + if self.codedHeight != nil { + try container.encode(self._codedHeight, forKey: .codedHeight) + } + if self.codedWidth != nil { + try container.encode(self._codedWidth, forKey: .codedWidth) + } + try container.encodeIfPresent(self.colorRange, forKey: .colorRange) + try container.encodeIfPresent(self.`default`, forKey: .`default`) + try container.encodeIfPresent(self.displayTitle, forKey: .displayTitle) + try container.encodeIfPresent(self.extendedDisplayTitle, forKey: .extendedDisplayTitle) + if self.frameRate != nil { + try container.encode(self._frameRate, forKey: .frameRate) + } + if self.height != nil { + try container.encode(self._height, forKey: .height) + } + if self.id != nil { + try container.encode(self._id, forKey: .id) + } + if self.index != nil { + try container.encode(self._index, forKey: .index) + } + try container.encodeIfPresent(self.language, forKey: .language) + try container.encodeIfPresent(self.languageCode, forKey: .languageCode) + try container.encodeIfPresent(self.languageTag, forKey: .languageTag) + if self.level != nil { + try container.encode(self._level, forKey: .level) + } + try container.encodeIfPresent(self.profile, forKey: .profile) + if self.refFrames != nil { + try container.encode(self._refFrames, forKey: .refFrames) + } + if self.streamType != nil { + try container.encode(self._streamType, forKey: .streamType) + } + if self.width != nil { + try container.encode(self._width, forKey: .width) + } + } +} + +extension Operations.Stream { + var idWrapper: DecimalSerialized { + return _id + } + var streamTypeWrapper: DecimalSerialized { + return _streamType + } + var indexWrapper: DecimalSerialized { + return _index + } + var bitrateWrapper: DecimalSerialized { + return _bitrate + } + var bitDepthWrapper: DecimalSerialized { + return _bitDepth + } + var codedHeightWrapper: DecimalSerialized { + return _codedHeight + } + var codedWidthWrapper: DecimalSerialized { + return _codedWidth + } + var frameRateWrapper: DecimalSerialized { + return _frameRate + } + var heightWrapper: DecimalSerialized { + return _height + } + var levelWrapper: DecimalSerialized { + return _level + } + var refFramesWrapper: DecimalSerialized { + return _refFrames + } + var widthWrapper: DecimalSerialized { + return _width + } +} diff --git a/Sources/Plexswift/models/operations/TaskName.swift b/Sources/Plexswift/models/operations/TaskName.swift new file mode 100644 index 0000000..1e5e7d9 --- /dev/null +++ b/Sources/Plexswift/models/operations/TaskName.swift @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// the name of the task to be started. + public enum TaskName: String, Codable, APIValue { + case backupDatabase = "BackupDatabase" + case buildGracenoteCollections = "BuildGracenoteCollections" + case checkForUpdates = "CheckForUpdates" + case cleanOldBundles = "CleanOldBundles" + case cleanOldCacheFiles = "CleanOldCacheFiles" + case deepMediaAnalysis = "DeepMediaAnalysis" + case generateAutoTags = "GenerateAutoTags" + case generateChapterThumbs = "GenerateChapterThumbs" + case generateMediaIndexFiles = "GenerateMediaIndexFiles" + case optimizeDatabase = "OptimizeDatabase" + case refreshLibraries = "RefreshLibraries" + case refreshLocalMedia = "RefreshLocalMedia" + case refreshPeriodicMetadata = "RefreshPeriodicMetadata" + case upgradeMediaAnalysis = "UpgradeMediaAnalysis" + } +} diff --git a/Sources/Plexswift/models/operations/Tonight.swift b/Sources/Plexswift/models/operations/Tonight.swift new file mode 100644 index 0000000..2fc14e9 --- /dev/null +++ b/Sources/Plexswift/models/operations/Tonight.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install + public enum Tonight: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/TranscodeSession.swift b/Sources/Plexswift/models/operations/TranscodeSession.swift new file mode 100644 index 0000000..65d24d5 --- /dev/null +++ b/Sources/Plexswift/models/operations/TranscodeSession.swift @@ -0,0 +1,189 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct TranscodeSession { + @DecimalSerialized + public private(set) var audioChannels: Double? + public let audioCodec: String? + public let audioDecision: String? + public let complete: Bool? + public let container: String? + public let context: String? + @DecimalSerialized + public private(set) var duration: Double? + public let error: Bool? + public let key: String? + @DecimalSerialized + public private(set) var maxOffsetAvailable: Double? + @DecimalSerialized + public private(set) var minOffsetAvailable: Double? + @DecimalSerialized + public private(set) var progress: Double? + public let `protocol`: String? + @DecimalSerialized + public private(set) var size: Double? + public let sourceAudioCodec: String? + public let sourceVideoCodec: String? + @DecimalSerialized + public private(set) var speed: Double? + public let throttled: Bool? + @DecimalSerialized + public private(set) var timeStamp: Double? + public let transcodeHwRequested: Bool? + public let videoCodec: String? + public let videoDecision: String? + + /// Creates an object with the specified parameters + /// + /// + public init(audioChannels: Double? = nil, audioCodec: String? = nil, audioDecision: String? = nil, complete: Bool? = nil, container: String? = nil, context: String? = nil, duration: Double? = nil, error: Bool? = nil, key: String? = nil, maxOffsetAvailable: Double? = nil, minOffsetAvailable: Double? = nil, progress: Double? = nil, `protocol`: String? = nil, size: Double? = nil, sourceAudioCodec: String? = nil, sourceVideoCodec: String? = nil, speed: Double? = nil, throttled: Bool? = nil, timeStamp: Double? = nil, transcodeHwRequested: Bool? = nil, videoCodec: String? = nil, videoDecision: String? = nil) { + self._audioChannels = DecimalSerialized(wrappedValue: audioChannels) + self.audioCodec = audioCodec + self.audioDecision = audioDecision + self.complete = complete + self.container = container + self.context = context + self._duration = DecimalSerialized(wrappedValue: duration) + self.error = error + self.key = key + self._maxOffsetAvailable = DecimalSerialized(wrappedValue: maxOffsetAvailable) + self._minOffsetAvailable = DecimalSerialized(wrappedValue: minOffsetAvailable) + self._progress = DecimalSerialized(wrappedValue: progress) + self.`protocol` = `protocol` + self._size = DecimalSerialized(wrappedValue: size) + self.sourceAudioCodec = sourceAudioCodec + self.sourceVideoCodec = sourceVideoCodec + self._speed = DecimalSerialized(wrappedValue: speed) + self.throttled = throttled + self._timeStamp = DecimalSerialized(wrappedValue: timeStamp) + self.transcodeHwRequested = transcodeHwRequested + self.videoCodec = videoCodec + self.videoDecision = videoDecision + } + } +} + +extension Operations.TranscodeSession: Codable { + enum CodingKeys: String, CodingKey { + case audioChannels + case audioCodec + case audioDecision + case complete + case container + case context + case duration + case error + case key + case maxOffsetAvailable + case minOffsetAvailable + case progress + case `protocol` = "protocol" + case size + case sourceAudioCodec + case sourceVideoCodec + case speed + case throttled + case timeStamp + case transcodeHwRequested + case videoCodec + case videoDecision + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._audioChannels = try container.decodeIfPresent(DecimalSerialized.self, forKey: .audioChannels) ?? DecimalSerialized(wrappedValue: nil) + self.audioCodec = try container.decodeIfPresent(String.self, forKey: .audioCodec) + self.audioDecision = try container.decodeIfPresent(String.self, forKey: .audioDecision) + self.complete = try container.decodeIfPresent(Bool.self, forKey: .complete) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self.context = try container.decodeIfPresent(String.self, forKey: .context) + self._duration = try container.decodeIfPresent(DecimalSerialized.self, forKey: .duration) ?? DecimalSerialized(wrappedValue: nil) + self.error = try container.decodeIfPresent(Bool.self, forKey: .error) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self._maxOffsetAvailable = try container.decodeIfPresent(DecimalSerialized.self, forKey: .maxOffsetAvailable) ?? DecimalSerialized(wrappedValue: nil) + self._minOffsetAvailable = try container.decodeIfPresent(DecimalSerialized.self, forKey: .minOffsetAvailable) ?? DecimalSerialized(wrappedValue: nil) + self._progress = try container.decodeIfPresent(DecimalSerialized.self, forKey: .progress) ?? DecimalSerialized(wrappedValue: nil) + self.`protocol` = try container.decodeIfPresent(String.self, forKey: .`protocol`) + self._size = try container.decodeIfPresent(DecimalSerialized.self, forKey: .size) ?? DecimalSerialized(wrappedValue: nil) + self.sourceAudioCodec = try container.decodeIfPresent(String.self, forKey: .sourceAudioCodec) + self.sourceVideoCodec = try container.decodeIfPresent(String.self, forKey: .sourceVideoCodec) + self._speed = try container.decodeIfPresent(DecimalSerialized.self, forKey: .speed) ?? DecimalSerialized(wrappedValue: nil) + self.throttled = try container.decodeIfPresent(Bool.self, forKey: .throttled) + self._timeStamp = try container.decodeIfPresent(DecimalSerialized.self, forKey: .timeStamp) ?? DecimalSerialized(wrappedValue: nil) + self.transcodeHwRequested = try container.decodeIfPresent(Bool.self, forKey: .transcodeHwRequested) + self.videoCodec = try container.decodeIfPresent(String.self, forKey: .videoCodec) + self.videoDecision = try container.decodeIfPresent(String.self, forKey: .videoDecision) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.audioChannels != nil { + try container.encode(self._audioChannels, forKey: .audioChannels) + } + try container.encodeIfPresent(self.audioCodec, forKey: .audioCodec) + try container.encodeIfPresent(self.audioDecision, forKey: .audioDecision) + try container.encodeIfPresent(self.complete, forKey: .complete) + try container.encodeIfPresent(self.container, forKey: .container) + try container.encodeIfPresent(self.context, forKey: .context) + if self.duration != nil { + try container.encode(self._duration, forKey: .duration) + } + try container.encodeIfPresent(self.error, forKey: .error) + try container.encodeIfPresent(self.key, forKey: .key) + if self.maxOffsetAvailable != nil { + try container.encode(self._maxOffsetAvailable, forKey: .maxOffsetAvailable) + } + if self.minOffsetAvailable != nil { + try container.encode(self._minOffsetAvailable, forKey: .minOffsetAvailable) + } + if self.progress != nil { + try container.encode(self._progress, forKey: .progress) + } + try container.encodeIfPresent(self.`protocol`, forKey: .`protocol`) + if self.size != nil { + try container.encode(self._size, forKey: .size) + } + try container.encodeIfPresent(self.sourceAudioCodec, forKey: .sourceAudioCodec) + try container.encodeIfPresent(self.sourceVideoCodec, forKey: .sourceVideoCodec) + if self.speed != nil { + try container.encode(self._speed, forKey: .speed) + } + try container.encodeIfPresent(self.throttled, forKey: .throttled) + if self.timeStamp != nil { + try container.encode(self._timeStamp, forKey: .timeStamp) + } + try container.encodeIfPresent(self.transcodeHwRequested, forKey: .transcodeHwRequested) + try container.encodeIfPresent(self.videoCodec, forKey: .videoCodec) + try container.encodeIfPresent(self.videoDecision, forKey: .videoDecision) + } +} + +extension Operations.TranscodeSession { + var progressWrapper: DecimalSerialized { + return _progress + } + var sizeWrapper: DecimalSerialized { + return _size + } + var speedWrapper: DecimalSerialized { + return _speed + } + var durationWrapper: DecimalSerialized { + return _duration + } + var audioChannelsWrapper: DecimalSerialized { + return _audioChannels + } + var timeStampWrapper: DecimalSerialized { + return _timeStamp + } + var maxOffsetAvailableWrapper: DecimalSerialized { + return _maxOffsetAvailable + } + var minOffsetAvailableWrapper: DecimalSerialized { + return _minOffsetAvailable + } +} diff --git a/Sources/Plexswift/models/operations/TypeModel.swift b/Sources/Plexswift/models/operations/TypeModel.swift new file mode 100644 index 0000000..53308a9 --- /dev/null +++ b/Sources/Plexswift/models/operations/TypeModel.swift @@ -0,0 +1,12 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// type of playlist to create + public enum TypeModel: String, Codable, APIValue { + case audio = "audio" + case video = "video" + case photo = "photo" + } +} diff --git a/Sources/Plexswift/models/operations/UpdatePlayProgressErrors.swift b/Sources/Plexswift/models/operations/UpdatePlayProgressErrors.swift new file mode 100644 index 0000000..31f7fe9 --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlayProgressErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct UpdatePlayProgressErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.UpdatePlayProgressErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.UpdatePlayProgressErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/UpdatePlayProgressRequest.swift b/Sources/Plexswift/models/operations/UpdatePlayProgressRequest.swift new file mode 100644 index 0000000..bab1113 --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlayProgressRequest.swift @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct UpdatePlayProgressRequest: APIValue { + /// the media key + public let key: String + /// The playback state of the media item. + public let state: String + /// The time, in milliseconds, used to set the media playback progress. + @DecimalSerialized + public private(set) var time: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter key: the media key + /// - Parameter state: The playback state of the media item. + /// - Parameter time: The time, in milliseconds, used to set the media playback progress. + /// + public init(key: String, state: String, time: Double) { + self.key = key + self.state = state + self._time = DecimalSerialized(wrappedValue: time) + } + } +} +extension Operations.UpdatePlayProgressRequest { + var timeWrapper: DecimalSerialized { + return _time + } +} diff --git a/Sources/Plexswift/models/operations/UpdatePlayProgressResponse.swift b/Sources/Plexswift/models/operations/UpdatePlayProgressResponse.swift new file mode 100644 index 0000000..14cbd0f --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlayProgressResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum UpdatePlayProgressResponse { + case empty + case object(Operations.UpdatePlayProgressResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.UpdatePlayProgressResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/UpdatePlayProgressResponseBody.swift b/Sources/Plexswift/models/operations/UpdatePlayProgressResponseBody.swift new file mode 100644 index 0000000..ef1b6d6 --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlayProgressResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct UpdatePlayProgressResponseBody { + public let errors: [Operations.UpdatePlayProgressErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.UpdatePlayProgressErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.UpdatePlayProgressResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/UpdatePlaylistErrors.swift b/Sources/Plexswift/models/operations/UpdatePlaylistErrors.swift new file mode 100644 index 0000000..19e6475 --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlaylistErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct UpdatePlaylistErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.UpdatePlaylistErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.UpdatePlaylistErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/UpdatePlaylistRequest.swift b/Sources/Plexswift/models/operations/UpdatePlaylistRequest.swift new file mode 100644 index 0000000..42ed07d --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlaylistRequest.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct UpdatePlaylistRequest: APIValue { + /// the ID of the playlist + @DecimalSerialized + public private(set) var playlistID: Double + + /// Creates an object with the specified parameters + /// + /// - Parameter playlistID: the ID of the playlist + /// + public init(playlistID: Double) { + self._playlistID = DecimalSerialized(wrappedValue: playlistID) + } + } +} +extension Operations.UpdatePlaylistRequest { + var playlistIDWrapper: DecimalSerialized { + return _playlistID + } +} diff --git a/Sources/Plexswift/models/operations/UpdatePlaylistResponse.swift b/Sources/Plexswift/models/operations/UpdatePlaylistResponse.swift new file mode 100644 index 0000000..ae5bc13 --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlaylistResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum UpdatePlaylistResponse { + case empty + case object(Operations.UpdatePlaylistResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.UpdatePlaylistResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/UpdatePlaylistResponseBody.swift b/Sources/Plexswift/models/operations/UpdatePlaylistResponseBody.swift new file mode 100644 index 0000000..3cf4f4a --- /dev/null +++ b/Sources/Plexswift/models/operations/UpdatePlaylistResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct UpdatePlaylistResponseBody { + public let errors: [Operations.UpdatePlaylistErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.UpdatePlaylistErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.UpdatePlaylistResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/UploadPlaylistErrors.swift b/Sources/Plexswift/models/operations/UploadPlaylistErrors.swift new file mode 100644 index 0000000..01ade9a --- /dev/null +++ b/Sources/Plexswift/models/operations/UploadPlaylistErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct UploadPlaylistErrors { + @DecimalSerialized + public private(set) var code: Double? + public let message: String? + @DecimalSerialized + public private(set) var status: Double? + + /// Creates an object with the specified parameters + /// + /// + public init(code: Double? = nil, message: String? = nil, status: Double? = nil) { + self._code = DecimalSerialized(wrappedValue: code) + self.message = message + self._status = DecimalSerialized(wrappedValue: status) + } + } +} + +extension Operations.UploadPlaylistErrors: Codable { + enum CodingKeys: String, CodingKey { + case code + case message + case status + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self._code = try container.decodeIfPresent(DecimalSerialized.self, forKey: .code) ?? DecimalSerialized(wrappedValue: nil) + self.message = try container.decodeIfPresent(String.self, forKey: .message) + self._status = try container.decodeIfPresent(DecimalSerialized.self, forKey: .status) ?? DecimalSerialized(wrappedValue: nil) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if self.code != nil { + try container.encode(self._code, forKey: .code) + } + try container.encodeIfPresent(self.message, forKey: .message) + if self.status != nil { + try container.encode(self._status, forKey: .status) + } + } +} + +extension Operations.UploadPlaylistErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/UploadPlaylistRequest.swift b/Sources/Plexswift/models/operations/UploadPlaylistRequest.swift new file mode 100644 index 0000000..a65b0e6 --- /dev/null +++ b/Sources/Plexswift/models/operations/UploadPlaylistRequest.swift @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct UploadPlaylistRequest: APIValue { + /// force overwriting of duplicate playlists. By default, a playlist file uploaded with the same path will overwrite the existing playlist. + /// The `force` argument is used to disable overwriting. If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. + /// + public let force: Operations.Force + /// absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server. + /// If the `path` argument is a directory, that path will be scanned for playlist files to be processed. + /// Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it. + /// The GUID of each playlist is based on the filename. + /// If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it. + /// The GUID of each playlist is based on the filename. + /// + public let path: String + + /// Creates an object with the specified parameters + /// + /// - Parameter force: force overwriting of duplicate playlists. By default, a playlist file uploaded with the same path will overwrite the existing playlist. + /// The `force` argument is used to disable overwriting. If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. + /// + /// - Parameter path: absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server. + /// If the `path` argument is a directory, that path will be scanned for playlist files to be processed. + /// Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it. + /// The GUID of each playlist is based on the filename. + /// If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it. + /// The GUID of each playlist is based on the filename. + /// + /// + public init(force: Operations.Force, path: String) { + self.force = force + self.path = path + } + } +} diff --git a/Sources/Plexswift/models/operations/UploadPlaylistResponse.swift b/Sources/Plexswift/models/operations/UploadPlaylistResponse.swift new file mode 100644 index 0000000..5b7ad6b --- /dev/null +++ b/Sources/Plexswift/models/operations/UploadPlaylistResponse.swift @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum UploadPlaylistResponse { + case empty + case object(Operations.UploadPlaylistResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func object() throws -> Operations.UploadPlaylistResponseBody { + guard case .object(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + } +} diff --git a/Sources/Plexswift/models/operations/UploadPlaylistResponseBody.swift b/Sources/Plexswift/models/operations/UploadPlaylistResponseBody.swift new file mode 100644 index 0000000..952c785 --- /dev/null +++ b/Sources/Plexswift/models/operations/UploadPlaylistResponseBody.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + public struct UploadPlaylistResponseBody { + public let errors: [Operations.UploadPlaylistErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.UploadPlaylistErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.UploadPlaylistResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/Upscale.swift b/Sources/Plexswift/models/operations/Upscale.swift new file mode 100644 index 0000000..36a3857 --- /dev/null +++ b/Sources/Plexswift/models/operations/Upscale.swift @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// allow images to be resized beyond native dimensions. + public enum Upscale: Int, Codable, APIValue { + case zero = 0 + case one = 1 + } +} diff --git a/Sources/Plexswift/models/operations/Writer.swift b/Sources/Plexswift/models/operations/Writer.swift new file mode 100644 index 0000000..7fd7525 --- /dev/null +++ b/Sources/Plexswift/models/operations/Writer.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct Writer { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.Writer: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/shared/Security.swift b/Sources/Plexswift/models/shared/Security.swift new file mode 100644 index 0000000..74db21e --- /dev/null +++ b/Sources/Plexswift/models/shared/Security.swift @@ -0,0 +1,10 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Shared { + /// Describes the available authentication methods when connecting to the API. + public enum Security { + case accessToken(String) + } +} diff --git a/Sources/plexswift/AnyValue.swift b/Sources/plexswift/AnyValue.swift new file mode 100644 index 0000000..253e4de --- /dev/null +++ b/Sources/plexswift/AnyValue.swift @@ -0,0 +1,220 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +/// A type that describes any value that can be used in a request or response object. +public protocol APIValue {} + +extension NSNull: APIValue {} +extension String: APIValue {} +extension Int: APIValue {} +extension Double: APIValue {} +extension Bool: APIValue {} +extension Optional: APIValue where Wrapped: APIValue {} +extension Array: APIValue where Element: APIValue {} +extension Dictionary: APIValue where Key == String, Value: APIValue {} + +enum APIValueConversionError: Error { + case invalidType +} + +/// A type-erased wrapper for passing around ``APIValue`` values. +public struct AnyValue: Codable { + // This is a type-erased wrapper which allows us to store Serializable values in collections, as well as handle + // JSON encoding and decoding. + + private var _serialize: (_ format: SerializableFormat) throws -> String + private var _serializeQueryParameters: (_ format: SerializableFormat) throws -> [QueryParameter] + private var _description: () -> String + private var _serializable: () -> any Serializable + + init(serializable: Serializable) { + _serialize = { format in try serializable.serialize(with: format) } + _serializeQueryParameters = { format in try serializable.serializeQueryParameters(with: format) } + _serializable = { return serializable } + _description = { + if let serializable = serializable as? CustomStringConvertible { + return serializable.description + } else { + return String(describing: serializable) + } + } + } + + /// Creates an object from an `NSNull` value + public init(_ null: NSNull) { + self.init(serializable: null) + } + + /// Creates an object from a string value + public init(_ string: String) { + self.init(serializable: string) + } + + /// Creates an object from an integer value + public init(_ int: Int) { + self.init(serializable: int) + } + + /// Creates an object from a double value + public init(_ double: Double) { + self.init(serializable: double) + } + + /// Creates an object from a boolean value + public init(_ bool: Bool) { + self.init(serializable: bool) + } + + /// Creates an object from any ``APIValue`` value + public init(_ value: APIValue) throws { + guard let serializable = value as? Serializable else { + throw APIValueConversionError.invalidType + } + self.init(serializable: serializable) + } + + /// Creates an object from an optional value + public init(_ optional: Optional) throws { + guard let serializable = optional as? Serializable else { + throw APIValueConversionError.invalidType + } + self.init(serializable: serializable) + } + + /// Creates an object from an array value + public init(_ array: Array) throws { + guard let serializable = array as? Serializable else { + throw APIValueConversionError.invalidType + } + self.init(serializable: serializable) + } + + /// Creates an object from a dictionary value + public init(_ dictionary: Dictionary) throws { + guard let serializable = dictionary as? Serializable else { + throw APIValueConversionError.invalidType + } + self.init(serializable: serializable) + } + + // MARK: - Codable + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + + if container.decodeNil() { + self.init(serializable: NSNull()) + } else if let boolValue = try? container.decode(Bool.self) { + self.init(serializable: boolValue) + } else if let intValue = try? container.decode(Int.self) { + self.init(serializable: intValue) + } else if let doubleValue = try? container.decode(Double.self) { + self.init(serializable: doubleValue) + } else if let stringValue = try? container.decode(String.self) { + self.init(serializable: stringValue) + } else if let arrayValue = try? container.decode([AnyValue].self) { + self.init(serializable: arrayValue) + } else if let dictionaryValue = try? container.decode([String: AnyValue].self) { + self.init(serializable: dictionaryValue) + } else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Unsupported value in container. Is this valid JSON?" + ) + } + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + let value = _serializable() + + if value is NSNull { + try container.encodeNil() + } else if let boolValue = value as? Bool { + try container.encode(boolValue) + } else if let intValue = value as? Int { + try container.encode(intValue) + } else if let doubleValue = value as? Double { + try container.encode(doubleValue) + } else if let stringValue = value as? String { + try container.encode(stringValue) + } else if let arrayValue = value as? [AnyValue] { + try container.encode(arrayValue) + } else if let dictionaryValue = value as? [String: AnyValue] { + try container.encode(dictionaryValue) + } else if let encodableValue = value as? Encodable { + try container.encode(encodableValue) + } else { + let context = EncodingError.Context(codingPath: container.codingPath, debugDescription: "Cannot encode value") + throw EncodingError.invalidValue(value, context) + } + } +} + +// MARK: - Serializable + +extension AnyValue: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try _serialize(format) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try _serializeQueryParameters(format) + } +} + +// MARK: - Helpers + +extension AnyValue { + subscript(key: String) -> AnyValue? { + if let serializable = _serializable() as? [String: Serializable], let value = serializable[key] { + return AnyValue(serializable: value) + } else { + return nil + } + } + + func `as`(type: T.Type) -> T? { + return _serializable() as? T + } + + func asArray(elementType: T.Type) -> [T]? { + guard let array = _serializable() as? [AnyValue] else { return nil } + var result: [T] = [] + for element in array { + guard let element = element.as(type: T.self) else { return nil } + result.append(element) + } + return result + } +} + +// MARK: - Equatable + +extension AnyValue: Equatable { + public static func == (lhs: AnyValue, rhs: AnyValue) -> Bool { + let lhsValue = lhs._serializable() + let rhsValue = rhs._serializable() + + switch (lhsValue, rhsValue) { + case is (NSNull, NSNull): return true + case let (lhsValue as Bool, rhsValue as Bool): return lhsValue == rhsValue + case let (lhsValue as Int, rhsValue as Int): return lhsValue == rhsValue + case let (lhsValue as Double, rhsValue as Double): return lhsValue == rhsValue + case let (lhsValue as String, rhsValue as String): return lhsValue == rhsValue + case let (lhsValue as [AnyValue], rhsValue as [AnyValue]): return lhsValue == rhsValue + case let (lhsValue as [String: AnyValue], rhsValue as [String: AnyValue]): return lhsValue == rhsValue + default: + return false + } + } +} + +// MARK: - CustomStringConvertible + +extension AnyValue: CustomStringConvertible { + public var description: String { + return _description() + } +} diff --git a/Sources/plexswift/PlexswiftAPI.swift b/Sources/plexswift/PlexswiftAPI.swift new file mode 100644 index 0000000..e7b6a8f --- /dev/null +++ b/Sources/plexswift/PlexswiftAPI.swift @@ -0,0 +1,782 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +/// Defines the operations supported by the API. +/// +/// This protocol defines all of the operations supported by the API. It is implemented by ``Client`` which can be used to make these API requests and handle their responses. +/// +/// ## Topics +/// +/// ### API calls +/// +/// These methods allow you to make requests to the API. +/// +/// +/// ### Scoped API calls +/// +/// These properties logically group other parts of the API. +/// +/// - ``server`` +/// - ``media`` +/// - ``activities`` +/// - ``butler`` +/// - ``hubs`` +/// - ``search`` +/// - ``library`` +/// - ``log`` +/// - ``playlists`` +/// - ``security`` +/// - ``sessions`` +/// - ``updater`` +/// - ``video`` +/// +public protocol PlexswiftAPI { + + // MARK: - Scoped APIs + /// Operations against the Plex Media Server System. + /// + var server: ServerAPI { get } + /// API Calls interacting with Plex Media Server Media + /// + var media: MediaAPI { get } + /// Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints. + /// Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity. + /// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details: + /// - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity. + /// - They must contain an `type` which is used by clients to distinguish the specific activity. + /// - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.) + /// - The may contain a `Response` object which attributes which represent the result of the asynchronous operation. + /// + var activities: ActivitiesAPI { get } + /// Butler is the task manager of the Plex Media Server Ecosystem. + /// + var butler: ButlerAPI { get } + /// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows. + /// + var hubs: HubsAPI { get } + /// API Calls that perform search operations with Plex Media Server + /// + var search: SearchAPI { get } + /// API Calls interacting with Plex Media Server Libraries + /// + var library: LibraryAPI { get } + /// Submit logs to the Log Handler for Plex Media Server + /// + var log: LogAPI { get } + /// Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017"). + /// They can be organized in (optionally nesting) folders. + /// Retrieving a playlist, or its items, will trigger a refresh of its metadata. + /// This may cause the duration and number of items to change. + /// + var playlists: PlaylistsAPI { get } + /// API Calls against Security for Plex Media Server + /// + var security: SecurityAPI { get } + /// API Calls that perform search operations with Plex Media Server Sessions + /// + var sessions: SessionsAPI { get } + /// This describes the API for searching and applying updates to the Plex Media Server. + /// Updates to the status can be observed via the Event API. + /// + var updater: UpdaterAPI { get } + /// API Calls that perform operations with Plex Media Server Videos + /// + var video: VideoAPI { get } +} + +// MARK: - ServerAPI + +/// Operations against the Plex Media Server System. +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getServerCapabilities()`` +/// - ``getServerPreferences()`` +/// - ``getAvailableClients()`` +/// - ``getDevices()`` +/// - ``getServerIdentity()`` +/// - ``getMyPlexAccount()`` +/// - ``getResizedPhoto(request:)`` +/// - ``getServerList()`` +/// +public protocol ServerAPI { + /// Server Capabilities + /// + /// - Returns: A ``Operations/GetServerCapabilitiesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getServerCapabilities() async throws -> Response + + /// Get Server Preferences + /// + /// - Returns: A ``Operations/GetServerPreferencesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getServerPreferences() async throws -> Response + + /// Get Available Clients + /// + /// - Returns: A ``Operations/GetAvailableClientsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getAvailableClients() async throws -> Response + + /// Get Devices + /// + /// - Returns: A ``Operations/GetDevicesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getDevices() async throws -> Response + + /// Get Server Identity + /// + /// - Returns: A ``Operations/GetServerIdentityResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getServerIdentity() async throws -> Response + + /// Returns MyPlex Account Information + /// + /// - Returns: A ``Operations/GetMyPlexAccountResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getMyPlexAccount() async throws -> Response + + /// Plex's Photo transcoder is used throughout the service to serve images at specified sizes. + /// + /// + /// - Parameter request: A ``Operations/GetResizedPhotoRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetResizedPhotoResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getResizedPhoto(request: Operations.GetResizedPhotoRequest) async throws -> Response + + /// Get Server List + /// + /// - Returns: A ``Operations/GetServerListResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getServerList() async throws -> Response +} + +// MARK: - MediaAPI + +/// API Calls interacting with Plex Media Server Media +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``markPlayed(request:)`` +/// - ``markUnplayed(request:)`` +/// - ``updatePlayProgress(request:)`` +/// +public protocol MediaAPI { + /// This will mark the provided media key as Played. + /// + /// - Parameter request: A ``Operations/MarkPlayedRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/MarkPlayedResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func markPlayed(request: Operations.MarkPlayedRequest) async throws -> Response + + /// This will mark the provided media key as Unplayed. + /// + /// - Parameter request: A ``Operations/MarkUnplayedRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/MarkUnplayedResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func markUnplayed(request: Operations.MarkUnplayedRequest) async throws -> Response + + /// This API command can be used to update the play progress of a media item. + /// + /// + /// - Parameter request: A ``Operations/UpdatePlayProgressRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/UpdatePlayProgressResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func updatePlayProgress(request: Operations.UpdatePlayProgressRequest) async throws -> Response +} + +// MARK: - ActivitiesAPI + +/// Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints. +/// Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity. +/// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details: +/// - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity. +/// - They must contain an `type` which is used by clients to distinguish the specific activity. +/// - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.) +/// - The may contain a `Response` object which attributes which represent the result of the asynchronous operation. +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getServerActivities()`` +/// - ``cancelServerActivities(request:)`` +/// +public protocol ActivitiesAPI { + /// Get Server Activities + /// + /// - Returns: A ``Operations/GetServerActivitiesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getServerActivities() async throws -> Response + + /// Cancel Server Activities + /// + /// - Parameter request: A ``Operations/CancelServerActivitiesRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/CancelServerActivitiesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func cancelServerActivities(request: Operations.CancelServerActivitiesRequest) async throws -> Response +} + +// MARK: - ButlerAPI + +/// Butler is the task manager of the Plex Media Server Ecosystem. +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getButlerTasks()`` +/// - ``startAllTasks()`` +/// - ``stopAllTasks()`` +/// - ``startTask(request:)`` +/// - ``stopTask(request:)`` +/// +public protocol ButlerAPI { + /// Returns a list of butler tasks + /// + /// - Returns: A ``Operations/GetButlerTasksResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getButlerTasks() async throws -> Response + + /// This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria: + /// 1. Any tasks not scheduled to run on the current day will be skipped. + /// 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately. + /// 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window. + /// 4. If we are outside the configured window, the task will start immediately. + /// + /// + /// - Returns: A ``Operations/StartAllTasksResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func startAllTasks() async throws -> Response + + /// This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue. + /// + /// + /// - Returns: A ``Operations/StopAllTasksResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func stopAllTasks() async throws -> Response + + /// This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria: + /// 1. Any tasks not scheduled to run on the current day will be skipped. + /// 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately. + /// 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window. + /// 4. If we are outside the configured window, the task will start immediately. + /// + /// + /// - Parameter request: A ``Operations/StartTaskRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/StartTaskResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func startTask(request: Operations.StartTaskRequest) async throws -> Response + + /// This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint. + /// + /// + /// - Parameter request: A ``Operations/StopTaskRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/StopTaskResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func stopTask(request: Operations.StopTaskRequest) async throws -> Response +} + +// MARK: - HubsAPI + +/// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows. +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getGlobalHubs(request:)`` +/// - ``getLibraryHubs(request:)`` +/// +public protocol HubsAPI { + /// Get Global Hubs filtered by the parameters provided. + /// + /// - Parameter request: A ``Operations/GetGlobalHubsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetGlobalHubsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getGlobalHubs(request: Operations.GetGlobalHubsRequest) async throws -> Response + + /// This endpoint will return a list of library specific hubs + /// + /// + /// - Parameter request: A ``Operations/GetLibraryHubsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetLibraryHubsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getLibraryHubs(request: Operations.GetLibraryHubsRequest) async throws -> Response +} + +// MARK: - SearchAPI + +/// API Calls that perform search operations with Plex Media Server +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``performSearch(request:)`` +/// - ``performVoiceSearch(request:)`` +/// - ``getSearchResults(request:)`` +/// +public protocol SearchAPI { + /// This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor). + /// + /// In the response's items, the following extra attributes are returned to further describe or disambiguate the result: + /// + /// - `reason`: The reason for the result, if not because of a direct search term match; can be either: + /// - `section`: There are multiple identical results from different sections. + /// - `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language). + /// - ``: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor` + /// - `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold"). + /// - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID. + /// + /// This request is intended to be very fast, and called as the user types. + /// + /// + /// - Parameter request: A ``Operations/PerformSearchRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/PerformSearchResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func performSearch(request: Operations.PerformSearchRequest) async throws -> Response + + /// This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint. + /// It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint. + /// Whenever possible, clients should limit the search to the appropriate type. + /// Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality. + /// + /// + /// - Parameter request: A ``Operations/PerformVoiceSearchRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/PerformVoiceSearchResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func performVoiceSearch(request: Operations.PerformVoiceSearchRequest) async throws -> Response + + /// This will search the database for the string provided. + /// + /// - Parameter request: A ``Operations/GetSearchResultsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetSearchResultsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getSearchResults(request: Operations.GetSearchResultsRequest) async throws -> Response +} + +// MARK: - LibraryAPI + +/// API Calls interacting with Plex Media Server Libraries +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getFileHash(request:)`` +/// - ``getRecentlyAdded()`` +/// - ``getLibraries()`` +/// - ``getLibrary(request:)`` +/// - ``deleteLibrary(request:)`` +/// - ``getLibraryItems(request:)`` +/// - ``refreshLibrary(request:)`` +/// - ``getLatestLibraryItems(request:)`` +/// - ``getCommonLibraryItems(request:)`` +/// - ``getMetadata(request:)`` +/// - ``getMetadataChildren(request:)`` +/// - ``getOnDeck()`` +/// +public protocol LibraryAPI { + /// This resource returns hash values for local files + /// + /// - Parameter request: A ``Operations/GetFileHashRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetFileHashResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getFileHash(request: Operations.GetFileHashRequest) async throws -> Response + + /// This endpoint will return the recently added content. + /// + /// + /// - Returns: A ``Operations/GetRecentlyAddedResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getRecentlyAdded() async throws -> Response + + /// A library section (commonly referred to as just a library) is a collection of media. + /// Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. + /// For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat. + /// + /// Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. + /// This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year). + /// + /// + /// - Returns: A ``Operations/GetLibrariesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getLibraries() async throws -> Response + + /// Returns details for the library. This can be thought of as an interstitial endpoint because it contains information about the library, rather than content itself. These details are: + /// + /// - A list of `Directory` objects: These used to be used by clients to build a menuing system. There are four flavors of directory found here: + /// - Primary: (e.g. all, On Deck) These are still used in some clients to provide "shortcuts" to subsets of media. However, with the exception of On Deck, all of them can be created by media queries, and the desire is to allow these to be customized by users. + /// - Secondary: These are marked with `secondary="1"` and were used by old clients to provide nested menus allowing for primative (but structured) navigation. + /// - Special: There is a By Folder entry which allows browsing the media by the underlying filesystem structure, and there's a completely obsolete entry marked `search="1"` which used to be used to allow clients to build search dialogs on the fly. + /// - A list of `Type` objects: These represent the types of things found in this library, and for each one, a list of `Filter` and `Sort` objects. These can be used to build rich controls around a grid of media to allow filtering and organizing. Note that these filters and sorts are optional, and without them, the client won't render any filtering controls. The `Type` object contains: + /// - `key`: This provides the root endpoint returning the actual media list for the type. + /// - `type`: This is the metadata type for the type (if a standard Plex type). + /// - `title`: The title for for the content of this type (e.g. "Movies"). + /// - Each `Filter` object contains a description of the filter. Note that it is not an exhaustive list of the full media query language, but an inportant subset useful for top-level API. + /// - `filter`: This represents the filter name used for the filter, which can be used to construct complex media queries with. + /// - `filterType`: This is either `string`, `integer`, or `boolean`, and describes the type of values used for the filter. + /// - `key`: This provides the endpoint where the possible range of values for the filter can be retrieved (e.g. for a "Genre" filter, it returns a list of all the genres in the library). This will include a `type` argument that matches the metadata type of the Type element. + /// - `title`: The title for the filter. + /// - Each `Sort` object contains a description of the sort field. + /// - `defaultDirection`: Can be either `asc` or `desc`, and specifies the default direction for the sort field (e.g. titles default to alphabetically ascending). + /// - `descKey` and `key`: Contains the parameters passed to the `sort=...` media query for each direction of the sort. + /// - `title`: The title of the field. + /// + /// + /// - Parameter request: A ``Operations/GetLibraryRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetLibraryResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getLibrary(request: Operations.GetLibraryRequest) async throws -> Response + + /// Delate a library using a specific section + /// + /// - Parameter request: A ``Operations/DeleteLibraryRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/DeleteLibraryResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func deleteLibrary(request: Operations.DeleteLibraryRequest) async throws -> Response + + /// This endpoint will return a list of library items filtered by the filter and type provided + /// + /// + /// - Parameter request: A ``Operations/GetLibraryItemsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetLibraryItemsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getLibraryItems(request: Operations.GetLibraryItemsRequest) async throws -> Response + + /// This endpoint Refreshes the library. + /// + /// + /// - Parameter request: A ``Operations/RefreshLibraryRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/RefreshLibraryResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func refreshLibrary(request: Operations.RefreshLibraryRequest) async throws -> Response + + /// This endpoint will return a list of the latest library items filtered by the filter and type provided + /// + /// + /// - Parameter request: A ``Operations/GetLatestLibraryItemsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetLatestLibraryItemsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getLatestLibraryItems(request: Operations.GetLatestLibraryItemsRequest) async throws -> Response + + /// Represents a "Common" item. It contains only the common attributes of the items selected by the provided filter + /// + /// + /// - Parameter request: A ``Operations/GetCommonLibraryItemsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetCommonLibraryItemsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getCommonLibraryItems(request: Operations.GetCommonLibraryItemsRequest) async throws -> Response + + /// This endpoint will return the metadata of a library item specified with the ratingKey. + /// + /// + /// - Parameter request: A ``Operations/GetMetadataRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetMetadataResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getMetadata(request: Operations.GetMetadataRequest) async throws -> Response + + /// This endpoint will return the children of of a library item specified with the ratingKey. + /// + /// + /// - Parameter request: A ``Operations/GetMetadataChildrenRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetMetadataChildrenResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getMetadataChildren(request: Operations.GetMetadataChildrenRequest) async throws -> Response + + /// This endpoint will return the on deck content. + /// + /// + /// - Returns: A ``Operations/GetOnDeckResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getOnDeck() async throws -> Response +} + +// MARK: - LogAPI + +/// Submit logs to the Log Handler for Plex Media Server +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``logLine(request:)`` +/// - ``logMultiLine()`` +/// - ``enablePaperTrail()`` +/// +public protocol LogAPI { + /// This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log. + /// + /// + /// - Parameter request: A ``Operations/LogLineRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/LogLineResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func logLine(request: Operations.LogLineRequest) async throws -> Response + + /// This endpoint will write multiple lines to the main Plex Media Server log in a single request. It takes a set of query strings as would normally sent to the above GET endpoint as a linefeed-separated block of POST data. The parameters for each query string match as above. + /// + /// + /// - Returns: A ``Operations/LogMultiLineResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func logMultiLine() async throws -> Response + + /// This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time. + /// + /// + /// - Returns: A ``Operations/EnablePaperTrailResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func enablePaperTrail() async throws -> Response +} + +// MARK: - PlaylistsAPI + +/// Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017"). +/// They can be organized in (optionally nesting) folders. +/// Retrieving a playlist, or its items, will trigger a refresh of its metadata. +/// This may cause the duration and number of items to change. +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``createPlaylist(request:)`` +/// - ``getPlaylists(request:)`` +/// - ``getPlaylist(request:)`` +/// - ``deletePlaylist(request:)`` +/// - ``updatePlaylist(request:)`` +/// - ``getPlaylistContents(request:)`` +/// - ``clearPlaylistContents(request:)`` +/// - ``addPlaylistContents(request:)`` +/// - ``uploadPlaylist(request:)`` +/// +public protocol PlaylistsAPI { + /// Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass: + /// - `uri` - The content URI for what we're playing (e.g. `library://...`). + /// - `playQueueID` - To create a playlist from an existing play queue. + /// + /// + /// - Parameter request: A ``Operations/CreatePlaylistRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/CreatePlaylistResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func createPlaylist(request: Operations.CreatePlaylistRequest) async throws -> Response + + /// Get All Playlists given the specified filters. + /// + /// - Parameter request: A ``Operations/GetPlaylistsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetPlaylistsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getPlaylists(request: Operations.GetPlaylistsRequest) async throws -> Response + + /// Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item: + /// Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing. + /// + /// + /// - Parameter request: A ``Operations/GetPlaylistRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetPlaylistResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getPlaylist(request: Operations.GetPlaylistRequest) async throws -> Response + + /// This endpoint will delete a playlist + /// + /// + /// - Parameter request: A ``Operations/DeletePlaylistRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/DeletePlaylistResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func deletePlaylist(request: Operations.DeletePlaylistRequest) async throws -> Response + + /// From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}` + /// + /// + /// - Parameter request: A ``Operations/UpdatePlaylistRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/UpdatePlaylistResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func updatePlaylist(request: Operations.UpdatePlaylistRequest) async throws -> Response + + /// Gets the contents of a playlist. Should be paged by clients via standard mechanisms. + /// By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter. + /// For example, you could use this to display a list of recently added albums vis a smart playlist. + /// Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items. + /// + /// + /// - Parameter request: A ``Operations/GetPlaylistContentsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetPlaylistContentsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getPlaylistContents(request: Operations.GetPlaylistContentsRequest) async throws -> Response + + /// Clears a playlist, only works with dumb playlists. Returns the playlist. + /// + /// + /// - Parameter request: A ``Operations/ClearPlaylistContentsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/ClearPlaylistContentsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func clearPlaylistContents(request: Operations.ClearPlaylistContentsRequest) async throws -> Response + + /// Adds a generator to a playlist, same parameters as the POST above. With a dumb playlist, this adds the specified items to the playlist. + /// With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist. + /// + /// + /// - Parameter request: A ``Operations/AddPlaylistContentsRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/AddPlaylistContentsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func addPlaylistContents(request: Operations.AddPlaylistContentsRequest) async throws -> Response + + /// Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file. + /// + /// + /// - Parameter request: A ``Operations/UploadPlaylistRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/UploadPlaylistResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func uploadPlaylist(request: Operations.UploadPlaylistRequest) async throws -> Response +} + +// MARK: - SecurityAPI + +/// API Calls against Security for Plex Media Server +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getTransientToken(request:)`` +/// - ``getSourceConnectionInformation(request:)`` +/// +public protocol SecurityAPI { + /// This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted. + /// + /// + /// - Parameter request: A ``Operations/GetTransientTokenRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetTransientTokenResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getTransientToken(request: Operations.GetTransientTokenRequest) async throws -> Response + + /// If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token. + /// Note: requires Plex Media Server >= 1.15.4. + /// + /// + /// - Parameter request: A ``Operations/GetSourceConnectionInformationRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetSourceConnectionInformationResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getSourceConnectionInformation(request: Operations.GetSourceConnectionInformationRequest) async throws -> Response +} + +// MARK: - SessionsAPI + +/// API Calls that perform search operations with Plex Media Server Sessions +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getSessions()`` +/// - ``getSessionHistory()`` +/// - ``getTranscodeSessions()`` +/// - ``stopTranscodeSession(request:)`` +/// +public protocol SessionsAPI { + /// This will retrieve the "Now Playing" Information of the PMS. + /// + /// - Returns: A ``Operations/GetSessionsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getSessions() async throws -> Response + + /// This will Retrieve a listing of all history views. + /// + /// - Returns: A ``Operations/GetSessionHistoryResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getSessionHistory() async throws -> Response + + /// Get Transcode Sessions + /// + /// - Returns: A ``Operations/GetTranscodeSessionsResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getTranscodeSessions() async throws -> Response + + /// Stop a Transcode Session + /// + /// - Parameter request: A ``Operations/StopTranscodeSessionRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/StopTranscodeSessionResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func stopTranscodeSession(request: Operations.StopTranscodeSessionRequest) async throws -> Response +} + +// MARK: - UpdaterAPI + +/// This describes the API for searching and applying updates to the Plex Media Server. +/// Updates to the status can be observed via the Event API. +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``getUpdateStatus()`` +/// - ``checkForUpdates(request:)`` +/// - ``applyUpdates(request:)`` +/// +public protocol UpdaterAPI { + /// Querying status of updates + /// + /// - Returns: A ``Operations/GetUpdateStatusResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getUpdateStatus() async throws -> Response + + /// Checking for updates + /// + /// - Parameter request: A ``Operations/CheckForUpdatesRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/CheckForUpdatesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func checkForUpdates(request: Operations.CheckForUpdatesRequest) async throws -> Response + + /// Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed + /// + /// + /// - Parameter request: A ``Operations/ApplyUpdatesRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/ApplyUpdatesResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func applyUpdates(request: Operations.ApplyUpdatesRequest) async throws -> Response +} + +// MARK: - VideoAPI + +/// API Calls that perform operations with Plex Media Server Videos +/// +/// +/// ## Topics +/// +/// ### API calls +/// +/// - ``startUniversalTranscode(request:)`` +/// - ``getTimeline(request:)`` +/// +public protocol VideoAPI { + /// Begin a Universal Transcode Session + /// + /// - Parameter request: A ``Operations/StartUniversalTranscodeRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/StartUniversalTranscodeResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func startUniversalTranscode(request: Operations.StartUniversalTranscodeRequest) async throws -> Response + + /// Get the timeline for a media item + /// + /// - Parameter request: A ``Operations/GetTimelineRequest`` object describing the input to the API operation + /// - Returns: A ``Operations/GetTimelineResponse`` object describing the result of the API operation + /// - Throws: An error of type ``PlexswiftError`` + func getTimeline(request: Operations.GetTimelineRequest) async throws -> Response +} diff --git a/Sources/plexswift/PlexswiftError.swift b/Sources/plexswift/PlexswiftError.swift new file mode 100644 index 0000000..9ff4926 --- /dev/null +++ b/Sources/plexswift/PlexswiftError.swift @@ -0,0 +1,208 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +/// Describes errors that occur when making requests to the API. +/// +/// ``PlexswiftError`` describes problems which occur through the lifecycle of making a request to the API, from constructing the underlying network request, through making the network request and handling the resulting response. +/// +/// Most of the error values have associated failure reasons: +/// - ``PlexswiftError/failedToConstructRequestURL(_:)`` +/// - ``PlexswiftError/failedToSerializeRequestParameters(_:)`` +/// - ``PlexswiftError/failedToConstructRequest(_:)`` +/// - ``PlexswiftError/failedToHandleResponse(_:)`` +/// +/// which provide more information about why the error occurred. +/// +/// If a network error occurs when making an API request, ``PlexswiftError/failedToMakeNetworkRequest(error:)`` has an associated [`Error`](https://developer.apple.com/documentation/swift/error) value which describes more information about why the network error occurred. +/// +/// In exceptional circumstances there may be an internal error which occurs in the implementation of ``Plexswift`` or in the underlying system frameworks. Where this occurs, ``PlexswiftError/internalError(error:)`` provides this information, with additional context if it is available. +/// +/// ### Getting an error description +/// +/// ``PlexswiftError`` conforms to the [`LocalizedError`](https://developer.apple.com/documentation/foundation/localizederror) protocol. As such a readable description of the error is provided through the [`errorDescription`](https://developer.apple.com/documentation/foundation/localizederror/2946895-errordescription) property. +/// +/// ## Topics +/// +/// ### Errors +/// - ``PlexswiftError/failedToConstructRequestURL(_:)`` +/// - ``PlexswiftError/failedToSerializeRequestParameters(_:)`` +/// - ``PlexswiftError/failedToConstructRequest(_:)`` +/// - ``PlexswiftError/failedToMakeNetworkRequest(error:)`` +/// - ``PlexswiftError/failedToHandleResponse(_:)`` +/// - ``PlexswiftError/internalError(error:)`` +/// +/// ### Error failure information +/// - ``PlexswiftError/RequestURLConstructionFailureReason`` +/// - ``PlexswiftError/ParameterSerializationFailureReason`` +/// - ``PlexswiftError/RequestConstructionFailureReason`` +/// - ``PlexswiftError/ResponseHandlingFailureReason`` +/// +/// ### Convenience properties +/// - ``PlexswiftError/underlyingError`` +public enum PlexswiftError: Swift.Error { + /// Failure reasons for ``PlexswiftError/failedToConstructRequestURL(_:)`` errors + public enum RequestURLConstructionFailureReason { + /// An invalid URL was returned when using a specified server definition to make a network request. + case invalidServerURL(string: String) + /// An invalid URL was used to make a network request. + case invalidRequestURL(string: String) + /// No default server could be found when making a network request. + case missingDefaultServer(serverType: String) + /// A server in a server list was specified but the index of that server is outside of the bounds of the list. + case invalidServerIndex(serverType: String, index: Int) + } + + /// Failure reasons for ``PlexswiftError/failedToSerializeRequestParameters(_:)`` errors + public enum ParameterSerializationFailureReason { + /// A server URL with parameters was used but the substitution parameter named `key` was not provided. + /// + /// A server URL with substitution parameters — for example `https://domain.com:{port}/{configurable}/path` — was specified. + case missingServerParameterSubstitutionKey(_ key: String, serverString: String) + /// An API operation path with parameters was used but the substitution parameter named `key` was not specified. + /// + /// An API operation with a path with substitution parameters — for example `"/{configurable}/endpoint"` — was specified. + case missingPathParameterSubstitutionKey(_ key: String, path: String) + /// A parameter was unexpectedly requested to be serialized to a given format. + case invalidSerializationParameter(type: String, format: String) + /// Failed to serialize a [Data](https://developer.apple.com/documentation/foundation/data) object when constructing the request. + case failedToSerializeData + } + + /// Failure reasons for ``PlexswiftError/failedToConstructRequest(_:)`` errors + public enum RequestConstructionFailureReason { + /// During request construction, a request body was not provided when one was expected. + case missingRequiredRequestBody + } + + /// Failure reasons for ``PlexswiftError/failedToHandleResponse(_:)`` errors + public enum ResponseHandlingFailureReason { + /// Failed to decode response data. + case failedToDecodeResponse + /// Failed to deserialize response JSON. + case failedToDeserializeJSON(_ error: Swift.Error) + } + + /// Constructing the URL to make a network request failed. + case failedToConstructRequestURL(_ reason: RequestURLConstructionFailureReason) + /// Serializing the parameters required to make the network request failed. + case failedToSerializeRequestParameters(_ reason: ParameterSerializationFailureReason) + /// Constructing a underlying request object to make a network request failed. + case failedToConstructRequest(_ reason: RequestConstructionFailureReason) + /// Making an underlying network request failed. + case failedToMakeNetworkRequest(error: Swift.Error) + /// Handling the response data from an API request failed. + case failedToHandleResponse(_ reason: ResponseHandlingFailureReason) + + /// An attempt to get response data from a response failed because it was missing. + case missingResponseData + + /// An error internal to the implementation of ``Client`` occurred. + case internalError(error: Swift.Error?) + +} + +extension PlexswiftError: LocalizedError { + public var errorDescription: String? { + switch self { + case .failedToConstructRequestURL(let reason): + return "Failed to construct URL for request: \(reason.localizedDescription)" + case .failedToSerializeRequestParameters(let reason): + return "Failed to serialize parameters for request: \(reason.localizedDescription)" + case .failedToConstructRequest(let reason): + return "Failed to construct request: \(reason.localizedDescription)" + case .failedToMakeNetworkRequest(let error): + return "Failed to make network request: \(error.localizedDescription)" + case .failedToHandleResponse(let reason): + return "Failed to handle response: \(reason.localizedDescription)" + case .missingResponseData: + return "The response didn't contain the requested data" + case .internalError: + return "The operation couldn't be completed" + } + } +} + +extension PlexswiftError { + /// Returns the associated underlying error, if available. + public var underlyingError: Swift.Error? { + switch self { + case .internalError(let error): + return error + case .failedToMakeNetworkRequest(let error): + return error + case .failedToHandleResponse(let reason): + switch reason { + case .failedToDecodeResponse: + return nil + case .failedToDeserializeJSON(let error): + return error + } + case .failedToConstructRequestURL, .failedToSerializeRequestParameters, .failedToConstructRequest, .missingResponseData: + return nil + } + } +} + +extension PlexswiftError.RequestURLConstructionFailureReason { + public var localizedDescription: String { + switch self { + case .invalidServerURL(string: let serverString): + return "Server URL '\(serverString)' is not valid" + case .invalidRequestURL(string: let string): + return "Request URL '\(string)' is not valid" + case .missingDefaultServer(let serverType): + return "No default server is available for type '\(serverType)'" + case .invalidServerIndex(serverType: let serverType, index: let index): + return "Server type '\(serverType)' has no server defined at index \(index)" + } + } +} + +extension PlexswiftError.ParameterSerializationFailureReason { + public var localizedDescription: String { + switch self { + case .missingServerParameterSubstitutionKey(let key, serverString: let serverString): + return "Missing substitution parameter '\(key)' when building server URL '\(serverString)'" + case .missingPathParameterSubstitutionKey(let key, path: let path): + return "Missing substitution parameter '\(key)' when building path '\(path)'" + case .invalidSerializationParameter(type: let type, format: let format): + return "Invalid parameter type '\(type)' when serializing for \(format)" + case .failedToSerializeData: + return "Failed to serialize data parameter" + } + } +} + +extension PlexswiftError.RequestConstructionFailureReason { + public var localizedDescription: String { + switch self { + case .missingRequiredRequestBody: + return "Required request body is missing" + } + } +} + +extension PlexswiftError.ResponseHandlingFailureReason { + public var localizedDescription: String { + switch self { + case .failedToDecodeResponse: + return "Failed to decode response data" + case .failedToDeserializeJSON(let error): + return "Failed to deserialize JSON: \(error.localizedDescription)" + } + } +} + +extension SerializableFormat { + var formatDescription: String { + switch self { + case .path: return "path parameter" + case .query: return "query parameter" + case .header: return "request header" + case .multipart: return "multipart encoding" + case .form: return "form encoding" + } + } +} diff --git a/Sources/plexswift/internal/api/Client+PlexswiftAPI.swift b/Sources/plexswift/internal/api/Client+PlexswiftAPI.swift new file mode 100644 index 0000000..cc11d87 --- /dev/null +++ b/Sources/plexswift/internal/api/Client+PlexswiftAPI.swift @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Client: PlexswiftAPI { + // MARK: - Root operations + + // MARK: - Scoped API operations + + public var server: ServerAPI { + return _ServerAPI(client: self) + } + + public var media: MediaAPI { + return _MediaAPI(client: self) + } + + public var activities: ActivitiesAPI { + return _ActivitiesAPI(client: self) + } + + public var butler: ButlerAPI { + return _ButlerAPI(client: self) + } + + public var hubs: HubsAPI { + return _HubsAPI(client: self) + } + + public var search: SearchAPI { + return _SearchAPI(client: self) + } + + public var library: LibraryAPI { + return _LibraryAPI(client: self) + } + + public var log: LogAPI { + return _LogAPI(client: self) + } + + public var playlists: PlaylistsAPI { + return _PlaylistsAPI(client: self) + } + + public var security: SecurityAPI { + return _SecurityAPI(client: self) + } + + public var sessions: SessionsAPI { + return _SessionsAPI(client: self) + } + + public var updater: UpdaterAPI { + return _UpdaterAPI(client: self) + } + + public var video: VideoAPI { + return _VideoAPI(client: self) + } +} + +// MARK: - Request Configuration + +// MARK: - Response Handlers + diff --git a/Sources/plexswift/internal/client/Response.swift b/Sources/plexswift/internal/client/Response.swift new file mode 100644 index 0000000..1999f16 --- /dev/null +++ b/Sources/plexswift/internal/client/Response.swift @@ -0,0 +1,121 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation +#if os(Linux) +import FoundationNetworking +#endif + +/// Describes any header values returned as part of a response to a call made to the API. +/// +/// As per the HTTP RFCs, header values can be queried in a case-insensitive manner. +public struct ResponseHeaders { + private let httpResponse: HTTPURLResponse + + init(httpResponse: HTTPURLResponse) { + self.httpResponse = httpResponse + } + + public func value(forHeaderNamed name: String) -> String? { + return httpResponse.value(forHTTPHeaderField: name) + } + + public subscript(name: String) -> String? { + return value(forHeaderNamed: name) + } +} + +/// Describes the result of making a request to the API. +/// +/// This type is returned by all functions which make calls to the API. It returns information about the response +/// and is parameterised by `T` over the type of data which is returned by the API operation. +public struct Response: ResponseFields { + + /// The HTTP status code returned by the server. + /// + /// This property contains the HTTP status code returned by the server in response to the underlying network request + /// made to fulfill the given API operation. + public var statusCode: Int { + return httpResponse.statusCode + } + + /// The media type returned by the server. + /// + /// This property contains the media type returned by the server in response to the underlying network request + /// made to fulfill the given API operation. + public var contentType: String { + return httpResponse.contentType + } + + /// The raw HTTP response object. + /// + /// This property contains the [HTTPURLResponse](https://developer.apple.com/documentation/foundation/httpurlresponse) object + /// returned from making the underlying network request to fulfill the given API operation. + public let httpResponse: HTTPURLResponse + + /// The response data. + /// + /// This property contains any response data associated with the API operation. + public let data: T + + public init(httpResponse: HTTPURLResponse, data: T) { + self.httpResponse = httpResponse + self.data = data + } +} + +/// Describes the result of making a request to the API which can contain resulting response header fields. +/// +/// This type is returned by all functions which make calls to the API. It returns information about the response +/// and is parameterised by `T` over the type of data which is returned by the API operation. +public struct ResponseWithHeaders: ResponseFields { + + /// The HTTP status code returned by the server. + /// + /// This property contains the HTTP status code returned by the server in response to the underlying network request + /// made to fulfill the given API operation. + public var statusCode: Int { + return httpResponse.statusCode + } + + /// The media type returned by the server. + /// + /// This property contains the media type returned by the server in response to the underlying network request + /// made to fulfill the given API operation. + public var contentType: String { + return httpResponse.contentType + } + + /// The raw HTTP response object. + /// + /// This property contains the [HTTPURLResponse](https://developer.apple.com/documentation/foundation/httpurlresponse) object + /// returned from making the underlying network request to fulfill the given API operation. + public let httpResponse: HTTPURLResponse + + /// Any response headers returned by the underlying network request made to fulfill the given API operation. + public let headers: ResponseHeaders? + + /// The response data. + /// + /// This property contains any response data associated with the API operation. + public let data: T + + public init(httpResponse: HTTPURLResponse, data: T) { + self.httpResponse = httpResponse + self.data = data + self.headers = ResponseHeaders(httpResponse: httpResponse) + } +} + +/// Describes the fields which are included in all responses to requests made to the API. +/// +/// This protocol is adopted by ``Response`` and ``ResponseWithHeaders`` depending on the individual API operation. +public protocol ResponseFields { + associatedtype T; + + var statusCode: Int { get } + var contentType: String { get } + var httpResponse: HTTPURLResponse { get } + var data: T { get } + + init(httpResponse: HTTPURLResponse, data: T) +} diff --git a/Sources/plexswift/internal/client/Servers.swift b/Sources/plexswift/internal/client/Servers.swift new file mode 100644 index 0000000..7a93684 --- /dev/null +++ b/Sources/plexswift/internal/client/Servers.swift @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +struct Server { + public let urlString: String +} + +protocol Servers { + static var urlStrings: [String] { get } + + static func `default`() throws -> Server + static func server(at index: Int) throws -> Server + static func server(at index: Int, substituting parameters: [String: String]?) throws -> Server +} + +protocol ServerConvertible { + func server() throws -> Server +} + +enum ServerConversionError: Swift.Error { + case `internal` + case missingDefaultServer(serverType: String) + case invalidServerIndex(serverType: String, index: Int) + case missingServerParameterSubstitutionKey(_ key: String, serverString: String) +} + +extension Servers { + static func `default`() throws -> Server { + guard urlStrings.count > 0 else { + throw ServerConversionError.missingDefaultServer(serverType: String(describing: self)) + } + + return Server(urlString: urlStrings[0]) + } + + static func server(at index: Int) throws -> Server { + return try server(at: index, substituting: nil) + } + + static func server(at index: Int, substituting parameters: [String: String]?) throws -> Server { + guard index >= 0 && index < urlStrings.count else { + throw ServerConversionError.invalidServerIndex(serverType: String(describing: self), index: index) + } + if let parameters = parameters { + do { + return Server(urlString: try urlStrings[index].substituteComponents { key in parameters[key] }) + } catch let error as StringSubstitutionError { + switch error { + case .internal: + throw ServerConversionError.internal + case .missingParameter(named: let name, in: let string): + throw ServerConversionError.missingServerParameterSubstitutionKey(name, serverString: string) + } + } + } else { + return Server(urlString: urlStrings[index]) + } + } +} diff --git a/Sources/plexswift/internal/client/URLRequestBuilder.swift b/Sources/plexswift/internal/client/URLRequestBuilder.swift new file mode 100644 index 0000000..4b1ffab --- /dev/null +++ b/Sources/plexswift/internal/client/URLRequestBuilder.swift @@ -0,0 +1,154 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation +#if os(Linux) +import FoundationNetworking +#endif + +enum URLRequestBuilderError: Swift.Error { + case internalError + case invalidURL(String) + case missingPathParameterSubstitutionKey(_ key: String, path: String) +} + +final class URLRequestBuilder: URLRequestConfiguration { + private let baseURL: URL + private let parameterDefaults: ParameterDefaults? + private let defaultSecurityParameterProviding: SecurityParameterProviding? + + var path: String = "" + var method: URLRequestHTTPMethod = .get + var contentType: String? + + var securityParameterProviding: SecurityParameterProviding? + + var pathParameterSerializable: PathParameterSerializable? + var queryParameterSerializable: QueryParameterSerializable? + var headerParameterSerializable: HeaderParameterSerializable? + + var body: Data? + + var telemetryHeader: TelemetryHeader = .userAgent + + init(baseURL: URL, parameterDefaults: ParameterDefaults?, defaultSecurityParameterProviding: SecurityParameterProviding?) { + self.baseURL = baseURL + self.parameterDefaults = parameterDefaults + self.defaultSecurityParameterProviding = defaultSecurityParameterProviding + } + + func build() throws -> URLRequest { + guard var urlComponents = URLComponents(url: baseURL, resolvingAgainstBaseURL: true) else { + throw URLRequestBuilderError.invalidURL(baseURL.absoluteString) + } + + try buildPathComponents(in: &urlComponents) + + guard let url = urlComponents.url else { + throw URLRequestBuilderError.invalidURL(baseURL.absoluteString) + } + + var urlRequest = URLRequest(url: url) + if let headerParameterSerializable { + for header in try headerParameterSerializable.serializedHeaderParameters() { + urlRequest.setValue(header.serialized, forHTTPHeaderField: header.name) + } + } + + urlRequest.httpMethod = method.rawValue + urlRequest.httpBody = body + + if let contentType { + urlRequest.setValue(contentType, forHTTPHeaderField: "Content-Type") + } + + urlRequest.setValue("speakeasy-sdk/swift 0.1.0 2.223.3 0.0.3 plexswift", forHTTPHeaderField: telemetryHeader.headerName) + + addSecurityParameters(to: &urlRequest) + + return urlRequest + } + + // MARK: - Private + + private func buildPathComponents(in urlComponents: inout URLComponents) throws { + let (path, fragment) = parsePath(path) + + if let pathParameterSerializable { + urlComponents.path = (urlComponents.path as NSString).appendingPathComponent( + try substitutePathParameters(in: path, with: pathParameterSerializable, parameterDefaults: parameterDefaults) + ) + } else { + urlComponents.path = (urlComponents.path as NSString).appendingPathComponent(path) + } + + if let queryParameterSerializable { + urlComponents.percentEncodedQuery = queryString( + from: try queryParameterSerializable.serializedQueryParameters(with: parameterDefaults, formatOverride: nil) + ) + } + + urlComponents.fragment = fragment + } + + private func parsePath(_ path: String) -> (path: String, fragment: String?) { + let components = path.components(separatedBy: "#") + guard let first = components.first else { + return (path: "", fragment: nil) + } + return (path: first, fragment: components.count > 1 ? components[1] : nil) + } + + private func addSecurityParameters(to request: inout URLRequest) { + guard let securityParameterProviding = securityParameterProviding ?? defaultSecurityParameterProviding else { return } + + let parameters = securityParameterProviding.securityParameters() + for parameter in parameters { + switch parameter { + case .httpBasic(username: let username, password: let password): + if let username, let password, let encoded = "\(username):\(password)".data(using: .utf8)?.base64EncodedString() { + request.addValue("Basic \(encoded)", forHTTPHeaderField: "Authorization") + } + case .httpBearer(value: let value): + if let value { + let headerValue = value.range(of: "Bearer ")?.lowerBound == value.startIndex ? value : "Bearer \(value)" + request.addValue(headerValue, forHTTPHeaderField: "Authorization") + } + case .apiKey(name: let name, value: let value), .oauth2(name: let name, value: let value), .openIdConnect(name: let name, value: let value): + if let value { + request.addValue(value, forHTTPHeaderField: name) + } + } + } + } +} + +// Substitute path parameters and rethrow `StringSubstitutionError`s as `URLRequestBuilderError`s. +fileprivate func substitutePathParameters( + in path: String, + with pathParameterSerializable: PathParameterSerializable, + parameterDefaults: ParameterDefaults? +) throws -> String { + do { + let parameters = try pathParameterSerializable.serializedPathParameters(formatOverride: nil) + return try path.substituteComponents { key in + return try parameters[key] ?? parameterDefaults?.defaultSerializedPathParameter(for: key) + } + } catch let error as StringSubstitutionError { + switch error { + case .internal: + throw URLRequestBuilderError.internalError + case .missingParameter(named: let name, in: let string): + throw URLRequestBuilderError.missingPathParameterSubstitutionKey(name, path: string) + } + } +} + +fileprivate extension TelemetryHeader { + var headerName: String { + switch self { + case .userAgent: return "User-Agent" + case .speakeasyUserAgent: return "X-Speakeasy-User-Agent" + } + } +} diff --git a/Sources/plexswift/internal/client/URLRequestConfiguration.swift b/Sources/plexswift/internal/client/URLRequestConfiguration.swift new file mode 100644 index 0000000..7abf26b --- /dev/null +++ b/Sources/plexswift/internal/client/URLRequestConfiguration.swift @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +enum URLRequestHTTPMethod: String { + case get = "GET" + case post = "POST" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" + case head = "HEAD" + case options = "OPTIONS" + case trace = "TRACE" +} + +enum TelemetryHeader { + case userAgent + case speakeasyUserAgent +} + +protocol URLRequestConfiguration: AnyObject { + var path: String { get set } + var method: URLRequestHTTPMethod { get set } + var contentType: String? { get set } + + var securityParameterProviding: SecurityParameterProviding? { get set } + + var pathParameterSerializable: PathParameterSerializable? { get set } + var queryParameterSerializable: QueryParameterSerializable? { get set } + var headerParameterSerializable: HeaderParameterSerializable? { get set } + + var body: Data? { get set } + + var telemetryHeader: TelemetryHeader { get set } +} diff --git a/Sources/plexswift/internal/extensions/HTTPURLResponse+ContentType.swift b/Sources/plexswift/internal/extensions/HTTPURLResponse+ContentType.swift new file mode 100644 index 0000000..59d0c33 --- /dev/null +++ b/Sources/plexswift/internal/extensions/HTTPURLResponse+ContentType.swift @@ -0,0 +1,12 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation +#if os(Linux) +import FoundationNetworking +#endif + +extension HTTPURLResponse { + var contentType: String { + return value(forHTTPHeaderField: "Content-Type") ?? "application/octet-stream" + } +} diff --git a/Sources/plexswift/internal/extensions/String+ContentType.swift b/Sources/plexswift/internal/extensions/String+ContentType.swift new file mode 100644 index 0000000..23ab2b3 --- /dev/null +++ b/Sources/plexswift/internal/extensions/String+ContentType.swift @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension String { + func matchContentType(pattern: String) -> Bool { + // Match wildcard types + if pattern == "*" || pattern == "*/*" { + return true + } + + // Match content type of the format 'application/json; charset=UTF-8' + let contentTypeComponents = pattern.components(separatedBy: ";").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) } + guard let mediaType = contentTypeComponents.first else { return false } + if mediaType == pattern { + return true + } + + // Match wildcard parts on the media type + let mediaTypeComponents = mediaType.components(separatedBy: "/") + guard mediaTypeComponents.count == 2 else { return false } + + return pattern == "\(mediaTypeComponents[0])/*" || pattern == "*/\(mediaTypeComponents[1])" + } +} diff --git a/Sources/plexswift/internal/extensions/String+ParameterSubstitution.swift b/Sources/plexswift/internal/extensions/String+ParameterSubstitution.swift new file mode 100644 index 0000000..2154ed5 --- /dev/null +++ b/Sources/plexswift/internal/extensions/String+ParameterSubstitution.swift @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +enum StringSubstitutionError: Swift.Error { + case `internal` + case missingParameter(named: String, in: String) +} + +extension String { + typealias SubstitutionHandler = (_ key: String) throws -> String? + + func substituteComponents(using substitutionHandler: SubstitutionHandler) throws -> String { + let regex = try NSRegularExpression(pattern: "\\{([^}]+)\\}") + let range = NSRange(startIndex.. String { + return "multipart/form-data; boundary=\(boundary)" +} + +func serializeMultipartFormData(with multipartFormBodySerializable: MultipartFormBodySerializable) throws -> (boundary: String, data: Data) { + let boundary = UUID().uuidString + + var data = Data() + let parameters = try multipartFormBodySerializable.serializedMultipartFormParameters(formatOverride: nil) + parameters.forEach { parameter in + switch parameter { + case .value(name: let name, serialized: let serialized): + guard let serialized else { return } + + data.append(utf8String: "--\(boundary)\r\n") + data.append(utf8String: "Content-Disposition: multipart/form-data; name=\"\(name)\"\r\n") + data.append(utf8String: "Content-Type: text/plain\r\n\r\n") + data.append(utf8String: "\(serialized)\r\n") + case .file(name: let name, filename: let filename, data: let content): + guard let filename, let content, let contentString = String(data: content, encoding: .ascii) else { return } + + data.append(utf8String: "--\(boundary)\r\n") + data.append(utf8String: "Content-Disposition: multipart/form-data; name=\"\(name)\"; filename=\"\(filename)\"\r\n") + data.append(utf8String: "Content-Type: text/plain\r\n\r\n") + data.append(utf8String: "\(contentString)\r\n") + } + } + + data.append(utf8String: "--\(boundary)--") + + return (boundary: boundary, data: data) +} + +func serializeFormData(with formBodySerializable: FormBodySerializable) throws -> Data? { + let encoded = (try formBodySerializable.serializedFormParameters(formatOverride: nil)) + .compactMap { parameter -> (String, String)? in + guard let serialized = parameter.serialized else { return nil } + return (parameter.name, serialized) + } + .map { (name, serialized) in + return "\(name)=\(serialized)" + } + .joined(separator: "&") + + return encoded.data(using: .utf8) +} + +fileprivate extension Data { + mutating func append(utf8String: String) { + if let data = utf8String.data(using: .utf8) { + append(data) + } + } +} diff --git a/Sources/plexswift/internal/serialization/JSON.swift b/Sources/plexswift/internal/serialization/JSON.swift new file mode 100644 index 0000000..520e272 --- /dev/null +++ b/Sources/plexswift/internal/serialization/JSON.swift @@ -0,0 +1,17 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +func jsonEncoder() -> JSONEncoder { + let jsonEncoder = JSONEncoder() + // Sort keys to make this easier to test resulting JSON. + jsonEncoder.outputFormatting = [.sortedKeys] + return jsonEncoder +} + +func serializeEncodable(_ encodable: Encodable?) throws -> String? { + guard let encodable else { return nil } + + let data = try jsonEncoder().encode(encodable) + return String(data: data, encoding: .utf8) +} diff --git a/Sources/plexswift/internal/serialization/Maps.swift b/Sources/plexswift/internal/serialization/Maps.swift new file mode 100644 index 0000000..dc89391 --- /dev/null +++ b/Sources/plexswift/internal/serialization/Maps.swift @@ -0,0 +1,7 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +func namedQueryParameters(from serializable: Serializable, name: String, format: SerializableFormat) throws -> [QueryParameter] { + return try serializable.serializeQueryParameters(with: format).mapKeys { _ in [name] } +} diff --git a/Sources/plexswift/internal/serialization/Parameters.swift b/Sources/plexswift/internal/serialization/Parameters.swift new file mode 100644 index 0000000..2cb6e57 --- /dev/null +++ b/Sources/plexswift/internal/serialization/Parameters.swift @@ -0,0 +1,102 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +struct SerializedParameter { + let name: String + let serialized: String? +} + +protocol ParameterDefaults { + func defaultSerializedPathParameter(for key: String) throws -> String? + func defaultQueryParameter(for key: String) -> AnyValue? +} + +// MARK: - Serialization Types + +protocol PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] +} + +protocol QueryParameterSerializable { + func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] +} + +protocol HeaderParameterSerializable { + func serializedHeaderParameters() throws -> [SerializedParameter] +} + +enum MultipartFormParameter { + case value(name: String, serialized: String?) + case file(name: String, filename: String?, data: Data?) +} + +protocol MultipartFormBodySerializable { + func serializedMultipartFormParameters(formatOverride: SerializableFormat?) throws -> [MultipartFormParameter] +} + +protocol FormBodySerializable { + func serializedFormParameters(formatOverride: SerializableFormat?) throws -> [SerializedParameter] +} + +// MARK: - Models + +func serializePathParameterSerializable( + _ pathParameterSerializable: PathParameterSerializable, + with format: SerializableFormat +) throws -> String { + let fields = try pathParameterSerializable + .serializedPathParameters(formatOverride: format) + .map { (key, value) in + SerializedParameter(name: key, serialized: value) + } + .sorted { a, b in + a.name < b.name + } + return serializeModel(with: fields, format: format) +} + +func serializeQueryParameterSerializable( + _ queryParameterSerializable: QueryParameterSerializable, + with format: SerializableFormat +) throws -> String { + let fields = try queryParameterSerializable + .serializedQueryParameters(with: nil, formatOverride: format) + .compactMap { queryParameter -> SerializedParameter? in + guard let key = queryParameter.key.last else { return nil } + return SerializedParameter(name: key, serialized: queryParameter.serialized) + } + return serializeModel(with: fields, format: format) +} + +func serializeModel( + with fields: [SerializedParameter], + format: SerializableFormat +) -> String { + return fields.map { field in + guard let serialized = field.serialized else { return nil } + if format.explode { + return "\(field.name)=\(serialized)" + } else { + return "\(field.name)\(format.separator)\(serialized)" + } + }.compactMap { $0 }.joined(separator: format.separator) +} + +// MARK: - Maps + +extension Dictionary: MultipartFormBodySerializable where Key == String, Value: Serializable { + func serializedMultipartFormParameters(formatOverride: SerializableFormat?) throws -> [MultipartFormParameter] { + return try map { key, value in + return .value(name: key, serialized: try value.serialize(with: formatOverride ?? .multipart)) + } + } +} + +extension Dictionary: FormBodySerializable where Key == String, Value: Serializable { + func serializedFormParameters(formatOverride: SerializableFormat?) throws -> [SerializedParameter] { + return try map { key, value in + return SerializedParameter(name: key, serialized: try value.serialize(with: formatOverride ?? .form(explode: false))) + } + } +} diff --git a/Sources/plexswift/internal/serialization/PropertyWrappers.swift b/Sources/plexswift/internal/serialization/PropertyWrappers.swift new file mode 100644 index 0000000..bdfe692 --- /dev/null +++ b/Sources/plexswift/internal/serialization/PropertyWrappers.swift @@ -0,0 +1,232 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +// MARK: - Wrappers + +/// An internal type used to aid in serializing request data and deserializing response data. +/// +/// > Important: This type should not be used directly. +@propertyWrapper public struct DecimalSerialized: Codable, Serializable where Value: DoubleConvertible { + // This property wrapper ensures that we (de)serialize values as Decimals to avoid floating-point rounding errors. + + public var wrappedValue: Value + + public init(wrappedValue: Value) { + self.wrappedValue = wrappedValue + } + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + wrappedValue = try Value.decodeValue(with: container) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + if let double = wrappedValue.toDouble() { + try container.encode(Decimal(double)) + } + } + + // MARK: - Serializable + + func serialize(with format: SerializableFormat) throws -> String { + return wrappedValue.toDouble().map { String($0) } ?? "" + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension DecimalSerialized: CustomStringConvertible where Value: CustomStringConvertible { + public var description: String { + return wrappedValue.description + } +} + +/// An internal type used to aid in serializing request data and deserializing response data. +/// +/// > Important: This type should not be used directly. +@propertyWrapper public struct DateTime: Codable, Serializable where Value: DateConvertible { + // This property wrapper ensures that we (de)serialize Swift Dates in the correct datetime format. + + public var wrappedValue: Value + + public init(wrappedValue: Value) { + self.wrappedValue = wrappedValue + } + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + wrappedValue = try Value.decodeValue(with: container, formatter: dateTimeFormatter) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + if let formatted = wrappedValue.formattedString(with: dateTimeFormatter) { + try container.encode(formatted) + } + } + + // MARK: - Serializable + + func serialize(with format: SerializableFormat) throws -> String { + return wrappedValue.formattedString(with: dateTimeFormatter) ?? "" + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension DateTime: CustomStringConvertible where Value: CustomStringConvertible { + public var description: String { + return wrappedValue.description + } +} + +/// An internal type used to aid in serializing request data and deserializing response data. +/// +/// > Important: This type should not be used directly. +@propertyWrapper public struct DateOnly: Codable, Serializable where Value: DateConvertible { + // This property wrapper ensures that we (de)serialize dates in the date-only format, as Date doesn't distinguish between these types. + + public var wrappedValue: Value + + public init(wrappedValue: Value) { + self.wrappedValue = wrappedValue + } + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + wrappedValue = try Value.decodeValue(with: container, formatter: dateOnlyFormatter) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + if let formatted = wrappedValue.formattedString(with: dateOnlyFormatter) { + try container.encode(formatted) + } + } + + // MARK: - Serializable + + func serialize(with format: SerializableFormat) throws -> String { + return wrappedValue.formattedString(with: dateOnlyFormatter) ?? "" + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension DateOnly: CustomStringConvertible where Value: CustomStringConvertible { + public var description: String { + return wrappedValue.description + } +} + +// MARK: - Formatters + +private let dateTimeFormatter = { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" + return dateFormatter +}() + +private let dateOnlyFormatter = { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd" + return dateFormatter +}() + +// MARK: - Helpers + +/// An internal type used to aid in serializing request data. +/// +/// > Important: This type should not be used directly. +public protocol DoubleConvertible { + func toDouble() -> Double? + static func decodeValue(with container: SingleValueDecodingContainer) throws -> Self +} + +extension Double: DoubleConvertible { + public static func decodeValue(with container: SingleValueDecodingContainer) throws -> Double { + return try container.decode(Double.self) + } + + public func toDouble() -> Double? { + return self + } +} + +extension Optional: DoubleConvertible where Wrapped == Double { + public static func decodeValue(with container: SingleValueDecodingContainer) throws -> Optional { + if container.decodeNil() { + return nil + } else { + return try container.decode(Double.self) + } + } + + public func toDouble() -> Double? { + return self + } +} + +/// An internal type used to aid in serializing request data. +/// +/// > Important: This type should not be used directly. +public protocol DateConvertible { + func toDate() -> Date? + func formattedString(with formatter: DateFormatter) -> String? + + static func decodeValue(with container: SingleValueDecodingContainer, formatter: DateFormatter) throws -> Self +} + +extension Date: DateConvertible { + public static func decodeValue(with container: SingleValueDecodingContainer, formatter: DateFormatter) throws -> Date { + let string = try container.decode(String.self) + guard let date = formatter.date(from: string) else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Invalid date string value '\(string)'" + ) + } + return date + } + + public func toDate() -> Date? { + return self + } + + public func formattedString(with formatter: DateFormatter) -> String? { + return formatter.string(from: self) + } +} + +extension Optional: DateConvertible where Wrapped == Date { + public static func decodeValue(with container: SingleValueDecodingContainer, formatter: DateFormatter) throws -> Optional { + if container.decodeNil() { + return nil + } else { + let string = try container.decode(String.self) + guard let date = formatter.date(from: string) else { + throw DecodingError.dataCorruptedError( + in: container, + debugDescription: "Invalid date string value '\(string)'" + ) + } + return date + } + } + + public func toDate() -> Date? { + return self + } + + public func formattedString(with formatter: DateFormatter) -> String? { + return self.map { formatter.string(from: $0) } + } +} diff --git a/Sources/plexswift/internal/serialization/QueryParameters.swift b/Sources/plexswift/internal/serialization/QueryParameters.swift new file mode 100644 index 0000000..995720c --- /dev/null +++ b/Sources/plexswift/internal/serialization/QueryParameters.swift @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +func queryString(from queryParameters: [QueryParameter]) -> String { + return queryParameters + .sorted { qp1, qp2 in + if qp1.key == qp2.key { + return qp1.index < qp2.index + } + + // Lexicographically sort components. + for (c1, c2) in zip(qp1.key, qp2.key) { + if c1 < c2 { return true } + else if c1 > c2 { return false } + } + return true + }.compactMap { queryParam in + guard + let encodedName = percentEncode(string: queryParameterName(from: queryParam.key)), + let encodedValue = percentEncode(string: queryParam.serialized) + else { return nil } + return "\(encodedName)=\(encodedValue)" + }.joined(separator: "&") +} + +// Helps build nested and exploded query parameters. +class QueryParameterBuilder { + private var queryParameters: [QueryParameter] = [] + + func addQueryParameters(from serializable: Serializable?, named name: String, format: SerializableFormat, parameterDefaults: ParameterDefaults?) throws { + guard let serializable = serializable ?? parameterDefaults?.defaultQueryParameter(for: name) else { return } + if format.explode { + queryParameters.append( + contentsOf: try serializable + .serializeQueryParameters(with: format) + .mapKeys { parameterKey(from: $0, nameOverride: name, with: format) } + ) + } else { + queryParameters.append(QueryParameter(key: [name], serialized: try serializable.serialize(with: format))) + } + } + + func addJSONQueryParameter(named name: String, with encodable: Encodable?) throws { + guard let encodable, let encoded = try serializeEncodable(encodable) else { return } + queryParameters.append(QueryParameter(key: [name], serialized: encoded)) + } + + func build() -> [QueryParameter] { + return queryParameters + } +} + +extension Array where Element == QueryParameter { + func mapKeys(_ f: ([String]) -> [String]) -> [QueryParameter] { + return map { QueryParameter(key: f($0.key), serialized: $0.serialized, index: $0.index) } + } +} + +private func parameterKey(from key: [String], nameOverride: String, with format: SerializableFormat) -> [String] { + if format.isDeep { + return [nameOverride] + key + } else { + return key.isEmpty ? [nameOverride] : key + } +} + +private let allowedPercentEncodingCharacters = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "-.")) + +private func percentEncode(string: String) -> String? { + return string.addingPercentEncoding(withAllowedCharacters: allowedPercentEncodingCharacters) +} + +private func queryParameterName(from key: [String]) -> String { + guard let first = key.first else { return "" } + let rest = key.dropFirst() + return "\(first)\(rest.map { "[\($0)]" }.joined())" +} diff --git a/Sources/plexswift/internal/serialization/SecurityParameters.swift b/Sources/plexswift/internal/serialization/SecurityParameters.swift new file mode 100644 index 0000000..c11c802 --- /dev/null +++ b/Sources/plexswift/internal/serialization/SecurityParameters.swift @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +enum SecurityParameter { + case httpBasic(username: String?, password: String?) + case httpBearer(value: String?) + case apiKey(name: String, value: String?) + case oauth2(name: String, value: String?) + case openIdConnect(name: String, value: String?) +} + +protocol SecurityParameterProviding { + func securityParameters() -> [SecurityParameter] +} diff --git a/Sources/plexswift/internal/serialization/Serializable.swift b/Sources/plexswift/internal/serialization/Serializable.swift new file mode 100644 index 0000000..e8b10e0 --- /dev/null +++ b/Sources/plexswift/internal/serialization/Serializable.swift @@ -0,0 +1,213 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +enum QueryParameterSerializableStyle { + case form + case pipeDelimited + case deepObject +} + +enum SerializableFormat { + case path(explode: Bool) + case query(style: QueryParameterSerializableStyle, explode: Bool) + case header(explode: Bool) + case multipart + case form(explode: Bool) + + var explode: Bool { + switch self { + case .path(let explode), .query(_, let explode), .header(let explode), .form(let explode): + return explode + case .multipart: + return false + } + } + + var isDeep: Bool { + switch self { + case .path, .header, .multipart, .form: + return false + case .query(let style, _): + switch style { + case .form, .pipeDelimited: + return false + case .deepObject: + return true + } + } + } +} + +struct QueryParameter { + let key: [String] + let serialized: String + let index: Int + + init(key: [String], serialized: String) { + self.key = key + self.serialized = serialized + self.index = 0 + } + + init(key: [String], serialized: String, index: Int) { + self.key = key + self.serialized = serialized + self.index = index + } +} + +enum SerializationError: Swift.Error { + case failedToSerializeData + case missingRequiredRequestBody + case invalidSerializationParameter(type: String, format: String) +} + +protocol Serializable { + func serialize(with format: SerializableFormat) throws -> String + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] +} + +extension Serializable { + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [] + } +} + +// MARK: - Primitives + +extension NSNull: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return "null" + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension String: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return self + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension Int: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return String(self) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension Double: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return String(self) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension Bool: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return String(self) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension Data: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + guard let string = String(data: self, encoding: .ascii) else { + throw SerializationError.failedToSerializeData + } + return string + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } +} + +extension Optional: Serializable where Wrapped: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try self?.serialize(with: format) ?? "" + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + return try self?.serializeQueryParameters(with: format) ?? [] + } +} + +// MARK: - Collections + +extension Array: Serializable where Element: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + return try map { try $0.serialize(with: format) }.joined(separator: format.separator) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + if format.explode { + return try enumerated().map { index, value in + QueryParameter(key: [], serialized: try value.serialize(with: format), index: index) + } + } else { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } + } +} + +extension Dictionary: Serializable where Key == String, Value: Serializable { + func serialize(with format: SerializableFormat) throws -> String { + // Sort by keys first to make serialization deterministic. + return try map { key, value in + (key, value) + }.sorted { + $0.0 < $1.0 + }.map { (key, value) in + if format.explode { + return "\(key)=\(try value.serialize(with: format))" + } else { + return "\(key)\(format.separator)\(try value.serialize(with: format))" + } + }.joined(separator: format.separator) + } + + func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] { + if format.explode { + return try flatMap { key, value in + try value.serializeQueryParameters(with: format).mapKeys { _ in [key] } + } + } else { + return [QueryParameter(key: [], serialized: try serialize(with: format))] + } + } +} + +// MARK: - Extensions + +extension SerializableFormat { + var separator: String { + switch self { + case .path, .header, .multipart, .form: + return "," + case .query(let style, _): + switch style { + case .form, .deepObject: + return "," + case .pipeDelimited: + return "|" + } + } + } +} diff --git a/USAGE.md b/USAGE.md new file mode 100644 index 0000000..d968c81 --- /dev/null +++ b/USAGE.md @@ -0,0 +1,23 @@ + +```swift +import Foundation +import Plexswift + +let client = Client(security: .accessToken("")) + +let response = try await client.server.getServerCapabilities() + +switch response.data { +case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break +case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break +case .empty: + // Handle empty response + break +} + +``` + \ No newline at end of file diff --git a/files.gen b/files.gen new file mode 100644 index 0000000..47c342b --- /dev/null +++ b/files.gen @@ -0,0 +1,383 @@ +Sources/Plexswift/internal/api/_ServerAPI.swift +Sources/Plexswift/internal/api/_MediaAPI.swift +Sources/Plexswift/internal/api/_ActivitiesAPI.swift +Sources/Plexswift/internal/api/_ButlerAPI.swift +Sources/Plexswift/internal/api/_HubsAPI.swift +Sources/Plexswift/internal/api/_SearchAPI.swift +Sources/Plexswift/internal/api/_LibraryAPI.swift +Sources/Plexswift/internal/api/_LogAPI.swift +Sources/Plexswift/internal/api/_PlaylistsAPI.swift +Sources/Plexswift/internal/api/_SecurityAPI.swift +Sources/Plexswift/internal/api/_SessionsAPI.swift +Sources/Plexswift/internal/api/_UpdaterAPI.swift +Sources/Plexswift/internal/api/_VideoAPI.swift +Sources/Plexswift/configuration/GlobalServer.swift +Sources/Plexswift/Client.swift +Package.swift +Sources/plexswift/AnyValue.swift +Sources/plexswift/internal/api/Client+PlexswiftAPI.swift +Sources/plexswift/internal/client/Response.swift +Sources/plexswift/internal/client/Servers.swift +Sources/plexswift/internal/client/URLRequestBuilder.swift +Sources/plexswift/internal/client/URLRequestConfiguration.swift +Sources/plexswift/internal/extensions/HTTPURLResponse+ContentType.swift +Sources/plexswift/internal/extensions/String+ContentType.swift +Sources/plexswift/internal/extensions/String+ParameterSubstitution.swift +Sources/plexswift/internal/serialization/Form.swift +Sources/plexswift/internal/serialization/JSON.swift +Sources/plexswift/internal/serialization/Maps.swift +Sources/plexswift/internal/serialization/Parameters.swift +Sources/plexswift/internal/serialization/PropertyWrappers.swift +Sources/plexswift/internal/serialization/QueryParameters.swift +Sources/plexswift/internal/serialization/SecurityParameters.swift +Sources/plexswift/internal/serialization/Serializable.swift +Sources/plexswift/PlexswiftError.swift +Sources/plexswift/PlexswiftAPI.swift +Sources/Plexswift/models/ModelScopes.swift +Sources/Plexswift/models/operations/Activity.swift +Sources/Plexswift/models/operations/AddPlaylistContentsErrors.swift +Sources/Plexswift/models/operations/AddPlaylistContentsRequest.swift +Sources/Plexswift/internal/models/AddPlaylistContentsRequest+Serialization.swift +Sources/Plexswift/models/operations/AddPlaylistContentsResponse.swift +Sources/Plexswift/models/operations/AddPlaylistContentsResponseBody.swift +Sources/Plexswift/models/operations/ApplyUpdatesErrors.swift +Sources/Plexswift/models/operations/ApplyUpdatesRequest.swift +Sources/Plexswift/internal/models/ApplyUpdatesRequest+Serialization.swift +Sources/Plexswift/models/operations/ApplyUpdatesResponse.swift +Sources/Plexswift/models/operations/ApplyUpdatesResponseBody.swift +Sources/Plexswift/models/operations/ButlerTask.swift +Sources/Plexswift/models/operations/ButlerTasks.swift +Sources/Plexswift/models/operations/CancelServerActivitiesErrors.swift +Sources/Plexswift/models/operations/CancelServerActivitiesRequest.swift +Sources/Plexswift/internal/models/CancelServerActivitiesRequest+Serialization.swift +Sources/Plexswift/models/operations/CancelServerActivitiesResponse.swift +Sources/Plexswift/models/operations/CancelServerActivitiesResponseBody.swift +Sources/Plexswift/models/operations/CheckForUpdatesErrors.swift +Sources/Plexswift/models/operations/CheckForUpdatesRequest.swift +Sources/Plexswift/internal/models/CheckForUpdatesRequest+Serialization.swift +Sources/Plexswift/models/operations/CheckForUpdatesResponse.swift +Sources/Plexswift/models/operations/CheckForUpdatesResponseBody.swift +Sources/Plexswift/models/operations/ClearPlaylistContentsErrors.swift +Sources/Plexswift/models/operations/ClearPlaylistContentsRequest.swift +Sources/Plexswift/internal/models/ClearPlaylistContentsRequest+Serialization.swift +Sources/Plexswift/models/operations/ClearPlaylistContentsResponse.swift +Sources/Plexswift/models/operations/ClearPlaylistContentsResponseBody.swift +Sources/Plexswift/models/operations/Context.swift +Sources/Plexswift/models/operations/Country.swift +Sources/Plexswift/models/operations/CreatePlaylistErrors.swift +Sources/Plexswift/models/operations/CreatePlaylistRequest.swift +Sources/Plexswift/internal/models/CreatePlaylistRequest+Serialization.swift +Sources/Plexswift/models/operations/CreatePlaylistResponse.swift +Sources/Plexswift/models/operations/CreatePlaylistResponseBody.swift +Sources/Plexswift/models/operations/DeleteLibraryErrors.swift +Sources/Plexswift/models/operations/DeleteLibraryRequest.swift +Sources/Plexswift/internal/models/DeleteLibraryRequest+Serialization.swift +Sources/Plexswift/models/operations/DeleteLibraryResponse.swift +Sources/Plexswift/models/operations/DeleteLibraryResponseBody.swift +Sources/Plexswift/models/operations/DeletePlaylistErrors.swift +Sources/Plexswift/models/operations/DeletePlaylistRequest.swift +Sources/Plexswift/internal/models/DeletePlaylistRequest+Serialization.swift +Sources/Plexswift/models/operations/DeletePlaylistResponse.swift +Sources/Plexswift/models/operations/DeletePlaylistResponseBody.swift +Sources/Plexswift/models/operations/Device.swift +Sources/Plexswift/models/operations/Director.swift +Sources/Plexswift/models/operations/Directory.swift +Sources/Plexswift/models/operations/Download.swift +Sources/Plexswift/internal/models/Download+Serialization.swift +Sources/Plexswift/models/operations/EnablePaperTrailErrors.swift +Sources/Plexswift/models/operations/EnablePaperTrailResponse.swift +Sources/Plexswift/models/operations/EnablePaperTrailResponseBody.swift +Sources/Plexswift/models/operations/Errors.swift +Sources/Plexswift/models/operations/Force.swift +Sources/Plexswift/internal/models/Force+Serialization.swift +Sources/Plexswift/models/operations/Genre.swift +Sources/Plexswift/models/operations/GetAvailableClientsErrors.swift +Sources/Plexswift/models/operations/GetAvailableClientsMediaContainer.swift +Sources/Plexswift/models/operations/GetAvailableClientsResponse.swift +Sources/Plexswift/models/operations/GetAvailableClientsResponseBody.swift +Sources/Plexswift/models/operations/GetButlerTasksButlerResponseBody.swift +Sources/Plexswift/models/operations/GetButlerTasksErrors.swift +Sources/Plexswift/models/operations/GetButlerTasksResponse.swift +Sources/Plexswift/models/operations/GetButlerTasksResponseBody.swift +Sources/Plexswift/models/operations/GetCommonLibraryItemsErrors.swift +Sources/Plexswift/models/operations/GetCommonLibraryItemsRequest.swift +Sources/Plexswift/internal/models/GetCommonLibraryItemsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetCommonLibraryItemsResponse.swift +Sources/Plexswift/models/operations/GetCommonLibraryItemsResponseBody.swift +Sources/Plexswift/models/operations/GetDevicesErrors.swift +Sources/Plexswift/models/operations/GetDevicesMediaContainer.swift +Sources/Plexswift/models/operations/GetDevicesResponse.swift +Sources/Plexswift/models/operations/GetDevicesResponseBody.swift +Sources/Plexswift/models/operations/GetDevicesServerResponseBody.swift +Sources/Plexswift/models/operations/GetFileHashErrors.swift +Sources/Plexswift/models/operations/GetFileHashRequest.swift +Sources/Plexswift/internal/models/GetFileHashRequest+Serialization.swift +Sources/Plexswift/models/operations/GetFileHashResponse.swift +Sources/Plexswift/models/operations/GetFileHashResponseBody.swift +Sources/Plexswift/models/operations/GetGlobalHubsErrors.swift +Sources/Plexswift/models/operations/GetGlobalHubsRequest.swift +Sources/Plexswift/internal/models/GetGlobalHubsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetGlobalHubsResponse.swift +Sources/Plexswift/models/operations/GetGlobalHubsResponseBody.swift +Sources/Plexswift/models/operations/GetLatestLibraryItemsErrors.swift +Sources/Plexswift/models/operations/GetLatestLibraryItemsRequest.swift +Sources/Plexswift/internal/models/GetLatestLibraryItemsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetLatestLibraryItemsResponse.swift +Sources/Plexswift/models/operations/GetLatestLibraryItemsResponseBody.swift +Sources/Plexswift/models/operations/GetLibrariesErrors.swift +Sources/Plexswift/models/operations/GetLibrariesResponse.swift +Sources/Plexswift/models/operations/GetLibrariesResponseBody.swift +Sources/Plexswift/models/operations/GetLibraryErrors.swift +Sources/Plexswift/models/operations/GetLibraryHubsErrors.swift +Sources/Plexswift/models/operations/GetLibraryHubsRequest.swift +Sources/Plexswift/internal/models/GetLibraryHubsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetLibraryHubsResponse.swift +Sources/Plexswift/models/operations/GetLibraryHubsResponseBody.swift +Sources/Plexswift/models/operations/GetLibraryItemsErrors.swift +Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift +Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift +Sources/Plexswift/models/operations/GetLibraryItemsResponseBody.swift +Sources/Plexswift/models/operations/GetLibraryRequest.swift +Sources/Plexswift/internal/models/GetLibraryRequest+Serialization.swift +Sources/Plexswift/models/operations/GetLibraryResponse.swift +Sources/Plexswift/models/operations/GetLibraryResponseBody.swift +Sources/Plexswift/models/operations/GetMetadataChildrenErrors.swift +Sources/Plexswift/models/operations/GetMetadataChildrenRequest.swift +Sources/Plexswift/internal/models/GetMetadataChildrenRequest+Serialization.swift +Sources/Plexswift/models/operations/GetMetadataChildrenResponse.swift +Sources/Plexswift/models/operations/GetMetadataChildrenResponseBody.swift +Sources/Plexswift/models/operations/GetMetadataErrors.swift +Sources/Plexswift/models/operations/GetMetadataRequest.swift +Sources/Plexswift/internal/models/GetMetadataRequest+Serialization.swift +Sources/Plexswift/models/operations/GetMetadataResponse.swift +Sources/Plexswift/models/operations/GetMetadataResponseBody.swift +Sources/Plexswift/models/operations/GetMyPlexAccountErrors.swift +Sources/Plexswift/models/operations/GetMyPlexAccountResponse.swift +Sources/Plexswift/models/operations/GetMyPlexAccountResponseBody.swift +Sources/Plexswift/models/operations/GetMyPlexAccountServerResponseBody.swift +Sources/Plexswift/models/operations/GetOnDeckErrors.swift +Sources/Plexswift/models/operations/GetOnDeckLibraryResponseBody.swift +Sources/Plexswift/models/operations/GetOnDeckMedia.swift +Sources/Plexswift/models/operations/GetOnDeckMediaContainer.swift +Sources/Plexswift/models/operations/GetOnDeckMetadata.swift +Sources/Plexswift/models/operations/GetOnDeckPart.swift +Sources/Plexswift/models/operations/GetOnDeckResponse.swift +Sources/Plexswift/models/operations/GetOnDeckResponseBody.swift +Sources/Plexswift/models/operations/GetPlaylistContentsErrors.swift +Sources/Plexswift/models/operations/GetPlaylistContentsRequest.swift +Sources/Plexswift/internal/models/GetPlaylistContentsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetPlaylistContentsResponse.swift +Sources/Plexswift/models/operations/GetPlaylistContentsResponseBody.swift +Sources/Plexswift/models/operations/GetPlaylistErrors.swift +Sources/Plexswift/models/operations/GetPlaylistRequest.swift +Sources/Plexswift/internal/models/GetPlaylistRequest+Serialization.swift +Sources/Plexswift/models/operations/GetPlaylistResponse.swift +Sources/Plexswift/models/operations/GetPlaylistResponseBody.swift +Sources/Plexswift/models/operations/GetPlaylistsErrors.swift +Sources/Plexswift/models/operations/GetPlaylistsRequest.swift +Sources/Plexswift/internal/models/GetPlaylistsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetPlaylistsResponse.swift +Sources/Plexswift/models/operations/GetPlaylistsResponseBody.swift +Sources/Plexswift/models/operations/GetRecentlyAddedErrors.swift +Sources/Plexswift/models/operations/GetRecentlyAddedLibraryResponseBody.swift +Sources/Plexswift/models/operations/GetRecentlyAddedMediaContainer.swift +Sources/Plexswift/models/operations/GetRecentlyAddedResponse.swift +Sources/Plexswift/models/operations/GetRecentlyAddedResponseBody.swift +Sources/Plexswift/models/operations/GetResizedPhotoErrors.swift +Sources/Plexswift/models/operations/GetResizedPhotoRequest.swift +Sources/Plexswift/internal/models/GetResizedPhotoRequest+Serialization.swift +Sources/Plexswift/models/operations/GetResizedPhotoResponse.swift +Sources/Plexswift/models/operations/GetResizedPhotoResponseBody.swift +Sources/Plexswift/models/operations/GetSearchResultsCountry.swift +Sources/Plexswift/models/operations/GetSearchResultsDirector.swift +Sources/Plexswift/models/operations/GetSearchResultsErrors.swift +Sources/Plexswift/models/operations/GetSearchResultsGenre.swift +Sources/Plexswift/models/operations/GetSearchResultsMedia.swift +Sources/Plexswift/models/operations/GetSearchResultsMediaContainer.swift +Sources/Plexswift/models/operations/GetSearchResultsMetadata.swift +Sources/Plexswift/models/operations/GetSearchResultsPart.swift +Sources/Plexswift/models/operations/GetSearchResultsRequest.swift +Sources/Plexswift/internal/models/GetSearchResultsRequest+Serialization.swift +Sources/Plexswift/models/operations/GetSearchResultsResponse.swift +Sources/Plexswift/models/operations/GetSearchResultsResponseBody.swift +Sources/Plexswift/models/operations/GetSearchResultsRole.swift +Sources/Plexswift/models/operations/GetSearchResultsSearchResponseBody.swift +Sources/Plexswift/models/operations/GetSearchResultsWriter.swift +Sources/Plexswift/models/operations/GetServerActivitiesActivitiesResponseBody.swift +Sources/Plexswift/models/operations/GetServerActivitiesErrors.swift +Sources/Plexswift/models/operations/GetServerActivitiesMediaContainer.swift +Sources/Plexswift/models/operations/GetServerActivitiesResponse.swift +Sources/Plexswift/models/operations/GetServerActivitiesResponseBody.swift +Sources/Plexswift/models/operations/GetServerCapabilitiesResponse.swift +Sources/Plexswift/models/operations/GetServerCapabilitiesResponseBody.swift +Sources/Plexswift/models/operations/GetServerCapabilitiesServerResponseBody.swift +Sources/Plexswift/models/operations/GetServerIdentityErrors.swift +Sources/Plexswift/models/operations/GetServerIdentityMediaContainer.swift +Sources/Plexswift/models/operations/GetServerIdentityResponse.swift +Sources/Plexswift/models/operations/GetServerIdentityResponseBody.swift +Sources/Plexswift/models/operations/GetServerIdentityServerResponseBody.swift +Sources/Plexswift/models/operations/GetServerListErrors.swift +Sources/Plexswift/models/operations/GetServerListMediaContainer.swift +Sources/Plexswift/models/operations/GetServerListResponse.swift +Sources/Plexswift/models/operations/GetServerListResponseBody.swift +Sources/Plexswift/models/operations/GetServerListServer.swift +Sources/Plexswift/models/operations/GetServerListServerResponseBody.swift +Sources/Plexswift/models/operations/GetServerPreferencesErrors.swift +Sources/Plexswift/models/operations/GetServerPreferencesResponse.swift +Sources/Plexswift/models/operations/GetServerPreferencesResponseBody.swift +Sources/Plexswift/models/operations/GetSessionHistoryErrors.swift +Sources/Plexswift/models/operations/GetSessionHistoryResponse.swift +Sources/Plexswift/models/operations/GetSessionHistoryResponseBody.swift +Sources/Plexswift/models/operations/GetSessionsErrors.swift +Sources/Plexswift/models/operations/GetSessionsResponse.swift +Sources/Plexswift/models/operations/GetSessionsResponseBody.swift +Sources/Plexswift/models/operations/GetSourceConnectionInformationErrors.swift +Sources/Plexswift/models/operations/GetSourceConnectionInformationRequest.swift +Sources/Plexswift/internal/models/GetSourceConnectionInformationRequest+Serialization.swift +Sources/Plexswift/models/operations/GetSourceConnectionInformationResponse.swift +Sources/Plexswift/models/operations/GetSourceConnectionInformationResponseBody.swift +Sources/Plexswift/models/operations/GetTimelineErrors.swift +Sources/Plexswift/models/operations/GetTimelineRequest.swift +Sources/Plexswift/internal/models/GetTimelineRequest+Serialization.swift +Sources/Plexswift/models/operations/GetTimelineResponse.swift +Sources/Plexswift/models/operations/GetTimelineResponseBody.swift +Sources/Plexswift/models/operations/GetTranscodeSessionsErrors.swift +Sources/Plexswift/models/operations/GetTranscodeSessionsMediaContainer.swift +Sources/Plexswift/models/operations/GetTranscodeSessionsResponse.swift +Sources/Plexswift/models/operations/GetTranscodeSessionsResponseBody.swift +Sources/Plexswift/models/operations/GetTranscodeSessionsSessionsResponseBody.swift +Sources/Plexswift/models/operations/GetTransientTokenErrors.swift +Sources/Plexswift/models/operations/GetTransientTokenRequest.swift +Sources/Plexswift/internal/models/GetTransientTokenRequest+Serialization.swift +Sources/Plexswift/models/operations/GetTransientTokenResponse.swift +Sources/Plexswift/models/operations/GetTransientTokenResponseBody.swift +Sources/Plexswift/models/operations/GetUpdateStatusErrors.swift +Sources/Plexswift/models/operations/GetUpdateStatusResponse.swift +Sources/Plexswift/models/operations/GetUpdateStatusResponseBody.swift +Sources/Plexswift/models/operations/Guids.swift +Sources/Plexswift/models/operations/IncludeDetails.swift +Sources/Plexswift/internal/models/IncludeDetails+Serialization.swift +Sources/Plexswift/models/operations/Level.swift +Sources/Plexswift/internal/models/Level+Serialization.swift +Sources/Plexswift/models/operations/LogLineErrors.swift +Sources/Plexswift/models/operations/LogLineRequest.swift +Sources/Plexswift/internal/models/LogLineRequest+Serialization.swift +Sources/Plexswift/models/operations/LogLineResponse.swift +Sources/Plexswift/models/operations/LogLineResponseBody.swift +Sources/Plexswift/models/operations/LogMultiLineErrors.swift +Sources/Plexswift/models/operations/LogMultiLineResponse.swift +Sources/Plexswift/models/operations/LogMultiLineResponseBody.swift +Sources/Plexswift/models/operations/MarkPlayedErrors.swift +Sources/Plexswift/models/operations/MarkPlayedRequest.swift +Sources/Plexswift/internal/models/MarkPlayedRequest+Serialization.swift +Sources/Plexswift/models/operations/MarkPlayedResponse.swift +Sources/Plexswift/models/operations/MarkPlayedResponseBody.swift +Sources/Plexswift/models/operations/MarkUnplayedErrors.swift +Sources/Plexswift/models/operations/MarkUnplayedRequest.swift +Sources/Plexswift/internal/models/MarkUnplayedRequest+Serialization.swift +Sources/Plexswift/models/operations/MarkUnplayedResponse.swift +Sources/Plexswift/models/operations/MarkUnplayedResponseBody.swift +Sources/Plexswift/models/operations/Media.swift +Sources/Plexswift/models/operations/MediaContainer.swift +Sources/Plexswift/models/operations/Metadata.swift +Sources/Plexswift/models/operations/MinSize.swift +Sources/Plexswift/internal/models/MinSize+Serialization.swift +Sources/Plexswift/models/operations/MyPlex.swift +Sources/Plexswift/models/operations/OnlyTransient.swift +Sources/Plexswift/internal/models/OnlyTransient+Serialization.swift +Sources/Plexswift/models/operations/Part.swift +Sources/Plexswift/models/operations/PathParamTaskName.swift +Sources/Plexswift/internal/models/PathParamTaskName+Serialization.swift +Sources/Plexswift/models/operations/PerformSearchErrors.swift +Sources/Plexswift/models/operations/PerformSearchRequest.swift +Sources/Plexswift/internal/models/PerformSearchRequest+Serialization.swift +Sources/Plexswift/models/operations/PerformSearchResponse.swift +Sources/Plexswift/models/operations/PerformSearchResponseBody.swift +Sources/Plexswift/models/operations/PerformVoiceSearchErrors.swift +Sources/Plexswift/models/operations/PerformVoiceSearchRequest.swift +Sources/Plexswift/internal/models/PerformVoiceSearchRequest+Serialization.swift +Sources/Plexswift/models/operations/PerformVoiceSearchResponse.swift +Sources/Plexswift/models/operations/PerformVoiceSearchResponseBody.swift +Sources/Plexswift/models/operations/PlaylistType.swift +Sources/Plexswift/internal/models/PlaylistType+Serialization.swift +Sources/Plexswift/models/operations/Provider.swift +Sources/Plexswift/models/operations/QueryParamOnlyTransient.swift +Sources/Plexswift/internal/models/QueryParamOnlyTransient+Serialization.swift +Sources/Plexswift/models/operations/QueryParamSmart.swift +Sources/Plexswift/internal/models/QueryParamSmart+Serialization.swift +Sources/Plexswift/models/operations/QueryParamType.swift +Sources/Plexswift/internal/models/QueryParamType+Serialization.swift +Sources/Plexswift/models/operations/RefreshLibraryErrors.swift +Sources/Plexswift/models/operations/RefreshLibraryRequest.swift +Sources/Plexswift/internal/models/RefreshLibraryRequest+Serialization.swift +Sources/Plexswift/models/operations/RefreshLibraryResponse.swift +Sources/Plexswift/models/operations/RefreshLibraryResponseBody.swift +Sources/Plexswift/models/operations/ResponseBody.swift +Sources/Plexswift/models/operations/Role.swift +Sources/Plexswift/models/operations/Scope.swift +Sources/Plexswift/internal/models/Scope+Serialization.swift +Sources/Plexswift/models/operations/Server.swift +Sources/Plexswift/models/operations/Skip.swift +Sources/Plexswift/internal/models/Skip+Serialization.swift +Sources/Plexswift/models/operations/Smart.swift +Sources/Plexswift/internal/models/Smart+Serialization.swift +Sources/Plexswift/models/operations/StartAllTasksErrors.swift +Sources/Plexswift/models/operations/StartAllTasksResponse.swift +Sources/Plexswift/models/operations/StartAllTasksResponseBody.swift +Sources/Plexswift/models/operations/StartTaskErrors.swift +Sources/Plexswift/models/operations/StartTaskRequest.swift +Sources/Plexswift/internal/models/StartTaskRequest+Serialization.swift +Sources/Plexswift/models/operations/StartTaskResponse.swift +Sources/Plexswift/models/operations/StartTaskResponseBody.swift +Sources/Plexswift/models/operations/StartUniversalTranscodeErrors.swift +Sources/Plexswift/models/operations/StartUniversalTranscodeRequest.swift +Sources/Plexswift/internal/models/StartUniversalTranscodeRequest+Serialization.swift +Sources/Plexswift/models/operations/StartUniversalTranscodeResponse.swift +Sources/Plexswift/models/operations/StartUniversalTranscodeResponseBody.swift +Sources/Plexswift/models/operations/State.swift +Sources/Plexswift/internal/models/State+Serialization.swift +Sources/Plexswift/models/operations/StopAllTasksErrors.swift +Sources/Plexswift/models/operations/StopAllTasksResponse.swift +Sources/Plexswift/models/operations/StopAllTasksResponseBody.swift +Sources/Plexswift/models/operations/StopTaskErrors.swift +Sources/Plexswift/models/operations/StopTaskRequest.swift +Sources/Plexswift/internal/models/StopTaskRequest+Serialization.swift +Sources/Plexswift/models/operations/StopTaskResponse.swift +Sources/Plexswift/models/operations/StopTaskResponseBody.swift +Sources/Plexswift/models/operations/StopTranscodeSessionErrors.swift +Sources/Plexswift/models/operations/StopTranscodeSessionRequest.swift +Sources/Plexswift/internal/models/StopTranscodeSessionRequest+Serialization.swift +Sources/Plexswift/models/operations/StopTranscodeSessionResponse.swift +Sources/Plexswift/models/operations/StopTranscodeSessionResponseBody.swift +Sources/Plexswift/models/operations/Stream.swift +Sources/Plexswift/models/operations/TaskName.swift +Sources/Plexswift/internal/models/TaskName+Serialization.swift +Sources/Plexswift/models/operations/Tonight.swift +Sources/Plexswift/internal/models/Tonight+Serialization.swift +Sources/Plexswift/models/operations/TranscodeSession.swift +Sources/Plexswift/models/operations/TypeModel.swift +Sources/Plexswift/internal/models/TypeModel+Serialization.swift +Sources/Plexswift/models/operations/UpdatePlayProgressErrors.swift +Sources/Plexswift/models/operations/UpdatePlayProgressRequest.swift +Sources/Plexswift/internal/models/UpdatePlayProgressRequest+Serialization.swift +Sources/Plexswift/models/operations/UpdatePlayProgressResponse.swift +Sources/Plexswift/models/operations/UpdatePlayProgressResponseBody.swift +Sources/Plexswift/models/operations/UpdatePlaylistErrors.swift +Sources/Plexswift/models/operations/UpdatePlaylistRequest.swift +Sources/Plexswift/internal/models/UpdatePlaylistRequest+Serialization.swift +Sources/Plexswift/models/operations/UpdatePlaylistResponse.swift +Sources/Plexswift/models/operations/UpdatePlaylistResponseBody.swift +Sources/Plexswift/models/operations/UploadPlaylistErrors.swift +Sources/Plexswift/models/operations/UploadPlaylistRequest.swift +Sources/Plexswift/internal/models/UploadPlaylistRequest+Serialization.swift +Sources/Plexswift/models/operations/UploadPlaylistResponse.swift +Sources/Plexswift/models/operations/UploadPlaylistResponseBody.swift +Sources/Plexswift/models/operations/Upscale.swift +Sources/Plexswift/internal/models/Upscale+Serialization.swift +Sources/Plexswift/models/operations/Writer.swift +Sources/Plexswift/models/shared/Security.swift +Sources/Plexswift/internal/models/Security+Serialization.swift +USAGE.md +Sources/Plexswift/Plexswift.docc/Plexswift.md +.gitattributes \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index 7111d2d..dcf44bb 100644 --- a/gen.yaml +++ b/gen.yaml @@ -1,16 +1,27 @@ configVersion: 1.0.0 +management: + docChecksum: 550154cf1b4d0c237436fb18c418b5db + docVersion: 0.0.3 + speakeasyVersion: 1.129.1 + generationVersion: 2.223.3 generation: comments: {} sdkClassName: Plex-API - repoURL: https://github.com/speakeasy-sdks/Personal-sample-sdk-9.git + repoURL: https://github.com/LukeHagar/plexswift.git maintainOpenAPIOrder: true usageSnippets: optionalPropertyRendering: withExample - useClassNamesForArrayFields: true fixes: nameResolutionDec2023: false + useClassNamesForArrayFields: true +features: + swift: + core: 3.1.1 + globalSecurity: 2.81.2 + globalServerURLs: 2.82.1 + nameOverrides: 2.81.1 swift: - version: 0.0.1 + version: 0.1.0 author: LukeHagar description: Swift Client SDK Generated by Speakeasy imports: @@ -24,3 +35,5 @@ swift: inputModelSuffix: input outputModelSuffix: output packageName: plexswift + published: true + repoSubDirectory: .