From 6b8d3696250b60a5372c26738edb0f7ff8402663 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 23 May 2024 15:57:47 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.295.1 --- .speakeasy/gen.lock | 30 +- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 8 +- README.md | 2 +- RELEASES.md | 12 +- Sources/Plexswift/Plexswift.docc/Plexswift.md | 17 + .../Plexswift/internal/api/_LibraryAPI.swift | 54 +- ...GetLibraryItemsRequest+Serialization.swift | 24 + .../internal/models/Tag+Serialization.swift | 14 + .../operations/GetLibraryItemsCountry.swift | 24 + .../operations/GetLibraryItemsDirector.swift | 24 + .../operations/GetLibraryItemsErrors.swift | 58 + .../operations/GetLibraryItemsGenre.swift | 24 + .../GetLibraryItemsLibraryResponseBody.swift | 24 + .../operations/GetLibraryItemsMedia.swift | 107 ++ .../GetLibraryItemsMediaContainer.swift | 69 + .../operations/GetLibraryItemsMetadata.swift | 334 +++++ .../operations/GetLibraryItemsPart.swift | 42 + .../operations/GetLibraryItemsRequest.swift | 23 + .../operations/GetLibraryItemsResponse.swift | 34 + .../GetLibraryItemsResponseBody.swift | 24 + .../operations/GetLibraryItemsRole.swift | 24 + .../operations/GetLibraryItemsWriter.swift | 24 + .../operations/SearchLibraryErrors.swift | 58 + .../SearchLibraryLibraryResponseBody.swift | 24 + .../operations/SearchLibraryResponse.swift | 14 +- Sources/Plexswift/models/operations/Tag.swift | 28 + Sources/plexswift/PlexswiftAPI.swift | 28 + .../internal/client/URLRequestBuilder.swift | 2 +- codeSamples.yaml | 1238 +++++++++-------- 30 files changed, 1756 insertions(+), 634 deletions(-) create mode 100644 Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift create mode 100644 Sources/Plexswift/internal/models/Tag+Serialization.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsCountry.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsDirector.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsErrors.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsGenre.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsLibraryResponseBody.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsMedia.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsMediaContainer.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsMetadata.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsPart.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsResponseBody.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsRole.swift create mode 100644 Sources/Plexswift/models/operations/GetLibraryItemsWriter.swift create mode 100644 Sources/Plexswift/models/operations/SearchLibraryErrors.swift create mode 100644 Sources/Plexswift/models/operations/SearchLibraryLibraryResponseBody.swift create mode 100644 Sources/Plexswift/models/operations/Tag.swift diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index f74fa76..95a6193 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 5d77204e-e413-4fd0-a14a-bad3aee2247a management: - docChecksum: 543cb95355401d2e3c2ba11a50d9dd94 + docChecksum: 911d74baa0d06121d2ce2c71d94e977a docVersion: 0.0.3 - speakeasyVersion: 1.285.0 - generationVersion: 2.326.3 - releaseVersion: 0.2.0 - configChecksum: 8e59cbc89b7aa4f53dedf1cd0d7d10a9 + speakeasyVersion: 1.295.1 + generationVersion: 2.335.5 + releaseVersion: 0.3.0 + configChecksum: ff83ff18de944ae2a94ad7cd0e953eeb repoURL: https://github.com/LukeHagar/plexswift.git features: swift: @@ -16,7 +16,6 @@ features: globals: 2.81.3 methodServerURLs: 3.0.1 nameOverrides: 2.81.2 - unions: 2.81.4 generatedFiles: - Sources/Plexswift/internal/api/_ServerAPI.swift - Sources/Plexswift/internal/api/_MediaAPI.swift @@ -176,6 +175,21 @@ generatedFiles: - Sources/Plexswift/models/operations/GetLibraryHubsResponseBody.swift - Sources/Plexswift/models/operations/GetLibraryHubsRole.swift - Sources/Plexswift/models/operations/GetLibraryHubsWriter.swift + - Sources/Plexswift/models/operations/GetLibraryItemsCountry.swift + - Sources/Plexswift/models/operations/GetLibraryItemsDirector.swift + - Sources/Plexswift/models/operations/GetLibraryItemsErrors.swift + - Sources/Plexswift/models/operations/GetLibraryItemsGenre.swift + - Sources/Plexswift/models/operations/GetLibraryItemsLibraryResponseBody.swift + - Sources/Plexswift/models/operations/GetLibraryItemsMedia.swift + - Sources/Plexswift/models/operations/GetLibraryItemsMediaContainer.swift + - Sources/Plexswift/models/operations/GetLibraryItemsMetadata.swift + - Sources/Plexswift/models/operations/GetLibraryItemsPart.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/GetLibraryItemsRole.swift + - Sources/Plexswift/models/operations/GetLibraryItemsWriter.swift - Sources/Plexswift/models/operations/GetLibraryLibraryResponseBody.swift - Sources/Plexswift/models/operations/GetLibraryMediaContainer.swift - Sources/Plexswift/models/operations/GetLibraryRequest.swift @@ -430,6 +444,8 @@ generatedFiles: - Sources/Plexswift/models/operations/Role.swift - Sources/Plexswift/models/operations/Scope.swift - Sources/Plexswift/internal/models/Scope+Serialization.swift + - Sources/Plexswift/models/operations/SearchLibraryErrors.swift + - Sources/Plexswift/models/operations/SearchLibraryLibraryResponseBody.swift - Sources/Plexswift/models/operations/SearchLibraryMediaContainer.swift - Sources/Plexswift/models/operations/SearchLibraryMetadata.swift - Sources/Plexswift/models/operations/SearchLibraryRequest.swift @@ -474,6 +490,8 @@ generatedFiles: - Sources/Plexswift/models/operations/StopTranscodeSessionResponse.swift - Sources/Plexswift/models/operations/StopTranscodeSessionResponseBody.swift - Sources/Plexswift/models/operations/Stream.swift + - Sources/Plexswift/models/operations/Tag.swift + - Sources/Plexswift/internal/models/Tag+Serialization.swift - Sources/Plexswift/models/operations/TaskName.swift - Sources/Plexswift/internal/models/TaskName+Serialization.swift - Sources/Plexswift/models/operations/Tonight.swift diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c36a01b..544e9ef 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true swift: - version: 0.2.0 + version: 0.3.0 author: LukeHagar description: Swift Client SDK Generated by Speakeasy imports: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 7c93265..c21e726 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.285.1 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:e57617d6790e0c330a0f2ef55e81649186eadee60f384fed42d595467de07223 - sourceBlobDigest: sha256:f777b439dbc2105056327d987ec43579164f73d7c9b5be957b87b728df3e0cc6 + sourceRevisionDigest: sha256:a0cdc9c76197fd535824e7065b0f253e299c9ca5a722edced811eb3cdc5f0b95 + sourceBlobDigest: sha256:55331272dbf4a3cc2212f7db12f93574f3d6633a5fb8bd07f5c3dc05630426fc tags: - latest - main @@ -11,8 +11,8 @@ targets: plexswift: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:e57617d6790e0c330a0f2ef55e81649186eadee60f384fed42d595467de07223 - sourceBlobDigest: sha256:f777b439dbc2105056327d987ec43579164f73d7c9b5be957b87b728df3e0cc6 + sourceRevisionDigest: sha256:a0cdc9c76197fd535824e7065b0f253e299c9ca5a722edced811eb3cdc5f0b95 + sourceBlobDigest: sha256:55331272dbf4a3cc2212f7db12f93574f3d6633a5fb8bd07f5c3dc05630426fc outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 diff --git a/README.md b/README.md index 22e77f3..4848dcb 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ You can add `plexswift` to your project directly in Xcode `(File > Add Packages. ```bash dependencies: [ - .package(url: "https://github.com/LukeHagar/plexswift.git", .upToNextMajor(from: "0.2.0")) + .package(url: "https://github.com/LukeHagar/plexswift.git", .upToNextMajor(from: "0.3.0")) ] ``` diff --git a/RELEASES.md b/RELEASES.md index d7757c0..f06637a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -232,4 +232,14 @@ Based on: ### Generated - [swift v0.2.0] . ### Releases -- [Swift Package Manager v0.2.0] https://github.com/LukeHagar/plexswift/releases/tag/v0.2.0 - . \ No newline at end of file +- [Swift Package Manager v0.2.0] https://github.com/LukeHagar/plexswift/releases/tag/v0.2.0 - . + +## 2024-05-23 15:57:01 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.295.1 (2.335.5) https://github.com/speakeasy-api/speakeasy +### Generated +- [swift v0.3.0] . +### Releases +- [Swift Package Manager v0.3.0] https://github.com/LukeHagar/plexswift/releases/tag/v0.3.0 - . \ No newline at end of file diff --git a/Sources/Plexswift/Plexswift.docc/Plexswift.md b/Sources/Plexswift/Plexswift.docc/Plexswift.md index 40fb360..9513299 100644 --- a/Sources/Plexswift/Plexswift.docc/Plexswift.md +++ b/Sources/Plexswift/Plexswift.docc/Plexswift.md @@ -93,6 +93,7 @@ case .empty: - ``Operations/GetLibrariesResponse`` - ``Operations/GetLibraryResponse`` - ``Operations/GetLibraryHubsResponse`` +- ``Operations/GetLibraryItemsResponse`` - ``Operations/GetMetadataResponse`` - ``Operations/GetMetadataChildrenResponse`` - ``Operations/GetMyPlexAccountResponse`` @@ -232,6 +233,19 @@ case .empty: - ``Operations/GetLibraryHubsResponseBody`` - ``Operations/GetLibraryHubsRole`` - ``Operations/GetLibraryHubsWriter`` +- ``Operations/GetLibraryItemsCountry`` +- ``Operations/GetLibraryItemsDirector`` +- ``Operations/GetLibraryItemsErrors`` +- ``Operations/GetLibraryItemsGenre`` +- ``Operations/GetLibraryItemsLibraryResponseBody`` +- ``Operations/GetLibraryItemsMedia`` +- ``Operations/GetLibraryItemsMediaContainer`` +- ``Operations/GetLibraryItemsMetadata`` +- ``Operations/GetLibraryItemsPart`` +- ``Operations/GetLibraryItemsRequest`` +- ``Operations/GetLibraryItemsResponseBody`` +- ``Operations/GetLibraryItemsRole`` +- ``Operations/GetLibraryItemsWriter`` - ``Operations/GetMetadataCountry`` - ``Operations/GetMetadataDirector`` - ``Operations/GetMetadataErrors`` @@ -417,6 +431,8 @@ case .empty: - ``Operations/Release`` - ``Operations/Role`` - ``Operations/Scope`` +- ``Operations/SearchLibraryErrors`` +- ``Operations/SearchLibraryLibraryResponseBody`` - ``Operations/SearchLibraryMediaContainer`` - ``Operations/SearchLibraryMetadata`` - ``Operations/SearchLibraryRequest`` @@ -446,6 +462,7 @@ case .empty: - ``Operations/StopTranscodeSessionRequest`` - ``Operations/StopTranscodeSessionResponseBody`` - ``Operations/Stream`` +- ``Operations/Tag`` - ``Operations/TaskName`` - ``Operations/Tonight`` - ``Operations/TranscodeSession`` diff --git a/Sources/Plexswift/internal/api/_LibraryAPI.swift b/Sources/Plexswift/internal/api/_LibraryAPI.swift index 70c1d93..44ad600 100644 --- a/Sources/Plexswift/internal/api/_LibraryAPI.swift +++ b/Sources/Plexswift/internal/api/_LibraryAPI.swift @@ -55,6 +55,15 @@ class _LibraryAPI: LibraryAPI { ) } + 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 @@ -138,6 +147,13 @@ private func configureDeleteLibraryRequest(with configuration: URLRequestConfigu configuration.telemetryHeader = .userAgent } +private func configureGetLibraryItemsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryItemsRequest) throws { + configuration.path = "/library/sections/{sectionId}/{tag}" + configuration.method = .get + configuration.pathParameterSerializable = request + configuration.telemetryHeader = .userAgent +} + private func configureRefreshLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.RefreshLibraryRequest) throws { configuration.path = "/library/sections/{sectionId}/refresh" configuration.method = .get @@ -289,6 +305,32 @@ private func handleDeleteLibraryResponse(response: Client.APIResponse) throws -> return .empty } +private func handleGetLibraryItemsResponse(response: Client.APIResponse) throws -> Operations.GetLibraryItemsResponse { + 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.GetLibraryItemsResponseBody.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.GetLibraryItemsLibraryResponseBody.self, from: data)) + } catch { + throw ResponseHandlerError.failedToDecodeJSON(error) + } + } + } + + return .empty +} + private func handleRefreshLibraryResponse(response: Client.APIResponse) throws -> Operations.RefreshLibraryResponse { let httpResponse = response.httpResponse @@ -313,7 +355,17 @@ private func handleSearchLibraryResponse(response: Client.APIResponse) throws -> if httpResponse.statusCode == 200 { if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data { do { - return .object(try JSONDecoder().decode(Operations.SearchLibraryResponseBody.self, from: data)) + return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.SearchLibraryResponseBody.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.SearchLibraryLibraryResponseBody.self, from: data)) } catch { throw ResponseHandlerError.failedToDecodeJSON(error) } diff --git a/Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift b/Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift new file mode 100644 index 0000000..e4f8837 --- /dev/null +++ b/Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift @@ -0,0 +1,24 @@ +// 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, .header, .multipart, .form: + throw SerializationError.invalidSerializationParameter(type: "Operations.GetLibraryItemsRequest", format: format.formatDescription) + } + } +} + +extension Operations.GetLibraryItemsRequest: PathParameterSerializable { + func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] { + return [ + "sectionId": try sectionId.serialize(with: formatOverride ?? .path(explode: false)), + "tag": try tag.serialize(with: formatOverride ?? .path(explode: false)), + ].compactMapValues { $0 } + } +} diff --git a/Sources/Plexswift/internal/models/Tag+Serialization.swift b/Sources/Plexswift/internal/models/Tag+Serialization.swift new file mode 100644 index 0000000..eb04237 --- /dev/null +++ b/Sources/Plexswift/internal/models/Tag+Serialization.swift @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + + +import Foundation + +extension Operations.Tag: 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/operations/GetLibraryItemsCountry.swift b/Sources/Plexswift/models/operations/GetLibraryItemsCountry.swift new file mode 100644 index 0000000..e64a8c2 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsCountry.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsCountry { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetLibraryItemsCountry: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsDirector.swift b/Sources/Plexswift/models/operations/GetLibraryItemsDirector.swift new file mode 100644 index 0000000..918baff --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsDirector.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsDirector { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetLibraryItemsDirector: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + 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/GetLibraryItemsGenre.swift b/Sources/Plexswift/models/operations/GetLibraryItemsGenre.swift new file mode 100644 index 0000000..6b721eb --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsGenre.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsGenre { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetLibraryItemsGenre: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsLibraryResponseBody.swift b/Sources/Plexswift/models/operations/GetLibraryItemsLibraryResponseBody.swift new file mode 100644 index 0000000..1df251b --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsLibraryResponseBody.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 GetLibraryItemsLibraryResponseBody { + public let errors: [Operations.GetLibraryItemsErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.GetLibraryItemsErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.GetLibraryItemsLibraryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsMedia.swift b/Sources/Plexswift/models/operations/GetLibraryItemsMedia.swift new file mode 100644 index 0000000..d93f1ef --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsMedia.swift @@ -0,0 +1,107 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsMedia { + @DecimalSerialized + public private(set) var aspectRatio: Double? + public let audioChannels: Int? + public let audioCodec: String? + public let bitrate: Int? + public let container: String? + public let duration: Int? + public let height: Int? + public let id: Int? + public let part: [Operations.GetLibraryItemsPart]? + public let videoCodec: String? + public let videoFrameRate: String? + public let videoProfile: String? + public let videoResolution: String? + public let width: Int? + + /// Creates an object with the specified parameters + /// + /// + public init(aspectRatio: Double? = nil, audioChannels: Int? = nil, audioCodec: String? = nil, bitrate: Int? = nil, container: String? = nil, duration: Int? = nil, height: Int? = nil, id: Int? = nil, part: [Operations.GetLibraryItemsPart]? = nil, videoCodec: String? = nil, videoFrameRate: String? = nil, videoProfile: String? = nil, videoResolution: String? = nil, width: Int? = nil) { + self._aspectRatio = DecimalSerialized(wrappedValue: aspectRatio) + self.audioChannels = audioChannels + self.audioCodec = audioCodec + self.bitrate = bitrate + self.container = container + self.duration = duration + self.height = height + self.id = id + self.part = part + self.videoCodec = videoCodec + self.videoFrameRate = videoFrameRate + self.videoProfile = videoProfile + self.videoResolution = videoResolution + self.width = width + } + } +} + +extension Operations.GetLibraryItemsMedia: Codable { + enum CodingKeys: String, CodingKey { + case aspectRatio + case audioChannels + case audioCodec + 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(Int.self, forKey: .audioChannels) + self.audioCodec = try container.decodeIfPresent(String.self, forKey: .audioCodec) + self.bitrate = try container.decodeIfPresent(Int.self, forKey: .bitrate) + self.container = try container.decodeIfPresent(String.self, forKey: .container) + self.duration = try container.decodeIfPresent(Int.self, forKey: .duration) + self.height = try container.decodeIfPresent(Int.self, forKey: .height) + self.id = try container.decodeIfPresent(Int.self, forKey: .id) + self.part = try container.decodeIfPresent([Operations.GetLibraryItemsPart].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(Int.self, forKey: .width) + } + + 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) + } + try container.encodeIfPresent(self.audioChannels, forKey: .audioChannels) + try container.encodeIfPresent(self.audioCodec, forKey: .audioCodec) + try container.encodeIfPresent(self.bitrate, forKey: .bitrate) + try container.encodeIfPresent(self.container, forKey: .container) + try container.encodeIfPresent(self.duration, forKey: .duration) + try container.encodeIfPresent(self.height, forKey: .height) + try container.encodeIfPresent(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) + try container.encodeIfPresent(self.width, forKey: .width) + } +} + +extension Operations.GetLibraryItemsMedia { + var aspectRatioWrapper: DecimalSerialized { + return _aspectRatio + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsMediaContainer.swift b/Sources/Plexswift/models/operations/GetLibraryItemsMediaContainer.swift new file mode 100644 index 0000000..02eaa64 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsMediaContainer.swift @@ -0,0 +1,69 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsMediaContainer { + public let allowSync: Bool? + public let art: String? + public let identifier: String? + public let librarySectionID: Int? + public let librarySectionTitle: String? + public let librarySectionUUID: String? + public let mediaTagPrefix: String? + public let mediaTagVersion: Int? + public let metadata: [Operations.GetLibraryItemsMetadata]? + public let mixedParents: Bool? + public let size: Int? + public let thumb: String? + public let title1: String? + public let title2: String? + public let viewGroup: String? + public let viewMode: Int? + + /// Creates an object with the specified parameters + /// + /// + public init(allowSync: Bool? = nil, art: String? = nil, identifier: String? = nil, librarySectionID: Int? = nil, librarySectionTitle: String? = nil, librarySectionUUID: String? = nil, mediaTagPrefix: String? = nil, mediaTagVersion: Int? = nil, metadata: [Operations.GetLibraryItemsMetadata]? = nil, mixedParents: Bool? = nil, size: Int? = nil, thumb: String? = nil, title1: String? = nil, title2: String? = nil, viewGroup: String? = nil, viewMode: Int? = nil) { + self.allowSync = allowSync + self.art = art + self.identifier = identifier + self.librarySectionID = librarySectionID + self.librarySectionTitle = librarySectionTitle + self.librarySectionUUID = librarySectionUUID + self.mediaTagPrefix = mediaTagPrefix + self.mediaTagVersion = mediaTagVersion + self.metadata = metadata + self.mixedParents = mixedParents + self.size = size + self.thumb = thumb + self.title1 = title1 + self.title2 = title2 + self.viewGroup = viewGroup + self.viewMode = viewMode + } + } +} + +extension Operations.GetLibraryItemsMediaContainer: Codable { + enum CodingKeys: String, CodingKey { + case allowSync + case art + case identifier + case librarySectionID + case librarySectionTitle + case librarySectionUUID + case mediaTagPrefix + case mediaTagVersion + case metadata = "Metadata" + case mixedParents + case size + case thumb + case title1 + case title2 + case viewGroup + case viewMode + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsMetadata.swift b/Sources/Plexswift/models/operations/GetLibraryItemsMetadata.swift new file mode 100644 index 0000000..8715075 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsMetadata.swift @@ -0,0 +1,334 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsMetadata { + public let addedAt: Int? + public let art: String? + @DecimalSerialized + public private(set) var audienceRating: Double? + public let audienceRatingImage: String? + public let chapterSource: String? + public let childCount: Int? + public let contentRating: String? + public let country: [Operations.GetLibraryItemsCountry]? + public let director: [Operations.GetLibraryItemsDirector]? + public let duration: Int? + public let genre: [Operations.GetLibraryItemsGenre]? + public let grandparentArt: String? + public let grandparentGuid: String? + public let grandparentKey: String? + public let grandparentRatingKey: String? + public let grandparentTheme: String? + public let grandparentThumb: String? + public let grandparentTitle: String? + public let guid: String? + public let hasPremiumExtras: String? + public let hasPremiumPrimaryExtra: String? + public let index: Int? + public let key: String? + public let lastViewedAt: Int? + public let leafCount: Int? + public let media: [Operations.GetLibraryItemsMedia]? + @DateOnly + public private(set) var originallyAvailableAt: Date? + public let originalTitle: String? + public let parentGuid: String? + public let parentIndex: Int? + public let parentKey: String? + public let parentRatingKey: String? + public let parentStudio: String? + public let parentTheme: String? + public let parentThumb: String? + public let parentTitle: String? + public let parentYear: Int? + public let primaryExtraKey: String? + @DecimalSerialized + public private(set) var rating: Double? + public let ratingImage: String? + public let ratingKey: String? + public let role: [Operations.GetLibraryItemsRole]? + public let skipCount: Int? + public let studio: String? + public let summary: String? + public let tagline: String? + public let theme: String? + public let thumb: String? + public let title: String? + public let titleSort: String? + public let type: String? + public let updatedAt: Int? + public let viewCount: Int? + public let viewedLeafCount: Int? + public let viewOffset: Int? + public let writer: [Operations.GetLibraryItemsWriter]? + public let year: Int? + + /// Creates an object with the specified parameters + /// + /// + public init(addedAt: Int? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, chapterSource: String? = nil, childCount: Int? = nil, contentRating: String? = nil, country: [Operations.GetLibraryItemsCountry]? = nil, director: [Operations.GetLibraryItemsDirector]? = nil, duration: Int? = nil, genre: [Operations.GetLibraryItemsGenre]? = nil, grandparentArt: String? = nil, grandparentGuid: String? = nil, grandparentKey: String? = nil, grandparentRatingKey: String? = nil, grandparentTheme: String? = nil, grandparentThumb: String? = nil, grandparentTitle: String? = nil, guid: String? = nil, hasPremiumExtras: String? = nil, hasPremiumPrimaryExtra: String? = nil, index: Int? = nil, key: String? = nil, lastViewedAt: Int? = nil, leafCount: Int? = nil, media: [Operations.GetLibraryItemsMedia]? = nil, originallyAvailableAt: Date? = nil, originalTitle: String? = nil, parentGuid: String? = nil, parentIndex: Int? = nil, parentKey: String? = nil, parentRatingKey: String? = nil, parentStudio: String? = nil, parentTheme: String? = nil, parentThumb: String? = nil, parentTitle: String? = nil, parentYear: Int? = nil, primaryExtraKey: String? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: String? = nil, role: [Operations.GetLibraryItemsRole]? = nil, skipCount: Int? = nil, studio: String? = nil, summary: String? = nil, tagline: String? = nil, theme: String? = nil, thumb: String? = nil, title: String? = nil, titleSort: String? = nil, type: String? = nil, updatedAt: Int? = nil, viewCount: Int? = nil, viewedLeafCount: Int? = nil, viewOffset: Int? = nil, writer: [Operations.GetLibraryItemsWriter]? = nil, year: Int? = nil) { + self.addedAt = addedAt + self.art = art + self._audienceRating = DecimalSerialized(wrappedValue: audienceRating) + self.audienceRatingImage = audienceRatingImage + self.chapterSource = chapterSource + self.childCount = childCount + self.contentRating = contentRating + self.country = country + self.director = director + self.duration = duration + self.genre = genre + self.grandparentArt = grandparentArt + self.grandparentGuid = grandparentGuid + self.grandparentKey = grandparentKey + self.grandparentRatingKey = grandparentRatingKey + self.grandparentTheme = grandparentTheme + self.grandparentThumb = grandparentThumb + self.grandparentTitle = grandparentTitle + self.guid = guid + self.hasPremiumExtras = hasPremiumExtras + self.hasPremiumPrimaryExtra = hasPremiumPrimaryExtra + self.index = index + self.key = key + self.lastViewedAt = lastViewedAt + self.leafCount = leafCount + self.media = media + self._originallyAvailableAt = DateOnly(wrappedValue: originallyAvailableAt) + self.originalTitle = originalTitle + self.parentGuid = parentGuid + self.parentIndex = parentIndex + self.parentKey = parentKey + self.parentRatingKey = parentRatingKey + self.parentStudio = parentStudio + self.parentTheme = parentTheme + self.parentThumb = parentThumb + self.parentTitle = parentTitle + self.parentYear = parentYear + self.primaryExtraKey = primaryExtraKey + self._rating = DecimalSerialized(wrappedValue: rating) + self.ratingImage = ratingImage + self.ratingKey = ratingKey + self.role = role + self.skipCount = skipCount + self.studio = studio + self.summary = summary + self.tagline = tagline + self.theme = theme + self.thumb = thumb + self.title = title + self.titleSort = titleSort + self.type = type + self.updatedAt = updatedAt + self.viewCount = viewCount + self.viewedLeafCount = viewedLeafCount + self.viewOffset = viewOffset + self.writer = writer + self.year = year + } + } +} + +extension Operations.GetLibraryItemsMetadata: Codable { + enum CodingKeys: String, CodingKey { + case addedAt + case art + case audienceRating + case audienceRatingImage + case chapterSource + case childCount + case contentRating + case country = "Country" + case director = "Director" + case duration + case genre = "Genre" + case grandparentArt + case grandparentGuid + case grandparentKey + case grandparentRatingKey + case grandparentTheme + case grandparentThumb + case grandparentTitle + case guid + case hasPremiumExtras + case hasPremiumPrimaryExtra + case index + case key + case lastViewedAt + case leafCount + case media = "Media" + case originallyAvailableAt + case originalTitle + case parentGuid + case parentIndex + case parentKey + case parentRatingKey + case parentStudio + case parentTheme + case parentThumb + case parentTitle + case parentYear + case primaryExtraKey + case rating + case ratingImage + case ratingKey + case role = "Role" + case skipCount + case studio + case summary + case tagline + case theme + case thumb + case title + case titleSort + case type + case updatedAt + case viewCount + case viewedLeafCount + case viewOffset + case writer = "Writer" + case year + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.addedAt = try container.decodeIfPresent(Int.self, forKey: .addedAt) + 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.childCount = try container.decodeIfPresent(Int.self, forKey: .childCount) + self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating) + self.country = try container.decodeIfPresent([Operations.GetLibraryItemsCountry].self, forKey: .country) + self.director = try container.decodeIfPresent([Operations.GetLibraryItemsDirector].self, forKey: .director) + self.duration = try container.decodeIfPresent(Int.self, forKey: .duration) + self.genre = try container.decodeIfPresent([Operations.GetLibraryItemsGenre].self, forKey: .genre) + 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(String.self, forKey: .grandparentRatingKey) + 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.hasPremiumExtras = try container.decodeIfPresent(String.self, forKey: .hasPremiumExtras) + self.hasPremiumPrimaryExtra = try container.decodeIfPresent(String.self, forKey: .hasPremiumPrimaryExtra) + self.index = try container.decodeIfPresent(Int.self, forKey: .index) + self.key = try container.decodeIfPresent(String.self, forKey: .key) + self.lastViewedAt = try container.decodeIfPresent(Int.self, forKey: .lastViewedAt) + self.leafCount = try container.decodeIfPresent(Int.self, forKey: .leafCount) + self.media = try container.decodeIfPresent([Operations.GetLibraryItemsMedia].self, forKey: .media) + self._originallyAvailableAt = try container.decodeIfPresent(DateOnly.self, forKey: .originallyAvailableAt) ?? DateOnly(wrappedValue: nil) + self.originalTitle = try container.decodeIfPresent(String.self, forKey: .originalTitle) + self.parentGuid = try container.decodeIfPresent(String.self, forKey: .parentGuid) + self.parentIndex = try container.decodeIfPresent(Int.self, forKey: .parentIndex) + self.parentKey = try container.decodeIfPresent(String.self, forKey: .parentKey) + self.parentRatingKey = try container.decodeIfPresent(String.self, forKey: .parentRatingKey) + self.parentStudio = try container.decodeIfPresent(String.self, forKey: .parentStudio) + self.parentTheme = try container.decodeIfPresent(String.self, forKey: .parentTheme) + self.parentThumb = try container.decodeIfPresent(String.self, forKey: .parentThumb) + self.parentTitle = try container.decodeIfPresent(String.self, forKey: .parentTitle) + self.parentYear = try container.decodeIfPresent(Int.self, forKey: .parentYear) + 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(String.self, forKey: .ratingKey) + self.role = try container.decodeIfPresent([Operations.GetLibraryItemsRole].self, forKey: .role) + self.skipCount = try container.decodeIfPresent(Int.self, forKey: .skipCount) + 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.theme = try container.decodeIfPresent(String.self, forKey: .theme) + self.thumb = try container.decodeIfPresent(String.self, forKey: .thumb) + self.title = try container.decodeIfPresent(String.self, forKey: .title) + self.titleSort = try container.decodeIfPresent(String.self, forKey: .titleSort) + self.type = try container.decodeIfPresent(String.self, forKey: .type) + self.updatedAt = try container.decodeIfPresent(Int.self, forKey: .updatedAt) + self.viewCount = try container.decodeIfPresent(Int.self, forKey: .viewCount) + self.viewedLeafCount = try container.decodeIfPresent(Int.self, forKey: .viewedLeafCount) + self.viewOffset = try container.decodeIfPresent(Int.self, forKey: .viewOffset) + self.writer = try container.decodeIfPresent([Operations.GetLibraryItemsWriter].self, forKey: .writer) + self.year = try container.decodeIfPresent(Int.self, forKey: .year) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(self.addedAt, forKey: .addedAt) + 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.childCount, forKey: .childCount) + try container.encodeIfPresent(self.contentRating, forKey: .contentRating) + try container.encodeIfPresent(self.country, forKey: .country) + try container.encodeIfPresent(self.director, forKey: .director) + try container.encodeIfPresent(self.duration, forKey: .duration) + try container.encodeIfPresent(self.genre, forKey: .genre) + try container.encodeIfPresent(self.grandparentArt, forKey: .grandparentArt) + try container.encodeIfPresent(self.grandparentGuid, forKey: .grandparentGuid) + try container.encodeIfPresent(self.grandparentKey, forKey: .grandparentKey) + try container.encodeIfPresent(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.hasPremiumExtras, forKey: .hasPremiumExtras) + try container.encodeIfPresent(self.hasPremiumPrimaryExtra, forKey: .hasPremiumPrimaryExtra) + try container.encodeIfPresent(self.index, forKey: .index) + try container.encodeIfPresent(self.key, forKey: .key) + try container.encodeIfPresent(self.lastViewedAt, forKey: .lastViewedAt) + try container.encodeIfPresent(self.leafCount, forKey: .leafCount) + try container.encodeIfPresent(self.media, forKey: .media) + if self.originallyAvailableAt != nil { + try container.encode(self._originallyAvailableAt, forKey: .originallyAvailableAt) + } + try container.encodeIfPresent(self.originalTitle, forKey: .originalTitle) + try container.encodeIfPresent(self.parentGuid, forKey: .parentGuid) + try container.encodeIfPresent(self.parentIndex, forKey: .parentIndex) + try container.encodeIfPresent(self.parentKey, forKey: .parentKey) + try container.encodeIfPresent(self.parentRatingKey, forKey: .parentRatingKey) + try container.encodeIfPresent(self.parentStudio, forKey: .parentStudio) + try container.encodeIfPresent(self.parentTheme, forKey: .parentTheme) + try container.encodeIfPresent(self.parentThumb, forKey: .parentThumb) + try container.encodeIfPresent(self.parentTitle, forKey: .parentTitle) + try container.encodeIfPresent(self.parentYear, forKey: .parentYear) + 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) + try container.encodeIfPresent(self.ratingKey, forKey: .ratingKey) + try container.encodeIfPresent(self.role, forKey: .role) + try container.encodeIfPresent(self.skipCount, forKey: .skipCount) + 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.theme, forKey: .theme) + try container.encodeIfPresent(self.thumb, forKey: .thumb) + try container.encodeIfPresent(self.title, forKey: .title) + try container.encodeIfPresent(self.titleSort, forKey: .titleSort) + try container.encodeIfPresent(self.type, forKey: .type) + try container.encodeIfPresent(self.updatedAt, forKey: .updatedAt) + try container.encodeIfPresent(self.viewCount, forKey: .viewCount) + try container.encodeIfPresent(self.viewedLeafCount, forKey: .viewedLeafCount) + try container.encodeIfPresent(self.viewOffset, forKey: .viewOffset) + try container.encodeIfPresent(self.writer, forKey: .writer) + try container.encodeIfPresent(self.year, forKey: .year) + } +} + +extension Operations.GetLibraryItemsMetadata { + var ratingWrapper: DecimalSerialized { + return _rating + } + var audienceRatingWrapper: DecimalSerialized { + return _audienceRating + } + var originallyAvailableAtWrapper: DateOnly { + return _originallyAvailableAt + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsPart.swift b/Sources/Plexswift/models/operations/GetLibraryItemsPart.swift new file mode 100644 index 0000000..d6a96ce --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsPart.swift @@ -0,0 +1,42 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsPart { + public let container: String? + public let duration: Int? + public let file: String? + public let id: Int? + public let key: String? + public let size: Int? + public let videoProfile: String? + + /// Creates an object with the specified parameters + /// + /// + public init(container: String? = nil, duration: Int? = nil, file: String? = nil, id: Int? = nil, key: String? = nil, size: Int? = nil, videoProfile: String? = nil) { + self.container = container + self.duration = duration + self.file = file + self.id = id + self.key = key + self.size = size + self.videoProfile = videoProfile + } + } +} + +extension Operations.GetLibraryItemsPart: Codable { + enum CodingKeys: String, CodingKey { + case container + case duration + case file + case id + case key + case size + case videoProfile + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift b/Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift new file mode 100644 index 0000000..0478aa5 --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift @@ -0,0 +1,23 @@ +// 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 + public let sectionId: Int + /// A key representing a specific tag within the section. + public let tag: Operations.Tag + + /// Creates an object with the specified parameters + /// + /// - Parameter sectionId: the Id of the library to query + /// - Parameter tag: A key representing a specific tag within the section. + /// + public init(sectionId: Int, tag: Operations.Tag) { + self.sectionId = sectionId + self.tag = tag + } + } +} diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift b/Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift new file mode 100644 index 0000000..8c9bdcf --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A response model + public enum GetLibraryItemsResponse { + case empty + case twoHundredApplicationJsonObject(Operations.GetLibraryItemsResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.GetLibraryItemsLibraryResponseBody) + + var isEmpty: Bool { + if case .empty = self { + return true + } else { + return false + } + } + + public func twoHundredApplicationJsonObject() throws -> Operations.GetLibraryItemsResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetLibraryItemsLibraryResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(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..9442744 --- /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 { + /// The contents of the library by section and tag + public struct GetLibraryItemsResponseBody { + public let mediaContainer: Operations.GetLibraryItemsMediaContainer? + + /// Creates an object with the specified parameters + /// + /// + public init(mediaContainer: Operations.GetLibraryItemsMediaContainer? = nil) { + self.mediaContainer = mediaContainer + } + } +} + +extension Operations.GetLibraryItemsResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case mediaContainer = "MediaContainer" + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsRole.swift b/Sources/Plexswift/models/operations/GetLibraryItemsRole.swift new file mode 100644 index 0000000..c99840b --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsRole.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsRole { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetLibraryItemsRole: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/GetLibraryItemsWriter.swift b/Sources/Plexswift/models/operations/GetLibraryItemsWriter.swift new file mode 100644 index 0000000..4125cea --- /dev/null +++ b/Sources/Plexswift/models/operations/GetLibraryItemsWriter.swift @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct GetLibraryItemsWriter { + public let tag: String? + + /// Creates an object with the specified parameters + /// + /// + public init(tag: String? = nil) { + self.tag = tag + } + } +} + +extension Operations.GetLibraryItemsWriter: Codable { + enum CodingKeys: String, CodingKey { + case tag + } +} + diff --git a/Sources/Plexswift/models/operations/SearchLibraryErrors.swift b/Sources/Plexswift/models/operations/SearchLibraryErrors.swift new file mode 100644 index 0000000..2cd7d7f --- /dev/null +++ b/Sources/Plexswift/models/operations/SearchLibraryErrors.swift @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A model object + public struct SearchLibraryErrors { + @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.SearchLibraryErrors: 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.SearchLibraryErrors { + var codeWrapper: DecimalSerialized { + return _code + } + var statusWrapper: DecimalSerialized { + return _status + } +} diff --git a/Sources/Plexswift/models/operations/SearchLibraryLibraryResponseBody.swift b/Sources/Plexswift/models/operations/SearchLibraryLibraryResponseBody.swift new file mode 100644 index 0000000..5026b3b --- /dev/null +++ b/Sources/Plexswift/models/operations/SearchLibraryLibraryResponseBody.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 SearchLibraryLibraryResponseBody { + public let errors: [Operations.SearchLibraryErrors]? + + /// Creates an object with the specified parameters + /// + /// + public init(errors: [Operations.SearchLibraryErrors]? = nil) { + self.errors = errors + } + } +} + +extension Operations.SearchLibraryLibraryResponseBody: Codable { + enum CodingKeys: String, CodingKey { + case errors + } +} + diff --git a/Sources/Plexswift/models/operations/SearchLibraryResponse.swift b/Sources/Plexswift/models/operations/SearchLibraryResponse.swift index 1247769..5f6c43b 100644 --- a/Sources/Plexswift/models/operations/SearchLibraryResponse.swift +++ b/Sources/Plexswift/models/operations/SearchLibraryResponse.swift @@ -6,7 +6,8 @@ extension Operations { /// A response model public enum SearchLibraryResponse { case empty - case object(Operations.SearchLibraryResponseBody) + case twoHundredApplicationJsonObject(Operations.SearchLibraryResponseBody) + case fourHundredAndOneApplicationJsonObject(Operations.SearchLibraryLibraryResponseBody) var isEmpty: Bool { if case .empty = self { @@ -16,8 +17,15 @@ extension Operations { } } - public func object() throws -> Operations.SearchLibraryResponseBody { - guard case .object(let value) = self else { + public func twoHundredApplicationJsonObject() throws -> Operations.SearchLibraryResponseBody { + guard case .twoHundredApplicationJsonObject(let value) = self else { + throw PlexswiftError.missingResponseData + } + return value + } + + public func fourHundredAndOneApplicationJsonObject() throws -> Operations.SearchLibraryLibraryResponseBody { + guard case .fourHundredAndOneApplicationJsonObject(let value) = self else { throw PlexswiftError.missingResponseData } return value diff --git a/Sources/Plexswift/models/operations/Tag.swift b/Sources/Plexswift/models/operations/Tag.swift new file mode 100644 index 0000000..ba79fea --- /dev/null +++ b/Sources/Plexswift/models/operations/Tag.swift @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +import Foundation + +extension Operations { + /// A key representing a specific tag within the section. + public enum Tag: String, Codable, APIValue { + case all = "all" + case unwatched = "unwatched" + case newest = "newest" + case recentlyAdded = "recentlyAdded" + case recentlyViewed = "recentlyViewed" + case onDeck = "onDeck" + case collection = "collection" + case edition = "edition" + case genre = "genre" + case year = "year" + case decade = "decade" + case director = "director" + case actor = "actor" + case country = "country" + case contentRating = "contentRating" + case rating = "rating" + case resolution = "resolution" + case firstCharacter = "firstCharacter" + case folder = "folder" + } +} diff --git a/Sources/plexswift/PlexswiftAPI.swift b/Sources/plexswift/PlexswiftAPI.swift index 82906f9..f919591 100644 --- a/Sources/plexswift/PlexswiftAPI.swift +++ b/Sources/plexswift/PlexswiftAPI.swift @@ -417,6 +417,7 @@ public protocol SearchAPI { /// - ``getLibraries()`` /// - ``getLibrary(request:)`` /// - ``deleteLibrary(request:)`` +/// - ``getLibraryItems(request:)`` /// - ``refreshLibrary(request:)`` /// - ``searchLibrary(request:)`` /// - ``getMetadata(request:)`` @@ -503,6 +504,33 @@ public protocol LibraryAPI { /// - Throws: An error of type ``PlexswiftError`` func deleteLibrary(request: Operations.DeleteLibraryRequest) async throws -> Response + /// Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values: + /// - `all`: All items in the section. + /// - `unwatched`: Items that have not been played. + /// - `newest`: Items that are recently released. + /// - `recentlyAdded`: Items that are recently added to the library. + /// - `recentlyViewed`: Items that were recently viewed. + /// - `onDeck`: Items to continue watching. + /// - `collection`: Items categorized by collection. + /// - `edition`: Items categorized by edition. + /// - `genre`: Items categorized by genre. + /// - `year`: Items categorized by year of release. + /// - `decade`: Items categorized by decade. + /// - `director`: Items categorized by director. + /// - `actor`: Items categorized by starring actor. + /// - `country`: Items categorized by country of origin. + /// - `contentRating`: Items categorized by content rating. + /// - `rating`: Items categorized by rating. + /// - `resolution`: Items categorized by resolution. + /// - `firstCharacter`: Items categorized by the first letter. + /// - `folder`: Items categorized by folder. + /// + /// + /// - 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. /// /// diff --git a/Sources/plexswift/internal/client/URLRequestBuilder.swift b/Sources/plexswift/internal/client/URLRequestBuilder.swift index f8899df..ac52a47 100644 --- a/Sources/plexswift/internal/client/URLRequestBuilder.swift +++ b/Sources/plexswift/internal/client/URLRequestBuilder.swift @@ -62,7 +62,7 @@ final class URLRequestBuilder: URLRequestConfiguration { urlRequest.setValue(contentType, forHTTPHeaderField: "Content-Type") } - urlRequest.setValue("speakeasy-sdk/swift 0.2.0 2.326.3 0.0.3 plexswift", forHTTPHeaderField: telemetryHeader.headerName) + urlRequest.setValue("speakeasy-sdk/swift 0.3.0 2.335.5 0.0.3 plexswift", forHTTPHeaderField: telemetryHeader.headerName) addSecurityParameters(to: &urlRequest) diff --git a/codeSamples.yaml b/codeSamples.yaml index 5fa0620..1c15f10 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,30 +3,18 @@ info: title: CodeSamples overlay for swift target version: 0.0.0 actions: - - target: $["paths"]["/:/progress"]["post"] + - target: $["paths"]["/:/prefs"]["get"] update: x-codeSamples: - lang: swift - label: updatePlayProgress - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.updatePlayProgress(\n request: Operations.UpdatePlayProgressRequest(\n key: \"\", \n state: \"played\", \n time: 90000\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/:/timeline"]["get"] - update: - x-codeSamples: - - lang: swift - label: getTimeline - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getTimeline(\n request: Operations.GetTimelineRequest(\n context: \"home:hub.continueWatching\", \n duration: 10000, \n hasMDE: 1, \n key: \"/library/metadata/23409\", \n playBackTime: 2000, \n playQueueItemID: 1, \n ratingKey: 23409, \n row: 1, \n state: .playing, \n time: 2000\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/transcode/sessions"]["get"] - update: - x-codeSamples: - - lang: swift - label: getTranscodeSessions + label: getServerPreferences source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getTranscodeSessions() + let response = try await client.getServerPreferences() switch response.data { case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): @@ -39,50 +27,20 @@ actions: // Handle empty response break } - - target: $["paths"]["/activities"]["get"] + - target: $["paths"]["/library/sections/{sectionId}"]["delete"] update: x-codeSamples: - lang: swift - label: getServerActivities + label: deleteLibrary source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getServerActivities() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/library/hashes"]["get"] - update: - x-codeSamples: - - lang: swift - label: getFileHash - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getFileHash(\n request: Operations.GetFileHashRequest(\n url: \"file://C:\\Image.png&type=13\", \n type: 4462.17\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/library/sections/{sectionId}/refresh"]["get"] - update: - x-codeSamples: - - lang: swift - label: refreshLibrary - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.refreshLibrary( - request: Operations.RefreshLibraryRequest( - sectionId: 934.16 + let response = try await client.deleteLibrary( + request: Operations.DeleteLibraryRequest( + sectionId: 1000 ) ) @@ -94,73 +52,18 @@ actions: // Handle empty response break } - - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] + - target: $["paths"]["/updater/status"]["get"] update: x-codeSamples: - lang: swift - label: getMetadataChildren + label: getUpdateStatus source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getMetadataChildren( - request: Operations.GetMetadataChildrenRequest( - ratingKey: 1539.14 - ) - ) - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/photo/:/transcode"]["get"] - update: - x-codeSamples: - - lang: swift - label: getResizedPhoto - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getResizedPhoto(\n request: Operations.GetResizedPhotoRequest(\n blur: 20, \n height: 165, \n minSize: .one, \n opacity: 96541, \n upscale: .zero, \n url: \"/library/metadata/49564/thumb/1654258204\", \n width: 110\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/log/networked"]["get"] - update: - x-codeSamples: - - lang: swift - label: enablePaperTrail - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.enablePaperTrail() - - switch response.data { - case .object(let object): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/"]["get"] - update: - x-codeSamples: - - lang: swift - label: getServerCapabilities - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getServerCapabilities() + let response = try await client.getUpdateStatus() switch response.data { case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): @@ -179,96 +82,26 @@ actions: - lang: swift label: performSearch source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.performSearch(\n request: Operations.PerformSearchRequest(\n query: \"dylan\", \n limit: 5, \n sectionId: 1516.53\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/search"]["get"] + - target: $["paths"]["/playlists/{playlistID}"]["put"] update: x-codeSamples: - lang: swift - label: getSearchResults + label: updatePlaylist + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.updatePlaylist(\n request: Operations.UpdatePlaylistRequest(\n playlistID: 3915, \n summary: \"\", \n title: \"\"\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/transcode/sessions/{sessionKey}"]["delete"] + update: + x-codeSamples: + - lang: swift + label: stopTranscodeSession source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getSearchResults( - request: Operations.GetSearchResultsRequest( - query: "110" - ) - ) - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/status/sessions"]["get"] - update: - x-codeSamples: - - lang: swift - label: getSessions - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getSessions() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/library/onDeck"]["get"] - update: - x-codeSamples: - - lang: swift - label: getOnDeck - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getOnDeck() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/playlists/{playlistID}/items"]["delete"] - update: - x-codeSamples: - - lang: swift - label: clearPlaylistContents - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.clearPlaylistContents( - request: Operations.ClearPlaylistContentsRequest( - playlistID: 1893.18 + let response = try await client.stopTranscodeSession( + request: Operations.StopTranscodeSessionRequest( + sessionKey: "zz7llzqlx8w9vnrsbnwhbmep" ) ) @@ -280,18 +113,103 @@ actions: // Handle empty response break } - - target: $["paths"]["/devices"]["get"] + - target: $["paths"]["/servers"]["get"] update: x-codeSamples: - lang: swift - label: getDevices + label: getServerList source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getDevices() + let response = try await client.getServerList() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/library/sections"]["get"] + update: + x-codeSamples: + - lang: swift + label: getLibraries + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getLibraries() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/playlists/{playlistID}/items"]["get"] + update: + x-codeSamples: + - lang: swift + label: getPlaylistContents + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getPlaylistContents(\n request: Operations.GetPlaylistContentsRequest(\n playlistID: 5004.46, \n type: 9403.59\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/security/token"]["get"] + update: + x-codeSamples: + - lang: swift + label: getTransientToken + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getTransientToken(\n request: Operations.GetTransientTokenRequest(\n scope: .all, \n type: .delegation\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/playlists/{playlistID}"]["delete"] + update: + x-codeSamples: + - lang: swift + label: deletePlaylist + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.deletePlaylist( + request: Operations.DeletePlaylistRequest( + playlistID: 216.22 + ) + ) + + switch response.data { + case .object(let object): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/myplex/account"]["get"] + update: + x-codeSamples: + - lang: swift + label: getMyPlexAccount + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getMyPlexAccount() switch response.data { case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): @@ -354,56 +272,45 @@ actions: // Handle empty response break } - - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] + - target: $["paths"]["/library/sections/{sectionId}/refresh"]["get"] update: x-codeSamples: - lang: swift - label: getLibraryHubs - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getLibraryHubs(\n request: Operations.GetLibraryHubsRequest(\n sectionId: 6728.76, \n count: 9010.22, \n onlyTransient: .zero\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/log"]["get"] - update: - x-codeSamples: - - lang: swift - label: logLine - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.logLine(\n request: Operations.LogLineRequest(\n level: .three, \n message: \"Test log message\", \n source: \"Postman\"\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/updater/status"]["get"] - update: - x-codeSamples: - - lang: swift - label: getUpdateStatus + label: refreshLibrary source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getUpdateStatus() + let response = try await client.refreshLibrary( + request: Operations.RefreshLibraryRequest( + sectionId: 934.16 + ) + ) switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + case .object(let object): // Handle response break case .empty: // Handle empty response break } - - target: $["paths"]["/updater/check"]["put"] + - target: $["paths"]["/playlists/{playlistID}/items"]["delete"] update: x-codeSamples: - lang: swift - label: checkForUpdates + label: clearPlaylistContents source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.checkForUpdates( - request: Operations.CheckForUpdatesRequest( - download: .one + let response = try await client.clearPlaylistContents( + request: Operations.ClearPlaylistContentsRequest( + playlistID: 1893.18 ) ) @@ -421,100 +328,36 @@ actions: - lang: swift label: applyUpdates source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.applyUpdates(\n request: Operations.ApplyUpdatesRequest(\n skip: .one, \n tonight: .zero\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/hubs/search/voice"]["get"] - update: - x-codeSamples: - - lang: swift - label: performVoiceSearch - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.performVoiceSearch(\n request: Operations.PerformVoiceSearchRequest(\n query: \"dead+poop\", \n limit: 5, \n sectionId: 4094.8\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/library/recentlyAdded"]["get"] - update: - x-codeSamples: - - lang: swift - label: getRecentlyAdded - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getRecentlyAdded() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/playlists/{playlistID}/items"]["put"] - update: - x-codeSamples: - - lang: swift - label: addPlaylistContents - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.addPlaylistContents(\n request: Operations.AddPlaylistContentsRequest(\n playlistID: 8502.01, \n uri: \"server://12345/com.plexapp.plugins.library/library/metadata/1\", \n playQueueID: 123\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/playlists/upload"]["post"] - update: - x-codeSamples: - - lang: swift - label: uploadPlaylist - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.uploadPlaylist(\n request: Operations.UploadPlaylistRequest(\n force: .zero, \n path: \"/home/barkley/playlist.m3u\"\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/pins"]["post"] - update: - x-codeSamples: - - lang: swift - label: getPin - source: "import Foundation\nimport Plexswift\n\nlet client = Client()\n\nlet response = try await client.getPin(\n request: Operations.GetPinRequest(\n strong: false, \n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredApplicationJsonObject(let fourHundredApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/servers"]["get"] - update: - x-codeSamples: - - lang: swift - label: getServerList - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getServerList() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - target: $["paths"]["/hubs"]["get"] update: x-codeSamples: - lang: swift label: getGlobalHubs source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getGlobalHubs(\n request: Operations.GetGlobalHubsRequest(\n count: 1262.49, \n onlyTransient: .one\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/library/sections/{sectionId}"]["delete"] + - target: $["paths"]["/library/sections/{sectionId}"]["get"] update: x-codeSamples: - lang: swift - label: deleteLibrary + label: getLibrary + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getLibrary(\n request: Operations.GetLibraryRequest(\n sectionId: 1000, \n includeDetails: .zero\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/library/sections/{sectionId}/{tag}"]["get"] + update: + x-codeSamples: + - lang: swift + label: getLibraryItems + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getLibraryItems(\n request: Operations.GetLibraryItemsRequest(\n sectionId: 1, \n tag: .genre\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/log/networked"]["get"] + update: + x-codeSamples: + - lang: swift + label: enablePaperTrail source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.deleteLibrary( - request: Operations.DeleteLibraryRequest( - sectionId: 1000 - ) - ) + let response = try await client.enablePaperTrail() switch response.data { case .object(let object): @@ -524,40 +367,37 @@ actions: // Handle empty response break } + - target: $["paths"]["/:/timeline"]["get"] + update: + x-codeSamples: + - lang: swift + label: getTimeline + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getTimeline(\n request: Operations.GetTimelineRequest(\n context: \"home:hub.continueWatching\", \n duration: 10000, \n hasMDE: 1, \n key: \"/library/metadata/23409\", \n playBackTime: 2000, \n playQueueItemID: 1, \n ratingKey: 23409, \n row: 1, \n state: .playing, \n time: 2000\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - target: $["paths"]["/library/sections/{sectionId}/search"]["get"] update: x-codeSamples: - lang: swift label: searchLibrary - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.searchLibrary(\n request: Operations.SearchLibraryRequest(\n sectionId: 933505, \n type: .four\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/library/sections/{sectionId}"]["get"] + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.searchLibrary(\n request: Operations.SearchLibraryRequest(\n sectionId: 933505, \n type: .four\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/security/resources"]["get"] update: x-codeSamples: - lang: swift - label: getLibrary - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getLibrary(\n request: Operations.GetLibraryRequest(\n sectionId: 1000, \n includeDetails: .zero\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] - update: - x-codeSamples: - - lang: swift - label: getMetadata + label: getSourceConnectionInformation source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getMetadata( - request: Operations.GetMetadataRequest( - ratingKey: 8382.31 + let response = try await client.getSourceConnectionInformation( + request: Operations.GetSourceConnectionInformationRequest( + source: "server://client-identifier" ) ) switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + case .object(let object): // Handle response break case .empty: @@ -588,100 +428,6 @@ actions: // Handle empty response break } - - target: $["paths"]["/identity"]["get"] - update: - x-codeSamples: - - lang: swift - label: getServerIdentity - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getServerIdentity() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/activities/{activityUUID}"]["delete"] - update: - x-codeSamples: - - lang: swift - label: cancelServerActivities - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.cancelServerActivities( - request: Operations.CancelServerActivitiesRequest( - activityUUID: "25b71ed5-0f9d-461c-baa7-d404e9e10d3e" - ) - ) - - switch response.data { - case .object(let object): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/butler"]["get"] - update: - x-codeSamples: - - lang: swift - label: getButlerTasks - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getButlerTasks() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/butler"]["post"] - update: - x-codeSamples: - - lang: swift - label: startAllTasks - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.startAllTasks() - - switch response.data { - case .object(let object): - // Handle response - break - case .empty: - // Handle empty response - break - } - target: $["paths"]["/butler"]["delete"] update: x-codeSamples: @@ -703,95 +449,18 @@ actions: // Handle empty response break } - - target: $["paths"]["/playlists"]["post"] + - target: $["paths"]["/log"]["post"] update: x-codeSamples: - lang: swift - label: createPlaylist - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.createPlaylist(\n request: Operations.CreatePlaylistRequest(\n smart: .one, \n title: \"\", \n type: .photo, \n uri: \"https://inborn-brochure.biz\", \n playQueueID: 3686.33\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/status/sessions/history/all"]["get"] - update: - x-codeSamples: - - lang: swift - label: getSessionHistory + label: logMultiLine source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getSessionHistory() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/playlists/{playlistID}"]["put"] - update: - x-codeSamples: - - lang: swift - label: updatePlaylist - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.updatePlaylist(\n request: Operations.UpdatePlaylistRequest(\n playlistID: 3915, \n summary: \"\", \n title: \"\"\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/security/token"]["get"] - update: - x-codeSamples: - - lang: swift - label: getTransientToken - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getTransientToken(\n request: Operations.GetTransientTokenRequest(\n scope: .all, \n type: .delegation\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/butler/{taskName}"]["post"] - update: - x-codeSamples: - - lang: swift - label: startTask - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.startTask( - request: Operations.StartTaskRequest( - taskName: .cleanOldBundles - ) - ) - - switch response.data { - case .object(let object): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/pins/{pinID}"]["get"] - update: - x-codeSamples: - - lang: swift - label: getToken - source: "import Foundation\nimport Plexswift\n\nlet client = Client()\n\nlet response = try await client.getToken(\n request: Operations.GetTokenRequest(\n pinID: \"\", \n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/playlists/{playlistID}"]["delete"] - update: - x-codeSamples: - - lang: swift - label: deletePlaylist - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.deletePlaylist( - request: Operations.DeletePlaylistRequest( - playlistID: 216.22 - ) - ) + let response = try await client.logMultiLine() switch response.data { case .object(let object): @@ -829,50 +498,29 @@ actions: // Handle empty response break } - - target: $["paths"]["/butler/{taskName}"]["delete"] + - target: $["paths"]["/photo/:/transcode"]["get"] update: x-codeSamples: - lang: swift - label: stopTask + label: getResizedPhoto + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getResizedPhoto(\n request: Operations.GetResizedPhotoRequest(\n blur: 20, \n height: 165, \n minSize: .one, \n opacity: 96541, \n upscale: .zero, \n url: \"/library/metadata/49564/thumb/1654258204\", \n width: 110\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] + update: + x-codeSamples: + - lang: swift + label: getMetadataChildren source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.stopTask( - request: Operations.StopTaskRequest( - taskName: .backupDatabase + let response = try await client.getMetadataChildren( + request: Operations.GetMetadataChildrenRequest( + ratingKey: 1539.14 ) ) - switch response.data { - case .object(let object): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/playlists"]["get"] - update: - x-codeSamples: - - lang: swift - label: getPlaylists - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getPlaylists(\n request: Operations.GetPlaylistsRequest(\n playlistType: .audio, \n smart: .zero\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/myplex/account"]["get"] - update: - x-codeSamples: - - lang: swift - label: getMyPlexAccount - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getMyPlexAccount() - switch response.data { case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): // Handle response @@ -884,112 +532,90 @@ actions: // Handle empty response break } + - target: $["paths"]["/playlists"]["post"] + update: + x-codeSamples: + - lang: swift + label: createPlaylist + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.createPlaylist(\n request: Operations.CreatePlaylistRequest(\n smart: .one, \n title: \"\", \n type: .photo, \n uri: \"https://inborn-brochure.biz\", \n playQueueID: 3686.33\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/status/sessions"]["get"] + update: + x-codeSamples: + - lang: swift + label: getSessions + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getSessions() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/transcode/sessions"]["get"] + update: + x-codeSamples: + - lang: swift + label: getTranscodeSessions + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getTranscodeSessions() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] + update: + x-codeSamples: + - lang: swift + label: getLibraryHubs + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getLibraryHubs(\n request: Operations.GetLibraryHubsRequest(\n sectionId: 6728.76, \n count: 9010.22, \n onlyTransient: .zero\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/log"]["get"] + update: + x-codeSamples: + - lang: swift + label: logLine + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.logLine(\n request: Operations.LogLineRequest(\n level: .three, \n message: \"Test log message\", \n source: \"Postman\"\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - target: $["paths"]["/video/:/transcode/universal/start.mpd"]["get"] update: x-codeSamples: - lang: swift label: startUniversalTranscode source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.startUniversalTranscode(\n request: Operations.StartUniversalTranscodeRequest(\n hasMDE: 1, \n mediaIndex: 0, \n partIndex: 0, \n path: \"/library/metadata/23409\", \n `protocol`: \"hls\", \n addDebugOverlay: 0, \n audioBoost: 100, \n autoAdjustQuality: 0, \n directPlay: 0, \n directStream: 0, \n fastSeek: 0, \n location: \"lan\", \n mediaBufferSize: 102400, \n session: \"zvcage8b7rkioqcm8f4uns4c\", \n subtites: \"burn\", \n subtitleSize: 100\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/library/sections"]["get"] + - target: $["paths"]["/pins/{pinID}"]["get"] update: x-codeSamples: - lang: swift - label: getLibraries - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getLibraries() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/playlists/{playlistID}/items"]["get"] + label: getToken + source: "import Foundation\nimport Plexswift\n\nlet client = Client()\n\nlet response = try await client.getToken(\n request: Operations.GetTokenRequest(\n pinID: \"\", \n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/playlists"]["get"] update: x-codeSamples: - lang: swift - label: getPlaylistContents - source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getPlaylistContents(\n request: Operations.GetPlaylistContentsRequest(\n playlistID: 5004.46, \n type: 9403.59\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - - target: $["paths"]["/transcode/sessions/{sessionKey}"]["delete"] - update: - x-codeSamples: - - lang: swift - label: stopTranscodeSession - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.stopTranscodeSession( - request: Operations.StopTranscodeSessionRequest( - sessionKey: "zz7llzqlx8w9vnrsbnwhbmep" - ) - ) - - switch response.data { - case .object(let object): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/:/prefs"]["get"] - update: - x-codeSamples: - - lang: swift - label: getServerPreferences - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.getServerPreferences() - - switch response.data { - case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): - // Handle response - break - case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): - // Handle response - break - case .empty: - // Handle empty response - break - } - - target: $["paths"]["/log"]["post"] - update: - x-codeSamples: - - lang: swift - label: logMultiLine - source: |- - import Foundation - import Plexswift - - let client = Client(security: .accessToken("")) - - let response = try await client.logMultiLine() - - switch response.data { - case .object(let object): - // Handle response - break - case .empty: - // Handle empty response - break - } + label: getPlaylists + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getPlaylists(\n request: Operations.GetPlaylistsRequest(\n playlistType: .audio, \n smart: .zero\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" - target: $["paths"]["/playlists/{playlistID}"]["get"] update: x-codeSamples: @@ -1018,20 +644,26 @@ actions: // Handle empty response break } - - target: $["paths"]["/security/resources"]["get"] + - target: $["paths"]["/playlists/upload"]["post"] update: x-codeSamples: - lang: swift - label: getSourceConnectionInformation + label: uploadPlaylist + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.uploadPlaylist(\n request: Operations.UploadPlaylistRequest(\n force: .zero, \n path: \"/home/barkley/playlist.m3u\"\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/updater/check"]["put"] + update: + x-codeSamples: + - lang: swift + label: checkForUpdates source: |- import Foundation import Plexswift let client = Client(security: .accessToken("")) - let response = try await client.getSourceConnectionInformation( - request: Operations.GetSourceConnectionInformationRequest( - source: "server://client-identifier" + let response = try await client.checkForUpdates( + request: Operations.CheckForUpdatesRequest( + download: .one ) ) @@ -1043,3 +675,377 @@ actions: // Handle empty response break } + - target: $["paths"]["/devices"]["get"] + update: + x-codeSamples: + - lang: swift + label: getDevices + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getDevices() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/activities/{activityUUID}"]["delete"] + update: + x-codeSamples: + - lang: swift + label: cancelServerActivities + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.cancelServerActivities( + request: Operations.CancelServerActivitiesRequest( + activityUUID: "25b71ed5-0f9d-461c-baa7-d404e9e10d3e" + ) + ) + + switch response.data { + case .object(let object): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/hubs/search/voice"]["get"] + update: + x-codeSamples: + - lang: swift + label: performVoiceSearch + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.performVoiceSearch(\n request: Operations.PerformVoiceSearchRequest(\n query: \"dead+poop\", \n limit: 5, \n sectionId: 4094.8\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/search"]["get"] + update: + x-codeSamples: + - lang: swift + label: getSearchResults + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getSearchResults( + request: Operations.GetSearchResultsRequest( + query: "110" + ) + ) + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/library/recentlyAdded"]["get"] + update: + x-codeSamples: + - lang: swift + label: getRecentlyAdded + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getRecentlyAdded() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/playlists/{playlistID}/items"]["put"] + update: + x-codeSamples: + - lang: swift + label: addPlaylistContents + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.addPlaylistContents(\n request: Operations.AddPlaylistContentsRequest(\n playlistID: 8502.01, \n uri: \"server://12345/com.plexapp.plugins.library/library/metadata/1\", \n playQueueID: 123\n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/"]["get"] + update: + x-codeSamples: + - lang: swift + label: getServerCapabilities + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getServerCapabilities() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/butler"]["post"] + update: + x-codeSamples: + - lang: swift + label: startAllTasks + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.startAllTasks() + + switch response.data { + case .object(let object): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/butler/{taskName}"]["post"] + update: + x-codeSamples: + - lang: swift + label: startTask + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.startTask( + request: Operations.StartTaskRequest( + taskName: .cleanOldBundles + ) + ) + + switch response.data { + case .object(let object): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] + update: + x-codeSamples: + - lang: swift + label: getMetadata + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getMetadata( + request: Operations.GetMetadataRequest( + ratingKey: 8382.31 + ) + ) + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/pins"]["post"] + update: + x-codeSamples: + - lang: swift + label: getPin + source: "import Foundation\nimport Plexswift\n\nlet client = Client()\n\nlet response = try await client.getPin(\n request: Operations.GetPinRequest(\n strong: false, \n )\n)\n\nswitch response.data {\ncase .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):\n // Handle response\n break\ncase .fourHundredApplicationJsonObject(let fourHundredApplicationJsonObject):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/identity"]["get"] + update: + x-codeSamples: + - lang: swift + label: getServerIdentity + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getServerIdentity() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/:/progress"]["post"] + update: + x-codeSamples: + - lang: swift + label: updatePlayProgress + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.updatePlayProgress(\n request: Operations.UpdatePlayProgressRequest(\n key: \"\", \n state: \"played\", \n time: 90000\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/activities"]["get"] + update: + x-codeSamples: + - lang: swift + label: getServerActivities + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getServerActivities() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/butler"]["get"] + update: + x-codeSamples: + - lang: swift + label: getButlerTasks + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getButlerTasks() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/butler/{taskName}"]["delete"] + update: + x-codeSamples: + - lang: swift + label: stopTask + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.stopTask( + request: Operations.StopTaskRequest( + taskName: .backupDatabase + ) + ) + + switch response.data { + case .object(let object): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/library/hashes"]["get"] + update: + x-codeSamples: + - lang: swift + label: getFileHash + source: "import Foundation\nimport Plexswift\n\nlet client = Client(security: .accessToken(\"\"))\n\nlet response = try await client.getFileHash(\n request: Operations.GetFileHashRequest(\n url: \"file://C:\\Image.png&type=13\", \n type: 4462.17\n )\n)\n\nswitch response.data {\ncase .object(let object):\n // Handle response\n break\ncase .empty:\n // Handle empty response\n break\n}" + - target: $["paths"]["/library/onDeck"]["get"] + update: + x-codeSamples: + - lang: swift + label: getOnDeck + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getOnDeck() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + } + - target: $["paths"]["/status/sessions/history/all"]["get"] + update: + x-codeSamples: + - lang: swift + label: getSessionHistory + source: |- + import Foundation + import Plexswift + + let client = Client(security: .accessToken("")) + + let response = try await client.getSessionHistory() + + switch response.data { + case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject): + // Handle response + break + case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject): + // Handle response + break + case .empty: + // Handle empty response + break + }