mirror of
https://github.com/LukeHagar/plexswift.git
synced 2025-12-06 12:47:44 +00:00
migrated to v15
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# This allows generated code to be indexed correctly
|
||||||
|
*.swift linguist-generated=false
|
||||||
@@ -15,14 +15,10 @@ permissions:
|
|||||||
- cron: 0 0 * * *
|
- cron: 0 0 * * *
|
||||||
jobs:
|
jobs:
|
||||||
generate:
|
generate:
|
||||||
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-generation.yaml@v14
|
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
|
||||||
with:
|
with:
|
||||||
force: ${{ github.event.inputs.force }}
|
force: ${{ github.event.inputs.force }}
|
||||||
languages: |
|
|
||||||
- swift
|
|
||||||
mode: direct
|
mode: direct
|
||||||
openapi_docs: |
|
|
||||||
- https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml
|
|
||||||
speakeasy_version: latest
|
speakeasy_version: latest
|
||||||
secrets:
|
secrets:
|
||||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
.DS_Store
|
||||||
|
/.build
|
||||||
|
/Packages
|
||||||
|
/*.xcodeproj
|
||||||
|
xcuserdata/
|
||||||
|
DerivedData/
|
||||||
|
.swiftpm/config/registries.json
|
||||||
|
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
||||||
|
.netrc
|
||||||
518
.speakeasy/gen.lock
Executable file
518
.speakeasy/gen.lock
Executable file
@@ -0,0 +1,518 @@
|
|||||||
|
lockVersion: 2.0.0
|
||||||
|
id: 5d77204e-e413-4fd0-a14a-bad3aee2247a
|
||||||
|
management:
|
||||||
|
docChecksum: e34dac84738ebf2d447ea2b9055a6eeb
|
||||||
|
docVersion: 0.0.3
|
||||||
|
speakeasyVersion: 1.210.0
|
||||||
|
generationVersion: 2.281.2
|
||||||
|
releaseVersion: 0.0.1
|
||||||
|
configChecksum: b1ec644cb39ebdb23044adf16e6d5e0f
|
||||||
|
features:
|
||||||
|
swift:
|
||||||
|
core: 3.2.2
|
||||||
|
globalSecurity: 2.81.4
|
||||||
|
globalServerURLs: 2.82.1
|
||||||
|
methodServerURLs: 3.0.1
|
||||||
|
nameOverrides: 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/_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/configuration/GlobalServer.swift
|
||||||
|
- Sources/Plexswift/Client.swift
|
||||||
|
- Package.swift
|
||||||
|
- Sources/plexswift/AnyValue.swift
|
||||||
|
- Sources/plexswift/internal/api/Client+PlexswiftAPI.swift
|
||||||
|
- Sources/plexswift/internal/client/Response.swift
|
||||||
|
- Sources/plexswift/internal/client/Servers.swift
|
||||||
|
- Sources/plexswift/internal/client/URLRequestBuilder.swift
|
||||||
|
- Sources/plexswift/internal/client/URLRequestConfiguration.swift
|
||||||
|
- Sources/plexswift/internal/extensions/HTTPURLResponse+ContentType.swift
|
||||||
|
- Sources/plexswift/internal/extensions/String+ContentType.swift
|
||||||
|
- Sources/plexswift/internal/extensions/String+ParameterSubstitution.swift
|
||||||
|
- Sources/plexswift/internal/serialization/Form.swift
|
||||||
|
- Sources/plexswift/internal/serialization/JSON.swift
|
||||||
|
- Sources/plexswift/internal/serialization/Maps.swift
|
||||||
|
- Sources/plexswift/internal/serialization/Parameters.swift
|
||||||
|
- Sources/plexswift/internal/serialization/PropertyWrappers.swift
|
||||||
|
- Sources/plexswift/internal/serialization/QueryParameters.swift
|
||||||
|
- Sources/plexswift/internal/serialization/SecurityParameters.swift
|
||||||
|
- Sources/plexswift/internal/serialization/Serializable.swift
|
||||||
|
- Sources/plexswift/PlexswiftError.swift
|
||||||
|
- Sources/plexswift/PlexswiftAPI.swift
|
||||||
|
- Sources/Plexswift/models/ModelScopes.swift
|
||||||
|
- Sources/Plexswift/models/operations/Account.swift
|
||||||
|
- Sources/Plexswift/models/operations/Activity.swift
|
||||||
|
- Sources/Plexswift/models/operations/AddPlaylistContentsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/AddPlaylistContentsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/AddPlaylistContentsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/AddPlaylistContentsPlaylistsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/AddPlaylistContentsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/AddPlaylistContentsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/AddPlaylistContentsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/AddPlaylistContentsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/ApplyUpdatesErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/ApplyUpdatesRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/ApplyUpdatesRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/ApplyUpdatesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/ApplyUpdatesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/ButlerTask.swift
|
||||||
|
- Sources/Plexswift/models/operations/ButlerTasks.swift
|
||||||
|
- Sources/Plexswift/models/operations/CancelServerActivitiesErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/CancelServerActivitiesRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/CancelServerActivitiesRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/CancelServerActivitiesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/CancelServerActivitiesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/CheckForUpdatesErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/CheckForUpdatesRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/CheckForUpdatesRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/CheckForUpdatesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/CheckForUpdatesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/ClearPlaylistContentsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/ClearPlaylistContentsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/ClearPlaylistContentsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/ClearPlaylistContentsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/ClearPlaylistContentsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Context.swift
|
||||||
|
- Sources/Plexswift/models/operations/Country.swift
|
||||||
|
- Sources/Plexswift/models/operations/CreatePlaylistErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/CreatePlaylistMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/CreatePlaylistMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/CreatePlaylistPlaylistsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/CreatePlaylistRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/CreatePlaylistRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/CreatePlaylistResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/CreatePlaylistResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeleteLibraryErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeleteLibraryRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/DeleteLibraryRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeleteLibraryResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeleteLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeletePlaylistErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeletePlaylistRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/DeletePlaylistRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeletePlaylistResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/DeletePlaylistResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Device.swift
|
||||||
|
- Sources/Plexswift/models/operations/Director.swift
|
||||||
|
- Sources/Plexswift/models/operations/Directory.swift
|
||||||
|
- Sources/Plexswift/models/operations/Download.swift
|
||||||
|
- Sources/Plexswift/internal/models/Download+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/EnablePaperTrailErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/EnablePaperTrailResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/EnablePaperTrailResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Errors.swift
|
||||||
|
- Sources/Plexswift/models/operations/Field.swift
|
||||||
|
- Sources/Plexswift/models/operations/FieldType.swift
|
||||||
|
- Sources/Plexswift/models/operations/Filter.swift
|
||||||
|
- Sources/Plexswift/models/operations/Force.swift
|
||||||
|
- Sources/Plexswift/internal/models/Force+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Genre.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetAvailableClientsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetAvailableClientsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetAvailableClientsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetAvailableClientsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetAvailableClientsServerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetButlerTasksButlerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetButlerTasksErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetButlerTasksResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetButlerTasksResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetDevicesErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetDevicesMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetDevicesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetDevicesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetDevicesServerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetFileHashErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetFileHashRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetFileHashRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetFileHashResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetFileHashResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetGlobalHubsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetGlobalHubsHubsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetGlobalHubsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetGlobalHubsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetGlobalHubsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetGlobalHubsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetGlobalHubsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetGlobalHubsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibrariesDirectory.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibrariesErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibrariesLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibrariesLocation.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibrariesMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibrariesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibrariesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryDirectory.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsCountry.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsDirector.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsGenre.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsHub.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsHubsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsPart.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetLibraryHubsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsRole.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryHubsWriter.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsCountry.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsDirector.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsGenre.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsPart.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetLibraryItemsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsRole.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryItemsWriter.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetLibraryRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetLibraryType.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenDirectory.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetMetadataChildrenRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataChildrenResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataCountry.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataDirector.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataGenre.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataPart.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetMetadataRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataRole.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMetadataWriter.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMyPlexAccountErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMyPlexAccountResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMyPlexAccountResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetMyPlexAccountServerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckGuids.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckPart.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetOnDeckStream.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPinErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPinPlexResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPinRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetPinRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPinResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPinResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsCountry.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsDirector.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsGenre.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsPart.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsPlaylistsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetPlaylistContentsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsRole.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistContentsWriter.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistPlaylistsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetPlaylistRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistsPlaylistsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetPlaylistsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetPlaylistsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetRecentlyAddedErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetRecentlyAddedLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetRecentlyAddedMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetRecentlyAddedResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetRecentlyAddedResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetResizedPhotoErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetResizedPhotoRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetResizedPhotoRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetResizedPhotoResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetResizedPhotoResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsCountry.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsDirector.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsGenre.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsPart.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetSearchResultsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsRole.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsSearchResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSearchResultsWriter.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerActivitiesActivitiesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerActivitiesErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerActivitiesMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerActivitiesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerActivitiesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerCapabilitiesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerCapabilitiesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerCapabilitiesServerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerIdentityErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerIdentityMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerIdentityResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerIdentityResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerIdentityServerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerListErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerListMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerListResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerListResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerListServer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerListServerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerPreferencesErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerPreferencesMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerPreferencesResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerPreferencesResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetServerPreferencesServerResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionHistoryErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionHistoryMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionHistoryMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionHistoryResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionHistoryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionHistorySessionsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsPart.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsSessionsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSessionsStream.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSourceConnectionInformationErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSourceConnectionInformationRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetSourceConnectionInformationRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSourceConnectionInformationResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetSourceConnectionInformationResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetStatisticsDevice.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetStatisticsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetStatisticsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetStatisticsRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetStatisticsRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetStatisticsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetStatisticsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetStatisticsStatisticsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTimelineErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTimelineRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetTimelineRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTimelineResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTimelineResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTokenErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTokenRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetTokenRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTokenResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTokenResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTranscodeSessionsErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTranscodeSessionsMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTranscodeSessionsResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTranscodeSessionsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTranscodeSessionsSessionsResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTransientTokenErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTransientTokenQueryParamType.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetTransientTokenQueryParamType+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTransientTokenRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/GetTransientTokenRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTransientTokenResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetTransientTokenResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetUpdateStatusErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetUpdateStatusMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetUpdateStatusResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetUpdateStatusResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/GetUpdateStatusUpdaterResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Guids.swift
|
||||||
|
- Sources/Plexswift/models/operations/Hub.swift
|
||||||
|
- Sources/Plexswift/models/operations/IncludeDetails.swift
|
||||||
|
- Sources/Plexswift/internal/models/IncludeDetails+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Level.swift
|
||||||
|
- Sources/Plexswift/internal/models/Level+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Location.swift
|
||||||
|
- Sources/Plexswift/models/operations/LogLineErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/LogLineRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/LogLineRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/LogLineResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/LogLineResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/LogMultiLineErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/LogMultiLineResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/LogMultiLineResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkPlayedErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkPlayedRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/MarkPlayedRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkPlayedResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkPlayedResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkUnplayedErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkUnplayedRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/MarkUnplayedRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkUnplayedResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/MarkUnplayedResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Media.swift
|
||||||
|
- Sources/Plexswift/models/operations/MediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/Metadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/MinSize.swift
|
||||||
|
- Sources/Plexswift/internal/models/MinSize+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/MyPlex.swift
|
||||||
|
- Sources/Plexswift/models/operations/OnlyTransient.swift
|
||||||
|
- Sources/Plexswift/internal/models/OnlyTransient+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Operator.swift
|
||||||
|
- Sources/Plexswift/models/operations/Part.swift
|
||||||
|
- Sources/Plexswift/models/operations/PathParamTaskName.swift
|
||||||
|
- Sources/Plexswift/internal/models/PathParamTaskName+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformSearchErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformSearchRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/PerformSearchRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformSearchResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformSearchResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformVoiceSearchErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformVoiceSearchRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/PerformVoiceSearchRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformVoiceSearchResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/PerformVoiceSearchResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Player.swift
|
||||||
|
- Sources/Plexswift/models/operations/PlaylistType.swift
|
||||||
|
- Sources/Plexswift/internal/models/PlaylistType+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Producer.swift
|
||||||
|
- Sources/Plexswift/models/operations/Provider.swift
|
||||||
|
- Sources/Plexswift/models/operations/QueryParamOnlyTransient.swift
|
||||||
|
- Sources/Plexswift/internal/models/QueryParamOnlyTransient+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/QueryParamSmart.swift
|
||||||
|
- Sources/Plexswift/internal/models/QueryParamSmart+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/QueryParamType.swift
|
||||||
|
- Sources/Plexswift/internal/models/QueryParamType+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Ratings.swift
|
||||||
|
- Sources/Plexswift/models/operations/RefreshLibraryErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/RefreshLibraryRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/RefreshLibraryRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/RefreshLibraryResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/RefreshLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Release.swift
|
||||||
|
- Sources/Plexswift/models/operations/Role.swift
|
||||||
|
- Sources/Plexswift/models/operations/Scope.swift
|
||||||
|
- Sources/Plexswift/internal/models/Scope+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/SearchLibraryMediaContainer.swift
|
||||||
|
- Sources/Plexswift/models/operations/SearchLibraryMetadata.swift
|
||||||
|
- Sources/Plexswift/models/operations/SearchLibraryRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/SearchLibraryRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/SearchLibraryResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/SearchLibraryResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Server.swift
|
||||||
|
- Sources/Plexswift/models/operations/Session.swift
|
||||||
|
- Sources/Plexswift/models/operations/Setting.swift
|
||||||
|
- Sources/Plexswift/models/operations/Skip.swift
|
||||||
|
- Sources/Plexswift/internal/models/Skip+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Smart.swift
|
||||||
|
- Sources/Plexswift/internal/models/Smart+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Sort.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartAllTasksErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartAllTasksResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartAllTasksResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartTaskErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartTaskRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/StartTaskRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartTaskResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartTaskResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartUniversalTranscodeErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartUniversalTranscodeRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/StartUniversalTranscodeRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartUniversalTranscodeResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/StartUniversalTranscodeResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/State.swift
|
||||||
|
- Sources/Plexswift/internal/models/State+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/StatisticsMedia.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopAllTasksErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopAllTasksResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopAllTasksResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTaskErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTaskRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/StopTaskRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTaskResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTaskResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTranscodeSessionErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTranscodeSessionRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/StopTranscodeSessionRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTranscodeSessionResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/StopTranscodeSessionResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Stream.swift
|
||||||
|
- Sources/Plexswift/models/operations/Tag.swift
|
||||||
|
- Sources/Plexswift/internal/models/Tag+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/TaskName.swift
|
||||||
|
- Sources/Plexswift/internal/models/TaskName+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/Tonight.swift
|
||||||
|
- Sources/Plexswift/internal/models/Tonight+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/TranscodeSession.swift
|
||||||
|
- Sources/Plexswift/models/operations/TypeModel.swift
|
||||||
|
- Sources/Plexswift/internal/models/TypeModel+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlayProgressErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlayProgressRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/UpdatePlayProgressRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlayProgressResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlayProgressResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlaylistErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlaylistRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/UpdatePlaylistRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlaylistResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/UpdatePlaylistResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/UploadPlaylistErrors.swift
|
||||||
|
- Sources/Plexswift/models/operations/UploadPlaylistRequest.swift
|
||||||
|
- Sources/Plexswift/internal/models/UploadPlaylistRequest+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/UploadPlaylistResponse.swift
|
||||||
|
- Sources/Plexswift/models/operations/UploadPlaylistResponseBody.swift
|
||||||
|
- Sources/Plexswift/models/operations/Upscale.swift
|
||||||
|
- Sources/Plexswift/internal/models/Upscale+Serialization.swift
|
||||||
|
- Sources/Plexswift/models/operations/User.swift
|
||||||
|
- Sources/Plexswift/models/operations/Writer.swift
|
||||||
|
- Sources/Plexswift/models/shared/Security.swift
|
||||||
|
- Sources/Plexswift/internal/models/Security+Serialization.swift
|
||||||
|
- USAGE.md
|
||||||
|
- Sources/Plexswift/Plexswift.docc/Plexswift.md
|
||||||
|
- .gitattributes
|
||||||
@@ -9,6 +9,8 @@ generation:
|
|||||||
nameResolutionDec2023: false
|
nameResolutionDec2023: false
|
||||||
parameterOrderingFeb2024: false
|
parameterOrderingFeb2024: false
|
||||||
requestResponseComponentNamesFeb2024: false
|
requestResponseComponentNamesFeb2024: false
|
||||||
|
auth:
|
||||||
|
oAuth2ClientCredentialsEnabled: true
|
||||||
swift:
|
swift:
|
||||||
version: 0.0.1
|
version: 0.0.1
|
||||||
author: LukeHagar
|
author: LukeHagar
|
||||||
9
.speakeasy/workflow.yaml
Normal file
9
.speakeasy/workflow.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
workflowVersion: 1.0.0
|
||||||
|
sources:
|
||||||
|
my-source:
|
||||||
|
inputs:
|
||||||
|
- location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml
|
||||||
|
targets:
|
||||||
|
plexswift:
|
||||||
|
target: swift
|
||||||
|
source: my-source
|
||||||
22
Package.swift
Normal file
22
Package.swift
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// swift-tools-version: 5.6
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "Plexswift",
|
||||||
|
platforms: [
|
||||||
|
.iOS(.v13)
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
.library(
|
||||||
|
name: "Plexswift",
|
||||||
|
targets: ["Plexswift"]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
dependencies: [],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "Plexswift",
|
||||||
|
dependencies: []
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
118
README.md
Normal file
118
README.md
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
# plexswift
|
||||||
|
|
||||||
|
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
||||||
|
<a href="https://opensource.org/licenses/MIT">
|
||||||
|
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
|
||||||
|
</a>
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
The SDK supports iOS 13 and later.
|
||||||
|
|
||||||
|
|
||||||
|
## 🏗 **Welcome to your new SDK!** 🏗
|
||||||
|
|
||||||
|
It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps:
|
||||||
|
- [ ] 🛠 Make your SDK feel handcrafted by [customizing it](https://www.speakeasyapi.dev/docs/customize-sdks)
|
||||||
|
- [ ] ♻️ Refine your SDK quickly by iterating locally with the [Speakeasy CLI](https://github.com/speakeasy-api/speakeasy)
|
||||||
|
- [ ] 🎁 Publish your SDK to package managers by [configuring automatic publishing](https://www.speakeasyapi.dev/docs/productionize-sdks/publish-sdks)
|
||||||
|
- [ ] ✨ When ready to productionize, delete this section from the README
|
||||||
|
|
||||||
|
<!-- Start SDK Installation [installation] -->
|
||||||
|
## SDK Installation
|
||||||
|
|
||||||
|
### Swift Package Manager
|
||||||
|
|
||||||
|
You can add `plexswift` to your project directly in Xcode `(File > Add Packages...)` or by adding it to your project's Package.swift file.
|
||||||
|
<!-- End SDK Installation [installation] -->
|
||||||
|
|
||||||
|
<!-- Start SDK Example Usage [usage] -->
|
||||||
|
## SDK Example Usage
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import Foundation
|
||||||
|
import Plexswift
|
||||||
|
|
||||||
|
let client = Client(security: .accessToken("<YOUR_API_KEY_HERE>"))
|
||||||
|
|
||||||
|
let response = try await client.server.getServerCapabilities()
|
||||||
|
|
||||||
|
switch response.data {
|
||||||
|
case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):
|
||||||
|
// Handle response
|
||||||
|
break
|
||||||
|
case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):
|
||||||
|
// Handle response
|
||||||
|
break
|
||||||
|
case .empty:
|
||||||
|
// Handle empty response
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
<!-- End SDK Example Usage [usage] -->
|
||||||
|
|
||||||
|
<!-- Start Available Resources and Operations [operations] -->
|
||||||
|
## Available Resources and Operations
|
||||||
|
|
||||||
|
|
||||||
|
<!-- End Available Resources and Operations [operations] -->
|
||||||
|
|
||||||
|
<!-- Start Authentication [security] -->
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
### Global Security Schemes
|
||||||
|
|
||||||
|
The SDK supports the following security scheme globally through the `Shared.Security` type:
|
||||||
|
|
||||||
|
| Name | Type | Scheme |
|
||||||
|
| -------------- | -------------- | -------------- |
|
||||||
|
| `.accessToken` | apiKey | API key |
|
||||||
|
|
||||||
|
You can set the appropriate security parameters by passing a `Shared.Security` value for the `security` parameter when initializing the `Client` instance. For example:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import Foundation
|
||||||
|
import Plexswift
|
||||||
|
|
||||||
|
let client = Client(security: .accessToken("<YOUR_API_KEY_HERE>"))
|
||||||
|
|
||||||
|
let response = try await client.server.getServerCapabilities()
|
||||||
|
|
||||||
|
switch response.data {
|
||||||
|
case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):
|
||||||
|
// Handle response
|
||||||
|
break
|
||||||
|
case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):
|
||||||
|
// Handle response
|
||||||
|
break
|
||||||
|
case .empty:
|
||||||
|
// Handle empty response
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
<!-- End Authentication [security] -->
|
||||||
|
|
||||||
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
||||||
|
|
||||||
|
# Development
|
||||||
|
|
||||||
|
## Maturity
|
||||||
|
|
||||||
|
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
||||||
|
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
||||||
|
looking for the latest version.
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
|
While we value open-source contributions to this SDK, this library is generated programmatically.
|
||||||
|
Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!
|
||||||
|
|
||||||
|
### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
|
||||||
220
Sources/Plexswift/AnyValue.swift
Normal file
220
Sources/Plexswift/AnyValue.swift
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// A type that describes any value that can be used in a request or response object.
|
||||||
|
public protocol APIValue {}
|
||||||
|
|
||||||
|
extension NSNull: APIValue {}
|
||||||
|
extension String: APIValue {}
|
||||||
|
extension Int: APIValue {}
|
||||||
|
extension Double: APIValue {}
|
||||||
|
extension Bool: APIValue {}
|
||||||
|
extension Optional: APIValue where Wrapped: APIValue {}
|
||||||
|
extension Array: APIValue where Element: APIValue {}
|
||||||
|
extension Dictionary: APIValue where Key == String, Value: APIValue {}
|
||||||
|
|
||||||
|
enum APIValueConversionError: Error {
|
||||||
|
case invalidType
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A type-erased wrapper for passing around ``APIValue`` values.
|
||||||
|
public struct AnyValue: Codable {
|
||||||
|
// This is a type-erased wrapper which allows us to store Serializable values in collections, as well as handle
|
||||||
|
// JSON encoding and decoding.
|
||||||
|
|
||||||
|
private var _serialize: (_ format: SerializableFormat) throws -> String
|
||||||
|
private var _serializeQueryParameters: (_ format: SerializableFormat) throws -> [QueryParameter]
|
||||||
|
private var _description: () -> String
|
||||||
|
private var _serializable: () -> any Serializable
|
||||||
|
|
||||||
|
init(serializable: Serializable) {
|
||||||
|
_serialize = { format in try serializable.serialize(with: format) }
|
||||||
|
_serializeQueryParameters = { format in try serializable.serializeQueryParameters(with: format) }
|
||||||
|
_serializable = { return serializable }
|
||||||
|
_description = {
|
||||||
|
if let serializable = serializable as? CustomStringConvertible {
|
||||||
|
return serializable.description
|
||||||
|
} else {
|
||||||
|
return String(describing: serializable)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from an `NSNull` value
|
||||||
|
public init(_ null: NSNull) {
|
||||||
|
self.init(serializable: null)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from a string value
|
||||||
|
public init(_ string: String) {
|
||||||
|
self.init(serializable: string)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from an integer value
|
||||||
|
public init(_ int: Int) {
|
||||||
|
self.init(serializable: int)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from a double value
|
||||||
|
public init(_ double: Double) {
|
||||||
|
self.init(serializable: double)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from a boolean value
|
||||||
|
public init(_ bool: Bool) {
|
||||||
|
self.init(serializable: bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from any ``APIValue`` value
|
||||||
|
public init(_ value: APIValue) throws {
|
||||||
|
guard let serializable = value as? Serializable else {
|
||||||
|
throw APIValueConversionError.invalidType
|
||||||
|
}
|
||||||
|
self.init(serializable: serializable)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from an optional value
|
||||||
|
public init<T: APIValue>(_ optional: Optional<T>) throws {
|
||||||
|
guard let serializable = optional as? Serializable else {
|
||||||
|
throw APIValueConversionError.invalidType
|
||||||
|
}
|
||||||
|
self.init(serializable: serializable)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from an array value
|
||||||
|
public init<T: APIValue>(_ array: Array<T>) throws {
|
||||||
|
guard let serializable = array as? Serializable else {
|
||||||
|
throw APIValueConversionError.invalidType
|
||||||
|
}
|
||||||
|
self.init(serializable: serializable)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates an object from a dictionary value
|
||||||
|
public init<T: APIValue>(_ dictionary: Dictionary<String, T>) throws {
|
||||||
|
guard let serializable = dictionary as? Serializable else {
|
||||||
|
throw APIValueConversionError.invalidType
|
||||||
|
}
|
||||||
|
self.init(serializable: serializable)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Codable
|
||||||
|
|
||||||
|
public init(from decoder: Decoder) throws {
|
||||||
|
let container = try decoder.singleValueContainer()
|
||||||
|
|
||||||
|
if container.decodeNil() {
|
||||||
|
self.init(serializable: NSNull())
|
||||||
|
} else if let boolValue = try? container.decode(Bool.self) {
|
||||||
|
self.init(serializable: boolValue)
|
||||||
|
} else if let intValue = try? container.decode(Int.self) {
|
||||||
|
self.init(serializable: intValue)
|
||||||
|
} else if let doubleValue = try? container.decode(Double.self) {
|
||||||
|
self.init(serializable: doubleValue)
|
||||||
|
} else if let stringValue = try? container.decode(String.self) {
|
||||||
|
self.init(serializable: stringValue)
|
||||||
|
} else if let arrayValue = try? container.decode([AnyValue].self) {
|
||||||
|
self.init(serializable: arrayValue)
|
||||||
|
} else if let dictionaryValue = try? container.decode([String: AnyValue].self) {
|
||||||
|
self.init(serializable: dictionaryValue)
|
||||||
|
} else {
|
||||||
|
throw DecodingError.dataCorruptedError(
|
||||||
|
in: container,
|
||||||
|
debugDescription: "Unsupported value in container. Is this valid JSON?"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.singleValueContainer()
|
||||||
|
let value = _serializable()
|
||||||
|
|
||||||
|
if value is NSNull {
|
||||||
|
try container.encodeNil()
|
||||||
|
} else if let boolValue = value as? Bool {
|
||||||
|
try container.encode(boolValue)
|
||||||
|
} else if let intValue = value as? Int {
|
||||||
|
try container.encode(intValue)
|
||||||
|
} else if let doubleValue = value as? Double {
|
||||||
|
try container.encode(doubleValue)
|
||||||
|
} else if let stringValue = value as? String {
|
||||||
|
try container.encode(stringValue)
|
||||||
|
} else if let arrayValue = value as? [AnyValue] {
|
||||||
|
try container.encode(arrayValue)
|
||||||
|
} else if let dictionaryValue = value as? [String: AnyValue] {
|
||||||
|
try container.encode(dictionaryValue)
|
||||||
|
} else if let encodableValue = value as? Encodable {
|
||||||
|
try container.encode(encodableValue)
|
||||||
|
} else {
|
||||||
|
let context = EncodingError.Context(codingPath: container.codingPath, debugDescription: "Cannot encode value")
|
||||||
|
throw EncodingError.invalidValue(value, context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Serializable
|
||||||
|
|
||||||
|
extension AnyValue: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try _serialize(format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try _serializeQueryParameters(format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
extension AnyValue {
|
||||||
|
subscript(key: String) -> AnyValue? {
|
||||||
|
if let serializable = _serializable() as? [String: Serializable], let value = serializable[key] {
|
||||||
|
return AnyValue(serializable: value)
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func `as`<T>(type: T.Type) -> T? {
|
||||||
|
return _serializable() as? T
|
||||||
|
}
|
||||||
|
|
||||||
|
func asArray<T>(elementType: T.Type) -> [T]? {
|
||||||
|
guard let array = _serializable() as? [AnyValue] else { return nil }
|
||||||
|
var result: [T] = []
|
||||||
|
for element in array {
|
||||||
|
guard let element = element.as(type: T.self) else { return nil }
|
||||||
|
result.append(element)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Equatable
|
||||||
|
|
||||||
|
extension AnyValue: Equatable {
|
||||||
|
public static func == (lhs: AnyValue, rhs: AnyValue) -> Bool {
|
||||||
|
let lhsValue = lhs._serializable()
|
||||||
|
let rhsValue = rhs._serializable()
|
||||||
|
|
||||||
|
switch (lhsValue, rhsValue) {
|
||||||
|
case is (NSNull, NSNull): return true
|
||||||
|
case let (lhsValue as Bool, rhsValue as Bool): return lhsValue == rhsValue
|
||||||
|
case let (lhsValue as Int, rhsValue as Int): return lhsValue == rhsValue
|
||||||
|
case let (lhsValue as Double, rhsValue as Double): return lhsValue == rhsValue
|
||||||
|
case let (lhsValue as String, rhsValue as String): return lhsValue == rhsValue
|
||||||
|
case let (lhsValue as [AnyValue], rhsValue as [AnyValue]): return lhsValue == rhsValue
|
||||||
|
case let (lhsValue as [String: AnyValue], rhsValue as [String: AnyValue]): return lhsValue == rhsValue
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - CustomStringConvertible
|
||||||
|
|
||||||
|
extension AnyValue: CustomStringConvertible {
|
||||||
|
public var description: String {
|
||||||
|
return _description()
|
||||||
|
}
|
||||||
|
}
|
||||||
211
Sources/Plexswift/Client.swift
Normal file
211
Sources/Plexswift/Client.swift
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
#if os(Linux)
|
||||||
|
import FoundationNetworking
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// An object used to make API calls.
|
||||||
|
///
|
||||||
|
/// ``Client`` is the main object that you interact with to communicate with the API, and is responsible for making the underlying HTTP requests for each API operation and handling the resulting responses. It implements the ``PlexswiftAPI`` protocol to support the available API operations.
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// Each API endpoint (or *operation*) is exposed as a method. For instance, the 'getResizedPhoto' operation is exposed as:
|
||||||
|
///
|
||||||
|
/// ```swift
|
||||||
|
/// func getResizedPhoto(request: Operations.GetResizedPhotoRequest) async throws -> Response<Operations.GetResizedPhotoResponse>
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ### Request and response objects
|
||||||
|
///
|
||||||
|
/// If an API operation has input parameters, the corresponding API method takes a `request` object, describing these parameters. The request object can either be a primitive value like a `String` or `[String]`, or a Swift `struct` describing the parameters.
|
||||||
|
///
|
||||||
|
/// Each API method also returns a ``Response`` object, which provides information about the result of making the API request. It is generic and parameterised by the resulting data — stored in the ``Response/data`` property — which is determined by each API operation.
|
||||||
|
///
|
||||||
|
/// The ``Response/data`` property defined by each API operation is an enum, and you can `switch` on this value to extract the corresponding value from the response. For example, the 'getResizedPhoto' operation returns a ``Operations/GetResizedPhotoResponse`` value:
|
||||||
|
///
|
||||||
|
/// ```swift
|
||||||
|
/// let response: Response<Operations.GetResizedPhotoResponse> = ... // Response from API call
|
||||||
|
/// switch response.data {
|
||||||
|
/// case .object(let object):
|
||||||
|
/// // Handle response
|
||||||
|
/// case .empty:
|
||||||
|
/// // Handle empty response
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// In addition to any data returned by a given API operation, each ``Response`` value contains information about the network request, including:
|
||||||
|
/// - The `contentType` returned by the server.
|
||||||
|
/// - The `statusCode` representing the HTTP status code returned by making the request
|
||||||
|
/// - A `httpResponse` value which is the raw [HTTPURLResponse](https://developer.apple.com/documentation/foundation/httpurlresponse) returned from making the underlying network request.
|
||||||
|
///
|
||||||
|
/// These values can be used to debug and/or react to responses returned from executing a given API operation.
|
||||||
|
///
|
||||||
|
/// ### Authentication
|
||||||
|
///
|
||||||
|
/// Calls to the API must be authenticated, and ``Client`` must be initialized with a configured ``Shared/Security`` object to authenticate requests.
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### Initializers
|
||||||
|
///
|
||||||
|
/// - ``init(security:)``
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// These methods allow you to make requests to the API.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ### Scoped API calls
|
||||||
|
///
|
||||||
|
/// These properties logically group other parts of the API.
|
||||||
|
///
|
||||||
|
/// - ``server``
|
||||||
|
/// - ``media``
|
||||||
|
/// - ``video``
|
||||||
|
/// - ``activities``
|
||||||
|
/// - ``butler``
|
||||||
|
/// - ``hubs``
|
||||||
|
/// - ``search``
|
||||||
|
/// - ``library``
|
||||||
|
/// - ``log``
|
||||||
|
/// - ``plex``
|
||||||
|
/// - ``playlists``
|
||||||
|
/// - ``authentication``
|
||||||
|
/// - ``statistics``
|
||||||
|
/// - ``sessions``
|
||||||
|
/// - ``updater``
|
||||||
|
///
|
||||||
|
public final class Client {
|
||||||
|
internal struct APIResponse {
|
||||||
|
let httpResponse: HTTPURLResponse
|
||||||
|
let data: Data?
|
||||||
|
}
|
||||||
|
|
||||||
|
internal typealias ConfigureURLRequest = (_ configuration: URLRequestConfiguration) throws -> Void
|
||||||
|
internal typealias ResponseHandler<ResponseObject> = (_ apiResponse: APIResponse) throws -> ResponseObject
|
||||||
|
|
||||||
|
// Underscore-prefix properties so these do not potentially conflict with any operation namespaces.
|
||||||
|
private lazy var _session = URLSession(configuration: .default)
|
||||||
|
private var _security: Shared.Security
|
||||||
|
|
||||||
|
private var _selectedServer: GlobalServers?
|
||||||
|
|
||||||
|
/// Creates an API client object with the specified parameters.
|
||||||
|
public init(security: Shared.Security) {
|
||||||
|
self._security = security
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Internal
|
||||||
|
|
||||||
|
internal func makeRequest<ResponseType: ResponseFields, ResponseObject>(
|
||||||
|
with server: Server? = nil,
|
||||||
|
configureRequest: @escaping ConfigureURLRequest,
|
||||||
|
handleResponse responseHandler: @escaping ResponseHandler<ResponseObject>
|
||||||
|
) async throws -> ResponseType where ResponseType.T == ResponseObject {
|
||||||
|
return try await withCheckedThrowingContinuation { continuation in
|
||||||
|
_makeRequest(with: server, configureRequest: configureRequest) { result in
|
||||||
|
do {
|
||||||
|
let apiResponse = try result.get()
|
||||||
|
let responseObject = try responseHandler(apiResponse)
|
||||||
|
continuation.resume(returning: ResponseType(httpResponse: apiResponse.httpResponse, data: responseObject))
|
||||||
|
} catch let error as ServerConversionError {
|
||||||
|
switch error {
|
||||||
|
case .internal:
|
||||||
|
continuation.resume(throwing: PlexswiftError.internalError(error: nil))
|
||||||
|
case .missingDefaultServer(let serverType):
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToConstructRequestURL(.missingDefaultServer(serverType: serverType)))
|
||||||
|
case .invalidServerIndex(let serverType, let index):
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToConstructRequestURL(.invalidServerIndex(serverType: serverType, index: index)))
|
||||||
|
case .missingServerParameterSubstitutionKey(let key, let serverString):
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.missingServerParameterSubstitutionKey(key, serverString: serverString)))
|
||||||
|
}
|
||||||
|
} catch let error as URLRequestBuilderError {
|
||||||
|
switch error {
|
||||||
|
case .internalError:
|
||||||
|
continuation.resume(throwing: PlexswiftError.internalError(error: nil))
|
||||||
|
case .invalidURL(let urlString):
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToConstructRequestURL(.invalidRequestURL(string: urlString)))
|
||||||
|
case .missingPathParameterSubstitutionKey(let key, let path):
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.missingPathParameterSubstitutionKey(key, path: path)))
|
||||||
|
}
|
||||||
|
} catch let error as SerializationError {
|
||||||
|
switch error {
|
||||||
|
case .failedToSerializeData:
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.failedToSerializeData))
|
||||||
|
case .missingRequiredRequestBody:
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToConstructRequest(.missingRequiredRequestBody))
|
||||||
|
case .invalidSerializationParameter(let type, let format):
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToSerializeRequestParameters(.invalidSerializationParameter(type: type, format: format)))
|
||||||
|
}
|
||||||
|
} catch let error as ResponseHandlerError {
|
||||||
|
switch error {
|
||||||
|
case .failedToDecodeResponse:
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToHandleResponse(.failedToDecodeResponse))
|
||||||
|
case .failedToDecodeJSON(let error):
|
||||||
|
continuation.resume(throwing: PlexswiftError.failedToHandleResponse(.failedToDeserializeJSON(error)))
|
||||||
|
}
|
||||||
|
} catch let error as PlexswiftError {
|
||||||
|
continuation.resume(throwing: error)
|
||||||
|
} catch {
|
||||||
|
continuation.resume(throwing: PlexswiftError.internalError(error: error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func _makeRequest(
|
||||||
|
with server: Server? = nil,
|
||||||
|
configureRequest: ConfigureURLRequest,
|
||||||
|
completion: @escaping (Result<APIResponse, Swift.Error>) -> Void
|
||||||
|
) {
|
||||||
|
do {
|
||||||
|
let builder = URLRequestBuilder(
|
||||||
|
baseURL: try baseURL(serverOverride: server),
|
||||||
|
parameterDefaults: nil,
|
||||||
|
defaultSecurityParameterProviding: _security
|
||||||
|
)
|
||||||
|
try configureRequest(builder)
|
||||||
|
return makeDataRequest(with: try builder.build(), completion: completion)
|
||||||
|
} catch {
|
||||||
|
completion(.failure(error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Private
|
||||||
|
|
||||||
|
private func baseURL(serverOverride: Server? = nil) throws -> URL {
|
||||||
|
let server: Server
|
||||||
|
if let serverOverride {
|
||||||
|
server = serverOverride
|
||||||
|
} else if let selectedServer = _selectedServer {
|
||||||
|
server = try selectedServer.server()
|
||||||
|
} else {
|
||||||
|
server = try GlobalServers.default()
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let url = URL(string: server.urlString) else {
|
||||||
|
throw PlexswiftError.failedToConstructRequestURL(.invalidServerURL(string: server.urlString))
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
|
private func makeDataRequest(with urlRequest: URLRequest, completion: @escaping (Result<APIResponse, Swift.Error>) -> Void) {
|
||||||
|
let task = _session.dataTask(with: urlRequest) { data, response, error in
|
||||||
|
if let error {
|
||||||
|
completion(.failure(PlexswiftError.failedToMakeNetworkRequest(error: error)))
|
||||||
|
} else if let httpResponse = response as? HTTPURLResponse {
|
||||||
|
completion(.success(APIResponse(httpResponse: httpResponse, data: data)))
|
||||||
|
} else {
|
||||||
|
completion(.failure(PlexswiftError.internalError(error: nil)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
task.resume()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ResponseHandlerError: Swift.Error {
|
||||||
|
case failedToDecodeJSON(_ error: Swift.Error)
|
||||||
|
case failedToDecodeResponse
|
||||||
|
}
|
||||||
493
Sources/Plexswift/Plexswift.docc/Plexswift.md
Normal file
493
Sources/Plexswift/Plexswift.docc/Plexswift.md
Normal file
@@ -0,0 +1,493 @@
|
|||||||
|
# ``plexswift``
|
||||||
|
|
||||||
|
An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||||
|
|
||||||
|
`plexswift` is a Swift library which provides functionality for making requests to the API using a modern, easy-to-use Swift API:
|
||||||
|
|
||||||
|
### SDK Example Usage
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import Foundation
|
||||||
|
import Plexswift
|
||||||
|
|
||||||
|
let client = Client(security: .accessToken("<YOUR_API_KEY_HERE>"))
|
||||||
|
|
||||||
|
let response = try await client.server.getServerCapabilities()
|
||||||
|
|
||||||
|
switch response.data {
|
||||||
|
case .twoHundredApplicationJsonObject(let twoHundredApplicationJsonObject):
|
||||||
|
// Handle response
|
||||||
|
break
|
||||||
|
case .fourHundredAndOneApplicationJsonObject(let fourHundredAndOneApplicationJsonObject):
|
||||||
|
// Handle response
|
||||||
|
break
|
||||||
|
case .empty:
|
||||||
|
// Handle empty response
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Getting started
|
||||||
|
- ``PlexswiftAPI`` defines the available API operations, including operations which are logically grouped by name (for example under ``PlexswiftAPI/server``).
|
||||||
|
- ``Client`` is the main object used when making requests to the API, and implements ``PlexswiftAPI`` to provide this functionality. Each available API method is exposed as an `async` function, which you can call and `await` its response and handle any errors that are thrown.
|
||||||
|
- API methods that require input data take a *request object* describing these parameters, and each method returns a *response object* containing information about the response. You can read more about these in <doc:Client#Request-and-response-objects>.
|
||||||
|
- Requests to the API must be authenticated. You can provide authentication credentials by initializing ``Client`` with a ``Shared/Security`` value.
|
||||||
|
- If an error occurs when making a request to the API, a ``PlexswiftError`` error is thrown with more information about what went wrong.
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### Connecting to the API
|
||||||
|
|
||||||
|
- ``Client``
|
||||||
|
- ``Shared/Security``
|
||||||
|
- ``Response``
|
||||||
|
- ``ResponseWithHeaders``
|
||||||
|
- ``ResponseFields``
|
||||||
|
- ``ResponseHeaders``
|
||||||
|
- ``PlexswiftError``
|
||||||
|
|
||||||
|
### API operations
|
||||||
|
|
||||||
|
- ``plexswift/PlexswiftAPI``
|
||||||
|
- ``ServerAPI``
|
||||||
|
- ``MediaAPI``
|
||||||
|
- ``VideoAPI``
|
||||||
|
- ``ActivitiesAPI``
|
||||||
|
- ``ButlerAPI``
|
||||||
|
- ``HubsAPI``
|
||||||
|
- ``SearchAPI``
|
||||||
|
- ``LibraryAPI``
|
||||||
|
- ``LogAPI``
|
||||||
|
- ``PlexAPI``
|
||||||
|
- ``PlaylistsAPI``
|
||||||
|
- ``AuthenticationAPI``
|
||||||
|
- ``StatisticsAPI``
|
||||||
|
- ``SessionsAPI``
|
||||||
|
- ``UpdaterAPI``
|
||||||
|
|
||||||
|
### Server configuration
|
||||||
|
- ``PlexServers/GetPin``
|
||||||
|
- ``PlexServers/GetToken``
|
||||||
|
|
||||||
|
### Shared models
|
||||||
|
|
||||||
|
### Request objects
|
||||||
|
|
||||||
|
### Response objects
|
||||||
|
- ``Operations/AddPlaylistContentsResponse``
|
||||||
|
- ``Operations/ApplyUpdatesResponse``
|
||||||
|
- ``Operations/CancelServerActivitiesResponse``
|
||||||
|
- ``Operations/CheckForUpdatesResponse``
|
||||||
|
- ``Operations/ClearPlaylistContentsResponse``
|
||||||
|
- ``Operations/CreatePlaylistResponse``
|
||||||
|
- ``Operations/DeleteLibraryResponse``
|
||||||
|
- ``Operations/DeletePlaylistResponse``
|
||||||
|
- ``Operations/EnablePaperTrailResponse``
|
||||||
|
- ``Operations/GetAvailableClientsResponse``
|
||||||
|
- ``Operations/GetButlerTasksResponse``
|
||||||
|
- ``Operations/GetDevicesResponse``
|
||||||
|
- ``Operations/GetFileHashResponse``
|
||||||
|
- ``Operations/GetGlobalHubsResponse``
|
||||||
|
- ``Operations/GetLibrariesResponse``
|
||||||
|
- ``Operations/GetLibraryResponse``
|
||||||
|
- ``Operations/GetLibraryHubsResponse``
|
||||||
|
- ``Operations/GetLibraryItemsResponse``
|
||||||
|
- ``Operations/GetMetadataResponse``
|
||||||
|
- ``Operations/GetMetadataChildrenResponse``
|
||||||
|
- ``Operations/GetMyPlexAccountResponse``
|
||||||
|
- ``Operations/GetOnDeckResponse``
|
||||||
|
- ``Operations/GetPinResponse``
|
||||||
|
- ``Operations/GetPlaylistResponse``
|
||||||
|
- ``Operations/GetPlaylistContentsResponse``
|
||||||
|
- ``Operations/GetPlaylistsResponse``
|
||||||
|
- ``Operations/GetRecentlyAddedResponse``
|
||||||
|
- ``Operations/GetResizedPhotoResponse``
|
||||||
|
- ``Operations/GetSearchResultsResponse``
|
||||||
|
- ``Operations/GetServerActivitiesResponse``
|
||||||
|
- ``Operations/GetServerCapabilitiesResponse``
|
||||||
|
- ``Operations/GetServerIdentityResponse``
|
||||||
|
- ``Operations/GetServerListResponse``
|
||||||
|
- ``Operations/GetServerPreferencesResponse``
|
||||||
|
- ``Operations/GetSessionHistoryResponse``
|
||||||
|
- ``Operations/GetSessionsResponse``
|
||||||
|
- ``Operations/GetSourceConnectionInformationResponse``
|
||||||
|
- ``Operations/GetStatisticsResponse``
|
||||||
|
- ``Operations/GetTimelineResponse``
|
||||||
|
- ``Operations/GetTokenResponse``
|
||||||
|
- ``Operations/GetTranscodeSessionsResponse``
|
||||||
|
- ``Operations/GetTransientTokenResponse``
|
||||||
|
- ``Operations/GetUpdateStatusResponse``
|
||||||
|
- ``Operations/LogLineResponse``
|
||||||
|
- ``Operations/LogMultiLineResponse``
|
||||||
|
- ``Operations/MarkPlayedResponse``
|
||||||
|
- ``Operations/MarkUnplayedResponse``
|
||||||
|
- ``Operations/PerformSearchResponse``
|
||||||
|
- ``Operations/PerformVoiceSearchResponse``
|
||||||
|
- ``Operations/RefreshLibraryResponse``
|
||||||
|
- ``Operations/SearchLibraryResponse``
|
||||||
|
- ``Operations/StartAllTasksResponse``
|
||||||
|
- ``Operations/StartTaskResponse``
|
||||||
|
- ``Operations/StartUniversalTranscodeResponse``
|
||||||
|
- ``Operations/StopAllTasksResponse``
|
||||||
|
- ``Operations/StopTaskResponse``
|
||||||
|
- ``Operations/StopTranscodeSessionResponse``
|
||||||
|
- ``Operations/UpdatePlaylistResponse``
|
||||||
|
- ``Operations/UpdatePlayProgressResponse``
|
||||||
|
- ``Operations/UploadPlaylistResponse``
|
||||||
|
|
||||||
|
### Other models
|
||||||
|
- ``Operations/Account``
|
||||||
|
- ``Operations/Activity``
|
||||||
|
- ``Operations/AddPlaylistContentsErrors``
|
||||||
|
- ``Operations/AddPlaylistContentsMediaContainer``
|
||||||
|
- ``Operations/AddPlaylistContentsMetadata``
|
||||||
|
- ``Operations/AddPlaylistContentsPlaylistsResponseBody``
|
||||||
|
- ``Operations/AddPlaylistContentsRequest``
|
||||||
|
- ``Operations/AddPlaylistContentsResponseBody``
|
||||||
|
- ``Operations/ApplyUpdatesErrors``
|
||||||
|
- ``Operations/ApplyUpdatesRequest``
|
||||||
|
- ``Operations/ApplyUpdatesResponseBody``
|
||||||
|
- ``Operations/ButlerTask``
|
||||||
|
- ``Operations/ButlerTasks``
|
||||||
|
- ``Operations/CancelServerActivitiesErrors``
|
||||||
|
- ``Operations/CancelServerActivitiesRequest``
|
||||||
|
- ``Operations/CancelServerActivitiesResponseBody``
|
||||||
|
- ``Operations/CheckForUpdatesErrors``
|
||||||
|
- ``Operations/CheckForUpdatesRequest``
|
||||||
|
- ``Operations/CheckForUpdatesResponseBody``
|
||||||
|
- ``Operations/ClearPlaylistContentsErrors``
|
||||||
|
- ``Operations/ClearPlaylistContentsRequest``
|
||||||
|
- ``Operations/ClearPlaylistContentsResponseBody``
|
||||||
|
- ``Operations/Context``
|
||||||
|
- ``Operations/Country``
|
||||||
|
- ``Operations/CreatePlaylistErrors``
|
||||||
|
- ``Operations/CreatePlaylistMediaContainer``
|
||||||
|
- ``Operations/CreatePlaylistMetadata``
|
||||||
|
- ``Operations/CreatePlaylistPlaylistsResponseBody``
|
||||||
|
- ``Operations/CreatePlaylistRequest``
|
||||||
|
- ``Operations/CreatePlaylistResponseBody``
|
||||||
|
- ``Operations/DeleteLibraryErrors``
|
||||||
|
- ``Operations/DeleteLibraryRequest``
|
||||||
|
- ``Operations/DeleteLibraryResponseBody``
|
||||||
|
- ``Operations/DeletePlaylistErrors``
|
||||||
|
- ``Operations/DeletePlaylistRequest``
|
||||||
|
- ``Operations/DeletePlaylistResponseBody``
|
||||||
|
- ``Operations/Device``
|
||||||
|
- ``Operations/Director``
|
||||||
|
- ``Operations/Directory``
|
||||||
|
- ``Operations/Download``
|
||||||
|
- ``Operations/EnablePaperTrailErrors``
|
||||||
|
- ``Operations/EnablePaperTrailResponseBody``
|
||||||
|
- ``Operations/Errors``
|
||||||
|
- ``Operations/Field``
|
||||||
|
- ``Operations/FieldType``
|
||||||
|
- ``Operations/Filter``
|
||||||
|
- ``Operations/Force``
|
||||||
|
- ``Operations/Genre``
|
||||||
|
- ``Operations/GetAvailableClientsErrors``
|
||||||
|
- ``Operations/GetAvailableClientsMediaContainer``
|
||||||
|
- ``Operations/GetAvailableClientsResponseBody``
|
||||||
|
- ``Operations/GetAvailableClientsServerResponseBody``
|
||||||
|
- ``Operations/GetButlerTasksButlerResponseBody``
|
||||||
|
- ``Operations/GetButlerTasksErrors``
|
||||||
|
- ``Operations/GetButlerTasksResponseBody``
|
||||||
|
- ``Operations/GetDevicesErrors``
|
||||||
|
- ``Operations/GetDevicesMediaContainer``
|
||||||
|
- ``Operations/GetDevicesResponseBody``
|
||||||
|
- ``Operations/GetDevicesServerResponseBody``
|
||||||
|
- ``Operations/GetFileHashErrors``
|
||||||
|
- ``Operations/GetFileHashRequest``
|
||||||
|
- ``Operations/GetFileHashResponseBody``
|
||||||
|
- ``Operations/GetGlobalHubsErrors``
|
||||||
|
- ``Operations/GetGlobalHubsHubsResponseBody``
|
||||||
|
- ``Operations/GetGlobalHubsMediaContainer``
|
||||||
|
- ``Operations/GetGlobalHubsMetadata``
|
||||||
|
- ``Operations/GetGlobalHubsRequest``
|
||||||
|
- ``Operations/GetGlobalHubsResponseBody``
|
||||||
|
- ``Operations/GetLibrariesDirectory``
|
||||||
|
- ``Operations/GetLibrariesErrors``
|
||||||
|
- ``Operations/GetLibrariesLibraryResponseBody``
|
||||||
|
- ``Operations/GetLibrariesLocation``
|
||||||
|
- ``Operations/GetLibrariesMediaContainer``
|
||||||
|
- ``Operations/GetLibrariesResponseBody``
|
||||||
|
- ``Operations/GetLibraryDirectory``
|
||||||
|
- ``Operations/GetLibraryErrors``
|
||||||
|
- ``Operations/GetLibraryLibraryResponseBody``
|
||||||
|
- ``Operations/GetLibraryMediaContainer``
|
||||||
|
- ``Operations/GetLibraryRequest``
|
||||||
|
- ``Operations/GetLibraryResponseBody``
|
||||||
|
- ``Operations/GetLibraryType``
|
||||||
|
- ``Operations/GetLibraryHubsCountry``
|
||||||
|
- ``Operations/GetLibraryHubsDirector``
|
||||||
|
- ``Operations/GetLibraryHubsErrors``
|
||||||
|
- ``Operations/GetLibraryHubsGenre``
|
||||||
|
- ``Operations/GetLibraryHubsHub``
|
||||||
|
- ``Operations/GetLibraryHubsHubsResponseBody``
|
||||||
|
- ``Operations/GetLibraryHubsMedia``
|
||||||
|
- ``Operations/GetLibraryHubsMediaContainer``
|
||||||
|
- ``Operations/GetLibraryHubsMetadata``
|
||||||
|
- ``Operations/GetLibraryHubsPart``
|
||||||
|
- ``Operations/GetLibraryHubsRequest``
|
||||||
|
- ``Operations/GetLibraryHubsResponseBody``
|
||||||
|
- ``Operations/GetLibraryHubsRole``
|
||||||
|
- ``Operations/GetLibraryHubsWriter``
|
||||||
|
- ``Operations/GetLibraryItemsCountry``
|
||||||
|
- ``Operations/GetLibraryItemsDirector``
|
||||||
|
- ``Operations/GetLibraryItemsGenre``
|
||||||
|
- ``Operations/GetLibraryItemsMedia``
|
||||||
|
- ``Operations/GetLibraryItemsMediaContainer``
|
||||||
|
- ``Operations/GetLibraryItemsMetadata``
|
||||||
|
- ``Operations/GetLibraryItemsPart``
|
||||||
|
- ``Operations/GetLibraryItemsRequest``
|
||||||
|
- ``Operations/GetLibraryItemsResponseBody``
|
||||||
|
- ``Operations/GetLibraryItemsRole``
|
||||||
|
- ``Operations/GetLibraryItemsWriter``
|
||||||
|
- ``Operations/GetMetadataCountry``
|
||||||
|
- ``Operations/GetMetadataDirector``
|
||||||
|
- ``Operations/GetMetadataErrors``
|
||||||
|
- ``Operations/GetMetadataGenre``
|
||||||
|
- ``Operations/GetMetadataLibraryResponseBody``
|
||||||
|
- ``Operations/GetMetadataMedia``
|
||||||
|
- ``Operations/GetMetadataMediaContainer``
|
||||||
|
- ``Operations/GetMetadataMetadata``
|
||||||
|
- ``Operations/GetMetadataPart``
|
||||||
|
- ``Operations/GetMetadataRequest``
|
||||||
|
- ``Operations/GetMetadataResponseBody``
|
||||||
|
- ``Operations/GetMetadataRole``
|
||||||
|
- ``Operations/GetMetadataWriter``
|
||||||
|
- ``Operations/GetMetadataChildrenDirectory``
|
||||||
|
- ``Operations/GetMetadataChildrenErrors``
|
||||||
|
- ``Operations/GetMetadataChildrenLibraryResponseBody``
|
||||||
|
- ``Operations/GetMetadataChildrenMediaContainer``
|
||||||
|
- ``Operations/GetMetadataChildrenMetadata``
|
||||||
|
- ``Operations/GetMetadataChildrenRequest``
|
||||||
|
- ``Operations/GetMetadataChildrenResponseBody``
|
||||||
|
- ``Operations/GetMyPlexAccountErrors``
|
||||||
|
- ``Operations/GetMyPlexAccountResponseBody``
|
||||||
|
- ``Operations/GetMyPlexAccountServerResponseBody``
|
||||||
|
- ``Operations/GetOnDeckErrors``
|
||||||
|
- ``Operations/GetOnDeckGuids``
|
||||||
|
- ``Operations/GetOnDeckLibraryResponseBody``
|
||||||
|
- ``Operations/GetOnDeckMedia``
|
||||||
|
- ``Operations/GetOnDeckMediaContainer``
|
||||||
|
- ``Operations/GetOnDeckMetadata``
|
||||||
|
- ``Operations/GetOnDeckPart``
|
||||||
|
- ``Operations/GetOnDeckResponseBody``
|
||||||
|
- ``Operations/GetOnDeckStream``
|
||||||
|
- ``Operations/GetPinErrors``
|
||||||
|
- ``Operations/GetPinPlexResponseBody``
|
||||||
|
- ``Operations/GetPinRequest``
|
||||||
|
- ``Operations/GetPinResponseBody``
|
||||||
|
- ``Operations/GetPlaylistErrors``
|
||||||
|
- ``Operations/GetPlaylistMediaContainer``
|
||||||
|
- ``Operations/GetPlaylistMetadata``
|
||||||
|
- ``Operations/GetPlaylistPlaylistsResponseBody``
|
||||||
|
- ``Operations/GetPlaylistRequest``
|
||||||
|
- ``Operations/GetPlaylistResponseBody``
|
||||||
|
- ``Operations/GetPlaylistContentsCountry``
|
||||||
|
- ``Operations/GetPlaylistContentsDirector``
|
||||||
|
- ``Operations/GetPlaylistContentsErrors``
|
||||||
|
- ``Operations/GetPlaylistContentsGenre``
|
||||||
|
- ``Operations/GetPlaylistContentsMedia``
|
||||||
|
- ``Operations/GetPlaylistContentsMediaContainer``
|
||||||
|
- ``Operations/GetPlaylistContentsMetadata``
|
||||||
|
- ``Operations/GetPlaylistContentsPart``
|
||||||
|
- ``Operations/GetPlaylistContentsPlaylistsResponseBody``
|
||||||
|
- ``Operations/GetPlaylistContentsRequest``
|
||||||
|
- ``Operations/GetPlaylistContentsResponseBody``
|
||||||
|
- ``Operations/GetPlaylistContentsRole``
|
||||||
|
- ``Operations/GetPlaylistContentsWriter``
|
||||||
|
- ``Operations/GetPlaylistsErrors``
|
||||||
|
- ``Operations/GetPlaylistsMediaContainer``
|
||||||
|
- ``Operations/GetPlaylistsMetadata``
|
||||||
|
- ``Operations/GetPlaylistsPlaylistsResponseBody``
|
||||||
|
- ``Operations/GetPlaylistsRequest``
|
||||||
|
- ``Operations/GetPlaylistsResponseBody``
|
||||||
|
- ``Operations/GetRecentlyAddedErrors``
|
||||||
|
- ``Operations/GetRecentlyAddedLibraryResponseBody``
|
||||||
|
- ``Operations/GetRecentlyAddedMediaContainer``
|
||||||
|
- ``Operations/GetRecentlyAddedResponseBody``
|
||||||
|
- ``Operations/GetResizedPhotoErrors``
|
||||||
|
- ``Operations/GetResizedPhotoRequest``
|
||||||
|
- ``Operations/GetResizedPhotoResponseBody``
|
||||||
|
- ``Operations/GetSearchResultsCountry``
|
||||||
|
- ``Operations/GetSearchResultsDirector``
|
||||||
|
- ``Operations/GetSearchResultsErrors``
|
||||||
|
- ``Operations/GetSearchResultsGenre``
|
||||||
|
- ``Operations/GetSearchResultsMedia``
|
||||||
|
- ``Operations/GetSearchResultsMediaContainer``
|
||||||
|
- ``Operations/GetSearchResultsMetadata``
|
||||||
|
- ``Operations/GetSearchResultsPart``
|
||||||
|
- ``Operations/GetSearchResultsRequest``
|
||||||
|
- ``Operations/GetSearchResultsResponseBody``
|
||||||
|
- ``Operations/GetSearchResultsRole``
|
||||||
|
- ``Operations/GetSearchResultsSearchResponseBody``
|
||||||
|
- ``Operations/GetSearchResultsWriter``
|
||||||
|
- ``Operations/GetServerActivitiesActivitiesResponseBody``
|
||||||
|
- ``Operations/GetServerActivitiesErrors``
|
||||||
|
- ``Operations/GetServerActivitiesMediaContainer``
|
||||||
|
- ``Operations/GetServerActivitiesResponseBody``
|
||||||
|
- ``Operations/GetServerCapabilitiesResponseBody``
|
||||||
|
- ``Operations/GetServerCapabilitiesServerResponseBody``
|
||||||
|
- ``Operations/GetServerIdentityErrors``
|
||||||
|
- ``Operations/GetServerIdentityMediaContainer``
|
||||||
|
- ``Operations/GetServerIdentityResponseBody``
|
||||||
|
- ``Operations/GetServerIdentityServerResponseBody``
|
||||||
|
- ``Operations/GetServerListErrors``
|
||||||
|
- ``Operations/GetServerListMediaContainer``
|
||||||
|
- ``Operations/GetServerListResponseBody``
|
||||||
|
- ``Operations/GetServerListServer``
|
||||||
|
- ``Operations/GetServerListServerResponseBody``
|
||||||
|
- ``Operations/GetServerPreferencesErrors``
|
||||||
|
- ``Operations/GetServerPreferencesMediaContainer``
|
||||||
|
- ``Operations/GetServerPreferencesResponseBody``
|
||||||
|
- ``Operations/GetServerPreferencesServerResponseBody``
|
||||||
|
- ``Operations/GetSessionHistoryErrors``
|
||||||
|
- ``Operations/GetSessionHistoryMediaContainer``
|
||||||
|
- ``Operations/GetSessionHistoryMetadata``
|
||||||
|
- ``Operations/GetSessionHistoryResponseBody``
|
||||||
|
- ``Operations/GetSessionHistorySessionsResponseBody``
|
||||||
|
- ``Operations/GetSessionsErrors``
|
||||||
|
- ``Operations/GetSessionsMedia``
|
||||||
|
- ``Operations/GetSessionsMediaContainer``
|
||||||
|
- ``Operations/GetSessionsMetadata``
|
||||||
|
- ``Operations/GetSessionsPart``
|
||||||
|
- ``Operations/GetSessionsResponseBody``
|
||||||
|
- ``Operations/GetSessionsSessionsResponseBody``
|
||||||
|
- ``Operations/GetSessionsStream``
|
||||||
|
- ``Operations/GetSourceConnectionInformationErrors``
|
||||||
|
- ``Operations/GetSourceConnectionInformationRequest``
|
||||||
|
- ``Operations/GetSourceConnectionInformationResponseBody``
|
||||||
|
- ``Operations/GetStatisticsDevice``
|
||||||
|
- ``Operations/GetStatisticsErrors``
|
||||||
|
- ``Operations/GetStatisticsMediaContainer``
|
||||||
|
- ``Operations/GetStatisticsRequest``
|
||||||
|
- ``Operations/GetStatisticsResponseBody``
|
||||||
|
- ``Operations/GetStatisticsStatisticsResponseBody``
|
||||||
|
- ``Operations/GetTimelineErrors``
|
||||||
|
- ``Operations/GetTimelineRequest``
|
||||||
|
- ``Operations/GetTimelineResponseBody``
|
||||||
|
- ``Operations/GetTokenErrors``
|
||||||
|
- ``Operations/GetTokenRequest``
|
||||||
|
- ``Operations/GetTokenResponseBody``
|
||||||
|
- ``Operations/GetTranscodeSessionsErrors``
|
||||||
|
- ``Operations/GetTranscodeSessionsMediaContainer``
|
||||||
|
- ``Operations/GetTranscodeSessionsResponseBody``
|
||||||
|
- ``Operations/GetTranscodeSessionsSessionsResponseBody``
|
||||||
|
- ``Operations/GetTransientTokenErrors``
|
||||||
|
- ``Operations/GetTransientTokenQueryParamType``
|
||||||
|
- ``Operations/GetTransientTokenRequest``
|
||||||
|
- ``Operations/GetTransientTokenResponseBody``
|
||||||
|
- ``Operations/GetUpdateStatusErrors``
|
||||||
|
- ``Operations/GetUpdateStatusMediaContainer``
|
||||||
|
- ``Operations/GetUpdateStatusResponseBody``
|
||||||
|
- ``Operations/GetUpdateStatusUpdaterResponseBody``
|
||||||
|
- ``Operations/Guids``
|
||||||
|
- ``Operations/Hub``
|
||||||
|
- ``Operations/IncludeDetails``
|
||||||
|
- ``Operations/Level``
|
||||||
|
- ``Operations/Location``
|
||||||
|
- ``Operations/LogLineErrors``
|
||||||
|
- ``Operations/LogLineRequest``
|
||||||
|
- ``Operations/LogLineResponseBody``
|
||||||
|
- ``Operations/LogMultiLineErrors``
|
||||||
|
- ``Operations/LogMultiLineResponseBody``
|
||||||
|
- ``Operations/MarkPlayedErrors``
|
||||||
|
- ``Operations/MarkPlayedRequest``
|
||||||
|
- ``Operations/MarkPlayedResponseBody``
|
||||||
|
- ``Operations/MarkUnplayedErrors``
|
||||||
|
- ``Operations/MarkUnplayedRequest``
|
||||||
|
- ``Operations/MarkUnplayedResponseBody``
|
||||||
|
- ``Operations/Media``
|
||||||
|
- ``Operations/MediaContainer``
|
||||||
|
- ``Operations/Metadata``
|
||||||
|
- ``Operations/MinSize``
|
||||||
|
- ``Operations/MyPlex``
|
||||||
|
- ``Operations/OnlyTransient``
|
||||||
|
- ``Operations/Operator``
|
||||||
|
- ``Operations/Part``
|
||||||
|
- ``Operations/PathParamTaskName``
|
||||||
|
- ``Operations/PerformSearchErrors``
|
||||||
|
- ``Operations/PerformSearchRequest``
|
||||||
|
- ``Operations/PerformSearchResponseBody``
|
||||||
|
- ``Operations/PerformVoiceSearchErrors``
|
||||||
|
- ``Operations/PerformVoiceSearchRequest``
|
||||||
|
- ``Operations/PerformVoiceSearchResponseBody``
|
||||||
|
- ``Operations/Player``
|
||||||
|
- ``Operations/PlaylistType``
|
||||||
|
- ``Operations/Producer``
|
||||||
|
- ``Operations/Provider``
|
||||||
|
- ``Operations/QueryParamOnlyTransient``
|
||||||
|
- ``Operations/QueryParamSmart``
|
||||||
|
- ``Operations/QueryParamType``
|
||||||
|
- ``Operations/Ratings``
|
||||||
|
- ``Operations/RefreshLibraryErrors``
|
||||||
|
- ``Operations/RefreshLibraryRequest``
|
||||||
|
- ``Operations/RefreshLibraryResponseBody``
|
||||||
|
- ``Operations/Release``
|
||||||
|
- ``Operations/Role``
|
||||||
|
- ``Operations/Scope``
|
||||||
|
- ``Operations/SearchLibraryMediaContainer``
|
||||||
|
- ``Operations/SearchLibraryMetadata``
|
||||||
|
- ``Operations/SearchLibraryRequest``
|
||||||
|
- ``Operations/SearchLibraryResponseBody``
|
||||||
|
- ``Operations/Server``
|
||||||
|
- ``Operations/Session``
|
||||||
|
- ``Operations/Setting``
|
||||||
|
- ``Operations/Skip``
|
||||||
|
- ``Operations/Smart``
|
||||||
|
- ``Operations/Sort``
|
||||||
|
- ``Operations/StartAllTasksErrors``
|
||||||
|
- ``Operations/StartAllTasksResponseBody``
|
||||||
|
- ``Operations/StartTaskErrors``
|
||||||
|
- ``Operations/StartTaskRequest``
|
||||||
|
- ``Operations/StartTaskResponseBody``
|
||||||
|
- ``Operations/StartUniversalTranscodeErrors``
|
||||||
|
- ``Operations/StartUniversalTranscodeRequest``
|
||||||
|
- ``Operations/StartUniversalTranscodeResponseBody``
|
||||||
|
- ``Operations/State``
|
||||||
|
- ``Operations/StatisticsMedia``
|
||||||
|
- ``Operations/StopAllTasksErrors``
|
||||||
|
- ``Operations/StopAllTasksResponseBody``
|
||||||
|
- ``Operations/StopTaskErrors``
|
||||||
|
- ``Operations/StopTaskRequest``
|
||||||
|
- ``Operations/StopTaskResponseBody``
|
||||||
|
- ``Operations/StopTranscodeSessionErrors``
|
||||||
|
- ``Operations/StopTranscodeSessionRequest``
|
||||||
|
- ``Operations/StopTranscodeSessionResponseBody``
|
||||||
|
- ``Operations/Stream``
|
||||||
|
- ``Operations/Tag``
|
||||||
|
- ``Operations/TaskName``
|
||||||
|
- ``Operations/Tonight``
|
||||||
|
- ``Operations/TranscodeSession``
|
||||||
|
- ``Operations/TypeModel``
|
||||||
|
- ``Operations/UpdatePlaylistErrors``
|
||||||
|
- ``Operations/UpdatePlaylistRequest``
|
||||||
|
- ``Operations/UpdatePlaylistResponseBody``
|
||||||
|
- ``Operations/UpdatePlayProgressErrors``
|
||||||
|
- ``Operations/UpdatePlayProgressRequest``
|
||||||
|
- ``Operations/UpdatePlayProgressResponseBody``
|
||||||
|
- ``Operations/UploadPlaylistErrors``
|
||||||
|
- ``Operations/UploadPlaylistRequest``
|
||||||
|
- ``Operations/UploadPlaylistResponseBody``
|
||||||
|
- ``Operations/Upscale``
|
||||||
|
- ``Operations/User``
|
||||||
|
- ``Operations/Writer``
|
||||||
|
|
||||||
|
### Type groupings
|
||||||
|
- ``Operations``
|
||||||
|
- ``Shared``
|
||||||
|
|
||||||
|
### Data types
|
||||||
|
|
||||||
|
- ``AnyValue``
|
||||||
|
- ``APIValue``
|
||||||
|
|
||||||
|
### Internal data types
|
||||||
|
|
||||||
|
- ``DateConvertible``
|
||||||
|
- ``DateOnly``
|
||||||
|
- ``DateTime``
|
||||||
|
- ``DecimalSerialized``
|
||||||
|
- ``DoubleConvertible``
|
||||||
980
Sources/Plexswift/PlexswiftAPI.swift
Normal file
980
Sources/Plexswift/PlexswiftAPI.swift
Normal file
@@ -0,0 +1,980 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// Defines the operations supported by the API.
|
||||||
|
///
|
||||||
|
/// This protocol defines all of the operations supported by the API. It is implemented by ``Client`` which can be used to make these API requests and handle their responses.
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// These methods allow you to make requests to the API.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ### Scoped API calls
|
||||||
|
///
|
||||||
|
/// These properties logically group other parts of the API.
|
||||||
|
///
|
||||||
|
/// - ``server``
|
||||||
|
/// - ``media``
|
||||||
|
/// - ``video``
|
||||||
|
/// - ``activities``
|
||||||
|
/// - ``butler``
|
||||||
|
/// - ``hubs``
|
||||||
|
/// - ``search``
|
||||||
|
/// - ``library``
|
||||||
|
/// - ``log``
|
||||||
|
/// - ``plex``
|
||||||
|
/// - ``playlists``
|
||||||
|
/// - ``authentication``
|
||||||
|
/// - ``statistics``
|
||||||
|
/// - ``sessions``
|
||||||
|
/// - ``updater``
|
||||||
|
///
|
||||||
|
public protocol PlexswiftAPI {
|
||||||
|
|
||||||
|
// MARK: - Scoped APIs
|
||||||
|
/// Operations against the Plex Media Server System.
|
||||||
|
///
|
||||||
|
var server: ServerAPI { get }
|
||||||
|
/// API Calls interacting with Plex Media Server Media
|
||||||
|
///
|
||||||
|
var media: MediaAPI { get }
|
||||||
|
/// API Calls that perform operations with Plex Media Server Videos
|
||||||
|
///
|
||||||
|
var video: VideoAPI { get }
|
||||||
|
/// Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.
|
||||||
|
/// Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.
|
||||||
|
/// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:
|
||||||
|
/// - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.
|
||||||
|
/// - They must contain an `type` which is used by clients to distinguish the specific activity.
|
||||||
|
/// - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)
|
||||||
|
/// - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
|
||||||
|
///
|
||||||
|
var activities: ActivitiesAPI { get }
|
||||||
|
/// Butler is the task manager of the Plex Media Server Ecosystem.
|
||||||
|
///
|
||||||
|
var butler: ButlerAPI { get }
|
||||||
|
/// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
|
||||||
|
///
|
||||||
|
var hubs: HubsAPI { get }
|
||||||
|
/// API Calls that perform search operations with Plex Media Server
|
||||||
|
///
|
||||||
|
var search: SearchAPI { get }
|
||||||
|
/// API Calls interacting with Plex Media Server Libraries
|
||||||
|
///
|
||||||
|
var library: LibraryAPI { get }
|
||||||
|
/// Submit logs to the Log Handler for Plex Media Server
|
||||||
|
///
|
||||||
|
var log: LogAPI { get }
|
||||||
|
/// 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.
|
||||||
|
/// This may cause the duration and number of items to change.
|
||||||
|
///
|
||||||
|
var playlists: PlaylistsAPI { get }
|
||||||
|
/// API Calls regarding authentication for Plex Media Server
|
||||||
|
///
|
||||||
|
var authentication: AuthenticationAPI { get }
|
||||||
|
/// API Calls that perform operations with Plex Media Server Statistics
|
||||||
|
///
|
||||||
|
var statistics: StatisticsAPI { get }
|
||||||
|
/// API Calls that perform search operations with Plex Media Server Sessions
|
||||||
|
///
|
||||||
|
var sessions: SessionsAPI { get }
|
||||||
|
/// This describes the API for searching and applying updates to the Plex Media Server.
|
||||||
|
/// Updates to the status can be observed via the Event API.
|
||||||
|
///
|
||||||
|
var updater: UpdaterAPI { get }
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - ServerAPI
|
||||||
|
|
||||||
|
/// Operations against the Plex Media Server System.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getServerCapabilities()``
|
||||||
|
/// - ``getServerPreferences()``
|
||||||
|
/// - ``getAvailableClients()``
|
||||||
|
/// - ``getDevices()``
|
||||||
|
/// - ``getServerIdentity()``
|
||||||
|
/// - ``getMyPlexAccount()``
|
||||||
|
/// - ``getResizedPhoto(request:)``
|
||||||
|
/// - ``getServerList()``
|
||||||
|
///
|
||||||
|
public protocol ServerAPI {
|
||||||
|
/// Server Capabilities
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetServerCapabilitiesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getServerCapabilities() async throws -> Response<Operations.GetServerCapabilitiesResponse>
|
||||||
|
|
||||||
|
/// Get Server Preferences
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetServerPreferencesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getServerPreferences() async throws -> Response<Operations.GetServerPreferencesResponse>
|
||||||
|
|
||||||
|
/// Get Available Clients
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetAvailableClientsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getAvailableClients() async throws -> Response<Operations.GetAvailableClientsResponse>
|
||||||
|
|
||||||
|
/// Get Devices
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetDevicesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getDevices() async throws -> Response<Operations.GetDevicesResponse>
|
||||||
|
|
||||||
|
/// Get Server Identity
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetServerIdentityResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getServerIdentity() async throws -> Response<Operations.GetServerIdentityResponse>
|
||||||
|
|
||||||
|
/// Returns MyPlex Account Information
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetMyPlexAccountResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getMyPlexAccount() async throws -> Response<Operations.GetMyPlexAccountResponse>
|
||||||
|
|
||||||
|
/// Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetResizedPhotoRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetResizedPhotoResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getResizedPhoto(request: Operations.GetResizedPhotoRequest) async throws -> Response<Operations.GetResizedPhotoResponse>
|
||||||
|
|
||||||
|
/// Get Server List
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetServerListResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getServerList() async throws -> Response<Operations.GetServerListResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - MediaAPI
|
||||||
|
|
||||||
|
/// API Calls interacting with Plex Media Server Media
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``markPlayed(request:)``
|
||||||
|
/// - ``markUnplayed(request:)``
|
||||||
|
/// - ``updatePlayProgress(request:)``
|
||||||
|
///
|
||||||
|
public protocol MediaAPI {
|
||||||
|
/// This will mark the provided media key as Played.
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/MarkPlayedRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/MarkPlayedResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func markPlayed(request: Operations.MarkPlayedRequest) async throws -> Response<Operations.MarkPlayedResponse>
|
||||||
|
|
||||||
|
/// This will mark the provided media key as Unplayed.
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/MarkUnplayedRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/MarkUnplayedResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func markUnplayed(request: Operations.MarkUnplayedRequest) async throws -> Response<Operations.MarkUnplayedResponse>
|
||||||
|
|
||||||
|
/// This API command can be used to update the play progress of a media item.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/UpdatePlayProgressRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/UpdatePlayProgressResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func updatePlayProgress(request: Operations.UpdatePlayProgressRequest) async throws -> Response<Operations.UpdatePlayProgressResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - VideoAPI
|
||||||
|
|
||||||
|
/// API Calls that perform operations with Plex Media Server Videos
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getTimeline(request:)``
|
||||||
|
/// - ``startUniversalTranscode(request:)``
|
||||||
|
///
|
||||||
|
public protocol VideoAPI {
|
||||||
|
/// Get the timeline for a media item
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetTimelineRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetTimelineResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getTimeline(request: Operations.GetTimelineRequest) async throws -> Response<Operations.GetTimelineResponse>
|
||||||
|
|
||||||
|
/// Begin a Universal Transcode Session
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/StartUniversalTranscodeRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/StartUniversalTranscodeResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func startUniversalTranscode(request: Operations.StartUniversalTranscodeRequest) async throws -> Response<Operations.StartUniversalTranscodeResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - ActivitiesAPI
|
||||||
|
|
||||||
|
/// Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.
|
||||||
|
/// Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.
|
||||||
|
/// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:
|
||||||
|
/// - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.
|
||||||
|
/// - They must contain an `type` which is used by clients to distinguish the specific activity.
|
||||||
|
/// - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)
|
||||||
|
/// - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getServerActivities()``
|
||||||
|
/// - ``cancelServerActivities(request:)``
|
||||||
|
///
|
||||||
|
public protocol ActivitiesAPI {
|
||||||
|
/// Get Server Activities
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetServerActivitiesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getServerActivities() async throws -> Response<Operations.GetServerActivitiesResponse>
|
||||||
|
|
||||||
|
/// Cancel Server Activities
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/CancelServerActivitiesRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/CancelServerActivitiesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func cancelServerActivities(request: Operations.CancelServerActivitiesRequest) async throws -> Response<Operations.CancelServerActivitiesResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - ButlerAPI
|
||||||
|
|
||||||
|
/// Butler is the task manager of the Plex Media Server Ecosystem.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getButlerTasks()``
|
||||||
|
/// - ``startAllTasks()``
|
||||||
|
/// - ``stopAllTasks()``
|
||||||
|
/// - ``startTask(request:)``
|
||||||
|
/// - ``stopTask(request:)``
|
||||||
|
///
|
||||||
|
public protocol ButlerAPI {
|
||||||
|
/// Returns a list of butler tasks
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetButlerTasksResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getButlerTasks() async throws -> Response<Operations.GetButlerTasksResponse>
|
||||||
|
|
||||||
|
/// This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
|
||||||
|
/// 1. Any tasks not scheduled to run on the current day will be skipped.
|
||||||
|
/// 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
|
||||||
|
/// 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
|
||||||
|
/// 4. If we are outside the configured window, the task will start immediately.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/StartAllTasksResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func startAllTasks() async throws -> Response<Operations.StartAllTasksResponse>
|
||||||
|
|
||||||
|
/// This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/StopAllTasksResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func stopAllTasks() async throws -> Response<Operations.StopAllTasksResponse>
|
||||||
|
|
||||||
|
/// This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
|
||||||
|
/// 1. Any tasks not scheduled to run on the current day will be skipped.
|
||||||
|
/// 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
|
||||||
|
/// 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
|
||||||
|
/// 4. If we are outside the configured window, the task will start immediately.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/StartTaskRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/StartTaskResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func startTask(request: Operations.StartTaskRequest) async throws -> Response<Operations.StartTaskResponse>
|
||||||
|
|
||||||
|
/// This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/StopTaskRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/StopTaskResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func stopTask(request: Operations.StopTaskRequest) async throws -> Response<Operations.StopTaskResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - HubsAPI
|
||||||
|
|
||||||
|
/// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getGlobalHubs(request:)``
|
||||||
|
/// - ``getLibraryHubs(request:)``
|
||||||
|
///
|
||||||
|
public protocol HubsAPI {
|
||||||
|
/// Get Global Hubs filtered by the parameters provided.
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetGlobalHubsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetGlobalHubsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getGlobalHubs(request: Operations.GetGlobalHubsRequest) async throws -> Response<Operations.GetGlobalHubsResponse>
|
||||||
|
|
||||||
|
/// This endpoint will return a list of library specific hubs
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetLibraryHubsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetLibraryHubsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getLibraryHubs(request: Operations.GetLibraryHubsRequest) async throws -> Response<Operations.GetLibraryHubsResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - SearchAPI
|
||||||
|
|
||||||
|
/// API Calls that perform search operations with Plex Media Server
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``performSearch(request:)``
|
||||||
|
/// - ``performVoiceSearch(request:)``
|
||||||
|
/// - ``getSearchResults(request:)``
|
||||||
|
///
|
||||||
|
public protocol SearchAPI {
|
||||||
|
/// This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).
|
||||||
|
///
|
||||||
|
/// In the response's items, the following extra attributes are returned to further describe or disambiguate the result:
|
||||||
|
///
|
||||||
|
/// - `reason`: The reason for the result, if not because of a direct search term match; can be either:
|
||||||
|
/// - `section`: There are multiple identical results from different sections.
|
||||||
|
/// - `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language).
|
||||||
|
/// - `<hub identifier>`: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor`
|
||||||
|
/// - `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold").
|
||||||
|
/// - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID.
|
||||||
|
///
|
||||||
|
/// This request is intended to be very fast, and called as the user types.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/PerformSearchRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/PerformSearchResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func performSearch(request: Operations.PerformSearchRequest) async throws -> Response<Operations.PerformSearchResponse>
|
||||||
|
|
||||||
|
/// This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint.
|
||||||
|
/// It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint.
|
||||||
|
/// Whenever possible, clients should limit the search to the appropriate type.
|
||||||
|
/// Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/PerformVoiceSearchRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/PerformVoiceSearchResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func performVoiceSearch(request: Operations.PerformVoiceSearchRequest) async throws -> Response<Operations.PerformVoiceSearchResponse>
|
||||||
|
|
||||||
|
/// This will search the database for the string provided.
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetSearchResultsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetSearchResultsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getSearchResults(request: Operations.GetSearchResultsRequest) async throws -> Response<Operations.GetSearchResultsResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - LibraryAPI
|
||||||
|
|
||||||
|
/// API Calls interacting with Plex Media Server Libraries
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getFileHash(request:)``
|
||||||
|
/// - ``getRecentlyAdded()``
|
||||||
|
/// - ``getLibraries()``
|
||||||
|
/// - ``getLibrary(request:)``
|
||||||
|
/// - ``deleteLibrary(request:)``
|
||||||
|
/// - ``getLibraryItems(request:)``
|
||||||
|
/// - ``refreshLibrary(request:)``
|
||||||
|
/// - ``searchLibrary(request:)``
|
||||||
|
/// - ``getMetadata(request:)``
|
||||||
|
/// - ``getMetadataChildren(request:)``
|
||||||
|
/// - ``getOnDeck()``
|
||||||
|
///
|
||||||
|
public protocol LibraryAPI {
|
||||||
|
/// This resource returns hash values for local files
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetFileHashRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetFileHashResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getFileHash(request: Operations.GetFileHashRequest) async throws -> Response<Operations.GetFileHashResponse>
|
||||||
|
|
||||||
|
/// This endpoint will return the recently added content.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetRecentlyAddedResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getRecentlyAdded() async throws -> Response<Operations.GetRecentlyAddedResponse>
|
||||||
|
|
||||||
|
/// A library section (commonly referred to as just a library) is a collection of media.
|
||||||
|
/// Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media.
|
||||||
|
/// For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat.
|
||||||
|
///
|
||||||
|
/// Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts.
|
||||||
|
/// This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year).
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetLibrariesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getLibraries() async throws -> Response<Operations.GetLibrariesResponse>
|
||||||
|
|
||||||
|
/// ## Library Details Endpoint
|
||||||
|
///
|
||||||
|
/// This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself.
|
||||||
|
///
|
||||||
|
/// The details include:
|
||||||
|
///
|
||||||
|
/// ### Directories
|
||||||
|
/// Organized into three categories:
|
||||||
|
///
|
||||||
|
/// - **Primary Directories**:
|
||||||
|
/// - Used in some clients for quick access to media subsets (e.g., "All", "On Deck").
|
||||||
|
/// - Most can be replicated via media queries.
|
||||||
|
/// - Customizable by users.
|
||||||
|
///
|
||||||
|
/// - **Secondary Directories**:
|
||||||
|
/// - Marked with `secondary="1"`.
|
||||||
|
/// - Used in older clients for structured navigation.
|
||||||
|
///
|
||||||
|
/// - **Special Directories**:
|
||||||
|
/// - Includes a "By Folder" entry for filesystem-based browsing.
|
||||||
|
/// - Contains an obsolete `search="1"` entry for on-the-fly search dialog creation.
|
||||||
|
///
|
||||||
|
/// ### Types
|
||||||
|
/// Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:
|
||||||
|
///
|
||||||
|
/// - **Type Object Attributes**:
|
||||||
|
/// - `key`: Endpoint for the media list of this type.
|
||||||
|
/// - `type`: Metadata type (if standard Plex type).
|
||||||
|
/// - `title`: Title for this content type (e.g., "Movies").
|
||||||
|
///
|
||||||
|
/// - **Filter Objects**:
|
||||||
|
/// - Subset of the media query language.
|
||||||
|
/// - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.
|
||||||
|
///
|
||||||
|
/// - **Sort Objects**:
|
||||||
|
/// - Description of sort fields.
|
||||||
|
/// - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.
|
||||||
|
///
|
||||||
|
/// > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetLibraryRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetLibraryResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getLibrary(request: Operations.GetLibraryRequest) async throws -> Response<Operations.GetLibraryResponse>
|
||||||
|
|
||||||
|
/// Delate a library using a specific section
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/DeleteLibraryRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/DeleteLibraryResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func deleteLibrary(request: Operations.DeleteLibraryRequest) async throws -> Response<Operations.DeleteLibraryResponse>
|
||||||
|
|
||||||
|
/// Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values:
|
||||||
|
/// - `all`: All items in the section.
|
||||||
|
/// - `unwatched`: Items that have not been played.
|
||||||
|
/// - `newest`: Items that are recently released.
|
||||||
|
/// - `recentlyAdded`: Items that are recently added to the library.
|
||||||
|
/// - `recentlyViewed`: Items that were recently viewed.
|
||||||
|
/// - `onDeck`: Items to continue watching.
|
||||||
|
/// - `collection`: Items categorized by collection.
|
||||||
|
/// - `edition`: Items categorized by edition.
|
||||||
|
/// - `genre`: Items categorized by genre.
|
||||||
|
/// - `year`: Items categorized by year of release.
|
||||||
|
/// - `decade`: Items categorized by decade.
|
||||||
|
/// - `director`: Items categorized by director.
|
||||||
|
/// - `actor`: Items categorized by starring actor.
|
||||||
|
/// - `country`: Items categorized by country of origin.
|
||||||
|
/// - `contentRating`: Items categorized by content rating.
|
||||||
|
/// - `rating`: Items categorized by rating.
|
||||||
|
/// - `resolution`: Items categorized by resolution.
|
||||||
|
/// - `firstCharacter`: Items categorized by the first letter.
|
||||||
|
/// - `folder`: Items categorized by folder.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetLibraryItemsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetLibraryItemsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getLibraryItems(request: Operations.GetLibraryItemsRequest) async throws -> Response<Operations.GetLibraryItemsResponse>
|
||||||
|
|
||||||
|
/// This endpoint Refreshes the library.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/RefreshLibraryRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/RefreshLibraryResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func refreshLibrary(request: Operations.RefreshLibraryRequest) async throws -> Response<Operations.RefreshLibraryResponse>
|
||||||
|
|
||||||
|
/// Search for content within a specific section of the library.
|
||||||
|
///
|
||||||
|
/// ### Types
|
||||||
|
/// Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:
|
||||||
|
///
|
||||||
|
/// - **Type Object Attributes**:
|
||||||
|
/// - `type`: Metadata type (if standard Plex type).
|
||||||
|
/// - `title`: Title for this content type (e.g., "Movies").
|
||||||
|
///
|
||||||
|
/// - **Filter Objects**:
|
||||||
|
/// - Subset of the media query language.
|
||||||
|
/// - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.
|
||||||
|
///
|
||||||
|
/// - **Sort Objects**:
|
||||||
|
/// - Description of sort fields.
|
||||||
|
/// - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.
|
||||||
|
///
|
||||||
|
/// > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/SearchLibraryRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/SearchLibraryResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func searchLibrary(request: Operations.SearchLibraryRequest) async throws -> Response<Operations.SearchLibraryResponse>
|
||||||
|
|
||||||
|
/// This endpoint will return the metadata of a library item specified with the ratingKey.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetMetadataRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetMetadataResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getMetadata(request: Operations.GetMetadataRequest) async throws -> Response<Operations.GetMetadataResponse>
|
||||||
|
|
||||||
|
/// This endpoint will return the children of of a library item specified with the ratingKey.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetMetadataChildrenRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetMetadataChildrenResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getMetadataChildren(request: Operations.GetMetadataChildrenRequest) async throws -> Response<Operations.GetMetadataChildrenResponse>
|
||||||
|
|
||||||
|
/// This endpoint will return the on deck content.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetOnDeckResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getOnDeck() async throws -> Response<Operations.GetOnDeckResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - LogAPI
|
||||||
|
|
||||||
|
/// Submit logs to the Log Handler for Plex Media Server
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``logLine(request:)``
|
||||||
|
/// - ``logMultiLine(request:)``
|
||||||
|
/// - ``enablePaperTrail()``
|
||||||
|
///
|
||||||
|
public protocol LogAPI {
|
||||||
|
/// This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/LogLineRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/LogLineResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func logLine(request: Operations.LogLineRequest) async throws -> Response<Operations.LogLineResponse>
|
||||||
|
|
||||||
|
/// This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
|
||||||
|
/// It accepts a text/plain request body, where each line represents a distinct log entry.
|
||||||
|
/// Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.
|
||||||
|
///
|
||||||
|
/// Log entries are separated by a newline character (`\n`).
|
||||||
|
/// Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
|
||||||
|
/// This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
|
||||||
|
///
|
||||||
|
/// The 'level' parameter specifies the log entry's severity or importance, with the following integer values:
|
||||||
|
/// - `0`: Error - Critical issues that require immediate attention.
|
||||||
|
/// - `1`: Warning - Important events that are not critical but may indicate potential issues.
|
||||||
|
/// - `2`: Info - General informational messages about system operation.
|
||||||
|
/// - `3`: Debug - Detailed information useful for debugging purposes.
|
||||||
|
/// - `4`: Verbose - Highly detailed diagnostic information for in-depth analysis.
|
||||||
|
///
|
||||||
|
/// The 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).
|
||||||
|
///
|
||||||
|
/// Example of a single log entry format:
|
||||||
|
/// `level=4&message=Sample%20log%20entry&source=applicationName`
|
||||||
|
///
|
||||||
|
/// Ensure each parameter is properly URL-encoded to avoid interpretation issues.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A string input to the API operation
|
||||||
|
/// - Returns: A ``Operations/LogMultiLineResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func logMultiLine(request: String) async throws -> Response<Operations.LogMultiLineResponse>
|
||||||
|
|
||||||
|
/// This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/EnablePaperTrailResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func enablePaperTrail() async throws -> Response<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").
|
||||||
|
/// They can be organized in (optionally nesting) folders.
|
||||||
|
/// Retrieving a playlist, or its items, will trigger a refresh of its metadata.
|
||||||
|
/// This may cause the duration and number of items to change.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``createPlaylist(request:)``
|
||||||
|
/// - ``getPlaylists(request:)``
|
||||||
|
/// - ``getPlaylist(request:)``
|
||||||
|
/// - ``deletePlaylist(request:)``
|
||||||
|
/// - ``updatePlaylist(request:)``
|
||||||
|
/// - ``getPlaylistContents(request:)``
|
||||||
|
/// - ``clearPlaylistContents(request:)``
|
||||||
|
/// - ``addPlaylistContents(request:)``
|
||||||
|
/// - ``uploadPlaylist(request:)``
|
||||||
|
///
|
||||||
|
public protocol PlaylistsAPI {
|
||||||
|
/// Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass:
|
||||||
|
/// - `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`).
|
||||||
|
/// - `playQueueID` - To create a playlist from an existing play queue.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/CreatePlaylistRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/CreatePlaylistResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func createPlaylist(request: Operations.CreatePlaylistRequest) async throws -> Response<Operations.CreatePlaylistResponse>
|
||||||
|
|
||||||
|
/// Get All Playlists given the specified filters.
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetPlaylistsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetPlaylistsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getPlaylists(request: Operations.GetPlaylistsRequest) async throws -> Response<Operations.GetPlaylistsResponse>
|
||||||
|
|
||||||
|
/// Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item:
|
||||||
|
/// Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetPlaylistRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetPlaylistResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getPlaylist(request: Operations.GetPlaylistRequest) async throws -> Response<Operations.GetPlaylistResponse>
|
||||||
|
|
||||||
|
/// This endpoint will delete a playlist
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/DeletePlaylistRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/DeletePlaylistResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func deletePlaylist(request: Operations.DeletePlaylistRequest) async throws -> Response<Operations.DeletePlaylistResponse>
|
||||||
|
|
||||||
|
/// From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/UpdatePlaylistRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/UpdatePlaylistResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func updatePlaylist(request: Operations.UpdatePlaylistRequest) async throws -> Response<Operations.UpdatePlaylistResponse>
|
||||||
|
|
||||||
|
/// Gets the contents of a playlist. Should be paged by clients via standard mechanisms.
|
||||||
|
/// By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter.
|
||||||
|
/// For example, you could use this to display a list of recently added albums vis a smart playlist.
|
||||||
|
/// Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetPlaylistContentsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetPlaylistContentsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getPlaylistContents(request: Operations.GetPlaylistContentsRequest) async throws -> Response<Operations.GetPlaylistContentsResponse>
|
||||||
|
|
||||||
|
/// Clears a playlist, only works with dumb playlists. Returns the playlist.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/ClearPlaylistContentsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/ClearPlaylistContentsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func clearPlaylistContents(request: Operations.ClearPlaylistContentsRequest) async throws -> Response<Operations.ClearPlaylistContentsResponse>
|
||||||
|
|
||||||
|
/// Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist.
|
||||||
|
/// With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/AddPlaylistContentsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/AddPlaylistContentsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func addPlaylistContents(request: Operations.AddPlaylistContentsRequest) async throws -> Response<Operations.AddPlaylistContentsResponse>
|
||||||
|
|
||||||
|
/// Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/UploadPlaylistRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/UploadPlaylistResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func uploadPlaylist(request: Operations.UploadPlaylistRequest) async throws -> Response<Operations.UploadPlaylistResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - AuthenticationAPI
|
||||||
|
|
||||||
|
/// API Calls regarding authentication for Plex Media Server
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getTransientToken(request:)``
|
||||||
|
/// - ``getSourceConnectionInformation(request:)``
|
||||||
|
///
|
||||||
|
public protocol AuthenticationAPI {
|
||||||
|
/// This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetTransientTokenRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetTransientTokenResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getTransientToken(request: Operations.GetTransientTokenRequest) async throws -> Response<Operations.GetTransientTokenResponse>
|
||||||
|
|
||||||
|
/// If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
|
||||||
|
/// Note: requires Plex Media Server >= 1.15.4.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetSourceConnectionInformationRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetSourceConnectionInformationResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getSourceConnectionInformation(request: Operations.GetSourceConnectionInformationRequest) async throws -> Response<Operations.GetSourceConnectionInformationResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - StatisticsAPI
|
||||||
|
|
||||||
|
/// API Calls that perform operations with Plex Media Server Statistics
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getStatistics(request:)``
|
||||||
|
///
|
||||||
|
public protocol StatisticsAPI {
|
||||||
|
/// This will return the media statistics for the server
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/GetStatisticsRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/GetStatisticsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getStatistics(request: Operations.GetStatisticsRequest) async throws -> Response<Operations.GetStatisticsResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - SessionsAPI
|
||||||
|
|
||||||
|
/// API Calls that perform search operations with Plex Media Server Sessions
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getSessions()``
|
||||||
|
/// - ``getSessionHistory()``
|
||||||
|
/// - ``getTranscodeSessions()``
|
||||||
|
/// - ``stopTranscodeSession(request:)``
|
||||||
|
///
|
||||||
|
public protocol SessionsAPI {
|
||||||
|
/// This will retrieve the "Now Playing" Information of the PMS.
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetSessionsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getSessions() async throws -> Response<Operations.GetSessionsResponse>
|
||||||
|
|
||||||
|
/// This will Retrieve a listing of all history views.
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetSessionHistoryResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getSessionHistory() async throws -> Response<Operations.GetSessionHistoryResponse>
|
||||||
|
|
||||||
|
/// Get Transcode Sessions
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetTranscodeSessionsResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getTranscodeSessions() async throws -> Response<Operations.GetTranscodeSessionsResponse>
|
||||||
|
|
||||||
|
/// Stop a Transcode Session
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/StopTranscodeSessionRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/StopTranscodeSessionResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func stopTranscodeSession(request: Operations.StopTranscodeSessionRequest) async throws -> Response<Operations.StopTranscodeSessionResponse>
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - UpdaterAPI
|
||||||
|
|
||||||
|
/// This describes the API for searching and applying updates to the Plex Media Server.
|
||||||
|
/// Updates to the status can be observed via the Event API.
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### API calls
|
||||||
|
///
|
||||||
|
/// - ``getUpdateStatus()``
|
||||||
|
/// - ``checkForUpdates(request:)``
|
||||||
|
/// - ``applyUpdates(request:)``
|
||||||
|
///
|
||||||
|
public protocol UpdaterAPI {
|
||||||
|
/// Querying status of updates
|
||||||
|
///
|
||||||
|
/// - Returns: A ``Operations/GetUpdateStatusResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func getUpdateStatus() async throws -> Response<Operations.GetUpdateStatusResponse>
|
||||||
|
|
||||||
|
/// Checking for updates
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/CheckForUpdatesRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/CheckForUpdatesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func checkForUpdates(request: Operations.CheckForUpdatesRequest) async throws -> Response<Operations.CheckForUpdatesResponse>
|
||||||
|
|
||||||
|
/// Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// - Parameter request: A ``Operations/ApplyUpdatesRequest`` object describing the input to the API operation
|
||||||
|
/// - Returns: A ``Operations/ApplyUpdatesResponse`` object describing the result of the API operation
|
||||||
|
/// - Throws: An error of type ``PlexswiftError``
|
||||||
|
func applyUpdates(request: Operations.ApplyUpdatesRequest) async throws -> Response<Operations.ApplyUpdatesResponse>
|
||||||
|
}
|
||||||
208
Sources/Plexswift/PlexswiftError.swift
Normal file
208
Sources/Plexswift/PlexswiftError.swift
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// Describes errors that occur when making requests to the API.
|
||||||
|
///
|
||||||
|
/// ``PlexswiftError`` describes problems which occur through the lifecycle of making a request to the API, from constructing the underlying network request, through making the network request and handling the resulting response.
|
||||||
|
///
|
||||||
|
/// Most of the error values have associated failure reasons:
|
||||||
|
/// - ``PlexswiftError/failedToConstructRequestURL(_:)``
|
||||||
|
/// - ``PlexswiftError/failedToSerializeRequestParameters(_:)``
|
||||||
|
/// - ``PlexswiftError/failedToConstructRequest(_:)``
|
||||||
|
/// - ``PlexswiftError/failedToHandleResponse(_:)``
|
||||||
|
///
|
||||||
|
/// which provide more information about why the error occurred.
|
||||||
|
///
|
||||||
|
/// If a network error occurs when making an API request, ``PlexswiftError/failedToMakeNetworkRequest(error:)`` has an associated [`Error`](https://developer.apple.com/documentation/swift/error) value which describes more information about why the network error occurred.
|
||||||
|
///
|
||||||
|
/// In exceptional circumstances there may be an internal error which occurs in the implementation of ``Plexswift`` or in the underlying system frameworks. Where this occurs, ``PlexswiftError/internalError(error:)`` provides this information, with additional context if it is available.
|
||||||
|
///
|
||||||
|
/// ### Getting an error description
|
||||||
|
///
|
||||||
|
/// ``PlexswiftError`` conforms to the [`LocalizedError`](https://developer.apple.com/documentation/foundation/localizederror) protocol. As such a readable description of the error is provided through the [`errorDescription`](https://developer.apple.com/documentation/foundation/localizederror/2946895-errordescription) property.
|
||||||
|
///
|
||||||
|
/// ## Topics
|
||||||
|
///
|
||||||
|
/// ### Errors
|
||||||
|
/// - ``PlexswiftError/failedToConstructRequestURL(_:)``
|
||||||
|
/// - ``PlexswiftError/failedToSerializeRequestParameters(_:)``
|
||||||
|
/// - ``PlexswiftError/failedToConstructRequest(_:)``
|
||||||
|
/// - ``PlexswiftError/failedToMakeNetworkRequest(error:)``
|
||||||
|
/// - ``PlexswiftError/failedToHandleResponse(_:)``
|
||||||
|
/// - ``PlexswiftError/internalError(error:)``
|
||||||
|
///
|
||||||
|
/// ### Error failure information
|
||||||
|
/// - ``PlexswiftError/RequestURLConstructionFailureReason``
|
||||||
|
/// - ``PlexswiftError/ParameterSerializationFailureReason``
|
||||||
|
/// - ``PlexswiftError/RequestConstructionFailureReason``
|
||||||
|
/// - ``PlexswiftError/ResponseHandlingFailureReason``
|
||||||
|
///
|
||||||
|
/// ### Convenience properties
|
||||||
|
/// - ``PlexswiftError/underlyingError``
|
||||||
|
public enum PlexswiftError: Swift.Error {
|
||||||
|
/// Failure reasons for ``PlexswiftError/failedToConstructRequestURL(_:)`` errors
|
||||||
|
public enum RequestURLConstructionFailureReason {
|
||||||
|
/// An invalid URL was returned when using a specified server definition to make a network request.
|
||||||
|
case invalidServerURL(string: String)
|
||||||
|
/// An invalid URL was used to make a network request.
|
||||||
|
case invalidRequestURL(string: String)
|
||||||
|
/// No default server could be found when making a network request.
|
||||||
|
case missingDefaultServer(serverType: String)
|
||||||
|
/// A server in a server list was specified but the index of that server is outside of the bounds of the list.
|
||||||
|
case invalidServerIndex(serverType: String, index: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Failure reasons for ``PlexswiftError/failedToSerializeRequestParameters(_:)`` errors
|
||||||
|
public enum ParameterSerializationFailureReason {
|
||||||
|
/// A server URL with parameters was used but the substitution parameter named `key` was not provided.
|
||||||
|
///
|
||||||
|
/// A server URL with substitution parameters — for example `https://domain.com:{port}/{configurable}/path` — was specified.
|
||||||
|
case missingServerParameterSubstitutionKey(_ key: String, serverString: String)
|
||||||
|
/// An API operation path with parameters was used but the substitution parameter named `key` was not specified.
|
||||||
|
///
|
||||||
|
/// An API operation with a path with substitution parameters — for example `"/{configurable}/endpoint"` — was specified.
|
||||||
|
case missingPathParameterSubstitutionKey(_ key: String, path: String)
|
||||||
|
/// A parameter was unexpectedly requested to be serialized to a given format.
|
||||||
|
case invalidSerializationParameter(type: String, format: String)
|
||||||
|
/// Failed to serialize a [Data](https://developer.apple.com/documentation/foundation/data) object when constructing the request.
|
||||||
|
case failedToSerializeData
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Failure reasons for ``PlexswiftError/failedToConstructRequest(_:)`` errors
|
||||||
|
public enum RequestConstructionFailureReason {
|
||||||
|
/// During request construction, a request body was not provided when one was expected.
|
||||||
|
case missingRequiredRequestBody
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Failure reasons for ``PlexswiftError/failedToHandleResponse(_:)`` errors
|
||||||
|
public enum ResponseHandlingFailureReason {
|
||||||
|
/// Failed to decode response data.
|
||||||
|
case failedToDecodeResponse
|
||||||
|
/// Failed to deserialize response JSON.
|
||||||
|
case failedToDeserializeJSON(_ error: Swift.Error)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Constructing the URL to make a network request failed.
|
||||||
|
case failedToConstructRequestURL(_ reason: RequestURLConstructionFailureReason)
|
||||||
|
/// Serializing the parameters required to make the network request failed.
|
||||||
|
case failedToSerializeRequestParameters(_ reason: ParameterSerializationFailureReason)
|
||||||
|
/// Constructing a underlying request object to make a network request failed.
|
||||||
|
case failedToConstructRequest(_ reason: RequestConstructionFailureReason)
|
||||||
|
/// Making an underlying network request failed.
|
||||||
|
case failedToMakeNetworkRequest(error: Swift.Error)
|
||||||
|
/// Handling the response data from an API request failed.
|
||||||
|
case failedToHandleResponse(_ reason: ResponseHandlingFailureReason)
|
||||||
|
|
||||||
|
/// An attempt to get response data from a response failed because it was missing.
|
||||||
|
case missingResponseData
|
||||||
|
|
||||||
|
/// An error internal to the implementation of ``Client`` occurred.
|
||||||
|
case internalError(error: Swift.Error?)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PlexswiftError: LocalizedError {
|
||||||
|
public var errorDescription: String? {
|
||||||
|
switch self {
|
||||||
|
case .failedToConstructRequestURL(let reason):
|
||||||
|
return "Failed to construct URL for request: \(reason.localizedDescription)"
|
||||||
|
case .failedToSerializeRequestParameters(let reason):
|
||||||
|
return "Failed to serialize parameters for request: \(reason.localizedDescription)"
|
||||||
|
case .failedToConstructRequest(let reason):
|
||||||
|
return "Failed to construct request: \(reason.localizedDescription)"
|
||||||
|
case .failedToMakeNetworkRequest(let error):
|
||||||
|
return "Failed to make network request: \(error.localizedDescription)"
|
||||||
|
case .failedToHandleResponse(let reason):
|
||||||
|
return "Failed to handle response: \(reason.localizedDescription)"
|
||||||
|
case .missingResponseData:
|
||||||
|
return "The response didn't contain the requested data"
|
||||||
|
case .internalError:
|
||||||
|
return "The operation couldn't be completed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PlexswiftError {
|
||||||
|
/// Returns the associated underlying error, if available.
|
||||||
|
public var underlyingError: Swift.Error? {
|
||||||
|
switch self {
|
||||||
|
case .internalError(let error):
|
||||||
|
return error
|
||||||
|
case .failedToMakeNetworkRequest(let error):
|
||||||
|
return error
|
||||||
|
case .failedToHandleResponse(let reason):
|
||||||
|
switch reason {
|
||||||
|
case .failedToDecodeResponse:
|
||||||
|
return nil
|
||||||
|
case .failedToDeserializeJSON(let error):
|
||||||
|
return error
|
||||||
|
}
|
||||||
|
case .failedToConstructRequestURL, .failedToSerializeRequestParameters, .failedToConstructRequest, .missingResponseData:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PlexswiftError.RequestURLConstructionFailureReason {
|
||||||
|
public var localizedDescription: String {
|
||||||
|
switch self {
|
||||||
|
case .invalidServerURL(string: let serverString):
|
||||||
|
return "Server URL '\(serverString)' is not valid"
|
||||||
|
case .invalidRequestURL(string: let string):
|
||||||
|
return "Request URL '\(string)' is not valid"
|
||||||
|
case .missingDefaultServer(let serverType):
|
||||||
|
return "No default server is available for type '\(serverType)'"
|
||||||
|
case .invalidServerIndex(serverType: let serverType, index: let index):
|
||||||
|
return "Server type '\(serverType)' has no server defined at index \(index)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PlexswiftError.ParameterSerializationFailureReason {
|
||||||
|
public var localizedDescription: String {
|
||||||
|
switch self {
|
||||||
|
case .missingServerParameterSubstitutionKey(let key, serverString: let serverString):
|
||||||
|
return "Missing substitution parameter '\(key)' when building server URL '\(serverString)'"
|
||||||
|
case .missingPathParameterSubstitutionKey(let key, path: let path):
|
||||||
|
return "Missing substitution parameter '\(key)' when building path '\(path)'"
|
||||||
|
case .invalidSerializationParameter(type: let type, format: let format):
|
||||||
|
return "Invalid parameter type '\(type)' when serializing for \(format)"
|
||||||
|
case .failedToSerializeData:
|
||||||
|
return "Failed to serialize data parameter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PlexswiftError.RequestConstructionFailureReason {
|
||||||
|
public var localizedDescription: String {
|
||||||
|
switch self {
|
||||||
|
case .missingRequiredRequestBody:
|
||||||
|
return "Required request body is missing"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PlexswiftError.ResponseHandlingFailureReason {
|
||||||
|
public var localizedDescription: String {
|
||||||
|
switch self {
|
||||||
|
case .failedToDecodeResponse:
|
||||||
|
return "Failed to decode response data"
|
||||||
|
case .failedToDeserializeJSON(let error):
|
||||||
|
return "Failed to deserialize JSON: \(error.localizedDescription)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension SerializableFormat {
|
||||||
|
var formatDescription: String {
|
||||||
|
switch self {
|
||||||
|
case .path: return "path parameter"
|
||||||
|
case .query: return "query parameter"
|
||||||
|
case .header: return "request header"
|
||||||
|
case .multipart: return "multipart encoding"
|
||||||
|
case .form: return "form encoding"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
38
Sources/Plexswift/configuration/GlobalServer.swift
Normal file
38
Sources/Plexswift/configuration/GlobalServer.swift
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
/// The protocol to use when connecting to your plex server.
|
||||||
|
public enum ServerProtocol: String, Codable, APIValue {
|
||||||
|
case http = "http"
|
||||||
|
case https = "https"
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GlobalServers: Servers, ServerConvertible {
|
||||||
|
/// Supported server value with substituted variables
|
||||||
|
///
|
||||||
|
/// Corresponds to `{protocol}://{ip}:{port}`
|
||||||
|
case server1(`protocol`: ServerProtocol = .http, ip: String = "10.10.10.47", port: String = "32400")
|
||||||
|
|
||||||
|
/// Defines the raw URL strings for each server option.
|
||||||
|
///
|
||||||
|
/// > Note: You do not need to use these values directly.
|
||||||
|
///
|
||||||
|
/// The available URL strings are defined as:
|
||||||
|
/// ```swift
|
||||||
|
/// public static let urlStrings = [
|
||||||
|
/// "{protocol}://{ip}:{port}"
|
||||||
|
/// ]
|
||||||
|
/// ```
|
||||||
|
public static let urlStrings = [
|
||||||
|
"{protocol}://{ip}:{port}"
|
||||||
|
]
|
||||||
|
|
||||||
|
func server() throws -> Server {
|
||||||
|
switch self {
|
||||||
|
case .server1(let `protocol`, let ip, let port):
|
||||||
|
return try type(of: self).server(at: 0, substituting: ["protocol": `protocol`.rawValue, "ip": ip, "port": port])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
74
Sources/Plexswift/internal/api/Client+PlexswiftAPI.swift
Normal file
74
Sources/Plexswift/internal/api/Client+PlexswiftAPI.swift
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Client: PlexswiftAPI {
|
||||||
|
// MARK: - Root operations
|
||||||
|
|
||||||
|
// MARK: - Scoped API operations
|
||||||
|
|
||||||
|
public var server: ServerAPI {
|
||||||
|
return _ServerAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var media: MediaAPI {
|
||||||
|
return _MediaAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var video: VideoAPI {
|
||||||
|
return _VideoAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var activities: ActivitiesAPI {
|
||||||
|
return _ActivitiesAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var butler: ButlerAPI {
|
||||||
|
return _ButlerAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var hubs: HubsAPI {
|
||||||
|
return _HubsAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var search: SearchAPI {
|
||||||
|
return _SearchAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var library: LibraryAPI {
|
||||||
|
return _LibraryAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var log: LogAPI {
|
||||||
|
return _LogAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var plex: PlexAPI {
|
||||||
|
return _PlexAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var playlists: PlaylistsAPI {
|
||||||
|
return _PlaylistsAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var authentication: AuthenticationAPI {
|
||||||
|
return _AuthenticationAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var statistics: StatisticsAPI {
|
||||||
|
return _StatisticsAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var sessions: SessionsAPI {
|
||||||
|
return _SessionsAPI(client: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var updater: UpdaterAPI {
|
||||||
|
return _UpdaterAPI(client: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
93
Sources/Plexswift/internal/api/_ActivitiesAPI.swift
Normal file
93
Sources/Plexswift/internal/api/_ActivitiesAPI.swift
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _ActivitiesAPI: ActivitiesAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getServerActivities() async throws -> Response<Operations.GetServerActivitiesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetServerActivitiesRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetServerActivitiesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func cancelServerActivities(request: Operations.CancelServerActivitiesRequest) async throws -> Response<Operations.CancelServerActivitiesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureCancelServerActivitiesRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleCancelServerActivitiesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetServerActivitiesRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/activities"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureCancelServerActivitiesRequest(with configuration: URLRequestConfiguration, request: Operations.CancelServerActivitiesRequest) throws {
|
||||||
|
configuration.path = "/activities/{activityUUID}"
|
||||||
|
configuration.method = .delete
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetServerActivitiesResponse(response: Client.APIResponse) throws -> Operations.GetServerActivitiesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerActivitiesResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerActivitiesActivitiesResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleCancelServerActivitiesResponse(response: Client.APIResponse) throws -> Operations.CancelServerActivitiesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.CancelServerActivitiesResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
86
Sources/Plexswift/internal/api/_AuthenticationAPI.swift
Normal file
86
Sources/Plexswift/internal/api/_AuthenticationAPI.swift
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _AuthenticationAPI: AuthenticationAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getTransientToken(request: Operations.GetTransientTokenRequest) async throws -> Response<Operations.GetTransientTokenResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetTransientTokenRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetTransientTokenResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getSourceConnectionInformation(request: Operations.GetSourceConnectionInformationRequest) async throws -> Response<Operations.GetSourceConnectionInformationResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetSourceConnectionInformationRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetSourceConnectionInformationResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetTransientTokenRequest(with configuration: URLRequestConfiguration, request: Operations.GetTransientTokenRequest) throws {
|
||||||
|
configuration.path = "/security/token"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetSourceConnectionInformationRequest(with configuration: URLRequestConfiguration, request: Operations.GetSourceConnectionInformationRequest) throws {
|
||||||
|
configuration.path = "/security/resources"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetTransientTokenResponse(response: Client.APIResponse) throws -> Operations.GetTransientTokenResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.GetTransientTokenResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetSourceConnectionInformationResponse(response: Client.APIResponse) throws -> Operations.GetSourceConnectionInformationResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.GetSourceConnectionInformationResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
193
Sources/Plexswift/internal/api/_ButlerAPI.swift
Normal file
193
Sources/Plexswift/internal/api/_ButlerAPI.swift
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _ButlerAPI: ButlerAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getButlerTasks() async throws -> Response<Operations.GetButlerTasksResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetButlerTasksRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetButlerTasksResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func startAllTasks() async throws -> Response<Operations.StartAllTasksResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureStartAllTasksRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleStartAllTasksResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func stopAllTasks() async throws -> Response<Operations.StopAllTasksResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureStopAllTasksRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleStopAllTasksResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func startTask(request: Operations.StartTaskRequest) async throws -> Response<Operations.StartTaskResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureStartTaskRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleStartTaskResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func stopTask(request: Operations.StopTaskRequest) async throws -> Response<Operations.StopTaskResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureStopTaskRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleStopTaskResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetButlerTasksRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/butler"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureStartAllTasksRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/butler"
|
||||||
|
configuration.method = .post
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureStopAllTasksRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/butler"
|
||||||
|
configuration.method = .delete
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureStartTaskRequest(with configuration: URLRequestConfiguration, request: Operations.StartTaskRequest) throws {
|
||||||
|
configuration.path = "/butler/{taskName}"
|
||||||
|
configuration.method = .post
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureStopTaskRequest(with configuration: URLRequestConfiguration, request: Operations.StopTaskRequest) throws {
|
||||||
|
configuration.path = "/butler/{taskName}"
|
||||||
|
configuration.method = .delete
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetButlerTasksResponse(response: Client.APIResponse) throws -> Operations.GetButlerTasksResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetButlerTasksResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetButlerTasksButlerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleStartAllTasksResponse(response: Client.APIResponse) throws -> Operations.StartAllTasksResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.StartAllTasksResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleStopAllTasksResponse(response: Client.APIResponse) throws -> Operations.StopAllTasksResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.StopAllTasksResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleStartTaskResponse(response: Client.APIResponse) throws -> Operations.StartTaskResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 202, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.StartTaskResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleStopTaskResponse(response: Client.APIResponse) throws -> Operations.StopTaskResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400, 404].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.StopTaskResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
103
Sources/Plexswift/internal/api/_HubsAPI.swift
Normal file
103
Sources/Plexswift/internal/api/_HubsAPI.swift
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _HubsAPI: HubsAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getGlobalHubs(request: Operations.GetGlobalHubsRequest) async throws -> Response<Operations.GetGlobalHubsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetGlobalHubsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetGlobalHubsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getLibraryHubs(request: Operations.GetLibraryHubsRequest) async throws -> Response<Operations.GetLibraryHubsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetLibraryHubsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetLibraryHubsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetGlobalHubsRequest(with configuration: URLRequestConfiguration, request: Operations.GetGlobalHubsRequest) throws {
|
||||||
|
configuration.path = "/hubs"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetLibraryHubsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryHubsRequest) throws {
|
||||||
|
configuration.path = "/hubs/sections/{sectionId}"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetGlobalHubsResponse(response: Client.APIResponse) throws -> Operations.GetGlobalHubsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetGlobalHubsResponseBody.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.GetGlobalHubsHubsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetLibraryHubsResponse(response: Client.APIResponse) throws -> Operations.GetLibraryHubsResponse {
|
||||||
|
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.GetLibraryHubsResponseBody.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.GetLibraryHubsHubsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
435
Sources/Plexswift/internal/api/_LibraryAPI.swift
Normal file
435
Sources/Plexswift/internal/api/_LibraryAPI.swift
Normal file
@@ -0,0 +1,435 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _LibraryAPI: LibraryAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getFileHash(request: Operations.GetFileHashRequest) async throws -> Response<Operations.GetFileHashResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetFileHashRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetFileHashResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getRecentlyAdded() async throws -> Response<Operations.GetRecentlyAddedResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetRecentlyAddedRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetRecentlyAddedResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getLibraries() async throws -> Response<Operations.GetLibrariesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetLibrariesRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetLibrariesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getLibrary(request: Operations.GetLibraryRequest) async throws -> Response<Operations.GetLibraryResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetLibraryRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetLibraryResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func deleteLibrary(request: Operations.DeleteLibraryRequest) async throws -> Response<Operations.DeleteLibraryResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureDeleteLibraryRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleDeleteLibraryResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getLibraryItems(request: Operations.GetLibraryItemsRequest) async throws -> Response<Operations.GetLibraryItemsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetLibraryItemsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetLibraryItemsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func refreshLibrary(request: Operations.RefreshLibraryRequest) async throws -> Response<Operations.RefreshLibraryResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureRefreshLibraryRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleRefreshLibraryResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func searchLibrary(request: Operations.SearchLibraryRequest) async throws -> Response<Operations.SearchLibraryResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureSearchLibraryRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleSearchLibraryResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getMetadata(request: Operations.GetMetadataRequest) async throws -> Response<Operations.GetMetadataResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetMetadataRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetMetadataResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getMetadataChildren(request: Operations.GetMetadataChildrenRequest) async throws -> Response<Operations.GetMetadataChildrenResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetMetadataChildrenRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetMetadataChildrenResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getOnDeck() async throws -> Response<Operations.GetOnDeckResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetOnDeckRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetOnDeckResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetFileHashRequest(with configuration: URLRequestConfiguration, request: Operations.GetFileHashRequest) throws {
|
||||||
|
configuration.path = "/library/hashes"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetRecentlyAddedRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/library/recentlyAdded"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetLibrariesRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/library/sections"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryRequest) throws {
|
||||||
|
configuration.path = "/library/sections/{sectionId}"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureDeleteLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.DeleteLibraryRequest) throws {
|
||||||
|
configuration.path = "/library/sections/{sectionId}"
|
||||||
|
configuration.method = .delete
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetLibraryItemsRequest(with configuration: URLRequestConfiguration, request: Operations.GetLibraryItemsRequest) throws {
|
||||||
|
configuration.path = "/library/sections/{sectionId}/{tag}"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureRefreshLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.RefreshLibraryRequest) throws {
|
||||||
|
configuration.path = "/library/sections/{sectionId}/refresh"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureSearchLibraryRequest(with configuration: URLRequestConfiguration, request: Operations.SearchLibraryRequest) throws {
|
||||||
|
configuration.path = "/library/sections/{sectionId}/search"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetMetadataRequest(with configuration: URLRequestConfiguration, request: Operations.GetMetadataRequest) throws {
|
||||||
|
configuration.path = "/library/metadata/{ratingKey}"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetMetadataChildrenRequest(with configuration: URLRequestConfiguration, request: Operations.GetMetadataChildrenRequest) throws {
|
||||||
|
configuration.path = "/library/metadata/{ratingKey}/children"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetOnDeckRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/library/onDeck"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetFileHashResponse(response: Client.APIResponse) throws -> Operations.GetFileHashResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.GetFileHashResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetRecentlyAddedResponse(response: Client.APIResponse) throws -> Operations.GetRecentlyAddedResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetRecentlyAddedResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetRecentlyAddedLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetLibrariesResponse(response: Client.APIResponse) throws -> Operations.GetLibrariesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetLibrariesResponseBody.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.GetLibrariesLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetLibraryResponse(response: Client.APIResponse) throws -> Operations.GetLibraryResponse {
|
||||||
|
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.GetLibraryResponseBody.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.GetLibraryLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleDeleteLibraryResponse(response: Client.APIResponse) throws -> Operations.DeleteLibraryResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.DeleteLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetLibraryItemsResponse(response: Client.APIResponse) throws -> Operations.GetLibraryItemsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.GetLibraryItemsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleRefreshLibraryResponse(response: Client.APIResponse) throws -> Operations.RefreshLibraryResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.RefreshLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleSearchLibraryResponse(response: Client.APIResponse) throws -> Operations.SearchLibraryResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.SearchLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetMetadataResponse(response: Client.APIResponse) throws -> Operations.GetMetadataResponse {
|
||||||
|
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.GetMetadataResponseBody.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.GetMetadataLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetMetadataChildrenResponse(response: Client.APIResponse) throws -> Operations.GetMetadataChildrenResponse {
|
||||||
|
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.GetMetadataChildrenResponseBody.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.GetMetadataChildrenLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetOnDeckResponse(response: Client.APIResponse) throws -> Operations.GetOnDeckResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetOnDeckResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetOnDeckLibraryResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
123
Sources/Plexswift/internal/api/_LogAPI.swift
Normal file
123
Sources/Plexswift/internal/api/_LogAPI.swift
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _LogAPI: LogAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func logLine(request: Operations.LogLineRequest) async throws -> Response<Operations.LogLineResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureLogLineRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleLogLineResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func logMultiLine(request: String) async throws -> Response<Operations.LogMultiLineResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureLogMultiLineRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleLogMultiLineResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func enablePaperTrail() async throws -> Response<Operations.EnablePaperTrailResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureEnablePaperTrailRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleEnablePaperTrailResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureLogLineRequest(with configuration: URLRequestConfiguration, request: Operations.LogLineRequest) throws {
|
||||||
|
configuration.path = "/log"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureLogMultiLineRequest(with configuration: URLRequestConfiguration, request: String) throws {
|
||||||
|
configuration.path = "/log"
|
||||||
|
configuration.method = .post
|
||||||
|
configuration.contentType = "text/plain"
|
||||||
|
configuration.body = request.data(using: .utf8)
|
||||||
|
if configuration.body == nil {
|
||||||
|
throw SerializationError.missingRequiredRequestBody
|
||||||
|
}
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureEnablePaperTrailRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/log/networked"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleLogLineResponse(response: Client.APIResponse) throws -> Operations.LogLineResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.LogLineResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleLogMultiLineResponse(response: Client.APIResponse) throws -> Operations.LogMultiLineResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.LogMultiLineResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleEnablePaperTrailResponse(response: Client.APIResponse) throws -> Operations.EnablePaperTrailResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400, 403].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.EnablePaperTrailResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
120
Sources/Plexswift/internal/api/_MediaAPI.swift
Normal file
120
Sources/Plexswift/internal/api/_MediaAPI.swift
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _MediaAPI: MediaAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func markPlayed(request: Operations.MarkPlayedRequest) async throws -> Response<Operations.MarkPlayedResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureMarkPlayedRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleMarkPlayedResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func markUnplayed(request: Operations.MarkUnplayedRequest) async throws -> Response<Operations.MarkUnplayedResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureMarkUnplayedRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleMarkUnplayedResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func updatePlayProgress(request: Operations.UpdatePlayProgressRequest) async throws -> Response<Operations.UpdatePlayProgressResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureUpdatePlayProgressRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleUpdatePlayProgressResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureMarkPlayedRequest(with configuration: URLRequestConfiguration, request: Operations.MarkPlayedRequest) throws {
|
||||||
|
configuration.path = "/:/scrobble"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureMarkUnplayedRequest(with configuration: URLRequestConfiguration, request: Operations.MarkUnplayedRequest) throws {
|
||||||
|
configuration.path = "/:/unscrobble"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureUpdatePlayProgressRequest(with configuration: URLRequestConfiguration, request: Operations.UpdatePlayProgressRequest) throws {
|
||||||
|
configuration.path = "/:/progress"
|
||||||
|
configuration.method = .post
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleMarkPlayedResponse(response: Client.APIResponse) throws -> Operations.MarkPlayedResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.MarkPlayedResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleMarkUnplayedResponse(response: Client.APIResponse) throws -> Operations.MarkUnplayedResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.MarkUnplayedResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleUpdatePlayProgressResponse(response: Client.APIResponse) throws -> Operations.UpdatePlayProgressResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.UpdatePlayProgressResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
367
Sources/Plexswift/internal/api/_PlaylistsAPI.swift
Normal file
367
Sources/Plexswift/internal/api/_PlaylistsAPI.swift
Normal file
@@ -0,0 +1,367 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _PlaylistsAPI: PlaylistsAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func createPlaylist(request: Operations.CreatePlaylistRequest) async throws -> Response<Operations.CreatePlaylistResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureCreatePlaylistRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleCreatePlaylistResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getPlaylists(request: Operations.GetPlaylistsRequest) async throws -> Response<Operations.GetPlaylistsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetPlaylistsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetPlaylistsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getPlaylist(request: Operations.GetPlaylistRequest) async throws -> Response<Operations.GetPlaylistResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetPlaylistRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetPlaylistResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func deletePlaylist(request: Operations.DeletePlaylistRequest) async throws -> Response<Operations.DeletePlaylistResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureDeletePlaylistRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleDeletePlaylistResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func updatePlaylist(request: Operations.UpdatePlaylistRequest) async throws -> Response<Operations.UpdatePlaylistResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureUpdatePlaylistRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleUpdatePlaylistResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getPlaylistContents(request: Operations.GetPlaylistContentsRequest) async throws -> Response<Operations.GetPlaylistContentsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetPlaylistContentsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetPlaylistContentsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func clearPlaylistContents(request: Operations.ClearPlaylistContentsRequest) async throws -> Response<Operations.ClearPlaylistContentsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureClearPlaylistContentsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleClearPlaylistContentsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func addPlaylistContents(request: Operations.AddPlaylistContentsRequest) async throws -> Response<Operations.AddPlaylistContentsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureAddPlaylistContentsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleAddPlaylistContentsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func uploadPlaylist(request: Operations.UploadPlaylistRequest) async throws -> Response<Operations.UploadPlaylistResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureUploadPlaylistRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleUploadPlaylistResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureCreatePlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.CreatePlaylistRequest) throws {
|
||||||
|
configuration.path = "/playlists"
|
||||||
|
configuration.method = .post
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetPlaylistsRequest(with configuration: URLRequestConfiguration, request: Operations.GetPlaylistsRequest) throws {
|
||||||
|
configuration.path = "/playlists"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetPlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.GetPlaylistRequest) throws {
|
||||||
|
configuration.path = "/playlists/{playlistID}"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureDeletePlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.DeletePlaylistRequest) throws {
|
||||||
|
configuration.path = "/playlists/{playlistID}"
|
||||||
|
configuration.method = .delete
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureUpdatePlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.UpdatePlaylistRequest) throws {
|
||||||
|
configuration.path = "/playlists/{playlistID}"
|
||||||
|
configuration.method = .put
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetPlaylistContentsRequest(with configuration: URLRequestConfiguration, request: Operations.GetPlaylistContentsRequest) throws {
|
||||||
|
configuration.path = "/playlists/{playlistID}/items"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureClearPlaylistContentsRequest(with configuration: URLRequestConfiguration, request: Operations.ClearPlaylistContentsRequest) throws {
|
||||||
|
configuration.path = "/playlists/{playlistID}/items"
|
||||||
|
configuration.method = .delete
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureAddPlaylistContentsRequest(with configuration: URLRequestConfiguration, request: Operations.AddPlaylistContentsRequest) throws {
|
||||||
|
configuration.path = "/playlists/{playlistID}/items"
|
||||||
|
configuration.method = .put
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureUploadPlaylistRequest(with configuration: URLRequestConfiguration, request: Operations.UploadPlaylistRequest) throws {
|
||||||
|
configuration.path = "/playlists/upload"
|
||||||
|
configuration.method = .post
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleCreatePlaylistResponse(response: Client.APIResponse) throws -> Operations.CreatePlaylistResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.CreatePlaylistResponseBody.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.CreatePlaylistPlaylistsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetPlaylistsResponse(response: Client.APIResponse) throws -> Operations.GetPlaylistsResponse {
|
||||||
|
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.GetPlaylistsResponseBody.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.GetPlaylistsPlaylistsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetPlaylistResponse(response: Client.APIResponse) throws -> Operations.GetPlaylistResponse {
|
||||||
|
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.GetPlaylistResponseBody.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.GetPlaylistPlaylistsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleDeletePlaylistResponse(response: Client.APIResponse) throws -> Operations.DeletePlaylistResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.DeletePlaylistResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleUpdatePlaylistResponse(response: Client.APIResponse) throws -> Operations.UpdatePlaylistResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.UpdatePlaylistResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetPlaylistContentsResponse(response: Client.APIResponse) throws -> Operations.GetPlaylistContentsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetPlaylistContentsResponseBody.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.GetPlaylistContentsPlaylistsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleClearPlaylistContentsResponse(response: Client.APIResponse) throws -> Operations.ClearPlaylistContentsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.ClearPlaylistContentsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleAddPlaylistContentsResponse(response: Client.APIResponse) throws -> Operations.AddPlaylistContentsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.AddPlaylistContentsResponseBody.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.AddPlaylistContentsPlaylistsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleUploadPlaylistResponse(response: Client.APIResponse) throws -> Operations.UploadPlaylistResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.UploadPlaylistResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
96
Sources/Plexswift/internal/api/_PlexAPI.swift
Normal file
96
Sources/Plexswift/internal/api/_PlexAPI.swift
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _PlexAPI: PlexAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
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(),
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetPinRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetPinResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getToken(request: Operations.GetTokenRequest, server: PlexServers.GetToken?) async throws -> Response<Operations.GetTokenResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
with: try server?.server() ?? PlexServers.GetToken.default(),
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetTokenRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetTokenResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetPinRequest(with configuration: URLRequestConfiguration, request: Operations.GetPinRequest) throws {
|
||||||
|
configuration.path = "/pins"
|
||||||
|
configuration.method = .post
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.headerParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetTokenRequest(with configuration: URLRequestConfiguration, request: Operations.GetTokenRequest) throws {
|
||||||
|
configuration.path = "/pins/{pinID}"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.headerParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetPinResponse(response: Client.APIResponse) throws -> Operations.GetPinResponse {
|
||||||
|
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))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetPinPlexResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetTokenResponse(response: Client.APIResponse) throws -> Operations.GetTokenResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
return .empty
|
||||||
|
} 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))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
128
Sources/Plexswift/internal/api/_SearchAPI.swift
Normal file
128
Sources/Plexswift/internal/api/_SearchAPI.swift
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _SearchAPI: SearchAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func performSearch(request: Operations.PerformSearchRequest) async throws -> Response<Operations.PerformSearchResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configurePerformSearchRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handlePerformSearchResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func performVoiceSearch(request: Operations.PerformVoiceSearchRequest) async throws -> Response<Operations.PerformVoiceSearchResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configurePerformVoiceSearchRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handlePerformVoiceSearchResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getSearchResults(request: Operations.GetSearchResultsRequest) async throws -> Response<Operations.GetSearchResultsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetSearchResultsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetSearchResultsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configurePerformSearchRequest(with configuration: URLRequestConfiguration, request: Operations.PerformSearchRequest) throws {
|
||||||
|
configuration.path = "/hubs/search"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configurePerformVoiceSearchRequest(with configuration: URLRequestConfiguration, request: Operations.PerformVoiceSearchRequest) throws {
|
||||||
|
configuration.path = "/hubs/search/voice"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetSearchResultsRequest(with configuration: URLRequestConfiguration, request: Operations.GetSearchResultsRequest) throws {
|
||||||
|
configuration.path = "/search"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handlePerformSearchResponse(response: Client.APIResponse) throws -> Operations.PerformSearchResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.PerformSearchResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handlePerformVoiceSearchResponse(response: Client.APIResponse) throws -> Operations.PerformVoiceSearchResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.PerformVoiceSearchResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetSearchResultsResponse(response: Client.APIResponse) throws -> Operations.GetSearchResultsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetSearchResultsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetSearchResultsSearchResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
339
Sources/Plexswift/internal/api/_ServerAPI.swift
Normal file
339
Sources/Plexswift/internal/api/_ServerAPI.swift
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _ServerAPI: ServerAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getServerCapabilities() async throws -> Response<Operations.GetServerCapabilitiesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetServerCapabilitiesRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetServerCapabilitiesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getServerPreferences() async throws -> Response<Operations.GetServerPreferencesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetServerPreferencesRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetServerPreferencesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getAvailableClients() async throws -> Response<Operations.GetAvailableClientsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetAvailableClientsRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetAvailableClientsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getDevices() async throws -> Response<Operations.GetDevicesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetDevicesRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetDevicesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getServerIdentity() async throws -> Response<Operations.GetServerIdentityResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetServerIdentityRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetServerIdentityResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getMyPlexAccount() async throws -> Response<Operations.GetMyPlexAccountResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetMyPlexAccountRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetMyPlexAccountResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getResizedPhoto(request: Operations.GetResizedPhotoRequest) async throws -> Response<Operations.GetResizedPhotoResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetResizedPhotoRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetResizedPhotoResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getServerList() async throws -> Response<Operations.GetServerListResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetServerListRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetServerListResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetServerCapabilitiesRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetServerPreferencesRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/:/prefs"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetAvailableClientsRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/clients"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetDevicesRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/devices"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetServerIdentityRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/identity"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetMyPlexAccountRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/myplex/account"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetResizedPhotoRequest(with configuration: URLRequestConfiguration, request: Operations.GetResizedPhotoRequest) throws {
|
||||||
|
configuration.path = "/photo/:/transcode"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetServerListRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/servers"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetServerCapabilitiesResponse(response: Client.APIResponse) throws -> Operations.GetServerCapabilitiesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerCapabilitiesResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerCapabilitiesServerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetServerPreferencesResponse(response: Client.APIResponse) throws -> Operations.GetServerPreferencesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerPreferencesResponseBody.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.GetServerPreferencesServerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetAvailableClientsResponse(response: Client.APIResponse) throws -> Operations.GetAvailableClientsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetAvailableClientsResponseBody.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.GetAvailableClientsServerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetDevicesResponse(response: Client.APIResponse) throws -> Operations.GetDevicesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetDevicesResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetDevicesServerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetServerIdentityResponse(response: Client.APIResponse) throws -> Operations.GetServerIdentityResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerIdentityResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerIdentityServerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetMyPlexAccountResponse(response: Client.APIResponse) throws -> Operations.GetMyPlexAccountResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetMyPlexAccountResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetMyPlexAccountServerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetResizedPhotoResponse(response: Client.APIResponse) throws -> Operations.GetResizedPhotoResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.GetResizedPhotoResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetServerListResponse(response: Client.APIResponse) throws -> Operations.GetServerListResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerListResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetServerListServerResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
175
Sources/Plexswift/internal/api/_SessionsAPI.swift
Normal file
175
Sources/Plexswift/internal/api/_SessionsAPI.swift
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _SessionsAPI: SessionsAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getSessions() async throws -> Response<Operations.GetSessionsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetSessionsRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetSessionsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getSessionHistory() async throws -> Response<Operations.GetSessionHistoryResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetSessionHistoryRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetSessionHistoryResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getTranscodeSessions() async throws -> Response<Operations.GetTranscodeSessionsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetTranscodeSessionsRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetTranscodeSessionsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func stopTranscodeSession(request: Operations.StopTranscodeSessionRequest) async throws -> Response<Operations.StopTranscodeSessionResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureStopTranscodeSessionRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleStopTranscodeSessionResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetSessionsRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/status/sessions"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetSessionHistoryRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/status/sessions/history/all"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureGetTranscodeSessionsRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/transcode/sessions"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureStopTranscodeSessionRequest(with configuration: URLRequestConfiguration, request: Operations.StopTranscodeSessionRequest) throws {
|
||||||
|
configuration.path = "/transcode/sessions/{sessionKey}"
|
||||||
|
configuration.method = .delete
|
||||||
|
configuration.pathParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetSessionsResponse(response: Client.APIResponse) throws -> Operations.GetSessionsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetSessionsResponseBody.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.GetSessionsSessionsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetSessionHistoryResponse(response: Client.APIResponse) throws -> Operations.GetSessionHistoryResponse {
|
||||||
|
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.GetSessionHistoryResponseBody.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.GetSessionHistorySessionsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleGetTranscodeSessionsResponse(response: Client.APIResponse) throws -> Operations.GetTranscodeSessionsResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetTranscodeSessionsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if httpResponse.statusCode == 400 {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .fourHundredAndOneApplicationJsonObject(try JSONDecoder().decode(Operations.GetTranscodeSessionsSessionsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleStopTranscodeSessionResponse(response: Client.APIResponse) throws -> Operations.StopTranscodeSessionResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [204, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.StopTranscodeSessionResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
60
Sources/Plexswift/internal/api/_StatisticsAPI.swift
Normal file
60
Sources/Plexswift/internal/api/_StatisticsAPI.swift
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _StatisticsAPI: StatisticsAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getStatistics(request: Operations.GetStatisticsRequest) async throws -> Response<Operations.GetStatisticsResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetStatisticsRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetStatisticsResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetStatisticsRequest(with configuration: URLRequestConfiguration, request: Operations.GetStatisticsRequest) throws {
|
||||||
|
configuration.path = "/statistics/media"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetStatisticsResponse(response: Client.APIResponse) throws -> Operations.GetStatisticsResponse {
|
||||||
|
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.GetStatisticsResponseBody.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.GetStatisticsStatisticsResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
127
Sources/Plexswift/internal/api/_UpdaterAPI.swift
Normal file
127
Sources/Plexswift/internal/api/_UpdaterAPI.swift
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _UpdaterAPI: UpdaterAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getUpdateStatus() async throws -> Response<Operations.GetUpdateStatusResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetUpdateStatusRequest(with: configuration)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetUpdateStatusResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func checkForUpdates(request: Operations.CheckForUpdatesRequest) async throws -> Response<Operations.CheckForUpdatesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureCheckForUpdatesRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleCheckForUpdatesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func applyUpdates(request: Operations.ApplyUpdatesRequest) async throws -> Response<Operations.ApplyUpdatesResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureApplyUpdatesRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleApplyUpdatesResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetUpdateStatusRequest(with configuration: URLRequestConfiguration) throws {
|
||||||
|
configuration.path = "/updater/status"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureCheckForUpdatesRequest(with configuration: URLRequestConfiguration, request: Operations.CheckForUpdatesRequest) throws {
|
||||||
|
configuration.path = "/updater/check"
|
||||||
|
configuration.method = .put
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureApplyUpdatesRequest(with configuration: URLRequestConfiguration, request: Operations.ApplyUpdatesRequest) throws {
|
||||||
|
configuration.path = "/updater/apply"
|
||||||
|
configuration.method = .put
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetUpdateStatusResponse(response: Client.APIResponse) throws -> Operations.GetUpdateStatusResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if httpResponse.statusCode == 200 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .twoHundredApplicationJsonObject(try JSONDecoder().decode(Operations.GetUpdateStatusResponseBody.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.GetUpdateStatusUpdaterResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleCheckForUpdatesResponse(response: Client.APIResponse) throws -> Operations.CheckForUpdatesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.CheckForUpdatesResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleApplyUpdatesResponse(response: Client.APIResponse) throws -> Operations.ApplyUpdatesResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400, 500].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.ApplyUpdatesResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
86
Sources/Plexswift/internal/api/_VideoAPI.swift
Normal file
86
Sources/Plexswift/internal/api/_VideoAPI.swift
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class _VideoAPI: VideoAPI {
|
||||||
|
private let client: Client
|
||||||
|
|
||||||
|
init(client: Client) {
|
||||||
|
self.client = client
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getTimeline(request: Operations.GetTimelineRequest) async throws -> Response<Operations.GetTimelineResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureGetTimelineRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleGetTimelineResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func startUniversalTranscode(request: Operations.StartUniversalTranscodeRequest) async throws -> Response<Operations.StartUniversalTranscodeResponse> {
|
||||||
|
return try await client.makeRequest(
|
||||||
|
configureRequest: { configuration in
|
||||||
|
try configureStartUniversalTranscodeRequest(with: configuration, request: request)
|
||||||
|
},
|
||||||
|
handleResponse: handleStartUniversalTranscodeResponse
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Request Configuration
|
||||||
|
|
||||||
|
private func configureGetTimelineRequest(with configuration: URLRequestConfiguration, request: Operations.GetTimelineRequest) throws {
|
||||||
|
configuration.path = "/:/timeline"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
private func configureStartUniversalTranscodeRequest(with configuration: URLRequestConfiguration, request: Operations.StartUniversalTranscodeRequest) throws {
|
||||||
|
configuration.path = "/video/:/transcode/universal/start.mpd"
|
||||||
|
configuration.method = .get
|
||||||
|
configuration.queryParameterSerializable = request
|
||||||
|
configuration.telemetryHeader = .userAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Response Handlers
|
||||||
|
|
||||||
|
private func handleGetTimelineResponse(response: Client.APIResponse) throws -> Operations.GetTimelineResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.GetTimelineResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleStartUniversalTranscodeResponse(response: Client.APIResponse) throws -> Operations.StartUniversalTranscodeResponse {
|
||||||
|
let httpResponse = response.httpResponse
|
||||||
|
|
||||||
|
if [200, 400].contains(httpResponse.statusCode) {
|
||||||
|
return .empty
|
||||||
|
} else if httpResponse.statusCode == 401 {
|
||||||
|
if httpResponse.contentType.matchContentType(pattern: "application/json"), let data = response.data {
|
||||||
|
do {
|
||||||
|
return .object(try JSONDecoder().decode(Operations.StartUniversalTranscodeResponseBody.self, from: data))
|
||||||
|
} catch {
|
||||||
|
throw ResponseHandlerError.failedToDecodeJSON(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return .empty
|
||||||
|
}
|
||||||
|
|
||||||
121
Sources/Plexswift/internal/client/Response.swift
Normal file
121
Sources/Plexswift/internal/client/Response.swift
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
#if os(Linux)
|
||||||
|
import FoundationNetworking
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Describes any header values returned as part of a response to a call made to the API.
|
||||||
|
///
|
||||||
|
/// As per the HTTP RFCs, header values can be queried in a case-insensitive manner.
|
||||||
|
public struct ResponseHeaders {
|
||||||
|
private let httpResponse: HTTPURLResponse
|
||||||
|
|
||||||
|
init(httpResponse: HTTPURLResponse) {
|
||||||
|
self.httpResponse = httpResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
public func value(forHeaderNamed name: String) -> String? {
|
||||||
|
return httpResponse.value(forHTTPHeaderField: name)
|
||||||
|
}
|
||||||
|
|
||||||
|
public subscript(name: String) -> String? {
|
||||||
|
return value(forHeaderNamed: name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Describes the result of making a request to the API.
|
||||||
|
///
|
||||||
|
/// This type is returned by all functions which make calls to the API. It returns information about the response
|
||||||
|
/// and is parameterised by `T` over the type of data which is returned by the API operation.
|
||||||
|
public struct Response<T>: ResponseFields {
|
||||||
|
|
||||||
|
/// The HTTP status code returned by the server.
|
||||||
|
///
|
||||||
|
/// This property contains the HTTP status code returned by the server in response to the underlying network request
|
||||||
|
/// made to fulfill the given API operation.
|
||||||
|
public var statusCode: Int {
|
||||||
|
return httpResponse.statusCode
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The media type returned by the server.
|
||||||
|
///
|
||||||
|
/// This property contains the media type returned by the server in response to the underlying network request
|
||||||
|
/// made to fulfill the given API operation.
|
||||||
|
public var contentType: String {
|
||||||
|
return httpResponse.contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The raw HTTP response object.
|
||||||
|
///
|
||||||
|
/// This property contains the [HTTPURLResponse](https://developer.apple.com/documentation/foundation/httpurlresponse) object
|
||||||
|
/// returned from making the underlying network request to fulfill the given API operation.
|
||||||
|
public let httpResponse: HTTPURLResponse
|
||||||
|
|
||||||
|
/// The response data.
|
||||||
|
///
|
||||||
|
/// This property contains any response data associated with the API operation.
|
||||||
|
public let data: T
|
||||||
|
|
||||||
|
public init(httpResponse: HTTPURLResponse, data: T) {
|
||||||
|
self.httpResponse = httpResponse
|
||||||
|
self.data = data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Describes the result of making a request to the API which can contain resulting response header fields.
|
||||||
|
///
|
||||||
|
/// This type is returned by all functions which make calls to the API. It returns information about the response
|
||||||
|
/// and is parameterised by `T` over the type of data which is returned by the API operation.
|
||||||
|
public struct ResponseWithHeaders<T>: ResponseFields {
|
||||||
|
|
||||||
|
/// The HTTP status code returned by the server.
|
||||||
|
///
|
||||||
|
/// This property contains the HTTP status code returned by the server in response to the underlying network request
|
||||||
|
/// made to fulfill the given API operation.
|
||||||
|
public var statusCode: Int {
|
||||||
|
return httpResponse.statusCode
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The media type returned by the server.
|
||||||
|
///
|
||||||
|
/// This property contains the media type returned by the server in response to the underlying network request
|
||||||
|
/// made to fulfill the given API operation.
|
||||||
|
public var contentType: String {
|
||||||
|
return httpResponse.contentType
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The raw HTTP response object.
|
||||||
|
///
|
||||||
|
/// This property contains the [HTTPURLResponse](https://developer.apple.com/documentation/foundation/httpurlresponse) object
|
||||||
|
/// returned from making the underlying network request to fulfill the given API operation.
|
||||||
|
public let httpResponse: HTTPURLResponse
|
||||||
|
|
||||||
|
/// Any response headers returned by the underlying network request made to fulfill the given API operation.
|
||||||
|
public let headers: ResponseHeaders?
|
||||||
|
|
||||||
|
/// The response data.
|
||||||
|
///
|
||||||
|
/// This property contains any response data associated with the API operation.
|
||||||
|
public let data: T
|
||||||
|
|
||||||
|
public init(httpResponse: HTTPURLResponse, data: T) {
|
||||||
|
self.httpResponse = httpResponse
|
||||||
|
self.data = data
|
||||||
|
self.headers = ResponseHeaders(httpResponse: httpResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Describes the fields which are included in all responses to requests made to the API.
|
||||||
|
///
|
||||||
|
/// This protocol is adopted by ``Response`` and ``ResponseWithHeaders`` depending on the individual API operation.
|
||||||
|
public protocol ResponseFields {
|
||||||
|
associatedtype T;
|
||||||
|
|
||||||
|
var statusCode: Int { get }
|
||||||
|
var contentType: String { get }
|
||||||
|
var httpResponse: HTTPURLResponse { get }
|
||||||
|
var data: T { get }
|
||||||
|
|
||||||
|
init(httpResponse: HTTPURLResponse, data: T)
|
||||||
|
}
|
||||||
60
Sources/Plexswift/internal/client/Servers.swift
Normal file
60
Sources/Plexswift/internal/client/Servers.swift
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct Server {
|
||||||
|
public let urlString: String
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol Servers {
|
||||||
|
static var urlStrings: [String] { get }
|
||||||
|
|
||||||
|
static func `default`() throws -> Server
|
||||||
|
static func server(at index: Int) throws -> Server
|
||||||
|
static func server(at index: Int, substituting parameters: [String: String]?) throws -> Server
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol ServerConvertible {
|
||||||
|
func server() throws -> Server
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ServerConversionError: Swift.Error {
|
||||||
|
case `internal`
|
||||||
|
case missingDefaultServer(serverType: String)
|
||||||
|
case invalidServerIndex(serverType: String, index: Int)
|
||||||
|
case missingServerParameterSubstitutionKey(_ key: String, serverString: String)
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Servers {
|
||||||
|
static func `default`() throws -> Server {
|
||||||
|
guard urlStrings.count > 0 else {
|
||||||
|
throw ServerConversionError.missingDefaultServer(serverType: String(describing: self))
|
||||||
|
}
|
||||||
|
|
||||||
|
return Server(urlString: urlStrings[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
static func server(at index: Int) throws -> Server {
|
||||||
|
return try server(at: index, substituting: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func server(at index: Int, substituting parameters: [String: String]?) throws -> Server {
|
||||||
|
guard index >= 0 && index < urlStrings.count else {
|
||||||
|
throw ServerConversionError.invalidServerIndex(serverType: String(describing: self), index: index)
|
||||||
|
}
|
||||||
|
if let parameters = parameters {
|
||||||
|
do {
|
||||||
|
return Server(urlString: try urlStrings[index].substituteComponents { key in parameters[key] })
|
||||||
|
} catch let error as StringSubstitutionError {
|
||||||
|
switch error {
|
||||||
|
case .internal:
|
||||||
|
throw ServerConversionError.internal
|
||||||
|
case .missingParameter(named: let name, in: let string):
|
||||||
|
throw ServerConversionError.missingServerParameterSubstitutionKey(name, serverString: string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Server(urlString: urlStrings[index])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
154
Sources/Plexswift/internal/client/URLRequestBuilder.swift
Normal file
154
Sources/Plexswift/internal/client/URLRequestBuilder.swift
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
#if os(Linux)
|
||||||
|
import FoundationNetworking
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum URLRequestBuilderError: Swift.Error {
|
||||||
|
case internalError
|
||||||
|
case invalidURL(String)
|
||||||
|
case missingPathParameterSubstitutionKey(_ key: String, path: String)
|
||||||
|
}
|
||||||
|
|
||||||
|
final class URLRequestBuilder: URLRequestConfiguration {
|
||||||
|
private let baseURL: URL
|
||||||
|
private let parameterDefaults: ParameterDefaults?
|
||||||
|
private let defaultSecurityParameterProviding: SecurityParameterProviding?
|
||||||
|
|
||||||
|
var path: String = ""
|
||||||
|
var method: URLRequestHTTPMethod = .get
|
||||||
|
var contentType: String?
|
||||||
|
|
||||||
|
var securityParameterProviding: SecurityParameterProviding?
|
||||||
|
|
||||||
|
var pathParameterSerializable: PathParameterSerializable?
|
||||||
|
var queryParameterSerializable: QueryParameterSerializable?
|
||||||
|
var headerParameterSerializable: HeaderParameterSerializable?
|
||||||
|
|
||||||
|
var body: Data?
|
||||||
|
|
||||||
|
var telemetryHeader: TelemetryHeader = .userAgent
|
||||||
|
|
||||||
|
init(baseURL: URL, parameterDefaults: ParameterDefaults?, defaultSecurityParameterProviding: SecurityParameterProviding?) {
|
||||||
|
self.baseURL = baseURL
|
||||||
|
self.parameterDefaults = parameterDefaults
|
||||||
|
self.defaultSecurityParameterProviding = defaultSecurityParameterProviding
|
||||||
|
}
|
||||||
|
|
||||||
|
func build() throws -> URLRequest {
|
||||||
|
guard var urlComponents = URLComponents(url: baseURL, resolvingAgainstBaseURL: true) else {
|
||||||
|
throw URLRequestBuilderError.invalidURL(baseURL.absoluteString)
|
||||||
|
}
|
||||||
|
|
||||||
|
try buildPathComponents(in: &urlComponents)
|
||||||
|
|
||||||
|
guard let url = urlComponents.url else {
|
||||||
|
throw URLRequestBuilderError.invalidURL(baseURL.absoluteString)
|
||||||
|
}
|
||||||
|
|
||||||
|
var urlRequest = URLRequest(url: url)
|
||||||
|
if let headerParameterSerializable {
|
||||||
|
for header in try headerParameterSerializable.serializedHeaderParameters() {
|
||||||
|
urlRequest.setValue(header.serialized, forHTTPHeaderField: header.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
urlRequest.httpMethod = method.rawValue
|
||||||
|
urlRequest.httpBody = body
|
||||||
|
|
||||||
|
if let contentType {
|
||||||
|
urlRequest.setValue(contentType, forHTTPHeaderField: "Content-Type")
|
||||||
|
}
|
||||||
|
|
||||||
|
urlRequest.setValue("speakeasy-sdk/swift 0.0.1 2.281.2 0.0.3 plexswift", forHTTPHeaderField: telemetryHeader.headerName)
|
||||||
|
|
||||||
|
addSecurityParameters(to: &urlRequest)
|
||||||
|
|
||||||
|
return urlRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Private
|
||||||
|
|
||||||
|
private func buildPathComponents(in urlComponents: inout URLComponents) throws {
|
||||||
|
let (path, fragment) = parsePath(path)
|
||||||
|
|
||||||
|
if let pathParameterSerializable {
|
||||||
|
urlComponents.path = (urlComponents.path as NSString).appendingPathComponent(
|
||||||
|
try substitutePathParameters(in: path, with: pathParameterSerializable, parameterDefaults: parameterDefaults)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
urlComponents.path = (urlComponents.path as NSString).appendingPathComponent(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let queryParameterSerializable {
|
||||||
|
urlComponents.percentEncodedQuery = queryString(
|
||||||
|
from: try queryParameterSerializable.serializedQueryParameters(with: parameterDefaults, formatOverride: nil)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
urlComponents.fragment = fragment
|
||||||
|
}
|
||||||
|
|
||||||
|
private func parsePath(_ path: String) -> (path: String, fragment: String?) {
|
||||||
|
let components = path.components(separatedBy: "#")
|
||||||
|
guard let first = components.first else {
|
||||||
|
return (path: "", fragment: nil)
|
||||||
|
}
|
||||||
|
return (path: first, fragment: components.count > 1 ? components[1] : nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func addSecurityParameters(to request: inout URLRequest) {
|
||||||
|
guard let securityParameterProviding = securityParameterProviding ?? defaultSecurityParameterProviding else { return }
|
||||||
|
|
||||||
|
let parameters = securityParameterProviding.securityParameters()
|
||||||
|
for parameter in parameters {
|
||||||
|
switch parameter {
|
||||||
|
case .httpBasic(username: let username, password: let password):
|
||||||
|
if let username, let password, let encoded = "\(username):\(password)".data(using: .utf8)?.base64EncodedString() {
|
||||||
|
request.addValue("Basic \(encoded)", forHTTPHeaderField: "Authorization")
|
||||||
|
}
|
||||||
|
case .httpBearer(value: let value):
|
||||||
|
if let value {
|
||||||
|
let headerValue = value.range(of: "Bearer ")?.lowerBound == value.startIndex ? value : "Bearer \(value)"
|
||||||
|
request.addValue(headerValue, forHTTPHeaderField: "Authorization")
|
||||||
|
}
|
||||||
|
case .apiKey(name: let name, value: let value), .oauth2(name: let name, value: let value), .openIdConnect(name: let name, value: let value):
|
||||||
|
if let value {
|
||||||
|
request.addValue(value, forHTTPHeaderField: name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Substitute path parameters and rethrow `StringSubstitutionError`s as `URLRequestBuilderError`s.
|
||||||
|
fileprivate func substitutePathParameters(
|
||||||
|
in path: String,
|
||||||
|
with pathParameterSerializable: PathParameterSerializable,
|
||||||
|
parameterDefaults: ParameterDefaults?
|
||||||
|
) throws -> String {
|
||||||
|
do {
|
||||||
|
let parameters = try pathParameterSerializable.serializedPathParameters(formatOverride: nil)
|
||||||
|
return try path.substituteComponents { key in
|
||||||
|
return try parameters[key] ?? parameterDefaults?.defaultSerializedPathParameter(for: key)
|
||||||
|
}
|
||||||
|
} catch let error as StringSubstitutionError {
|
||||||
|
switch error {
|
||||||
|
case .internal:
|
||||||
|
throw URLRequestBuilderError.internalError
|
||||||
|
case .missingParameter(named: let name, in: let string):
|
||||||
|
throw URLRequestBuilderError.missingPathParameterSubstitutionKey(name, path: string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate extension TelemetryHeader {
|
||||||
|
var headerName: String {
|
||||||
|
switch self {
|
||||||
|
case .userAgent: return "User-Agent"
|
||||||
|
case .speakeasyUserAgent: return "X-Speakeasy-User-Agent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
enum URLRequestHTTPMethod: String {
|
||||||
|
case get = "GET"
|
||||||
|
case post = "POST"
|
||||||
|
case put = "PUT"
|
||||||
|
case patch = "PATCH"
|
||||||
|
case delete = "DELETE"
|
||||||
|
case head = "HEAD"
|
||||||
|
case options = "OPTIONS"
|
||||||
|
case trace = "TRACE"
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TelemetryHeader {
|
||||||
|
case userAgent
|
||||||
|
case speakeasyUserAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol URLRequestConfiguration: AnyObject {
|
||||||
|
var path: String { get set }
|
||||||
|
var method: URLRequestHTTPMethod { get set }
|
||||||
|
var contentType: String? { get set }
|
||||||
|
|
||||||
|
var securityParameterProviding: SecurityParameterProviding? { get set }
|
||||||
|
|
||||||
|
var pathParameterSerializable: PathParameterSerializable? { get set }
|
||||||
|
var queryParameterSerializable: QueryParameterSerializable? { get set }
|
||||||
|
var headerParameterSerializable: HeaderParameterSerializable? { get set }
|
||||||
|
|
||||||
|
var body: Data? { get set }
|
||||||
|
|
||||||
|
var telemetryHeader: TelemetryHeader { get set }
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
#if os(Linux)
|
||||||
|
import FoundationNetworking
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extension HTTPURLResponse {
|
||||||
|
var contentType: String {
|
||||||
|
return value(forHTTPHeaderField: "Content-Type") ?? "application/octet-stream"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension String {
|
||||||
|
func matchContentType(pattern: String) -> Bool {
|
||||||
|
// Match wildcard types
|
||||||
|
if pattern == "*" || pattern == "*/*" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match content type of the format 'application/json; charset=UTF-8'
|
||||||
|
let contentTypeComponents = pattern.components(separatedBy: ";").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
|
||||||
|
guard let mediaType = contentTypeComponents.first else { return false }
|
||||||
|
if mediaType == pattern {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match wildcard parts on the media type
|
||||||
|
let mediaTypeComponents = mediaType.components(separatedBy: "/")
|
||||||
|
guard mediaTypeComponents.count == 2 else { return false }
|
||||||
|
|
||||||
|
return pattern == "\(mediaTypeComponents[0])/*" || pattern == "*/\(mediaTypeComponents[1])"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
enum StringSubstitutionError: Swift.Error {
|
||||||
|
case `internal`
|
||||||
|
case missingParameter(named: String, in: String)
|
||||||
|
}
|
||||||
|
|
||||||
|
extension String {
|
||||||
|
typealias SubstitutionHandler = (_ key: String) throws -> String?
|
||||||
|
|
||||||
|
func substituteComponents(using substitutionHandler: SubstitutionHandler) throws -> String {
|
||||||
|
let regex = try NSRegularExpression(pattern: "\\{([^}]+)\\}")
|
||||||
|
let range = NSRange(startIndex..<endIndex, in: self)
|
||||||
|
let matches = regex.matches(in: self, range: range)
|
||||||
|
|
||||||
|
var substitutedPath = self
|
||||||
|
// Reverse matches so that we can replace substrings in place.
|
||||||
|
for match in matches.reversed() {
|
||||||
|
let templateRange = match.range
|
||||||
|
guard let keyRange = Range(match.range(at: 1), in: self) else {
|
||||||
|
throw StringSubstitutionError.internal
|
||||||
|
}
|
||||||
|
|
||||||
|
let key = String(self[keyRange])
|
||||||
|
guard let serializedParameter = try substitutionHandler(key) else {
|
||||||
|
throw StringSubstitutionError.missingParameter(named: key, in: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
let startIndex = substitutedPath.index(substitutedPath.startIndex, offsetBy: templateRange.location)
|
||||||
|
let endIndex = substitutedPath.index(startIndex, offsetBy: templateRange.length)
|
||||||
|
substitutedPath.replaceSubrange(startIndex..<endIndex, with: serializedParameter)
|
||||||
|
}
|
||||||
|
return substitutedPath
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.AddPlaylistContentsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.AddPlaylistContentsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.AddPlaylistContentsRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.AddPlaylistContentsRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: uri, named: "uri", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if playQueueID != nil {
|
||||||
|
try builder.addQueryParameters(from: playQueueIDWrapper, named: "playQueueID", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.ApplyUpdatesRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.ApplyUpdatesRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.ApplyUpdatesRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: skip, named: "skip", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: tonight, named: "tonight", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.CancelServerActivitiesRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.CancelServerActivitiesRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.CancelServerActivitiesRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"activityUUID": try activityUUID.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.CheckForUpdatesRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.CheckForUpdatesRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.CheckForUpdatesRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: download, named: "download", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.ClearPlaylistContentsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.ClearPlaylistContentsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.ClearPlaylistContentsRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.CreatePlaylistRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.CreatePlaylistRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.CreatePlaylistRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: smart, named: "smart", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: title, named: "title", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: type, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: uri, named: "uri", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if playQueueID != nil {
|
||||||
|
try builder.addQueryParameters(from: playQueueIDWrapper, named: "playQueueID", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.DeleteLibraryRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.DeleteLibraryRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.DeleteLibraryRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.DeletePlaylistRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.DeletePlaylistRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.DeletePlaylistRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Download: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Sources/Plexswift/internal/models/Force+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/Force+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Force: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetFileHashRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetFileHashRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetFileHashRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: url, named: "url", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if type != nil {
|
||||||
|
try builder.addQueryParameters(from: typeWrapper, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetGlobalHubsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetGlobalHubsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetGlobalHubsRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
if count != nil {
|
||||||
|
try builder.addQueryParameters(from: countWrapper, named: "count", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
try builder.addQueryParameters(from: onlyTransient, named: "onlyTransient", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetLibraryHubsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetLibraryHubsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetLibraryHubsRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetLibraryHubsRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
if count != nil {
|
||||||
|
try builder.addQueryParameters(from: countWrapper, named: "count", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
try builder.addQueryParameters(from: onlyTransient, named: "onlyTransient", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetLibraryItemsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetLibraryItemsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetLibraryItemsRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"sectionId": try sectionId.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
"tag": try tag.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetLibraryRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetLibraryRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetLibraryRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetLibraryRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: includeDetails, named: "includeDetails", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetMetadataChildrenRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetMetadataChildrenRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetMetadataChildrenRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"ratingKey": try ratingKeyWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetMetadataRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetMetadataRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetMetadataRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"ratingKey": try ratingKeyWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetPinRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .header:
|
||||||
|
return serializeModel(with: try serializedHeaderParameters(), format: format)
|
||||||
|
case .path, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetPinRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetPinRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: strong, named: "strong", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetPinRequest: HeaderParameterSerializable {
|
||||||
|
func serializedHeaderParameters() throws -> [SerializedParameter] {
|
||||||
|
return [
|
||||||
|
SerializedParameter(name: "X-Plex-Client-Identifier", serialized: try xPlexClientIdentifier.serialize(with: .header(explode: false)))
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetPlaylistContentsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetPlaylistContentsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetPlaylistContentsRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetPlaylistContentsRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: typeWrapper, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetPlaylistRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetPlaylistRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetPlaylistRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetPlaylistsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetPlaylistsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetPlaylistsRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: playlistType, named: "playlistType", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: smart, named: "smart", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetResizedPhotoRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetResizedPhotoRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetResizedPhotoRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: blurWrapper, named: "blur", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: heightWrapper, named: "height", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: minSize, named: "minSize", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: opacity, named: "opacity", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: upscale, named: "upscale", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: url, named: "url", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: widthWrapper, named: "width", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetSearchResultsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetSearchResultsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetSearchResultsRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: query, named: "query", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetSourceConnectionInformationRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetSourceConnectionInformationRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetSourceConnectionInformationRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: source, named: "source", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetStatisticsRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetStatisticsRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetStatisticsRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: timespan, named: "Timespan", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetTimelineRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetTimelineRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetTimelineRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: context, named: "context", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: durationWrapper, named: "duration", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: hasMDEWrapper, named: "hasMDE", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: key, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: playBackTimeWrapper, named: "playBackTime", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: playQueueItemIDWrapper, named: "playQueueItemID", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: ratingKeyWrapper, named: "ratingKey", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: rowWrapper, named: "row", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: state, named: "state", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: timeWrapper, named: "time", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetTokenRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .header:
|
||||||
|
return serializeModel(with: try serializedHeaderParameters(), format: format)
|
||||||
|
case .query, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetTokenRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetTokenRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"pinID": try pinID.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetTokenRequest: HeaderParameterSerializable {
|
||||||
|
func serializedHeaderParameters() throws -> [SerializedParameter] {
|
||||||
|
return [
|
||||||
|
SerializedParameter(name: "X-Plex-Client-Identifier", serialized: try xPlexClientIdentifier.serialize(with: .header(explode: false)))
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetTransientTokenQueryParamType: 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,28 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.GetTransientTokenRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.GetTransientTokenRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.GetTransientTokenRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: scope, named: "scope", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: type, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.IncludeDetails: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Sources/Plexswift/internal/models/Level+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/Level+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Level: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.LogLineRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.LogLineRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.LogLineRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: level, named: "level", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: message, named: "message", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: source, named: "source", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.MarkPlayedRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.MarkPlayedRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.MarkPlayedRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: keyWrapper, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.MarkUnplayedRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.MarkUnplayedRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.MarkUnplayedRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: keyWrapper, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.MinSize: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.OnlyTransient: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.PathParamTaskName: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.PerformSearchRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.PerformSearchRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.PerformSearchRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: query, named: "query", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if limit != nil {
|
||||||
|
try builder.addQueryParameters(from: limitWrapper, named: "limit", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
if sectionId != nil {
|
||||||
|
try builder.addQueryParameters(from: sectionIdWrapper, named: "sectionId", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.PerformVoiceSearchRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.PerformVoiceSearchRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.PerformVoiceSearchRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: query, named: "query", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if limit != nil {
|
||||||
|
try builder.addQueryParameters(from: limitWrapper, named: "limit", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
if sectionId != nil {
|
||||||
|
try builder.addQueryParameters(from: sectionIdWrapper, named: "sectionId", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.PlaylistType: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.QueryParamOnlyTransient: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.QueryParamSmart: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.QueryParamType: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.RefreshLibraryRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.RefreshLibraryRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.RefreshLibraryRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"sectionId": try sectionIdWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Sources/Plexswift/internal/models/Scope+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/Scope+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Scope: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.SearchLibraryRequest: 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.SearchLibraryRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.SearchLibraryRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"sectionId": try sectionId.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.SearchLibraryRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: type, named: "type", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Shared.Security: SecurityParameterProviding {
|
||||||
|
func securityParameters() -> [SecurityParameter] {
|
||||||
|
switch self {
|
||||||
|
case .accessToken(let value):
|
||||||
|
return [.apiKey(name: "X-Plex-Token", value: value)]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Sources/Plexswift/internal/models/Skip+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/Skip+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Skip: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Sources/Plexswift/internal/models/Smart+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/Smart+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Smart: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.StartTaskRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.StartTaskRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.StartTaskRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"taskName": try taskName.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.StartUniversalTranscodeRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.StartUniversalTranscodeRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.StartUniversalTranscodeRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: hasMDEWrapper, named: "hasMDE", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: mediaIndexWrapper, named: "mediaIndex", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: partIndexWrapper, named: "partIndex", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: path, named: "path", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: `protocol`, named: "protocol", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if addDebugOverlay != nil {
|
||||||
|
try builder.addQueryParameters(from: addDebugOverlayWrapper, named: "addDebugOverlay", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
if audioBoost != nil {
|
||||||
|
try builder.addQueryParameters(from: audioBoostWrapper, named: "audioBoost", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
if autoAdjustQuality != nil {
|
||||||
|
try builder.addQueryParameters(from: autoAdjustQualityWrapper, named: "autoAdjustQuality", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
if directPlay != nil {
|
||||||
|
try builder.addQueryParameters(from: directPlayWrapper, named: "directPlay", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
if directStream != nil {
|
||||||
|
try builder.addQueryParameters(from: directStreamWrapper, named: "directStream", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
if fastSeek != nil {
|
||||||
|
try builder.addQueryParameters(from: fastSeekWrapper, named: "fastSeek", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
try builder.addQueryParameters(from: location, named: "location", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if mediaBufferSize != nil {
|
||||||
|
try builder.addQueryParameters(from: mediaBufferSizeWrapper, named: "mediaBufferSize", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
try builder.addQueryParameters(from: session, named: "session", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: subtites, named: "subtites", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
if subtitleSize != nil {
|
||||||
|
try builder.addQueryParameters(from: subtitleSizeWrapper, named: "subtitleSize", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
}
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Sources/Plexswift/internal/models/State+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/State+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.State: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.StopTaskRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.StopTaskRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.StopTaskRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"taskName": try taskName.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.StopTranscodeSessionRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.StopTranscodeSessionRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.StopTranscodeSessionRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"sessionKey": try sessionKey.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Sources/Plexswift/internal/models/Tag+Serialization.swift
Normal file
14
Sources/Plexswift/internal/models/Tag+Serialization.swift
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Tag: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.TaskName: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Tonight: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.TypeModel: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.UpdatePlayProgressRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.UpdatePlayProgressRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.UpdatePlayProgressRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: key, named: "key", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: state, named: "state", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: timeWrapper, named: "time", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.UpdatePlaylistRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .path:
|
||||||
|
return try serializePathParameterSerializable(self, with: format)
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.UpdatePlaylistRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.UpdatePlaylistRequest: PathParameterSerializable {
|
||||||
|
func serializedPathParameters(formatOverride: SerializableFormat?) throws -> [String: String] {
|
||||||
|
return [
|
||||||
|
"playlistID": try playlistIDWrapper.serialize(with: formatOverride ?? .path(explode: false)),
|
||||||
|
].compactMapValues { $0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.UpdatePlaylistRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: summary, named: "summary", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: title, named: "title", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.UploadPlaylistRequest: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
switch format {
|
||||||
|
case .query:
|
||||||
|
return try serializeQueryParameterSerializable(self, with: format)
|
||||||
|
case .path, .header, .multipart, .form:
|
||||||
|
throw SerializationError.invalidSerializationParameter(type: "Operations.UploadPlaylistRequest", format: format.formatDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return try serializedQueryParameters(with: nil, formatOverride: format)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Operations.UploadPlaylistRequest: QueryParameterSerializable {
|
||||||
|
func serializedQueryParameters(with parameterDefaults: ParameterDefaults?, formatOverride: SerializableFormat?) throws -> [QueryParameter] {
|
||||||
|
let builder = QueryParameterBuilder()
|
||||||
|
try builder.addQueryParameters(from: force, named: "force", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
try builder.addQueryParameters(from: path, named: "path", format: formatOverride ?? .query(style: .form, explode: true), parameterDefaults: parameterDefaults)
|
||||||
|
return builder.build()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension Operations.Upscale: Serializable {
|
||||||
|
func serialize(with format: SerializableFormat) throws -> String {
|
||||||
|
return try rawValue.serialize(with: format)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeQueryParameters(with format: SerializableFormat) throws -> [QueryParameter] {
|
||||||
|
return [QueryParameter(key: [], serialized: try serialize(with: format))]
|
||||||
|
}
|
||||||
|
}
|
||||||
58
Sources/Plexswift/internal/serialization/Form.swift
Normal file
58
Sources/Plexswift/internal/serialization/Form.swift
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
func multipartContentType(with boundary: String) -> String {
|
||||||
|
return "multipart/form-data; boundary=\(boundary)"
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeMultipartFormData(with multipartFormBodySerializable: MultipartFormBodySerializable) throws -> (boundary: String, data: Data) {
|
||||||
|
let boundary = UUID().uuidString
|
||||||
|
|
||||||
|
var data = Data()
|
||||||
|
let parameters = try multipartFormBodySerializable.serializedMultipartFormParameters(formatOverride: nil)
|
||||||
|
parameters.forEach { parameter in
|
||||||
|
switch parameter {
|
||||||
|
case .value(name: let name, serialized: let serialized):
|
||||||
|
guard let serialized else { return }
|
||||||
|
|
||||||
|
data.append(utf8String: "--\(boundary)\r\n")
|
||||||
|
data.append(utf8String: "Content-Disposition: multipart/form-data; name=\"\(name)\"\r\n")
|
||||||
|
data.append(utf8String: "Content-Type: text/plain\r\n\r\n")
|
||||||
|
data.append(utf8String: "\(serialized)\r\n")
|
||||||
|
case .file(name: let name, filename: let filename, data: let content):
|
||||||
|
guard let filename, let content, let contentString = String(data: content, encoding: .ascii) else { return }
|
||||||
|
|
||||||
|
data.append(utf8String: "--\(boundary)\r\n")
|
||||||
|
data.append(utf8String: "Content-Disposition: multipart/form-data; name=\"\(name)\"; filename=\"\(filename)\"\r\n")
|
||||||
|
data.append(utf8String: "Content-Type: text/plain\r\n\r\n")
|
||||||
|
data.append(utf8String: "\(contentString)\r\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.append(utf8String: "--\(boundary)--")
|
||||||
|
|
||||||
|
return (boundary: boundary, data: data)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serializeFormData(with formBodySerializable: FormBodySerializable) throws -> Data? {
|
||||||
|
let encoded = (try formBodySerializable.serializedFormParameters(formatOverride: nil))
|
||||||
|
.compactMap { parameter -> (String, String)? in
|
||||||
|
guard let serialized = parameter.serialized else { return nil }
|
||||||
|
return (parameter.name, serialized)
|
||||||
|
}
|
||||||
|
.map { (name, serialized) in
|
||||||
|
return "\(name)=\(serialized)"
|
||||||
|
}
|
||||||
|
.joined(separator: "&")
|
||||||
|
|
||||||
|
return encoded.data(using: .utf8)
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate extension Data {
|
||||||
|
mutating func append(utf8String: String) {
|
||||||
|
if let data = utf8String.data(using: .utf8) {
|
||||||
|
append(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user