mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-06 12:47:44 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.308.1
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
lockVersion: 2.0.0
|
||||
id: 5d77204e-e413-4fd0-a14a-bad3aee2247a
|
||||
management:
|
||||
docChecksum: 911d74baa0d06121d2ce2c71d94e977a
|
||||
docChecksum: 37654ea0982ab5e87a9a9576014c9d19
|
||||
docVersion: 0.0.3
|
||||
speakeasyVersion: 1.299.6
|
||||
generationVersion: 2.338.12
|
||||
releaseVersion: 0.3.1
|
||||
configChecksum: 118251f8f3f1b3c85b9dc10712fa7a5f
|
||||
speakeasyVersion: 1.308.1
|
||||
generationVersion: 2.342.6
|
||||
releaseVersion: 0.4.0
|
||||
configChecksum: 13dc4c5ae6371accdb7e2797a7681034
|
||||
repoURL: https://github.com/LukeHagar/plexswift.git
|
||||
features:
|
||||
swift:
|
||||
@@ -16,22 +16,24 @@ features:
|
||||
globals: 2.81.3
|
||||
methodServerURLs: 3.0.1
|
||||
nameOverrides: 2.81.2
|
||||
typeOverrides: 2.81.1
|
||||
generatedFiles:
|
||||
- Sources/Plexswift/internal/api/_ServerAPI.swift
|
||||
- Sources/Plexswift/internal/api/_MediaAPI.swift
|
||||
- Sources/Plexswift/internal/api/_VideoAPI.swift
|
||||
- Sources/Plexswift/internal/api/_ActivitiesAPI.swift
|
||||
- Sources/Plexswift/internal/api/_ButlerAPI.swift
|
||||
- Sources/Plexswift/internal/api/_PlexAPI.swift
|
||||
- Sources/Plexswift/internal/api/_HubsAPI.swift
|
||||
- Sources/Plexswift/internal/api/_SearchAPI.swift
|
||||
- Sources/Plexswift/internal/api/_LibraryAPI.swift
|
||||
- Sources/Plexswift/internal/api/_LogAPI.swift
|
||||
- Sources/Plexswift/internal/api/_PlexAPI.swift
|
||||
- Sources/Plexswift/internal/api/_PlaylistsAPI.swift
|
||||
- Sources/Plexswift/internal/api/_AuthenticationAPI.swift
|
||||
- Sources/Plexswift/internal/api/_StatisticsAPI.swift
|
||||
- Sources/Plexswift/internal/api/_SessionsAPI.swift
|
||||
- Sources/Plexswift/internal/api/_UpdaterAPI.swift
|
||||
- Sources/Plexswift/internal/api/_WatchlistAPI.swift
|
||||
- Sources/Plexswift/configuration/GlobalServer.swift
|
||||
- Sources/Plexswift/configuration/GlobalParameters.swift
|
||||
- Sources/Plexswift/Client.swift
|
||||
@@ -120,6 +122,7 @@ generatedFiles:
|
||||
- Sources/Plexswift/models/operations/Field.swift
|
||||
- Sources/Plexswift/models/operations/FieldType.swift
|
||||
- Sources/Plexswift/models/operations/Filter.swift
|
||||
- Sources/Plexswift/internal/models/Filter+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/Force.swift
|
||||
- Sources/Plexswift/internal/models/Force+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/Genre.swift
|
||||
@@ -150,6 +153,10 @@ generatedFiles:
|
||||
- Sources/Plexswift/internal/models/GetGlobalHubsRequest+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/GetGlobalHubsResponse.swift
|
||||
- Sources/Plexswift/models/operations/GetGlobalHubsResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetHomeDataErrors.swift
|
||||
- Sources/Plexswift/models/operations/GetHomeDataPlexResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetHomeDataResponse.swift
|
||||
- Sources/Plexswift/models/operations/GetHomeDataResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetLibrariesDirectory.swift
|
||||
- Sources/Plexswift/models/operations/GetLibrariesErrors.swift
|
||||
- Sources/Plexswift/models/operations/GetLibrariesLibraryResponseBody.swift
|
||||
@@ -159,6 +166,7 @@ generatedFiles:
|
||||
- Sources/Plexswift/models/operations/GetLibrariesResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetLibraryDirectory.swift
|
||||
- Sources/Plexswift/models/operations/GetLibraryErrors.swift
|
||||
- Sources/Plexswift/models/operations/GetLibraryFilter.swift
|
||||
- Sources/Plexswift/models/operations/GetLibraryHubsCountry.swift
|
||||
- Sources/Plexswift/models/operations/GetLibraryHubsDirector.swift
|
||||
- Sources/Plexswift/models/operations/GetLibraryHubsErrors.swift
|
||||
@@ -275,6 +283,7 @@ generatedFiles:
|
||||
- Sources/Plexswift/models/operations/GetRecentlyAddedErrors.swift
|
||||
- Sources/Plexswift/models/operations/GetRecentlyAddedLibraryResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetRecentlyAddedMediaContainer.swift
|
||||
- Sources/Plexswift/models/operations/GetRecentlyAddedMetadata.swift
|
||||
- Sources/Plexswift/models/operations/GetRecentlyAddedResponse.swift
|
||||
- Sources/Plexswift/models/operations/GetRecentlyAddedResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetResizedPhotoErrors.swift
|
||||
@@ -355,6 +364,8 @@ generatedFiles:
|
||||
- Sources/Plexswift/models/operations/GetTimelineResponse.swift
|
||||
- Sources/Plexswift/models/operations/GetTimelineResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetTokenErrors.swift
|
||||
- Sources/Plexswift/models/operations/GetTokenLocation.swift
|
||||
- Sources/Plexswift/models/operations/GetTokenPlexResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetTokenRequest.swift
|
||||
- Sources/Plexswift/internal/models/GetTokenRequest+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/GetTokenResponse.swift
|
||||
@@ -376,12 +387,25 @@ generatedFiles:
|
||||
- Sources/Plexswift/models/operations/GetUpdateStatusResponse.swift
|
||||
- Sources/Plexswift/models/operations/GetUpdateStatusResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetUpdateStatusUpdaterResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetWatchlistErrors.swift
|
||||
- Sources/Plexswift/models/operations/GetWatchlistRequest.swift
|
||||
- Sources/Plexswift/internal/models/GetWatchlistRequest+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/GetWatchlistResponse.swift
|
||||
- Sources/Plexswift/models/operations/GetWatchlistResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/GetWatchlistWatchlistResponseBody.swift
|
||||
- Sources/Plexswift/models/operations/Guids.swift
|
||||
- Sources/Plexswift/models/operations/Hub.swift
|
||||
- Sources/Plexswift/models/operations/Image.swift
|
||||
- Sources/Plexswift/models/operations/IncludeCollections.swift
|
||||
- Sources/Plexswift/internal/models/IncludeCollections+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/IncludeDetails.swift
|
||||
- Sources/Plexswift/internal/models/IncludeDetails+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/IncludeExternalMedia.swift
|
||||
- Sources/Plexswift/internal/models/IncludeExternalMedia+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/Level.swift
|
||||
- Sources/Plexswift/internal/models/Level+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/Libtype.swift
|
||||
- Sources/Plexswift/internal/models/Libtype+Serialization.swift
|
||||
- Sources/Plexswift/models/operations/Location.swift
|
||||
- Sources/Plexswift/models/operations/LogLineErrors.swift
|
||||
- Sources/Plexswift/models/operations/LogLineRequest.swift
|
||||
|
||||
@@ -12,7 +12,7 @@ generation:
|
||||
auth:
|
||||
oAuth2ClientCredentialsEnabled: true
|
||||
swift:
|
||||
version: 0.3.1
|
||||
version: 0.4.0
|
||||
author: LukeHagar
|
||||
description: Swift Client SDK Generated by Speakeasy
|
||||
imports:
|
||||
|
||||
@@ -2,8 +2,8 @@ speakeasyVersion: 1.308.0
|
||||
sources:
|
||||
my-source:
|
||||
sourceNamespace: my-source
|
||||
sourceRevisionDigest: sha256:8a55e4d358b370c539223f7ca9d8ee71aac82295ae3df605a54e9c25ff3dbd35
|
||||
sourceBlobDigest: sha256:5b8d105e28a64fda9bf9e366db182a47097880bd8f309fbada44fbc0bd745bbb
|
||||
sourceRevisionDigest: sha256:5624db047dbcbdea446c5bfd39647c4eeff845353f814d00a01f5591a4667a38
|
||||
sourceBlobDigest: sha256:853e4c9838e000baff90393829ccf8e6bafd9a6e6017368e04fa33f174ba0904
|
||||
tags:
|
||||
- latest
|
||||
- main
|
||||
@@ -11,8 +11,8 @@ targets:
|
||||
plexswift:
|
||||
source: my-source
|
||||
sourceNamespace: my-source
|
||||
sourceRevisionDigest: sha256:8a55e4d358b370c539223f7ca9d8ee71aac82295ae3df605a54e9c25ff3dbd35
|
||||
sourceBlobDigest: sha256:5b8d105e28a64fda9bf9e366db182a47097880bd8f309fbada44fbc0bd745bbb
|
||||
sourceRevisionDigest: sha256:5624db047dbcbdea446c5bfd39647c4eeff845353f814d00a01f5591a4667a38
|
||||
sourceBlobDigest: sha256:853e4c9838e000baff90393829ccf8e6bafd9a6e6017368e04fa33f174ba0904
|
||||
outLocation: /github/workspace/repo
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
|
||||
@@ -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.3.1"))
|
||||
.package(url: "https://github.com/LukeHagar/plexswift.git", .upToNextMajor(from: "0.4.0"))
|
||||
]
|
||||
```
|
||||
<!-- End SDK Installation [installation] -->
|
||||
@@ -127,12 +127,13 @@ let client = Client()
|
||||
|
||||
let response = try await client.plex.getPin(
|
||||
request: Operations.GetPinRequest(
|
||||
xPlexProduct: "Postman",
|
||||
strong: false,
|
||||
)
|
||||
)
|
||||
|
||||
switch response.data {
|
||||
case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):
|
||||
case .twoHundredAndOneApplicationJsonObject(let twoHundredAndOneApplicationJsonObject):
|
||||
// Handle response
|
||||
break
|
||||
case .fourHundredApplicationJsonObject(let fourHundredApplicationJsonObject):
|
||||
|
||||
12
RELEASES.md
12
RELEASES.md
@@ -462,4 +462,14 @@ Based on:
|
||||
### Generated
|
||||
- [swift v0.3.1] .
|
||||
### Releases
|
||||
- [Swift Package Manager v0.3.1] https://github.com/LukeHagar/plexswift/releases/tag/v0.3.1 - .
|
||||
- [Swift Package Manager v0.3.1] https://github.com/LukeHagar/plexswift/releases/tag/v0.3.1 - .
|
||||
|
||||
## 2024-06-15 00:13:24
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.308.1 (2.342.6) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [swift v0.4.0] .
|
||||
### Releases
|
||||
- [Swift Package Manager v0.4.0] https://github.com/LukeHagar/plexswift/releases/tag/v0.4.0 - .
|
||||
@@ -66,16 +66,17 @@ import FoundationNetworking
|
||||
/// - ``video``
|
||||
/// - ``activities``
|
||||
/// - ``butler``
|
||||
/// - ``plex``
|
||||
/// - ``hubs``
|
||||
/// - ``search``
|
||||
/// - ``library``
|
||||
/// - ``log``
|
||||
/// - ``plex``
|
||||
/// - ``playlists``
|
||||
/// - ``authentication``
|
||||
/// - ``statistics``
|
||||
/// - ``sessions``
|
||||
/// - ``updater``
|
||||
/// - ``watchlist``
|
||||
///
|
||||
public final class Client {
|
||||
internal struct APIResponse {
|
||||
|
||||
@@ -56,20 +56,22 @@ case .empty:
|
||||
- ``VideoAPI``
|
||||
- ``ActivitiesAPI``
|
||||
- ``ButlerAPI``
|
||||
- ``PlexAPI``
|
||||
- ``HubsAPI``
|
||||
- ``SearchAPI``
|
||||
- ``LibraryAPI``
|
||||
- ``LogAPI``
|
||||
- ``PlexAPI``
|
||||
- ``PlaylistsAPI``
|
||||
- ``AuthenticationAPI``
|
||||
- ``StatisticsAPI``
|
||||
- ``SessionsAPI``
|
||||
- ``UpdaterAPI``
|
||||
- ``WatchlistAPI``
|
||||
|
||||
### Server configuration
|
||||
- ``PlexServers/GetPin``
|
||||
- ``PlexServers/GetToken``
|
||||
- ``WatchlistServers/GetWatchlist``
|
||||
|
||||
### Shared models
|
||||
|
||||
@@ -90,6 +92,7 @@ case .empty:
|
||||
- ``Operations/GetDevicesResponse``
|
||||
- ``Operations/GetFileHashResponse``
|
||||
- ``Operations/GetGlobalHubsResponse``
|
||||
- ``Operations/GetHomeDataResponse``
|
||||
- ``Operations/GetLibrariesResponse``
|
||||
- ``Operations/GetLibraryResponse``
|
||||
- ``Operations/GetLibraryHubsResponse``
|
||||
@@ -119,6 +122,7 @@ case .empty:
|
||||
- ``Operations/GetTranscodeSessionsResponse``
|
||||
- ``Operations/GetTransientTokenResponse``
|
||||
- ``Operations/GetUpdateStatusResponse``
|
||||
- ``Operations/GetWatchlistResponse``
|
||||
- ``Operations/LogLineResponse``
|
||||
- ``Operations/LogMultiLineResponse``
|
||||
- ``Operations/MarkPlayedResponse``
|
||||
@@ -206,6 +210,9 @@ case .empty:
|
||||
- ``Operations/GetGlobalHubsMetadata``
|
||||
- ``Operations/GetGlobalHubsRequest``
|
||||
- ``Operations/GetGlobalHubsResponseBody``
|
||||
- ``Operations/GetHomeDataErrors``
|
||||
- ``Operations/GetHomeDataPlexResponseBody``
|
||||
- ``Operations/GetHomeDataResponseBody``
|
||||
- ``Operations/GetLibrariesDirectory``
|
||||
- ``Operations/GetLibrariesErrors``
|
||||
- ``Operations/GetLibrariesLibraryResponseBody``
|
||||
@@ -214,6 +221,7 @@ case .empty:
|
||||
- ``Operations/GetLibrariesResponseBody``
|
||||
- ``Operations/GetLibraryDirectory``
|
||||
- ``Operations/GetLibraryErrors``
|
||||
- ``Operations/GetLibraryFilter``
|
||||
- ``Operations/GetLibraryLibraryResponseBody``
|
||||
- ``Operations/GetLibraryMediaContainer``
|
||||
- ``Operations/GetLibraryRequest``
|
||||
@@ -310,6 +318,7 @@ case .empty:
|
||||
- ``Operations/GetRecentlyAddedErrors``
|
||||
- ``Operations/GetRecentlyAddedLibraryResponseBody``
|
||||
- ``Operations/GetRecentlyAddedMediaContainer``
|
||||
- ``Operations/GetRecentlyAddedMetadata``
|
||||
- ``Operations/GetRecentlyAddedResponseBody``
|
||||
- ``Operations/GetResizedPhotoErrors``
|
||||
- ``Operations/GetResizedPhotoRequest``
|
||||
@@ -372,6 +381,8 @@ case .empty:
|
||||
- ``Operations/GetTimelineRequest``
|
||||
- ``Operations/GetTimelineResponseBody``
|
||||
- ``Operations/GetTokenErrors``
|
||||
- ``Operations/GetTokenLocation``
|
||||
- ``Operations/GetTokenPlexResponseBody``
|
||||
- ``Operations/GetTokenRequest``
|
||||
- ``Operations/GetTokenResponseBody``
|
||||
- ``Operations/GetTranscodeSessionsErrors``
|
||||
@@ -386,10 +397,18 @@ case .empty:
|
||||
- ``Operations/GetUpdateStatusMediaContainer``
|
||||
- ``Operations/GetUpdateStatusResponseBody``
|
||||
- ``Operations/GetUpdateStatusUpdaterResponseBody``
|
||||
- ``Operations/GetWatchlistErrors``
|
||||
- ``Operations/GetWatchlistRequest``
|
||||
- ``Operations/GetWatchlistResponseBody``
|
||||
- ``Operations/GetWatchlistWatchlistResponseBody``
|
||||
- ``Operations/Guids``
|
||||
- ``Operations/Hub``
|
||||
- ``Operations/Image``
|
||||
- ``Operations/IncludeCollections``
|
||||
- ``Operations/IncludeDetails``
|
||||
- ``Operations/IncludeExternalMedia``
|
||||
- ``Operations/Level``
|
||||
- ``Operations/Libtype``
|
||||
- ``Operations/Location``
|
||||
- ``Operations/LogLineErrors``
|
||||
- ``Operations/LogLineRequest``
|
||||
|
||||
@@ -10,6 +10,15 @@ class _PlexAPI: PlexAPI {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
public func getHomeData() async throws -> Response<Operations.GetHomeDataResponse> {
|
||||
return try await client.makeRequest(
|
||||
configureRequest: { configuration in
|
||||
try configureGetHomeDataRequest(with: configuration)
|
||||
},
|
||||
handleResponse: handleGetHomeDataResponse
|
||||
)
|
||||
}
|
||||
|
||||
public func getPin(request: Operations.GetPinRequest, server: PlexServers.GetPin?) async throws -> Response<Operations.GetPinResponse> {
|
||||
return try await client.makeRequest(
|
||||
with: try server?.server() ?? PlexServers.GetPin.default(),
|
||||
@@ -34,6 +43,12 @@ class _PlexAPI: PlexAPI {
|
||||
|
||||
// MARK: - Request Configuration
|
||||
|
||||
private func configureGetHomeDataRequest(with configuration: URLRequestConfiguration) throws {
|
||||
configuration.path = "/home"
|
||||
configuration.method = .get
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
private func configureGetPinRequest(with configuration: URLRequestConfiguration, request: Operations.GetPinRequest) throws {
|
||||
configuration.path = "/pins"
|
||||
configuration.method = .post
|
||||
@@ -52,13 +67,39 @@ private func configureGetTokenRequest(with configuration: URLRequestConfiguratio
|
||||
|
||||
// MARK: - Response Handlers
|
||||
|
||||
private func handleGetPinResponse(response: Client.APIResponse) throws -> Operations.GetPinResponse {
|
||||
private func handleGetHomeDataResponse(response: Client.APIResponse) throws -> Operations.GetHomeDataResponse {
|
||||
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.GetPinResponseBody.self, from: data))
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetHomeDataResponseBody.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.GetHomeDataPlexResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .empty
|
||||
}
|
||||
|
||||
private func handleGetPinResponse(response: Client.APIResponse) throws -> Operations.GetPinResponse {
|
||||
let httpResponse = response.httpResponse
|
||||
|
||||
if httpResponse.statusCode == 201 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetPinResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
@@ -80,11 +121,17 @@ private func handleGetTokenResponse(response: Client.APIResponse) throws -> Oper
|
||||
let httpResponse = response.httpResponse
|
||||
|
||||
if httpResponse.statusCode == 200 {
|
||||
return .empty
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetTokenResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
} else if httpResponse.statusCode == 400 {
|
||||
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||
do {
|
||||
return .object(try JSONDecoder().decode(Operations.GetTokenResponseBody.self, from: data))
|
||||
return .fourHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetTokenPlexResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
|
||||
62
Sources/Plexswift/internal/api/_WatchlistAPI.swift
Normal file
62
Sources/Plexswift/internal/api/_WatchlistAPI.swift
Normal file
@@ -0,0 +1,62 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
|
||||
import Foundation
|
||||
|
||||
class _WatchlistAPI: WatchlistAPI {
|
||||
private let client: Client
|
||||
|
||||
init(client: Client) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
public func getWatchlist(request: Operations.GetWatchlistRequest, server: WatchlistServers.GetWatchlist?) async throws -> Response<Operations.GetWatchlistResponse> {
|
||||
return try await client.makeRequest(
|
||||
with: try server?.server() ?? WatchlistServers.GetWatchlist.default(),
|
||||
configureRequest: { configuration in
|
||||
try configureGetWatchlistRequest(with: configuration, request: request)
|
||||
},
|
||||
handleResponse: handleGetWatchlistResponse
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Request Configuration
|
||||
|
||||
private func configureGetWatchlistRequest(with configuration: URLRequestConfiguration, request: Operations.GetWatchlistRequest) throws {
|
||||
configuration.path = "/library/sections/watchlist/{filter}"
|
||||
configuration.method = .get
|
||||
configuration.pathParameterSerializable = request
|
||||
configuration.queryParameterSerializable = request
|
||||
configuration.telemetryHeader = .userAgent
|
||||
}
|
||||
|
||||
// MARK: - Response Handlers
|
||||
|
||||
private func handleGetWatchlistResponse(response: Client.APIResponse) throws -> Operations.GetWatchlistResponse {
|
||||
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.GetWatchlistResponseBody.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.GetWatchlistWatchlistResponseBody.self, from: data))
|
||||
} catch {
|
||||
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return .empty
|
||||
}
|
||||
|
||||
14
Sources/Plexswift/internal/models/Filter+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/Filter+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations.Filter: 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))]
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ extension Operations.GetPinRequest: QueryParameterSerializable {
|
||||
extension Operations.GetPinRequest: HeaderParameterSerializable {
|
||||
func serializedHeaderParameters() throws -> [SerializedParameter] {
|
||||
return [
|
||||
SerializedParameter(name: "X-Plex-Product", serialized: try xPlexProduct.serialize(with: .header(explode: false))),
|
||||
SerializedParameter(name: "X-Plex-Client-Identifier", serialized: try xPlexClientIdentifier?.serialize(with: .header(explode: false)))
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations.GetWatchlistRequest: Serializable {
|
||||
func serialize(with format: SerializableFormat) throws -> String {
|
||||
switch format {
|
||||
case .path:
|
||||
return try serializePathParameterSerializable(self, with: format)
|
||||
case .query:
|
||||
return try serializeQueryParameterSerializable(self, with: format)
|
||||
case .header, .multipart, .form:
|
||||
throw SerializationError.invalidSerializationParameter(type: "Operations.GetWatchlistRequest", format: format.formatDescription)
|
||||
}
|
||||
}
|
||||
|
||||
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetWatchlistRequest: PathParameterSerializable {
|
||||
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||
return [
|
||||
"filter": try filter.serialize(with: formatOverride ?? .path(explode: false)),
|
||||
].compactMapValues { $0 }
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetWatchlistRequest: QueryParameterSerializable {
|
||||
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||
let builder = QueryParameterBuilder()
|
||||
try builder.addQueryParameters(from: xPlexToken, named: "X-Plex-Token", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
try builder.addQueryParameters(from: includeCollections, named: "includeCollections", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
try builder.addQueryParameters(from: includeExternalMedia, named: "includeExternalMedia", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
try builder.addQueryParameters(from: libtype, named: "libtype", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
try builder.addQueryParameters(from: maxresults, named: "maxresults", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
try builder.addQueryParameters(from: sort, named: "sort", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
try builder.addQueryParameters(from: xPlexContainerSize, named: "X-Plex-Container-Size", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
try builder.addQueryParameters(from: xPlexContainerStart, named: "X-Plex-Container-Start", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||
return builder.build()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations.IncludeCollections: 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))]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations.IncludeExternalMedia: 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))]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations.Libtype: 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))]
|
||||
}
|
||||
}
|
||||
@@ -3,34 +3,10 @@
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct Filter {
|
||||
public let filter: String?
|
||||
public let filterType: String?
|
||||
public let key: String?
|
||||
public let title: String?
|
||||
public let type: String?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(filter: String? = nil, filterType: String? = nil, key: String? = nil, title: String? = nil, type: String? = nil) {
|
||||
self.filter = filter
|
||||
self.filterType = filterType
|
||||
self.key = key
|
||||
self.title = title
|
||||
self.type = type
|
||||
}
|
||||
/// Filter
|
||||
public enum Filter: String, Codable, APIValue {
|
||||
case all = "all"
|
||||
case available = "available"
|
||||
case released = "released"
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.Filter: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case filter
|
||||
case filterType
|
||||
case key
|
||||
case title
|
||||
case type
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
58
Sources/Plexswift/models/operations/GetHomeDataErrors.swift
Normal file
58
Sources/Plexswift/models/operations/GetHomeDataErrors.swift
Normal file
@@ -0,0 +1,58 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct GetHomeDataErrors {
|
||||
@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<Double?>(wrappedValue: code)
|
||||
self.message = message
|
||||
self._status = DecimalSerialized<Double?>(wrappedValue: status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetHomeDataErrors: 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<Double?>.self, forKey: .code) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.message = try container.decodeIfPresent(String.self, forKey: .message)
|
||||
self._status = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .status) ?? DecimalSerialized<Double?>(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.GetHomeDataErrors {
|
||||
var codeWrapper: DecimalSerialized<Double?> {
|
||||
return _code
|
||||
}
|
||||
var statusWrapper: DecimalSerialized<Double?> {
|
||||
return _status
|
||||
}
|
||||
}
|
||||
@@ -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 GetHomeDataPlexResponseBody {
|
||||
public let errors: [Operations.GetHomeDataErrors]?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(errors: [Operations.GetHomeDataErrors]? = nil) {
|
||||
self.errors = errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetHomeDataPlexResponseBody: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case errors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A response model
|
||||
public enum GetHomeDataResponse {
|
||||
case empty
|
||||
case twoHundredApplicationJsonObject(Operations.GetHomeDataResponseBody)
|
||||
case fourHundredAndOneApplicationJsonObject(Operations.GetHomeDataPlexResponseBody)
|
||||
|
||||
var isEmpty: Bool {
|
||||
if case .empty = self {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public func twoHundredApplicationJsonObject() throws -> Operations.GetHomeDataResponseBody {
|
||||
guard case .twoHundredApplicationJsonObject(let value) = self else {
|
||||
throw PlexswiftError.missingResponseData
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetHomeDataPlexResponseBody {
|
||||
guard case .fourHundredAndOneApplicationJsonObject(let value) = self else {
|
||||
throw PlexswiftError.missingResponseData
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// Home Data
|
||||
public struct GetHomeDataResponseBody {
|
||||
public let guestEnabled: Bool?
|
||||
@DecimalSerialized
|
||||
public private(set) var guestUserID: Double?
|
||||
public let guestUserUUID: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var id: Double?
|
||||
public let name: String?
|
||||
public let subscription: Bool?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(guestEnabled: Bool? = nil, guestUserID: Double? = nil, guestUserUUID: String? = nil, id: Double? = nil, name: String? = nil, subscription: Bool? = nil) {
|
||||
self.guestEnabled = guestEnabled
|
||||
self._guestUserID = DecimalSerialized<Double?>(wrappedValue: guestUserID)
|
||||
self.guestUserUUID = guestUserUUID
|
||||
self._id = DecimalSerialized<Double?>(wrappedValue: id)
|
||||
self.name = name
|
||||
self.subscription = subscription
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetHomeDataResponseBody: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case guestEnabled
|
||||
case guestUserID
|
||||
case guestUserUUID
|
||||
case id
|
||||
case name
|
||||
case subscription
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.guestEnabled = try container.decodeIfPresent(Bool.self, forKey: .guestEnabled)
|
||||
self._guestUserID = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .guestUserID) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.guestUserUUID = try container.decodeIfPresent(String.self, forKey: .guestUserUUID)
|
||||
self._id = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .id) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.name = try container.decodeIfPresent(String.self, forKey: .name)
|
||||
self.subscription = try container.decodeIfPresent(Bool.self, forKey: .subscription)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(self.guestEnabled, forKey: .guestEnabled)
|
||||
if self.guestUserID != nil {
|
||||
try container.encode(self._guestUserID, forKey: .guestUserID)
|
||||
}
|
||||
try container.encodeIfPresent(self.guestUserUUID, forKey: .guestUserUUID)
|
||||
if self.id != nil {
|
||||
try container.encode(self._id, forKey: .id)
|
||||
}
|
||||
try container.encodeIfPresent(self.name, forKey: .name)
|
||||
try container.encodeIfPresent(self.subscription, forKey: .subscription)
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetHomeDataResponseBody {
|
||||
var idWrapper: DecimalSerialized<Double?> {
|
||||
return _id
|
||||
}
|
||||
var guestUserIDWrapper: DecimalSerialized<Double?> {
|
||||
return _guestUserID
|
||||
}
|
||||
}
|
||||
36
Sources/Plexswift/models/operations/GetLibraryFilter.swift
Normal file
36
Sources/Plexswift/models/operations/GetLibraryFilter.swift
Normal file
@@ -0,0 +1,36 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct GetLibraryFilter {
|
||||
public let filter: String?
|
||||
public let filterType: String?
|
||||
public let key: String?
|
||||
public let title: String?
|
||||
public let type: String?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(filter: String? = nil, filterType: String? = nil, key: String? = nil, title: String? = nil, type: String? = nil) {
|
||||
self.filter = filter
|
||||
self.filterType = filterType
|
||||
self.key = key
|
||||
self.title = title
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetLibraryFilter: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case filter
|
||||
case filterType
|
||||
case key
|
||||
case title
|
||||
case type
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ extension Operations {
|
||||
/// A model object
|
||||
public struct GetLibraryItemsRequest: APIValue {
|
||||
/// the Id of the library to query
|
||||
public let sectionId: Int
|
||||
public let sectionId: AnyValue
|
||||
/// A key representing a specific tag within the section.
|
||||
public let tag: Operations.Tag
|
||||
|
||||
@@ -15,7 +15,7 @@ extension Operations {
|
||||
/// - 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) {
|
||||
public init(sectionId: AnyValue, tag: Operations.Tag) {
|
||||
self.sectionId = sectionId
|
||||
self.tag = tag
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ extension Operations {
|
||||
public struct GetLibraryType {
|
||||
public let active: Bool?
|
||||
public let field: [Operations.Field]?
|
||||
public let filter: [Operations.Filter]?
|
||||
public let filter: [Operations.GetLibraryFilter]?
|
||||
public let key: String?
|
||||
public let sort: [Operations.Sort]?
|
||||
public let title: String?
|
||||
@@ -16,7 +16,7 @@ extension Operations {
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(active: Bool? = nil, field: [Operations.Field]? = nil, filter: [Operations.Filter]? = nil, key: String? = nil, sort: [Operations.Sort]? = nil, title: String? = nil, type: String? = nil) {
|
||||
public init(active: Bool? = nil, field: [Operations.Field]? = nil, filter: [Operations.GetLibraryFilter]? = nil, key: String? = nil, sort: [Operations.Sort]? = nil, title: String? = nil, type: String? = nil) {
|
||||
self.active = active
|
||||
self.field = field
|
||||
self.filter = filter
|
||||
|
||||
@@ -5,6 +5,9 @@ import Foundation
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct GetPinRequest: APIValue {
|
||||
/// Product name of the application shown in the list of devices
|
||||
///
|
||||
public let xPlexProduct: String
|
||||
/// Determines the kind of code returned by the API call
|
||||
/// Strong codes are used for Pin authentication flows
|
||||
/// Non-Strong codes are used for `Plex.tv/link`
|
||||
@@ -18,6 +21,8 @@ extension Operations {
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
/// - Parameter xPlexProduct: Product name of the application shown in the list of devices
|
||||
///
|
||||
/// - Parameter strong: Determines the kind of code returned by the API call
|
||||
/// Strong codes are used for Pin authentication flows
|
||||
/// Non-Strong codes are used for `Plex.tv/link`
|
||||
@@ -27,7 +32,8 @@ extension Operations {
|
||||
/// (UUID, serial number, or other number unique per device)
|
||||
///
|
||||
///
|
||||
public init(strong: Bool? = nil, xPlexClientIdentifier: String? = nil) {
|
||||
public init(xPlexProduct: String, strong: Bool? = nil, xPlexClientIdentifier: String? = nil) {
|
||||
self.xPlexProduct = xPlexProduct
|
||||
self.strong = strong
|
||||
self.xPlexClientIdentifier = xPlexClientIdentifier
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ extension Operations {
|
||||
/// A response model
|
||||
public enum GetPinResponse {
|
||||
case empty
|
||||
case twoHundredApplicationJsonObject(Operations.GetPinResponseBody)
|
||||
case twoHundredAndOneApplicationJsonObject(Operations.GetPinResponseBody)
|
||||
case fourHundredApplicationJsonObject(Operations.GetPinPlexResponseBody)
|
||||
|
||||
var isEmpty: Bool {
|
||||
@@ -17,8 +17,8 @@ extension Operations {
|
||||
}
|
||||
}
|
||||
|
||||
public func twoHundredApplicationJsonObject() throws -> Operations.GetPinResponseBody {
|
||||
guard case .twoHundredApplicationJsonObject(let value) = self else {
|
||||
public func twoHundredAndOneApplicationJsonObject() throws -> Operations.GetPinResponseBody {
|
||||
guard case .twoHundredAndOneApplicationJsonObject(let value) = self else {
|
||||
throw PlexswiftError.missingResponseData
|
||||
}
|
||||
return value
|
||||
|
||||
@@ -10,7 +10,7 @@ extension Operations {
|
||||
public let mediaTagPrefix: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var mediaTagVersion: Double?
|
||||
public let metadata: [Operations.Metadata]?
|
||||
public let metadata: [Operations.GetRecentlyAddedMetadata]?
|
||||
public let mixedParents: Bool?
|
||||
@DecimalSerialized
|
||||
public private(set) var size: Double?
|
||||
@@ -18,7 +18,7 @@ extension Operations {
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(allowSync: Bool? = nil, identifier: String? = nil, mediaTagPrefix: String? = nil, mediaTagVersion: Double? = nil, metadata: [Operations.Metadata]? = nil, mixedParents: Bool? = nil, size: Double? = nil) {
|
||||
public init(allowSync: Bool? = nil, identifier: String? = nil, mediaTagPrefix: String? = nil, mediaTagVersion: Double? = nil, metadata: [Operations.GetRecentlyAddedMetadata]? = nil, mixedParents: Bool? = nil, size: Double? = nil) {
|
||||
self.allowSync = allowSync
|
||||
self.identifier = identifier
|
||||
self.mediaTagPrefix = mediaTagPrefix
|
||||
@@ -47,7 +47,7 @@ extension Operations.GetRecentlyAddedMediaContainer: Codable {
|
||||
self.identifier = try container.decodeIfPresent(String.self, forKey: .identifier)
|
||||
self.mediaTagPrefix = try container.decodeIfPresent(String.self, forKey: .mediaTagPrefix)
|
||||
self._mediaTagVersion = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .mediaTagVersion) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.metadata = try container.decodeIfPresent([Operations.Metadata].self, forKey: .metadata)
|
||||
self.metadata = try container.decodeIfPresent([Operations.GetRecentlyAddedMetadata].self, forKey: .metadata)
|
||||
self.mixedParents = try container.decodeIfPresent(Bool.self, forKey: .mixedParents)
|
||||
self._size = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .size) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct GetRecentlyAddedMetadata {
|
||||
@DecimalSerialized
|
||||
public private(set) var addedAt: Double?
|
||||
public let allowSync: Bool?
|
||||
public let art: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var audienceRating: Double?
|
||||
public let audienceRatingImage: String?
|
||||
public let chapterSource: String?
|
||||
public let contentRating: String?
|
||||
public let country: [Operations.Country]?
|
||||
public let director: [Operations.Director]?
|
||||
@DecimalSerialized
|
||||
public private(set) var duration: Double?
|
||||
public let genre: [Operations.Genre]?
|
||||
public let guid: String?
|
||||
public let key: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var librarySectionID: Double?
|
||||
public let librarySectionTitle: String?
|
||||
public let librarySectionUUID: String?
|
||||
public let media: [Operations.Media]?
|
||||
@DateTime
|
||||
public private(set) var originallyAvailableAt: Date?
|
||||
public let primaryExtraKey: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var rating: Double?
|
||||
public let ratingImage: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var ratingKey: Double?
|
||||
public let role: [Operations.Role]?
|
||||
public let studio: String?
|
||||
public let summary: String?
|
||||
public let tagline: String?
|
||||
public let thumb: String?
|
||||
public let title: String?
|
||||
public let type: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var updatedAt: Double?
|
||||
public let writer: [Operations.Writer]?
|
||||
@DecimalSerialized
|
||||
public private(set) var year: Double?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(addedAt: Double? = nil, allowSync: Bool? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, chapterSource: String? = nil, contentRating: String? = nil, country: [Operations.Country]? = nil, director: [Operations.Director]? = nil, duration: Double? = nil, genre: [Operations.Genre]? = nil, guid: String? = nil, key: String? = nil, librarySectionID: Double? = nil, librarySectionTitle: String? = nil, librarySectionUUID: String? = nil, media: [Operations.Media]? = nil, originallyAvailableAt: Date? = nil, primaryExtraKey: String? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: Double? = nil, role: [Operations.Role]? = nil, studio: String? = nil, summary: String? = nil, tagline: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, updatedAt: Double? = nil, writer: [Operations.Writer]? = nil, year: Double? = nil) {
|
||||
self._addedAt = DecimalSerialized<Double?>(wrappedValue: addedAt)
|
||||
self.allowSync = allowSync
|
||||
self.art = art
|
||||
self._audienceRating = DecimalSerialized<Double?>(wrappedValue: audienceRating)
|
||||
self.audienceRatingImage = audienceRatingImage
|
||||
self.chapterSource = chapterSource
|
||||
self.contentRating = contentRating
|
||||
self.country = country
|
||||
self.director = director
|
||||
self._duration = DecimalSerialized<Double?>(wrappedValue: duration)
|
||||
self.genre = genre
|
||||
self.guid = guid
|
||||
self.key = key
|
||||
self._librarySectionID = DecimalSerialized<Double?>(wrappedValue: librarySectionID)
|
||||
self.librarySectionTitle = librarySectionTitle
|
||||
self.librarySectionUUID = librarySectionUUID
|
||||
self.media = media
|
||||
self._originallyAvailableAt = DateTime<Date?>(wrappedValue: originallyAvailableAt)
|
||||
self.primaryExtraKey = primaryExtraKey
|
||||
self._rating = DecimalSerialized<Double?>(wrappedValue: rating)
|
||||
self.ratingImage = ratingImage
|
||||
self._ratingKey = DecimalSerialized<Double?>(wrappedValue: ratingKey)
|
||||
self.role = role
|
||||
self.studio = studio
|
||||
self.summary = summary
|
||||
self.tagline = tagline
|
||||
self.thumb = thumb
|
||||
self.title = title
|
||||
self.type = type
|
||||
self._updatedAt = DecimalSerialized<Double?>(wrappedValue: updatedAt)
|
||||
self.writer = writer
|
||||
self._year = DecimalSerialized<Double?>(wrappedValue: year)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetRecentlyAddedMetadata: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case addedAt
|
||||
case allowSync
|
||||
case art
|
||||
case audienceRating
|
||||
case audienceRatingImage
|
||||
case chapterSource
|
||||
case contentRating
|
||||
case country = "Country"
|
||||
case director = "Director"
|
||||
case duration
|
||||
case genre = "Genre"
|
||||
case guid
|
||||
case key
|
||||
case librarySectionID
|
||||
case librarySectionTitle
|
||||
case librarySectionUUID
|
||||
case media = "Media"
|
||||
case originallyAvailableAt
|
||||
case primaryExtraKey
|
||||
case rating
|
||||
case ratingImage
|
||||
case ratingKey
|
||||
case role = "Role"
|
||||
case studio
|
||||
case summary
|
||||
case tagline
|
||||
case thumb
|
||||
case title
|
||||
case type
|
||||
case updatedAt
|
||||
case writer = "Writer"
|
||||
case year
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self._addedAt = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .addedAt) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync)
|
||||
self.art = try container.decodeIfPresent(String.self, forKey: .art)
|
||||
self._audienceRating = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .audienceRating) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.audienceRatingImage = try container.decodeIfPresent(String.self, forKey: .audienceRatingImage)
|
||||
self.chapterSource = try container.decodeIfPresent(String.self, forKey: .chapterSource)
|
||||
self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating)
|
||||
self.country = try container.decodeIfPresent([Operations.Country].self, forKey: .country)
|
||||
self.director = try container.decodeIfPresent([Operations.Director].self, forKey: .director)
|
||||
self._duration = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .duration) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.genre = try container.decodeIfPresent([Operations.Genre].self, forKey: .genre)
|
||||
self.guid = try container.decodeIfPresent(String.self, forKey: .guid)
|
||||
self.key = try container.decodeIfPresent(String.self, forKey: .key)
|
||||
self._librarySectionID = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .librarySectionID) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.librarySectionTitle = try container.decodeIfPresent(String.self, forKey: .librarySectionTitle)
|
||||
self.librarySectionUUID = try container.decodeIfPresent(String.self, forKey: .librarySectionUUID)
|
||||
self.media = try container.decodeIfPresent([Operations.Media].self, forKey: .media)
|
||||
self._originallyAvailableAt = try container.decodeIfPresent(DateTime<Date?>.self, forKey: .originallyAvailableAt) ?? DateTime<Date?>(wrappedValue: nil)
|
||||
self.primaryExtraKey = try container.decodeIfPresent(String.self, forKey: .primaryExtraKey)
|
||||
self._rating = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .rating) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.ratingImage = try container.decodeIfPresent(String.self, forKey: .ratingImage)
|
||||
self._ratingKey = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .ratingKey) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.role = try container.decodeIfPresent([Operations.Role].self, forKey: .role)
|
||||
self.studio = try container.decodeIfPresent(String.self, forKey: .studio)
|
||||
self.summary = try container.decodeIfPresent(String.self, forKey: .summary)
|
||||
self.tagline = try container.decodeIfPresent(String.self, forKey: .tagline)
|
||||
self.thumb = try container.decodeIfPresent(String.self, forKey: .thumb)
|
||||
self.title = try container.decodeIfPresent(String.self, forKey: .title)
|
||||
self.type = try container.decodeIfPresent(String.self, forKey: .type)
|
||||
self._updatedAt = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .updatedAt) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.writer = try container.decodeIfPresent([Operations.Writer].self, forKey: .writer)
|
||||
self._year = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .year) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
if self.addedAt != nil {
|
||||
try container.encode(self._addedAt, forKey: .addedAt)
|
||||
}
|
||||
try container.encodeIfPresent(self.allowSync, forKey: .allowSync)
|
||||
try container.encodeIfPresent(self.art, forKey: .art)
|
||||
if self.audienceRating != nil {
|
||||
try container.encode(self._audienceRating, forKey: .audienceRating)
|
||||
}
|
||||
try container.encodeIfPresent(self.audienceRatingImage, forKey: .audienceRatingImage)
|
||||
try container.encodeIfPresent(self.chapterSource, forKey: .chapterSource)
|
||||
try container.encodeIfPresent(self.contentRating, forKey: .contentRating)
|
||||
try container.encodeIfPresent(self.country, forKey: .country)
|
||||
try container.encodeIfPresent(self.director, forKey: .director)
|
||||
if self.duration != nil {
|
||||
try container.encode(self._duration, forKey: .duration)
|
||||
}
|
||||
try container.encodeIfPresent(self.genre, forKey: .genre)
|
||||
try container.encodeIfPresent(self.guid, forKey: .guid)
|
||||
try container.encodeIfPresent(self.key, forKey: .key)
|
||||
if self.librarySectionID != nil {
|
||||
try container.encode(self._librarySectionID, forKey: .librarySectionID)
|
||||
}
|
||||
try container.encodeIfPresent(self.librarySectionTitle, forKey: .librarySectionTitle)
|
||||
try container.encodeIfPresent(self.librarySectionUUID, forKey: .librarySectionUUID)
|
||||
try container.encodeIfPresent(self.media, forKey: .media)
|
||||
if self.originallyAvailableAt != nil {
|
||||
try container.encode(self._originallyAvailableAt, forKey: .originallyAvailableAt)
|
||||
}
|
||||
try container.encodeIfPresent(self.primaryExtraKey, forKey: .primaryExtraKey)
|
||||
if self.rating != nil {
|
||||
try container.encode(self._rating, forKey: .rating)
|
||||
}
|
||||
try container.encodeIfPresent(self.ratingImage, forKey: .ratingImage)
|
||||
if self.ratingKey != nil {
|
||||
try container.encode(self._ratingKey, forKey: .ratingKey)
|
||||
}
|
||||
try container.encodeIfPresent(self.role, forKey: .role)
|
||||
try container.encodeIfPresent(self.studio, forKey: .studio)
|
||||
try container.encodeIfPresent(self.summary, forKey: .summary)
|
||||
try container.encodeIfPresent(self.tagline, forKey: .tagline)
|
||||
try container.encodeIfPresent(self.thumb, forKey: .thumb)
|
||||
try container.encodeIfPresent(self.title, forKey: .title)
|
||||
try container.encodeIfPresent(self.type, forKey: .type)
|
||||
if self.updatedAt != nil {
|
||||
try container.encode(self._updatedAt, forKey: .updatedAt)
|
||||
}
|
||||
try container.encodeIfPresent(self.writer, forKey: .writer)
|
||||
if self.year != nil {
|
||||
try container.encode(self._year, forKey: .year)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetRecentlyAddedMetadata {
|
||||
var librarySectionIDWrapper: DecimalSerialized<Double?> {
|
||||
return _librarySectionID
|
||||
}
|
||||
var ratingKeyWrapper: DecimalSerialized<Double?> {
|
||||
return _ratingKey
|
||||
}
|
||||
var ratingWrapper: DecimalSerialized<Double?> {
|
||||
return _rating
|
||||
}
|
||||
var audienceRatingWrapper: DecimalSerialized<Double?> {
|
||||
return _audienceRating
|
||||
}
|
||||
var yearWrapper: DecimalSerialized<Double?> {
|
||||
return _year
|
||||
}
|
||||
var durationWrapper: DecimalSerialized<Double?> {
|
||||
return _duration
|
||||
}
|
||||
var originallyAvailableAtWrapper: DateTime<Date?> {
|
||||
return _originallyAvailableAt
|
||||
}
|
||||
var addedAtWrapper: DecimalSerialized<Double?> {
|
||||
return _addedAt
|
||||
}
|
||||
var updatedAtWrapper: DecimalSerialized<Double?> {
|
||||
return _updatedAt
|
||||
}
|
||||
}
|
||||
51
Sources/Plexswift/models/operations/GetTokenLocation.swift
Normal file
51
Sources/Plexswift/models/operations/GetTokenLocation.swift
Normal file
@@ -0,0 +1,51 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct GetTokenLocation {
|
||||
public let city: String?
|
||||
public let code: String?
|
||||
public let continentCode: String?
|
||||
public let coordinates: String?
|
||||
public let country: String?
|
||||
public let europeanUnionMember: Bool?
|
||||
public let inPrivacyRestrictedCountry: Bool?
|
||||
public let postalCode: String?
|
||||
public let subdivisions: String?
|
||||
public let timeZone: String?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(city: String? = nil, code: String? = nil, continentCode: String? = nil, coordinates: String? = nil, country: String? = nil, europeanUnionMember: Bool? = nil, inPrivacyRestrictedCountry: Bool? = nil, postalCode: String? = nil, subdivisions: String? = nil, timeZone: String? = nil) {
|
||||
self.city = city
|
||||
self.code = code
|
||||
self.continentCode = continentCode
|
||||
self.coordinates = coordinates
|
||||
self.country = country
|
||||
self.europeanUnionMember = europeanUnionMember
|
||||
self.inPrivacyRestrictedCountry = inPrivacyRestrictedCountry
|
||||
self.postalCode = postalCode
|
||||
self.subdivisions = subdivisions
|
||||
self.timeZone = timeZone
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetTokenLocation: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case city
|
||||
case code
|
||||
case continentCode = "continent_code"
|
||||
case coordinates
|
||||
case country
|
||||
case europeanUnionMember = "european_union_member"
|
||||
case inPrivacyRestrictedCountry = "in_privacy_restricted_country"
|
||||
case postalCode = "postal_code"
|
||||
case subdivisions
|
||||
case timeZone = "time_zone"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// X-Plex-Client-Identifier is missing
|
||||
public struct GetTokenPlexResponseBody {
|
||||
public let errors: [Operations.GetTokenErrors]?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(errors: [Operations.GetTokenErrors]? = nil) {
|
||||
self.errors = errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetTokenPlexResponseBody: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case errors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ extension Operations {
|
||||
/// A response model
|
||||
public enum GetTokenResponse {
|
||||
case empty
|
||||
case object(Operations.GetTokenResponseBody)
|
||||
case twoHundredApplicationJsonObject(Operations.GetTokenResponseBody)
|
||||
case fourHundredApplicationJsonObject(Operations.GetTokenPlexResponseBody)
|
||||
|
||||
var isEmpty: Bool {
|
||||
if case .empty = self {
|
||||
@@ -16,8 +17,15 @@ extension Operations {
|
||||
}
|
||||
}
|
||||
|
||||
public func object() throws -> Operations.GetTokenResponseBody {
|
||||
guard case .object(let value) = self else {
|
||||
public func twoHundredApplicationJsonObject() throws -> Operations.GetTokenResponseBody {
|
||||
guard case .twoHundredApplicationJsonObject(let value) = self else {
|
||||
throw PlexswiftError.missingResponseData
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
public func fourHundredApplicationJsonObject() throws -> Operations.GetTokenPlexResponseBody {
|
||||
guard case .fourHundredApplicationJsonObject(let value) = self else {
|
||||
throw PlexswiftError.missingResponseData
|
||||
}
|
||||
return value
|
||||
|
||||
@@ -3,22 +3,123 @@
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// X-Plex-Client-Identifier is missing
|
||||
/// Access Token
|
||||
public struct GetTokenResponseBody {
|
||||
public let errors: [Operations.GetTokenErrors]?
|
||||
public let authToken: String?
|
||||
public let clientIdentifier: String?
|
||||
public let code: String?
|
||||
@DateTime
|
||||
public private(set) var createdAt: Date?
|
||||
@DateTime
|
||||
public private(set) var expiresAt: Date?
|
||||
@DecimalSerialized
|
||||
public private(set) var expiresIn: Double?
|
||||
/// PinID for use with authentication
|
||||
@DecimalSerialized
|
||||
public private(set) var id: Double?
|
||||
public let location: Operations.GetTokenLocation?
|
||||
public let newRegistration: String?
|
||||
public let product: String?
|
||||
/// a link to a QR code hosted on plex.tv
|
||||
/// The QR code redirects to the relevant `plex.tv/link` authentication page
|
||||
/// Which then prompts the user for the 4 Digit Link Pin
|
||||
///
|
||||
public let qr: String?
|
||||
public let trusted: Bool?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
/// - Parameter id: PinID for use with authentication
|
||||
/// - Parameter qr: a link to a QR code hosted on plex.tv
|
||||
/// The QR code redirects to the relevant `plex.tv/link` authentication page
|
||||
/// Which then prompts the user for the 4 Digit Link Pin
|
||||
///
|
||||
///
|
||||
public init(errors: [Operations.GetTokenErrors]? = nil) {
|
||||
self.errors = errors
|
||||
public init(authToken: String? = nil, clientIdentifier: String? = nil, code: String? = nil, createdAt: Date? = nil, expiresAt: Date? = nil, expiresIn: Double? = nil, id: Double? = nil, location: Operations.GetTokenLocation? = nil, newRegistration: String? = nil, product: String? = nil, qr: String? = nil, trusted: Bool? = nil) {
|
||||
self.authToken = authToken
|
||||
self.clientIdentifier = clientIdentifier
|
||||
self.code = code
|
||||
self._createdAt = DateTime<Date?>(wrappedValue: createdAt)
|
||||
self._expiresAt = DateTime<Date?>(wrappedValue: expiresAt)
|
||||
self._expiresIn = DecimalSerialized<Double?>(wrappedValue: expiresIn)
|
||||
self._id = DecimalSerialized<Double?>(wrappedValue: id)
|
||||
self.location = location
|
||||
self.newRegistration = newRegistration
|
||||
self.product = product
|
||||
self.qr = qr
|
||||
self.trusted = trusted
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetTokenResponseBody: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case errors
|
||||
case authToken
|
||||
case clientIdentifier
|
||||
case code
|
||||
case createdAt
|
||||
case expiresAt
|
||||
case expiresIn
|
||||
case id
|
||||
case location
|
||||
case newRegistration
|
||||
case product
|
||||
case qr
|
||||
case trusted
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.authToken = try container.decodeIfPresent(String.self, forKey: .authToken)
|
||||
self.clientIdentifier = try container.decodeIfPresent(String.self, forKey: .clientIdentifier)
|
||||
self.code = try container.decodeIfPresent(String.self, forKey: .code)
|
||||
self._createdAt = try container.decodeIfPresent(DateTime<Date?>.self, forKey: .createdAt) ?? DateTime<Date?>(wrappedValue: nil)
|
||||
self._expiresAt = try container.decodeIfPresent(DateTime<Date?>.self, forKey: .expiresAt) ?? DateTime<Date?>(wrappedValue: nil)
|
||||
self._expiresIn = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .expiresIn) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self._id = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .id) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.location = try container.decodeIfPresent(Operations.GetTokenLocation.self, forKey: .location)
|
||||
self.newRegistration = try container.decodeIfPresent(String.self, forKey: .newRegistration)
|
||||
self.product = try container.decodeIfPresent(String.self, forKey: .product)
|
||||
self.qr = try container.decodeIfPresent(String.self, forKey: .qr)
|
||||
self.trusted = try container.decodeIfPresent(Bool.self, forKey: .trusted)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(self.authToken, forKey: .authToken)
|
||||
try container.encodeIfPresent(self.clientIdentifier, forKey: .clientIdentifier)
|
||||
try container.encodeIfPresent(self.code, forKey: .code)
|
||||
if self.createdAt != nil {
|
||||
try container.encode(self._createdAt, forKey: .createdAt)
|
||||
}
|
||||
if self.expiresAt != nil {
|
||||
try container.encode(self._expiresAt, forKey: .expiresAt)
|
||||
}
|
||||
if self.expiresIn != nil {
|
||||
try container.encode(self._expiresIn, forKey: .expiresIn)
|
||||
}
|
||||
if self.id != nil {
|
||||
try container.encode(self._id, forKey: .id)
|
||||
}
|
||||
try container.encodeIfPresent(self.location, forKey: .location)
|
||||
try container.encodeIfPresent(self.newRegistration, forKey: .newRegistration)
|
||||
try container.encodeIfPresent(self.product, forKey: .product)
|
||||
try container.encodeIfPresent(self.qr, forKey: .qr)
|
||||
try container.encodeIfPresent(self.trusted, forKey: .trusted)
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetTokenResponseBody {
|
||||
var idWrapper: DecimalSerialized<Double?> {
|
||||
return _id
|
||||
}
|
||||
var expiresInWrapper: DecimalSerialized<Double?> {
|
||||
return _expiresIn
|
||||
}
|
||||
var createdAtWrapper: DateTime<Date?> {
|
||||
return _createdAt
|
||||
}
|
||||
var expiresAtWrapper: DateTime<Date?> {
|
||||
return _expiresAt
|
||||
}
|
||||
}
|
||||
|
||||
58
Sources/Plexswift/models/operations/GetWatchlistErrors.swift
Normal file
58
Sources/Plexswift/models/operations/GetWatchlistErrors.swift
Normal file
@@ -0,0 +1,58 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct GetWatchlistErrors {
|
||||
@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<Double?>(wrappedValue: code)
|
||||
self.message = message
|
||||
self._status = DecimalSerialized<Double?>(wrappedValue: status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetWatchlistErrors: 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<Double?>.self, forKey: .code) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.message = try container.decodeIfPresent(String.self, forKey: .message)
|
||||
self._status = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .status) ?? DecimalSerialized<Double?>(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.GetWatchlistErrors {
|
||||
var codeWrapper: DecimalSerialized<Double?> {
|
||||
return _code
|
||||
}
|
||||
var statusWrapper: DecimalSerialized<Double?> {
|
||||
return _status
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct GetWatchlistRequest: APIValue {
|
||||
/// Filter
|
||||
public let filter: Operations.Filter
|
||||
/// User Token
|
||||
public let xPlexToken: String
|
||||
/// include collections in the results
|
||||
///
|
||||
public let includeCollections: Operations.IncludeCollections?
|
||||
/// include external media in the results
|
||||
///
|
||||
public let includeExternalMedia: Operations.IncludeExternalMedia?
|
||||
/// The type of library to filter. Can be "movie" or "show", or all if not present.
|
||||
///
|
||||
public let libtype: Operations.Libtype?
|
||||
/// The number of items to return. If not specified, all items will be returned.
|
||||
/// If the number of items exceeds the limit, the response will be paginated.
|
||||
///
|
||||
public let maxresults: Int?
|
||||
/// In the format "field:dir". Available fields are "watchlistedAt" (Added At),
|
||||
/// "titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
|
||||
/// "dir" can be "asc" or "desc"
|
||||
///
|
||||
public let sort: String?
|
||||
/// The number of items to return. If not specified, all items will be returned.
|
||||
/// If the number of items exceeds the limit, the response will be paginated.
|
||||
///
|
||||
public let xPlexContainerSize: Int?
|
||||
/// The index of the first item to return. If not specified, the first item will be returned.
|
||||
/// If the number of items exceeds the limit, the response will be paginated.
|
||||
///
|
||||
public let xPlexContainerStart: Int?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
/// - Parameter filter: Filter
|
||||
/// - Parameter xPlexToken: User Token
|
||||
/// - Parameter includeCollections: include collections in the results
|
||||
///
|
||||
/// - Parameter includeExternalMedia: include external media in the results
|
||||
///
|
||||
/// - Parameter libtype: The type of library to filter. Can be "movie" or "show", or all if not present.
|
||||
///
|
||||
/// - Parameter maxresults: The number of items to return. If not specified, all items will be returned.
|
||||
/// If the number of items exceeds the limit, the response will be paginated.
|
||||
///
|
||||
/// - Parameter sort: In the format "field:dir". Available fields are "watchlistedAt" (Added At),
|
||||
/// "titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
|
||||
/// "dir" can be "asc" or "desc"
|
||||
///
|
||||
/// - Parameter xPlexContainerSize: The number of items to return. If not specified, all items will be returned.
|
||||
/// If the number of items exceeds the limit, the response will be paginated.
|
||||
///
|
||||
/// - Parameter xPlexContainerStart: The index of the first item to return. If not specified, the first item will be returned.
|
||||
/// If the number of items exceeds the limit, the response will be paginated.
|
||||
///
|
||||
///
|
||||
public init(filter: Operations.Filter, xPlexToken: String, includeCollections: Operations.IncludeCollections? = nil, includeExternalMedia: Operations.IncludeExternalMedia? = nil, libtype: Operations.Libtype? = nil, maxresults: Int? = nil, sort: String? = nil, xPlexContainerSize: Int? = nil, xPlexContainerStart: Int? = nil) {
|
||||
self.filter = filter
|
||||
self.xPlexToken = xPlexToken
|
||||
self.includeCollections = includeCollections
|
||||
self.includeExternalMedia = includeExternalMedia
|
||||
self.libtype = libtype
|
||||
self.maxresults = maxresults
|
||||
self.sort = sort
|
||||
self.xPlexContainerSize = xPlexContainerSize
|
||||
self.xPlexContainerStart = xPlexContainerStart
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A response model
|
||||
public enum GetWatchlistResponse {
|
||||
case empty
|
||||
case twoHundredApplicationJsonObject(Operations.GetWatchlistResponseBody)
|
||||
case fourHundredAndOneApplicationJsonObject(Operations.GetWatchlistWatchlistResponseBody)
|
||||
|
||||
var isEmpty: Bool {
|
||||
if case .empty = self {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public func twoHundredApplicationJsonObject() throws -> Operations.GetWatchlistResponseBody {
|
||||
guard case .twoHundredApplicationJsonObject(let value) = self else {
|
||||
throw PlexswiftError.missingResponseData
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
public func fourHundredAndOneApplicationJsonObject() throws -> Operations.GetWatchlistWatchlistResponseBody {
|
||||
guard case .fourHundredAndOneApplicationJsonObject(let value) = self else {
|
||||
throw PlexswiftError.missingResponseData
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// Watchlist Data
|
||||
public struct GetWatchlistResponseBody {
|
||||
public let identifier: String?
|
||||
public let librarySectionID: String?
|
||||
public let librarySectionTitle: String?
|
||||
public let metadata: [Operations.Metadata]?
|
||||
public let offset: Int?
|
||||
public let size: Int?
|
||||
public let totalSize: Int?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(identifier: String? = nil, librarySectionID: String? = nil, librarySectionTitle: String? = nil, metadata: [Operations.Metadata]? = nil, offset: Int? = nil, size: Int? = nil, totalSize: Int? = nil) {
|
||||
self.identifier = identifier
|
||||
self.librarySectionID = librarySectionID
|
||||
self.librarySectionTitle = librarySectionTitle
|
||||
self.metadata = metadata
|
||||
self.offset = offset
|
||||
self.size = size
|
||||
self.totalSize = totalSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetWatchlistResponseBody: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case identifier
|
||||
case librarySectionID
|
||||
case librarySectionTitle
|
||||
case metadata = "Metadata"
|
||||
case offset
|
||||
case size
|
||||
case totalSize
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 GetWatchlistWatchlistResponseBody {
|
||||
public let errors: [Operations.GetWatchlistErrors]?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(errors: [Operations.GetWatchlistErrors]? = nil) {
|
||||
self.errors = errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.GetWatchlistWatchlistResponseBody: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case errors
|
||||
}
|
||||
}
|
||||
|
||||
30
Sources/Plexswift/models/operations/Image.swift
Normal file
30
Sources/Plexswift/models/operations/Image.swift
Normal file
@@ -0,0 +1,30 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct Image {
|
||||
public let alt: String?
|
||||
public let type: String?
|
||||
public let url: String?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(alt: String? = nil, type: String? = nil, url: String? = nil) {
|
||||
self.alt = alt
|
||||
self.type = type
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.Image: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case alt
|
||||
case type
|
||||
case url
|
||||
}
|
||||
}
|
||||
|
||||
12
Sources/Plexswift/models/operations/IncludeCollections.swift
Normal file
12
Sources/Plexswift/models/operations/IncludeCollections.swift
Normal file
@@ -0,0 +1,12 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// include collections in the results
|
||||
///
|
||||
public enum IncludeCollections: Int, Codable, APIValue {
|
||||
case one = 1
|
||||
case zero = 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// include external media in the results
|
||||
///
|
||||
public enum IncludeExternalMedia: Int, Codable, APIValue {
|
||||
case one = 1
|
||||
case zero = 0
|
||||
}
|
||||
}
|
||||
12
Sources/Plexswift/models/operations/Libtype.swift
Normal file
12
Sources/Plexswift/models/operations/Libtype.swift
Normal file
@@ -0,0 +1,12 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Operations {
|
||||
/// The type of library to filter. Can be "movie" or "show", or all if not present.
|
||||
///
|
||||
public enum Libtype: String, Codable, APIValue {
|
||||
case movie = "movie"
|
||||
case show = "show"
|
||||
}
|
||||
}
|
||||
@@ -12,15 +12,14 @@ extension Operations {
|
||||
public let country: String?
|
||||
public let europeanUnionMember: Bool?
|
||||
public let inPrivacyRestrictedCountry: Bool?
|
||||
@DecimalSerialized
|
||||
public private(set) var postalCode: Double?
|
||||
public let postalCode: String?
|
||||
public let subdivisions: String?
|
||||
public let timeZone: String?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(city: String? = nil, code: String? = nil, continentCode: String? = nil, coordinates: String? = nil, country: String? = nil, europeanUnionMember: Bool? = nil, inPrivacyRestrictedCountry: Bool? = nil, postalCode: Double? = nil, subdivisions: String? = nil, timeZone: String? = nil) {
|
||||
public init(city: String? = nil, code: String? = nil, continentCode: String? = nil, coordinates: String? = nil, country: String? = nil, europeanUnionMember: Bool? = nil, inPrivacyRestrictedCountry: Bool? = nil, postalCode: String? = nil, subdivisions: String? = nil, timeZone: String? = nil) {
|
||||
self.city = city
|
||||
self.code = code
|
||||
self.continentCode = continentCode
|
||||
@@ -28,7 +27,7 @@ extension Operations {
|
||||
self.country = country
|
||||
self.europeanUnionMember = europeanUnionMember
|
||||
self.inPrivacyRestrictedCountry = inPrivacyRestrictedCountry
|
||||
self._postalCode = DecimalSerialized<Double?>(wrappedValue: postalCode)
|
||||
self.postalCode = postalCode
|
||||
self.subdivisions = subdivisions
|
||||
self.timeZone = timeZone
|
||||
}
|
||||
@@ -48,40 +47,5 @@ extension Operations.Location: Codable {
|
||||
case subdivisions
|
||||
case timeZone = "time_zone"
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.city = try container.decodeIfPresent(String.self, forKey: .city)
|
||||
self.code = try container.decodeIfPresent(String.self, forKey: .code)
|
||||
self.continentCode = try container.decodeIfPresent(String.self, forKey: .continentCode)
|
||||
self.coordinates = try container.decodeIfPresent(String.self, forKey: .coordinates)
|
||||
self.country = try container.decodeIfPresent(String.self, forKey: .country)
|
||||
self.europeanUnionMember = try container.decodeIfPresent(Bool.self, forKey: .europeanUnionMember)
|
||||
self.inPrivacyRestrictedCountry = try container.decodeIfPresent(Bool.self, forKey: .inPrivacyRestrictedCountry)
|
||||
self._postalCode = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .postalCode) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.subdivisions = try container.decodeIfPresent(String.self, forKey: .subdivisions)
|
||||
self.timeZone = try container.decodeIfPresent(String.self, forKey: .timeZone)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(self.city, forKey: .city)
|
||||
try container.encodeIfPresent(self.code, forKey: .code)
|
||||
try container.encodeIfPresent(self.continentCode, forKey: .continentCode)
|
||||
try container.encodeIfPresent(self.coordinates, forKey: .coordinates)
|
||||
try container.encodeIfPresent(self.country, forKey: .country)
|
||||
try container.encodeIfPresent(self.europeanUnionMember, forKey: .europeanUnionMember)
|
||||
try container.encodeIfPresent(self.inPrivacyRestrictedCountry, forKey: .inPrivacyRestrictedCountry)
|
||||
if self.postalCode != nil {
|
||||
try container.encode(self._postalCode, forKey: .postalCode)
|
||||
}
|
||||
try container.encodeIfPresent(self.subdivisions, forKey: .subdivisions)
|
||||
try container.encodeIfPresent(self.timeZone, forKey: .timeZone)
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.Location {
|
||||
var postalCodeWrapper: DecimalSerialized<Double?> {
|
||||
return _postalCode
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,84 +5,84 @@ import Foundation
|
||||
extension Operations {
|
||||
/// A model object
|
||||
public struct Metadata {
|
||||
@DecimalSerialized
|
||||
public private(set) var addedAt: Double?
|
||||
public let allowSync: Bool?
|
||||
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 availabilityId: String?
|
||||
public let banner: String?
|
||||
public let childCount: Int?
|
||||
public let contentRating: String?
|
||||
public let country: [Operations.Country]?
|
||||
public let director: [Operations.Director]?
|
||||
@DecimalSerialized
|
||||
public private(set) var duration: Double?
|
||||
public let genre: [Operations.Genre]?
|
||||
public let duration: Int?
|
||||
public let expiresAt: Int?
|
||||
public let guid: String?
|
||||
public let image: [Operations.Image]?
|
||||
public let imdbRatingCount: Int?
|
||||
public let isContinuingSeries: Bool?
|
||||
public let key: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var librarySectionID: Double?
|
||||
public let librarySectionTitle: String?
|
||||
public let librarySectionUUID: String?
|
||||
public let media: [Operations.Media]?
|
||||
@DateTime
|
||||
public let leafCount: Int?
|
||||
@DateOnly
|
||||
public private(set) var originallyAvailableAt: Date?
|
||||
public let primaryExtraKey: String?
|
||||
public let originalTitle: String?
|
||||
public let playableKey: String?
|
||||
public let publicPagesURL: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var rating: Double?
|
||||
public let ratingImage: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var ratingKey: Double?
|
||||
public let role: [Operations.Role]?
|
||||
public let ratingKey: String?
|
||||
public let skipChildren: Bool?
|
||||
public let slug: String?
|
||||
public let streamingMediaId: String?
|
||||
public let studio: String?
|
||||
public let summary: String?
|
||||
public let subtype: String?
|
||||
public let tagline: String?
|
||||
public let theme: String?
|
||||
public let thumb: String?
|
||||
public let title: String?
|
||||
public let type: String?
|
||||
@DecimalSerialized
|
||||
public private(set) var updatedAt: Double?
|
||||
public let writer: [Operations.Writer]?
|
||||
@DecimalSerialized
|
||||
public private(set) var year: Double?
|
||||
public let userState: Bool?
|
||||
public let year: Int?
|
||||
|
||||
/// Creates an object with the specified parameters
|
||||
///
|
||||
///
|
||||
public init(addedAt: Double? = nil, allowSync: Bool? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, chapterSource: String? = nil, contentRating: String? = nil, country: [Operations.Country]? = nil, director: [Operations.Director]? = nil, duration: Double? = nil, genre: [Operations.Genre]? = nil, guid: String? = nil, key: String? = nil, librarySectionID: Double? = nil, librarySectionTitle: String? = nil, librarySectionUUID: String? = nil, media: [Operations.Media]? = nil, originallyAvailableAt: Date? = nil, primaryExtraKey: String? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: Double? = nil, role: [Operations.Role]? = nil, studio: String? = nil, summary: String? = nil, tagline: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, updatedAt: Double? = nil, writer: [Operations.Writer]? = nil, year: Double? = nil) {
|
||||
self._addedAt = DecimalSerialized<Double?>(wrappedValue: addedAt)
|
||||
self.allowSync = allowSync
|
||||
public init(addedAt: Int? = nil, art: String? = nil, audienceRating: Double? = nil, audienceRatingImage: String? = nil, availabilityId: String? = nil, banner: String? = nil, childCount: Int? = nil, contentRating: String? = nil, duration: Int? = nil, expiresAt: Int? = nil, guid: String? = nil, image: [Operations.Image]? = nil, imdbRatingCount: Int? = nil, isContinuingSeries: Bool? = nil, key: String? = nil, leafCount: Int? = nil, originallyAvailableAt: Date? = nil, originalTitle: String? = nil, playableKey: String? = nil, publicPagesURL: String? = nil, rating: Double? = nil, ratingImage: String? = nil, ratingKey: String? = nil, skipChildren: Bool? = nil, slug: String? = nil, streamingMediaId: String? = nil, studio: String? = nil, subtype: String? = nil, tagline: String? = nil, theme: String? = nil, thumb: String? = nil, title: String? = nil, type: String? = nil, userState: Bool? = nil, year: Int? = nil) {
|
||||
self.addedAt = addedAt
|
||||
self.art = art
|
||||
self._audienceRating = DecimalSerialized<Double?>(wrappedValue: audienceRating)
|
||||
self.audienceRatingImage = audienceRatingImage
|
||||
self.chapterSource = chapterSource
|
||||
self.availabilityId = availabilityId
|
||||
self.banner = banner
|
||||
self.childCount = childCount
|
||||
self.contentRating = contentRating
|
||||
self.country = country
|
||||
self.director = director
|
||||
self._duration = DecimalSerialized<Double?>(wrappedValue: duration)
|
||||
self.genre = genre
|
||||
self.duration = duration
|
||||
self.expiresAt = expiresAt
|
||||
self.guid = guid
|
||||
self.image = image
|
||||
self.imdbRatingCount = imdbRatingCount
|
||||
self.isContinuingSeries = isContinuingSeries
|
||||
self.key = key
|
||||
self._librarySectionID = DecimalSerialized<Double?>(wrappedValue: librarySectionID)
|
||||
self.librarySectionTitle = librarySectionTitle
|
||||
self.librarySectionUUID = librarySectionUUID
|
||||
self.media = media
|
||||
self._originallyAvailableAt = DateTime<Date?>(wrappedValue: originallyAvailableAt)
|
||||
self.primaryExtraKey = primaryExtraKey
|
||||
self.leafCount = leafCount
|
||||
self._originallyAvailableAt = DateOnly<Date?>(wrappedValue: originallyAvailableAt)
|
||||
self.originalTitle = originalTitle
|
||||
self.playableKey = playableKey
|
||||
self.publicPagesURL = publicPagesURL
|
||||
self._rating = DecimalSerialized<Double?>(wrappedValue: rating)
|
||||
self.ratingImage = ratingImage
|
||||
self._ratingKey = DecimalSerialized<Double?>(wrappedValue: ratingKey)
|
||||
self.role = role
|
||||
self.ratingKey = ratingKey
|
||||
self.skipChildren = skipChildren
|
||||
self.slug = slug
|
||||
self.streamingMediaId = streamingMediaId
|
||||
self.studio = studio
|
||||
self.summary = summary
|
||||
self.subtype = subtype
|
||||
self.tagline = tagline
|
||||
self.theme = theme
|
||||
self.thumb = thumb
|
||||
self.title = title
|
||||
self.type = type
|
||||
self._updatedAt = DecimalSerialized<Double?>(wrappedValue: updatedAt)
|
||||
self.writer = writer
|
||||
self._year = DecimalSerialized<Double?>(wrappedValue: year)
|
||||
self.userState = userState
|
||||
self.year = year
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,136 +90,130 @@ extension Operations {
|
||||
extension Operations.Metadata: Codable {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case addedAt
|
||||
case allowSync
|
||||
case art
|
||||
case audienceRating
|
||||
case audienceRatingImage
|
||||
case chapterSource
|
||||
case availabilityId
|
||||
case banner
|
||||
case childCount
|
||||
case contentRating
|
||||
case country = "Country"
|
||||
case director = "Director"
|
||||
case duration
|
||||
case genre = "Genre"
|
||||
case expiresAt
|
||||
case guid
|
||||
case image = "Image"
|
||||
case imdbRatingCount
|
||||
case isContinuingSeries
|
||||
case key
|
||||
case librarySectionID
|
||||
case librarySectionTitle
|
||||
case librarySectionUUID
|
||||
case media = "Media"
|
||||
case leafCount
|
||||
case originallyAvailableAt
|
||||
case primaryExtraKey
|
||||
case originalTitle
|
||||
case playableKey
|
||||
case publicPagesURL
|
||||
case rating
|
||||
case ratingImage
|
||||
case ratingKey
|
||||
case role = "Role"
|
||||
case skipChildren
|
||||
case slug
|
||||
case streamingMediaId
|
||||
case studio
|
||||
case summary
|
||||
case subtype
|
||||
case tagline
|
||||
case theme
|
||||
case thumb
|
||||
case title
|
||||
case type
|
||||
case updatedAt
|
||||
case writer = "Writer"
|
||||
case userState
|
||||
case year
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self._addedAt = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .addedAt) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.allowSync = try container.decodeIfPresent(Bool.self, forKey: .allowSync)
|
||||
self.addedAt = try container.decodeIfPresent(Int.self, forKey: .addedAt)
|
||||
self.art = try container.decodeIfPresent(String.self, forKey: .art)
|
||||
self._audienceRating = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .audienceRating) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.audienceRatingImage = try container.decodeIfPresent(String.self, forKey: .audienceRatingImage)
|
||||
self.chapterSource = try container.decodeIfPresent(String.self, forKey: .chapterSource)
|
||||
self.availabilityId = try container.decodeIfPresent(String.self, forKey: .availabilityId)
|
||||
self.banner = try container.decodeIfPresent(String.self, forKey: .banner)
|
||||
self.childCount = try container.decodeIfPresent(Int.self, forKey: .childCount)
|
||||
self.contentRating = try container.decodeIfPresent(String.self, forKey: .contentRating)
|
||||
self.country = try container.decodeIfPresent([Operations.Country].self, forKey: .country)
|
||||
self.director = try container.decodeIfPresent([Operations.Director].self, forKey: .director)
|
||||
self._duration = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .duration) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.genre = try container.decodeIfPresent([Operations.Genre].self, forKey: .genre)
|
||||
self.duration = try container.decodeIfPresent(Int.self, forKey: .duration)
|
||||
self.expiresAt = try container.decodeIfPresent(Int.self, forKey: .expiresAt)
|
||||
self.guid = try container.decodeIfPresent(String.self, forKey: .guid)
|
||||
self.image = try container.decodeIfPresent([Operations.Image].self, forKey: .image)
|
||||
self.imdbRatingCount = try container.decodeIfPresent(Int.self, forKey: .imdbRatingCount)
|
||||
self.isContinuingSeries = try container.decodeIfPresent(Bool.self, forKey: .isContinuingSeries)
|
||||
self.key = try container.decodeIfPresent(String.self, forKey: .key)
|
||||
self._librarySectionID = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .librarySectionID) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.librarySectionTitle = try container.decodeIfPresent(String.self, forKey: .librarySectionTitle)
|
||||
self.librarySectionUUID = try container.decodeIfPresent(String.self, forKey: .librarySectionUUID)
|
||||
self.media = try container.decodeIfPresent([Operations.Media].self, forKey: .media)
|
||||
self._originallyAvailableAt = try container.decodeIfPresent(DateTime<Date?>.self, forKey: .originallyAvailableAt) ?? DateTime<Date?>(wrappedValue: nil)
|
||||
self.primaryExtraKey = try container.decodeIfPresent(String.self, forKey: .primaryExtraKey)
|
||||
self.leafCount = try container.decodeIfPresent(Int.self, forKey: .leafCount)
|
||||
self._originallyAvailableAt = try container.decodeIfPresent(DateOnly<Date?>.self, forKey: .originallyAvailableAt) ?? DateOnly<Date?>(wrappedValue: nil)
|
||||
self.originalTitle = try container.decodeIfPresent(String.self, forKey: .originalTitle)
|
||||
self.playableKey = try container.decodeIfPresent(String.self, forKey: .playableKey)
|
||||
self.publicPagesURL = try container.decodeIfPresent(String.self, forKey: .publicPagesURL)
|
||||
self._rating = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .rating) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.ratingImage = try container.decodeIfPresent(String.self, forKey: .ratingImage)
|
||||
self._ratingKey = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .ratingKey) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.role = try container.decodeIfPresent([Operations.Role].self, forKey: .role)
|
||||
self.ratingKey = try container.decodeIfPresent(String.self, forKey: .ratingKey)
|
||||
self.skipChildren = try container.decodeIfPresent(Bool.self, forKey: .skipChildren)
|
||||
self.slug = try container.decodeIfPresent(String.self, forKey: .slug)
|
||||
self.streamingMediaId = try container.decodeIfPresent(String.self, forKey: .streamingMediaId)
|
||||
self.studio = try container.decodeIfPresent(String.self, forKey: .studio)
|
||||
self.summary = try container.decodeIfPresent(String.self, forKey: .summary)
|
||||
self.subtype = try container.decodeIfPresent(String.self, forKey: .subtype)
|
||||
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.type = try container.decodeIfPresent(String.self, forKey: .type)
|
||||
self._updatedAt = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .updatedAt) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.writer = try container.decodeIfPresent([Operations.Writer].self, forKey: .writer)
|
||||
self._year = try container.decodeIfPresent(DecimalSerialized<Double?>.self, forKey: .year) ?? DecimalSerialized<Double?>(wrappedValue: nil)
|
||||
self.userState = try container.decodeIfPresent(Bool.self, forKey: .userState)
|
||||
self.year = try container.decodeIfPresent(Int.self, forKey: .year)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
if self.addedAt != nil {
|
||||
try container.encode(self._addedAt, forKey: .addedAt)
|
||||
}
|
||||
try container.encodeIfPresent(self.allowSync, forKey: .allowSync)
|
||||
try container.encodeIfPresent(self.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.availabilityId, forKey: .availabilityId)
|
||||
try container.encodeIfPresent(self.banner, forKey: .banner)
|
||||
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)
|
||||
if self.duration != nil {
|
||||
try container.encode(self._duration, forKey: .duration)
|
||||
}
|
||||
try container.encodeIfPresent(self.genre, forKey: .genre)
|
||||
try container.encodeIfPresent(self.duration, forKey: .duration)
|
||||
try container.encodeIfPresent(self.expiresAt, forKey: .expiresAt)
|
||||
try container.encodeIfPresent(self.guid, forKey: .guid)
|
||||
try container.encodeIfPresent(self.image, forKey: .image)
|
||||
try container.encodeIfPresent(self.imdbRatingCount, forKey: .imdbRatingCount)
|
||||
try container.encodeIfPresent(self.isContinuingSeries, forKey: .isContinuingSeries)
|
||||
try container.encodeIfPresent(self.key, forKey: .key)
|
||||
if self.librarySectionID != nil {
|
||||
try container.encode(self._librarySectionID, forKey: .librarySectionID)
|
||||
}
|
||||
try container.encodeIfPresent(self.librarySectionTitle, forKey: .librarySectionTitle)
|
||||
try container.encodeIfPresent(self.librarySectionUUID, forKey: .librarySectionUUID)
|
||||
try container.encodeIfPresent(self.media, forKey: .media)
|
||||
try container.encodeIfPresent(self.leafCount, forKey: .leafCount)
|
||||
if self.originallyAvailableAt != nil {
|
||||
try container.encode(self._originallyAvailableAt, forKey: .originallyAvailableAt)
|
||||
}
|
||||
try container.encodeIfPresent(self.primaryExtraKey, forKey: .primaryExtraKey)
|
||||
try container.encodeIfPresent(self.originalTitle, forKey: .originalTitle)
|
||||
try container.encodeIfPresent(self.playableKey, forKey: .playableKey)
|
||||
try container.encodeIfPresent(self.publicPagesURL, forKey: .publicPagesURL)
|
||||
if self.rating != nil {
|
||||
try container.encode(self._rating, forKey: .rating)
|
||||
}
|
||||
try container.encodeIfPresent(self.ratingImage, forKey: .ratingImage)
|
||||
if self.ratingKey != nil {
|
||||
try container.encode(self._ratingKey, forKey: .ratingKey)
|
||||
}
|
||||
try container.encodeIfPresent(self.role, forKey: .role)
|
||||
try container.encodeIfPresent(self.ratingKey, forKey: .ratingKey)
|
||||
try container.encodeIfPresent(self.skipChildren, forKey: .skipChildren)
|
||||
try container.encodeIfPresent(self.slug, forKey: .slug)
|
||||
try container.encodeIfPresent(self.streamingMediaId, forKey: .streamingMediaId)
|
||||
try container.encodeIfPresent(self.studio, forKey: .studio)
|
||||
try container.encodeIfPresent(self.summary, forKey: .summary)
|
||||
try container.encodeIfPresent(self.subtype, forKey: .subtype)
|
||||
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.type, forKey: .type)
|
||||
if self.updatedAt != nil {
|
||||
try container.encode(self._updatedAt, forKey: .updatedAt)
|
||||
}
|
||||
try container.encodeIfPresent(self.writer, forKey: .writer)
|
||||
if self.year != nil {
|
||||
try container.encode(self._year, forKey: .year)
|
||||
}
|
||||
try container.encodeIfPresent(self.userState, forKey: .userState)
|
||||
try container.encodeIfPresent(self.year, forKey: .year)
|
||||
}
|
||||
}
|
||||
|
||||
extension Operations.Metadata {
|
||||
var librarySectionIDWrapper: DecimalSerialized<Double?> {
|
||||
return _librarySectionID
|
||||
}
|
||||
var ratingKeyWrapper: DecimalSerialized<Double?> {
|
||||
return _ratingKey
|
||||
var originallyAvailableAtWrapper: DateOnly<Date?> {
|
||||
return _originallyAvailableAt
|
||||
}
|
||||
var ratingWrapper: DecimalSerialized<Double?> {
|
||||
return _rating
|
||||
@@ -227,19 +221,4 @@ extension Operations.Metadata {
|
||||
var audienceRatingWrapper: DecimalSerialized<Double?> {
|
||||
return _audienceRating
|
||||
}
|
||||
var yearWrapper: DecimalSerialized<Double?> {
|
||||
return _year
|
||||
}
|
||||
var durationWrapper: DecimalSerialized<Double?> {
|
||||
return _duration
|
||||
}
|
||||
var originallyAvailableAtWrapper: DateTime<Date?> {
|
||||
return _originallyAvailableAt
|
||||
}
|
||||
var addedAtWrapper: DecimalSerialized<Double?> {
|
||||
return _addedAt
|
||||
}
|
||||
var updatedAtWrapper: DecimalSerialized<Double?> {
|
||||
return _updatedAt
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,16 +22,17 @@ import Foundation
|
||||
/// - ``video``
|
||||
/// - ``activities``
|
||||
/// - ``butler``
|
||||
/// - ``plex``
|
||||
/// - ``hubs``
|
||||
/// - ``search``
|
||||
/// - ``library``
|
||||
/// - ``log``
|
||||
/// - ``plex``
|
||||
/// - ``playlists``
|
||||
/// - ``authentication``
|
||||
/// - ``statistics``
|
||||
/// - ``sessions``
|
||||
/// - ``updater``
|
||||
/// - ``watchlist``
|
||||
///
|
||||
public protocol PlexswiftAPI {
|
||||
|
||||
@@ -57,6 +58,9 @@ public protocol PlexswiftAPI {
|
||||
/// Butler is the task manager of the Plex Media Server Ecosystem.
|
||||
///
|
||||
var butler: ButlerAPI { get }
|
||||
/// API Calls that perform operations directly against https://Plex.tv
|
||||
///
|
||||
var plex: PlexAPI { get }
|
||||
/// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
|
||||
///
|
||||
var hubs: HubsAPI { get }
|
||||
@@ -69,9 +73,6 @@ public protocol PlexswiftAPI {
|
||||
/// Submit logs to the Log Handler for Plex Media Server
|
||||
///
|
||||
var log: LogAPI { get }
|
||||
/// API Calls that perform operations directly against https://Plex.tv
|
||||
///
|
||||
var plex: PlexAPI { get }
|
||||
/// Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017").
|
||||
/// They can be organized in (optionally nesting) folders.
|
||||
/// Retrieving a playlist, or its items, will trigger a refresh of its metadata.
|
||||
@@ -91,6 +92,9 @@ public protocol PlexswiftAPI {
|
||||
/// Updates to the status can be observed via the Event API.
|
||||
///
|
||||
var updater: UpdaterAPI { get }
|
||||
/// API Calls that perform operations with Plex Media Server Watchlists
|
||||
///
|
||||
var watchlist: WatchlistAPI { get }
|
||||
}
|
||||
|
||||
// MARK: - ServerAPI
|
||||
@@ -322,6 +326,115 @@ public protocol ButlerAPI {
|
||||
func stopTask(request: Operations.StopTaskRequest) async throws -> Response<Operations.StopTaskResponse>
|
||||
}
|
||||
|
||||
// MARK: - PlexAPI
|
||||
public enum PlexServers {
|
||||
|
||||
/// Describes the available servers that can be used when making 'getPin' requests.
|
||||
///
|
||||
/// Use this type when making calls to ``PlexAPI/getPin(request:server:)`` to customize the server which is used.
|
||||
public enum GetPin: Servers, ServerConvertible {
|
||||
/// Supported server value.
|
||||
///
|
||||
/// Corresponds to `https://plex.tv/api/v2`
|
||||
case server1
|
||||
|
||||
/// Defines the raw URL strings for each server option.
|
||||
///
|
||||
/// > Note: You do not need to use these values directly.
|
||||
///
|
||||
/// The available URL strings are defined as:
|
||||
/// ```swift
|
||||
/// public static let urlStrings = [
|
||||
/// "https://plex.tv/api/v2"
|
||||
/// ]
|
||||
/// ```
|
||||
public static let urlStrings = [
|
||||
"https://plex.tv/api/v2"
|
||||
]
|
||||
|
||||
static func `default`() throws -> Server {
|
||||
return try PlexServers.GetPin.server1.server()
|
||||
}
|
||||
|
||||
func server() throws -> Server {
|
||||
switch self {
|
||||
case .server1:
|
||||
return try type(of: self).server(at: 0, substituting: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes the available servers that can be used when making 'getToken' requests.
|
||||
///
|
||||
/// Use this type when making calls to ``PlexAPI/getToken(request:server:)`` to customize the server which is used.
|
||||
public enum GetToken: Servers, ServerConvertible {
|
||||
/// Supported server value.
|
||||
///
|
||||
/// Corresponds to `https://plex.tv/api/v2`
|
||||
case server1
|
||||
|
||||
/// Defines the raw URL strings for each server option.
|
||||
///
|
||||
/// > Note: You do not need to use these values directly.
|
||||
///
|
||||
/// The available URL strings are defined as:
|
||||
/// ```swift
|
||||
/// public static let urlStrings = [
|
||||
/// "https://plex.tv/api/v2"
|
||||
/// ]
|
||||
/// ```
|
||||
public static let urlStrings = [
|
||||
"https://plex.tv/api/v2"
|
||||
]
|
||||
|
||||
static func `default`() throws -> Server {
|
||||
return try PlexServers.GetToken.server1.server()
|
||||
}
|
||||
|
||||
func server() throws -> Server {
|
||||
switch self {
|
||||
case .server1:
|
||||
return try type(of: self).server(at: 0, substituting: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// API Calls that perform operations directly against https://Plex.tv
|
||||
///
|
||||
///
|
||||
/// ## Topics
|
||||
///
|
||||
/// ### API calls
|
||||
///
|
||||
/// - ``getHomeData()``
|
||||
/// - ``getPin(request:server:)``
|
||||
/// - ``getToken(request:server:)``
|
||||
///
|
||||
public protocol PlexAPI {
|
||||
/// Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.
|
||||
///
|
||||
/// - Returns: A ``Operations/GetHomeDataResponse`` object describing the result of the API operation
|
||||
/// - Throws: An error of type ``PlexswiftError``
|
||||
func getHomeData() async throws -> Response<Operations.GetHomeDataResponse>
|
||||
|
||||
/// Retrieve a Pin from Plex.tv for authentication flows
|
||||
///
|
||||
/// - Parameter request: A ``Operations/GetPinRequest`` object describing the input to the API operation
|
||||
/// - Parameter server: An optional server override to use for this operation
|
||||
/// - Returns: A ``Operations/GetPinResponse`` object describing the result of the API operation
|
||||
/// - Throws: An error of type ``PlexswiftError``
|
||||
func getPin(request: Operations.GetPinRequest, server: PlexServers.GetPin?) async throws -> Response<Operations.GetPinResponse>
|
||||
|
||||
/// Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
|
||||
///
|
||||
/// - Parameter request: A ``Operations/GetTokenRequest`` object describing the input to the API operation
|
||||
/// - Parameter server: An optional server override to use for this operation
|
||||
/// - Returns: A ``Operations/GetTokenResponse`` object describing the result of the API operation
|
||||
/// - Throws: An error of type ``PlexswiftError``
|
||||
func getToken(request: Operations.GetTokenRequest, server: PlexServers.GetToken?) async throws -> Response<Operations.GetTokenResponse>
|
||||
}
|
||||
|
||||
// MARK: - HubsAPI
|
||||
|
||||
/// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
|
||||
@@ -646,108 +759,6 @@ public protocol LogAPI {
|
||||
func enablePaperTrail() async throws -> Response<Operations.EnablePaperTrailResponse>
|
||||
}
|
||||
|
||||
// MARK: - PlexAPI
|
||||
public enum PlexServers {
|
||||
|
||||
/// Describes the available servers that can be used when making 'getPin' requests.
|
||||
///
|
||||
/// Use this type when making calls to ``PlexAPI/getPin(request:server:)`` to customize the server which is used.
|
||||
public enum GetPin: Servers, ServerConvertible {
|
||||
/// Supported server value.
|
||||
///
|
||||
/// Corresponds to `https://plex.tv/api/v2`
|
||||
case server1
|
||||
|
||||
/// Defines the raw URL strings for each server option.
|
||||
///
|
||||
/// > Note: You do not need to use these values directly.
|
||||
///
|
||||
/// The available URL strings are defined as:
|
||||
/// ```swift
|
||||
/// public static let urlStrings = [
|
||||
/// "https://plex.tv/api/v2"
|
||||
/// ]
|
||||
/// ```
|
||||
public static let urlStrings = [
|
||||
"https://plex.tv/api/v2"
|
||||
]
|
||||
|
||||
static func `default`() throws -> Server {
|
||||
return try PlexServers.GetPin.server1.server()
|
||||
}
|
||||
|
||||
func server() throws -> Server {
|
||||
switch self {
|
||||
case .server1:
|
||||
return try type(of: self).server(at: 0, substituting: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes the available servers that can be used when making 'getToken' requests.
|
||||
///
|
||||
/// Use this type when making calls to ``PlexAPI/getToken(request:server:)`` to customize the server which is used.
|
||||
public enum GetToken: Servers, ServerConvertible {
|
||||
/// Supported server value.
|
||||
///
|
||||
/// Corresponds to `https://plex.tv/api/v2`
|
||||
case server1
|
||||
|
||||
/// Defines the raw URL strings for each server option.
|
||||
///
|
||||
/// > Note: You do not need to use these values directly.
|
||||
///
|
||||
/// The available URL strings are defined as:
|
||||
/// ```swift
|
||||
/// public static let urlStrings = [
|
||||
/// "https://plex.tv/api/v2"
|
||||
/// ]
|
||||
/// ```
|
||||
public static let urlStrings = [
|
||||
"https://plex.tv/api/v2"
|
||||
]
|
||||
|
||||
static func `default`() throws -> Server {
|
||||
return try PlexServers.GetToken.server1.server()
|
||||
}
|
||||
|
||||
func server() throws -> Server {
|
||||
switch self {
|
||||
case .server1:
|
||||
return try type(of: self).server(at: 0, substituting: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// API Calls that perform operations directly against https://Plex.tv
|
||||
///
|
||||
///
|
||||
/// ## Topics
|
||||
///
|
||||
/// ### API calls
|
||||
///
|
||||
/// - ``getPin(request:server:)``
|
||||
/// - ``getToken(request:server:)``
|
||||
///
|
||||
public protocol PlexAPI {
|
||||
/// Retrieve a Pin from Plex.tv for authentication flows
|
||||
///
|
||||
/// - Parameter request: A ``Operations/GetPinRequest`` object describing the input to the API operation
|
||||
/// - Parameter server: An optional server override to use for this operation
|
||||
/// - Returns: A ``Operations/GetPinResponse`` object describing the result of the API operation
|
||||
/// - Throws: An error of type ``PlexswiftError``
|
||||
func getPin(request: Operations.GetPinRequest, server: PlexServers.GetPin?) async throws -> Response<Operations.GetPinResponse>
|
||||
|
||||
/// Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
|
||||
///
|
||||
/// - Parameter request: A ``Operations/GetTokenRequest`` object describing the input to the API operation
|
||||
/// - Parameter server: An optional server override to use for this operation
|
||||
/// - Returns: A ``Operations/GetTokenResponse`` object describing the result of the API operation
|
||||
/// - Throws: An error of type ``PlexswiftError``
|
||||
func getToken(request: Operations.GetTokenRequest, server: PlexServers.GetToken?) async throws -> Response<Operations.GetTokenResponse>
|
||||
}
|
||||
|
||||
// MARK: - PlaylistsAPI
|
||||
|
||||
/// Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017").
|
||||
@@ -978,3 +989,61 @@ public protocol UpdaterAPI {
|
||||
/// - Throws: An error of type ``PlexswiftError``
|
||||
func applyUpdates(request: Operations.ApplyUpdatesRequest) async throws -> Response<Operations.ApplyUpdatesResponse>
|
||||
}
|
||||
|
||||
// MARK: - WatchlistAPI
|
||||
public enum WatchlistServers {
|
||||
|
||||
/// Describes the available servers that can be used when making 'getWatchlist' requests.
|
||||
///
|
||||
/// Use this type when making calls to ``WatchlistAPI/getWatchlist(request:server:)`` to customize the server which is used.
|
||||
public enum GetWatchlist: Servers, ServerConvertible {
|
||||
/// Supported server value.
|
||||
///
|
||||
/// Corresponds to `https://metadata.provider.plex.tv`
|
||||
case server1
|
||||
|
||||
/// Defines the raw URL strings for each server option.
|
||||
///
|
||||
/// > Note: You do not need to use these values directly.
|
||||
///
|
||||
/// The available URL strings are defined as:
|
||||
/// ```swift
|
||||
/// public static let urlStrings = [
|
||||
/// "https://metadata.provider.plex.tv"
|
||||
/// ]
|
||||
/// ```
|
||||
public static let urlStrings = [
|
||||
"https://metadata.provider.plex.tv"
|
||||
]
|
||||
|
||||
static func `default`() throws -> Server {
|
||||
return try WatchlistServers.GetWatchlist.server1.server()
|
||||
}
|
||||
|
||||
func server() throws -> Server {
|
||||
switch self {
|
||||
case .server1:
|
||||
return try type(of: self).server(at: 0, substituting: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// API Calls that perform operations with Plex Media Server Watchlists
|
||||
///
|
||||
///
|
||||
/// ## Topics
|
||||
///
|
||||
/// ### API calls
|
||||
///
|
||||
/// - ``getWatchlist(request:server:)``
|
||||
///
|
||||
public protocol WatchlistAPI {
|
||||
/// Get User Watchlist
|
||||
///
|
||||
/// - Parameter request: A ``Operations/GetWatchlistRequest`` object describing the input to the API operation
|
||||
/// - Parameter server: An optional server override to use for this operation
|
||||
/// - Returns: A ``Operations/GetWatchlistResponse`` object describing the result of the API operation
|
||||
/// - Throws: An error of type ``PlexswiftError``
|
||||
func getWatchlist(request: Operations.GetWatchlistRequest, server: WatchlistServers.GetWatchlist?) async throws -> Response<Operations.GetWatchlistResponse>
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ extension Client: PlexswiftAPI {
|
||||
return _ButlerAPI(client: self)
|
||||
}
|
||||
|
||||
public var plex: PlexAPI {
|
||||
return _PlexAPI(client: self)
|
||||
}
|
||||
|
||||
public var hubs: HubsAPI {
|
||||
return _HubsAPI(client: self)
|
||||
}
|
||||
@@ -43,10 +47,6 @@ extension Client: PlexswiftAPI {
|
||||
return _LogAPI(client: self)
|
||||
}
|
||||
|
||||
public var plex: PlexAPI {
|
||||
return _PlexAPI(client: self)
|
||||
}
|
||||
|
||||
public var playlists: PlaylistsAPI {
|
||||
return _PlaylistsAPI(client: self)
|
||||
}
|
||||
@@ -66,6 +66,10 @@ extension Client: PlexswiftAPI {
|
||||
public var updater: UpdaterAPI {
|
||||
return _UpdaterAPI(client: self)
|
||||
}
|
||||
|
||||
public var watchlist: WatchlistAPI {
|
||||
return _WatchlistAPI(client: self)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Request Configuration
|
||||
|
||||
@@ -62,7 +62,7 @@ final class URLRequestBuilder: URLRequestConfiguration {
|
||||
urlRequest.setValue(contentType, forHTTPHeaderField: "Content-Type")
|
||||
}
|
||||
|
||||
urlRequest.setValue("speakeasy-sdk/swift 0.3.1 2.338.12 0.0.3 plexswift", forHTTPHeaderField: telemetryHeader.headerName)
|
||||
urlRequest.setValue("speakeasy-sdk/swift 0.4.0 2.342.6 0.0.3 plexswift", forHTTPHeaderField: telemetryHeader.headerName)
|
||||
|
||||
addSecurityParameters(to: &urlRequest)
|
||||
|
||||
|
||||
1054
codeSamples.yaml
1054
codeSamples.yaml
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user