ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.459.2

This commit is contained in:
speakeasybot
2024-12-21 00:10:57 +00:00
parent 3204dbc84e
commit 2321f0edaf
153 changed files with 8571 additions and 5993 deletions

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,12 @@ generation:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
php:
version: 0.11.1
version: 0.12.0
additionalDependencies:
autoload: {}
autoload-dev: {}
require: {}
require-dev: {}
clientServerStatusCodesAsErrors: true
defaultErrorName: SDKException
flattenGlobalSecurity: true

View File

@@ -1,4 +1,4 @@
speakeasyVersion: 1.438.3
speakeasyVersion: 1.459.2
sources:
my-source:
sourceNamespace: my-source
@@ -9,19 +9,19 @@ sources:
- main
plexapi:
sourceNamespace: plexapi
sourceRevisionDigest: sha256:37c6bfb15f4154eb89b112465107f20757411f22bd1cc7d0a04335df7127fcb4
sourceBlobDigest: sha256:290473ebc909cada80ff428c685b897f4621cf121397e1417355e06d334e7206
sourceRevisionDigest: sha256:ccba0c42f1644923e2209e28da7a78195a843e48da1aeaaedbf8759f1a8a0fe0
sourceBlobDigest: sha256:b362c110ef633288220a55ab50627374b996c64f2d9b8e020944e84ea2840332
tags:
- latest
- main
- speakeasy-sdk-regen-1734739773
targets:
plexphp:
source: plexapi
sourceNamespace: plexapi
sourceRevisionDigest: sha256:37c6bfb15f4154eb89b112465107f20757411f22bd1cc7d0a04335df7127fcb4
sourceBlobDigest: sha256:290473ebc909cada80ff428c685b897f4621cf121397e1417355e06d334e7206
sourceRevisionDigest: sha256:ccba0c42f1644923e2209e28da7a78195a843e48da1aeaaedbf8759f1a8a0fe0
sourceBlobDigest: sha256:b362c110ef633288220a55ab50627374b996c64f2d9b8e020944e84ea2840332
codeSamplesNamespace: code-samples-php-plexphp
codeSamplesRevisionDigest: sha256:ec39a1baa000076369129c6d77614e8a87e3e5d12991082cbd1c60a9cc9e9c59
codeSamplesRevisionDigest: sha256:8bb8bad6945558485d64a156003735f5f0ed2a978ff2565fc7fda7876790c5cb
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest

151
README.md
View File

@@ -40,12 +40,20 @@ The following SDKs are generated from the OpenAPI Specification. They are automa
<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [lukehagar/plex-api](#lukehagarplex-api)
* [Plex Media Server OpenAPI Specification](#plex-media-server-openapi-specification)
* [Documentation](#documentation)
* [SDKs](#sdks)
* [SDK Installation](#sdk-installation)
* [SDK Example Usage](#sdk-example-usage)
* [Available Resources and Operations](#available-resources-and-operations)
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
* [Development](#development)
* [Maturity](#maturity)
* [Contributions](#contributions)
* [SDK Installation](#sdk-installation)
* [SDK Example Usage](#sdk-example-usage)
* [Available Resources and Operations](#available-resources-and-operations)
* [Error Handling](#error-handling)
* [Server Selection](#server-selection)
<!-- End Table of Contents [toc] -->
<!-- Start SDK Installation [installation] -->
@@ -73,13 +81,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -101,119 +103,119 @@ if ($response->object !== null) {
### [activities](docs/sdks/activities/README.md)
* [getServerActivities](docs/sdks/activities/README.md#getserveractivities) - Get Server Activities
* [cancelServerActivities](docs/sdks/activities/README.md#cancelserveractivities) - Cancel Server Activities
* [getServerActivities](docs/sdks/activities/README.md#getserveractivities) - Get Server Activities
### [authentication](docs/sdks/authentication/README.md)
* [getTransientToken](docs/sdks/authentication/README.md#gettransienttoken) - Get a Transient Token
* [getSourceConnectionInformation](docs/sdks/authentication/README.md#getsourceconnectioninformation) - Get Source Connection Information
* [getTokenDetails](docs/sdks/authentication/README.md#gettokendetails) - Get Token Details
* [getTransientToken](docs/sdks/authentication/README.md#gettransienttoken) - Get a Transient Token
* [postUsersSignInData](docs/sdks/authentication/README.md#postuserssignindata) - Get User Sign In Data
### [butler](docs/sdks/butler/README.md)
* [getButlerTasks](docs/sdks/butler/README.md#getbutlertasks) - Get Butler tasks
* [startAllTasks](docs/sdks/butler/README.md#startalltasks) - Start all Butler tasks
* [stopAllTasks](docs/sdks/butler/README.md#stopalltasks) - Stop all Butler tasks
* [startTask](docs/sdks/butler/README.md#starttask) - Start a single Butler task
* [stopAllTasks](docs/sdks/butler/README.md#stopalltasks) - Stop all Butler tasks
* [stopTask](docs/sdks/butler/README.md#stoptask) - Stop a single Butler task
### [hubs](docs/sdks/hubs/README.md)
* [getGlobalHubs](docs/sdks/hubs/README.md#getglobalhubs) - Get Global Hubs
* [getRecentlyAdded](docs/sdks/hubs/README.md#getrecentlyadded) - Get Recently Added
* [getGlobalHubs](docs/sdks/hubs/README.md#getglobalhubs) - Get Global Hubs
* [getLibraryHubs](docs/sdks/hubs/README.md#getlibraryhubs) - Get library specific hubs
### [library](docs/sdks/library/README.md)
* [getFileHash](docs/sdks/library/README.md#getfilehash) - Get Hash Value
* [getRecentlyAddedLibrary](docs/sdks/library/README.md#getrecentlyaddedlibrary) - Get Recently Added
* [deleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section
* [getAllLibraries](docs/sdks/library/README.md#getalllibraries) - Get All Libraries
* [getLibraryDetails](docs/sdks/library/README.md#getlibrarydetails) - Get Library Details
* [deleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section
* [getLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items
* [getRefreshLibraryMetadata](docs/sdks/library/README.md#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
* [getSearchLibrary](docs/sdks/library/README.md#getsearchlibrary) - Search Library
* [getSearchAllLibraries](docs/sdks/library/README.md#getsearchalllibraries) - Search All Libraries
* [getMetaDataByRatingKey](docs/sdks/library/README.md#getmetadatabyratingkey) - Get Metadata by RatingKey
* [getRecentlyAddedLibrary](docs/sdks/library/README.md#getrecentlyaddedlibrary) - Get Recently Added
* [getRefreshLibraryMetadata](docs/sdks/library/README.md#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
* [getSearchAllLibraries](docs/sdks/library/README.md#getsearchalllibraries) - Search All Libraries
* [getSearchLibrary](docs/sdks/library/README.md#getsearchlibrary) - Search Library
* [getFileHash](docs/sdks/library/README.md#getfilehash) - Get Hash Value
* [getMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children
* [getTopWatchedContent](docs/sdks/library/README.md#gettopwatchedcontent) - Get Top Watched Content
* [getOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck
* [getTopWatchedContent](docs/sdks/library/README.md#gettopwatchedcontent) - Get Top Watched Content
### [log](docs/sdks/log/README.md)
* [enablePaperTrail](docs/sdks/log/README.md#enablepapertrail) - Enabling Papertrail
* [logLine](docs/sdks/log/README.md#logline) - Logging a single line message.
* [logMultiLine](docs/sdks/log/README.md#logmultiline) - Logging a multi-line message
* [enablePaperTrail](docs/sdks/log/README.md#enablepapertrail) - Enabling Papertrail
### [media](docs/sdks/media/README.md)
* [getBannerImage](docs/sdks/media/README.md#getbannerimage) - Get Banner Image
* [getThumbImage](docs/sdks/media/README.md#getthumbimage) - Get Thumb Image
* [markPlayed](docs/sdks/media/README.md#markplayed) - Mark Media Played
* [markUnplayed](docs/sdks/media/README.md#markunplayed) - Mark Media Unplayed
* [updatePlayProgress](docs/sdks/media/README.md#updateplayprogress) - Update Media Play Progress
* [getBannerImage](docs/sdks/media/README.md#getbannerimage) - Get Banner Image
* [getThumbImage](docs/sdks/media/README.md#getthumbimage) - Get Thumb Image
### [playlists](docs/sdks/playlists/README.md)
* [createPlaylist](docs/sdks/playlists/README.md#createplaylist) - Create a Playlist
* [getPlaylists](docs/sdks/playlists/README.md#getplaylists) - Get All Playlists
* [getPlaylist](docs/sdks/playlists/README.md#getplaylist) - Retrieve Playlist
* [deletePlaylist](docs/sdks/playlists/README.md#deleteplaylist) - Deletes a Playlist
* [updatePlaylist](docs/sdks/playlists/README.md#updateplaylist) - Update a Playlist
* [getPlaylistContents](docs/sdks/playlists/README.md#getplaylistcontents) - Retrieve Playlist Contents
* [clearPlaylistContents](docs/sdks/playlists/README.md#clearplaylistcontents) - Delete Playlist Contents
* [addPlaylistContents](docs/sdks/playlists/README.md#addplaylistcontents) - Adding to a Playlist
* [clearPlaylistContents](docs/sdks/playlists/README.md#clearplaylistcontents) - Delete Playlist Contents
* [createPlaylist](docs/sdks/playlists/README.md#createplaylist) - Create a Playlist
* [deletePlaylist](docs/sdks/playlists/README.md#deleteplaylist) - Deletes a Playlist
* [getPlaylist](docs/sdks/playlists/README.md#getplaylist) - Retrieve Playlist
* [getPlaylistContents](docs/sdks/playlists/README.md#getplaylistcontents) - Retrieve Playlist Contents
* [getPlaylists](docs/sdks/playlists/README.md#getplaylists) - Get All Playlists
* [updatePlaylist](docs/sdks/playlists/README.md#updateplaylist) - Update a Playlist
* [uploadPlaylist](docs/sdks/playlists/README.md#uploadplaylist) - Upload Playlist
### [plex](docs/sdks/plex/README.md)
* [getServerResources](docs/sdks/plex/README.md#getserverresources) - Get Server Resources
* [getCompanionsData](docs/sdks/plex/README.md#getcompanionsdata) - Get Companions Data
* [getUserFriends](docs/sdks/plex/README.md#getuserfriends) - Get list of friends of the user logged in
* [getGeoData](docs/sdks/plex/README.md#getgeodata) - Get Geo Data
* [getHomeData](docs/sdks/plex/README.md#gethomedata) - Get Plex Home Data
* [getServerResources](docs/sdks/plex/README.md#getserverresources) - Get Server Resources
* [getPin](docs/sdks/plex/README.md#getpin) - Get a Pin
* [getTokenByPinId](docs/sdks/plex/README.md#gettokenbypinid) - Get Access Token by PinId
* [getUserFriends](docs/sdks/plex/README.md#getuserfriends) - Get list of friends of the user logged in
### [search](docs/sdks/search/README.md)
* [getSearchResults](docs/sdks/search/README.md#getsearchresults) - Get Search Results
* [performSearch](docs/sdks/search/README.md#performsearch) - Perform a search
* [performVoiceSearch](docs/sdks/search/README.md#performvoicesearch) - Perform a voice search
* [getSearchResults](docs/sdks/search/README.md#getsearchresults) - Get Search Results
### [server](docs/sdks/server/README.md)
* [getServerCapabilities](docs/sdks/server/README.md#getservercapabilities) - Get Server Capabilities
* [getServerPreferences](docs/sdks/server/README.md#getserverpreferences) - Get Server Preferences
* [getMediaProviders](docs/sdks/server/README.md#getmediaproviders) - Get Media Providers
* [getServerIdentity](docs/sdks/server/README.md#getserveridentity) - Get Server Identity
* [getAvailableClients](docs/sdks/server/README.md#getavailableclients) - Get Available Clients
* [getDevices](docs/sdks/server/README.md#getdevices) - Get Devices
* [getServerIdentity](docs/sdks/server/README.md#getserveridentity) - Get Server Identity
* [getMyPlexAccount](docs/sdks/server/README.md#getmyplexaccount) - Get MyPlex Account
* [getResizedPhoto](docs/sdks/server/README.md#getresizedphoto) - Get a Resized Photo
* [getMediaProviders](docs/sdks/server/README.md#getmediaproviders) - Get Media Providers
* [getServerCapabilities](docs/sdks/server/README.md#getservercapabilities) - Get Server Capabilities
* [getServerList](docs/sdks/server/README.md#getserverlist) - Get Server List
* [getServerPreferences](docs/sdks/server/README.md#getserverpreferences) - Get Server Preferences
### [sessions](docs/sdks/sessions/README.md)
* [getSessions](docs/sdks/sessions/README.md#getsessions) - Get Active Sessions
* [getSessionHistory](docs/sdks/sessions/README.md#getsessionhistory) - Get Session History
* [getSessions](docs/sdks/sessions/README.md#getsessions) - Get Active Sessions
* [getTranscodeSessions](docs/sdks/sessions/README.md#gettranscodesessions) - Get Transcode Sessions
* [stopTranscodeSession](docs/sdks/sessions/README.md#stoptranscodesession) - Stop a Transcode Session
### [statistics](docs/sdks/statistics/README.md)
* [getStatistics](docs/sdks/statistics/README.md#getstatistics) - Get Media Statistics
* [getResourcesStatistics](docs/sdks/statistics/README.md#getresourcesstatistics) - Get Resources Statistics
* [getBandwidthStatistics](docs/sdks/statistics/README.md#getbandwidthstatistics) - Get Bandwidth Statistics
* [getResourcesStatistics](docs/sdks/statistics/README.md#getresourcesstatistics) - Get Resources Statistics
* [getStatistics](docs/sdks/statistics/README.md#getstatistics) - Get Media Statistics
### [updater](docs/sdks/updater/README.md)
* [getUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) - Querying status of updates
* [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates
* [applyUpdates](docs/sdks/updater/README.md#applyupdates) - Apply Updates
* [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates
* [getUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) - Querying status of updates
### [video](docs/sdks/video/README.md)
@@ -241,13 +243,13 @@ By default an API error will raise a `Errors\SDKException` exception, which has
| `$rawResponse` | *?\Psr\Http\Message\ResponseInterface* | The raw HTTP response |
| `$body` | *string* | The response content |
When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `getServerCapabilities` method throws the following exceptions:
When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `getMediaProviders` method throws the following exceptions:
| Error Type | Status Code | Content Type |
| ---------------------------------------- | ----------- | ---------------- |
| Errors\GetServerCapabilitiesBadRequest | 400 | application/json |
| Errors\GetServerCapabilitiesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| ------------------------------------ | ----------- | ---------------- |
| Errors\GetMediaProvidersBadRequest | 400 | application/json |
| Errors\GetMediaProvidersUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
### Example
@@ -260,26 +262,20 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getServerCapabilities(
$response = $sdk->server->getMediaProviders(
xPlexToken: 'CV5xoxjTpFKUzBTShsaf'
);
if ($response->object !== null) {
// handle response
}
} catch (Errors\GetServerCapabilitiesBadRequestThrowable $e) {
} catch (Errors\GetMediaProvidersBadRequestThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\GetServerCapabilitiesUnauthorizedThrowable $e) {
} catch (Errors\GetMediaProvidersUnauthorizedThrowable $e) {
// handle $e->$container data
throw $e;
} catch (Errors\SDKException $e) {
@@ -312,18 +308,13 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setServerURL("https://10.10.10.47:32400")
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setServerURL('https://10.10.10.47:32400')
->setSecurity($security)->build();
$response = $sdk->server->getServerCapabilities(
$response = $sdk->server->getMediaProviders(
xPlexToken: 'CV5xoxjTpFKUzBTShsaf'
);
if ($response->object !== null) {
@@ -340,24 +331,24 @@ declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->plex->getCompanionsData(
"https://plex.tv/api/v2"
$response = $sdk->plex->getServerResources(
'https://plex.tv/api/v2',
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
includeHttps: Operations\IncludeHttps::Enable,
includeRelay: Operations\IncludeRelay::Enable,
includeIPv6: Operations\IncludeIPv6::Enable
);
if ($response->responseBodies !== null) {
if ($response->plexDevices !== null) {
// handle response
}
```

View File

@@ -713,3 +713,13 @@ Based on:
- [php v0.11.1] .
### Releases
- [Composer v0.11.1] https://packagist.org/packages/lukehagar/plex-api#v0.11.1 - .
## 2024-12-21 00:09:29
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.459.2 (2.483.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [php v0.12.0] .
### Releases
- [Composer v0.12.0] https://packagist.org/packages/lukehagar/plex-api#v0.12.0 - .

View File

@@ -8,18 +8,12 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->server->getServerCapabilities(
$response = $sdk->server->getMediaProviders(
xPlexToken: 'CV5xoxjTpFKUzBTShsaf'
);
if ($response->object !== null) {

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"galbar/jsonpath": "^3.0",
"guzzlehttp/guzzle": "^7.0",
"speakeasy/serializer": "^4.0.0",
"brick/date-time": "^0.7.0",
@@ -27,14 +28,15 @@
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true,
"sort-packages": true
"sort-packages": true,
"process-timeout": 60
},
"scripts": {
"test": [
"./vendor/bin/phpunit --testdox --display-warnings --colors=always"
],
"stan": [
"./vendor/bin/phpstan analyse --memory-limit=2g"
"./vendor/bin/phpstan analyse --memory-limit=2g --error-format=table"
]
},
"script-descriptions": {

View File

@@ -25,7 +25,7 @@
| `seasonCount` | *?int* | :heavy_minus_sign: | N/A | 2022 |
| `tagline` | *?string* | :heavy_minus_sign: | N/A | Return to Pandora. |
| `flattenSeasons` | [?Operations\GetLibraryItemsFlattenSeasons](../../Models/Operations/GetLibraryItemsFlattenSeasons.md) | :heavy_minus_sign: | N/A | 1 |
| `showOrdering` | [?Operations\GetLibraryItemsShowOrdering](../../Models/Operations/GetLibraryItemsShowOrdering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show <br/>None = Library default, <br/>tmdbAiring = The Movie Database (Aired), <br/>aired = TheTVDB (Aired), <br/>dvd = TheTVDB (DVD), <br/>absolute = TheTVDB (Absolute)).<br/> | dvd |
| `showOrdering` | [?Operations\GetLibraryItemsShowOrdering](../../Models/Operations/GetLibraryItemsShowOrdering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>tvdbAiring = TheTVDB (Aired),<br/>tvdbDvd = TheTVDB (DVD),<br/>tvdbAbsolute = TheTVDB (Absolute)).<br/> | tvdbDvd |
| `thumb` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 |
| `art` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 |
| `banner` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 |

View File

@@ -18,3 +18,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
| `Season` | 3 |
| `Episode` | 4 |
| `Audio` | 8 |
| `Album` | 9 |
| `Track` | 10 |

View File

@@ -3,18 +3,18 @@
Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
## Values
| Name | Value |
| ------------ | ------------ |
| `None` | None |
| `TmdbAiring` | tmdbAiring |
| `Aired` | aired |
| `Dvd` | dvd |
| `Absolute` | absolute |
| Name | Value |
| -------------- | -------------- |
| `None` | None |
| `TmdbAiring` | tmdbAiring |
| `TvdbAiring` | tvdbAiring |
| `TvdbDvd` | tvdbDvd |
| `TvdbAbsolute` | tvdbAbsolute |

View File

@@ -14,6 +14,11 @@
| `librarySectionTitle` | *?string* | :heavy_minus_sign: | N/A | Movies |
| `librarySectionID` | *?int* | :heavy_minus_sign: | N/A | 1 |
| `librarySectionKey` | *?string* | :heavy_minus_sign: | N/A | /library/sections/1 |
| `grandparentTitle` | *?string* | :heavy_minus_sign: | The name of the album artist for the track when audio, and the name of the TV show for the episode when video. | |
| `parentTitle` | *?string* | :heavy_minus_sign: | The name of the album for the track when audio, and the name of the season for the episode when TV show. | |
| `originalTitle` | *?string* | :heavy_minus_sign: | The orginal untranslated name of the media item when non-english. | |
| `index` | *?int* | :heavy_minus_sign: | The index starting from 0 of this media item in the MetaData array. | |
| `parentIndex` | *?int* | :heavy_minus_sign: | The parent index starting from 0 of this media item in the parent MetaData array. | |
| `contentRating` | *?string* | :heavy_minus_sign: | N/A | PG-13 |
| `summary` | *?string* | :heavy_minus_sign: | N/A | Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job. |
| `rating` | *?float* | :heavy_minus_sign: | N/A | 8.2 |

View File

@@ -5,8 +5,8 @@
| Field | Type | Required | Description | Example |
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `strong` | *?bool* | :heavy_minus_sign: | Determines the kind of code returned by the API call<br/>Strong codes are used for Pin authentication flows<br/>Non-Strong codes are used for `Plex.tv/link`<br/> | |
| `clientID` | *?string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `clientName` | *?string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku |
| `deviceNickname` | *?string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 |
| `clientVersion` | *?string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 |

View File

@@ -18,3 +18,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
| `Season` | 3 |
| `Episode` | 4 |
| `Audio` | 8 |
| `Album` | 9 |
| `Track` | 10 |

View File

@@ -25,7 +25,7 @@
| `seasonCount` | *?int* | :heavy_minus_sign: | N/A | 2022 |
| `tagline` | *?string* | :heavy_minus_sign: | N/A | Return to Pandora. |
| `flattenSeasons` | [?Operations\FlattenSeasons](../../Models/Operations/FlattenSeasons.md) | :heavy_minus_sign: | N/A | 1 |
| `showOrdering` | [?Operations\ShowOrdering](../../Models/Operations/ShowOrdering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show <br/>None = Library default, <br/>tmdbAiring = The Movie Database (Aired), <br/>aired = TheTVDB (Aired), <br/>dvd = TheTVDB (DVD), <br/>absolute = TheTVDB (Absolute)).<br/> | dvd |
| `showOrdering` | [?Operations\ShowOrdering](../../Models/Operations/ShowOrdering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>tvdbAiring = TheTVDB (Aired),<br/>tvdbDvd = TheTVDB (DVD),<br/>tvdbAbsolute = TheTVDB (Absolute)).<br/> | tvdbDvd |
| `thumb` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 |
| `art` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 |
| `banner` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 |

View File

@@ -25,7 +25,7 @@
| `seasonCount` | *?int* | :heavy_minus_sign: | N/A | 2022 |
| `tagline` | *?string* | :heavy_minus_sign: | N/A | Return to Pandora. |
| `flattenSeasons` | [?Operations\GetSearchAllLibrariesFlattenSeasons](../../Models/Operations/GetSearchAllLibrariesFlattenSeasons.md) | :heavy_minus_sign: | N/A | 1 |
| `showOrdering` | [?Operations\GetSearchAllLibrariesShowOrdering](../../Models/Operations/GetSearchAllLibrariesShowOrdering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show <br/>None = Library default, <br/>tmdbAiring = The Movie Database (Aired), <br/>aired = TheTVDB (Aired), <br/>dvd = TheTVDB (DVD), <br/>absolute = TheTVDB (Absolute)).<br/> | dvd |
| `showOrdering` | [?Operations\GetSearchAllLibrariesShowOrdering](../../Models/Operations/GetSearchAllLibrariesShowOrdering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show<br/>None = Library default,<br/>tmdbAiring = The Movie Database (Aired),<br/>tvdbAiring = TheTVDB (Aired),<br/>tvdbDvd = TheTVDB (DVD),<br/>tvdbAbsolute = TheTVDB (Absolute)).<br/> | tvdbDvd |
| `thumb` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 |
| `art` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 |
| `banner` | *?string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 |

View File

@@ -6,7 +6,7 @@
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `query` | *string* | :heavy_check_mark: | The search query term. | |
| `clientID` | *?string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `clientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `limit` | *?int* | :heavy_minus_sign: | Limit the number of results returned. | |
| `searchTypes` | array<[Operations\SearchTypes](../../Models/Operations/SearchTypes.md)> | :heavy_minus_sign: | A comma-separated list of search types to include. Valid values are: movies, music, otherVideos, people, tv.<br/> | movies,music,otherVideos,people,tv |
| `includeCollections` | [?Operations\QueryParamIncludeCollections](../../Models/Operations/QueryParamIncludeCollections.md) | :heavy_minus_sign: | Whether to include collections in the search results. | 1 |

View File

@@ -3,18 +3,18 @@
Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
## Values
| Name | Value |
| ------------ | ------------ |
| `None` | None |
| `TmdbAiring` | tmdbAiring |
| `Aired` | aired |
| `Dvd` | dvd |
| `Absolute` | absolute |
| Name | Value |
| -------------- | -------------- |
| `None` | None |
| `TmdbAiring` | tmdbAiring |
| `TvdbAiring` | tvdbAiring |
| `TvdbDvd` | tvdbDvd |
| `TvdbAbsolute` | tvdbAbsolute |

View File

@@ -18,3 +18,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
| `Season` | 3 |
| `Episode` | 4 |
| `Audio` | 8 |
| `Album` | 9 |
| `Track` | 10 |

View File

@@ -5,7 +5,7 @@
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `clientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `includeHttps` | [?Operations\IncludeHttps](../../Models/Operations/IncludeHttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 |
| `includeRelay` | [?Operations\IncludeRelay](../../Models/Operations/IncludeRelay.md) | :heavy_minus_sign: | Include Relay addresses in the results <br/>E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400<br/> | 1 |
| `includeIPv6` | [?Operations\IncludeIPv6](../../Models/Operations/IncludeIPv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 |
| `clientID` | *?string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |

View File

@@ -6,7 +6,7 @@
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| `pinID` | *int* | :heavy_check_mark: | The PinID to retrieve an access token for | |
| `clientID` | *?string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `clientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `clientName` | *?string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku |
| `deviceNickname` | *?string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 |
| `clientVersion` | *?string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 |

View File

@@ -18,3 +18,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
| `Season` | 3 |
| `Episode` | 4 |
| `Audio` | 8 |
| `Album` | 9 |
| `Track` | 10 |

View File

@@ -5,7 +5,7 @@
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `clientID` | *?string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `clientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `clientName` | *?string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku |
| `deviceNickname` | *?string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 |
| `clientVersion` | *?string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 |

View File

@@ -18,3 +18,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
| `Season` | 3 |
| `Episode` | 4 |
| `Audio` | 8 |
| `Album` | 9 |
| `Track` | 10 |

View File

@@ -3,18 +3,18 @@
Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
## Values
| Name | Value |
| ------------ | ------------ |
| `None` | None |
| `TmdbAiring` | tmdbAiring |
| `Aired` | aired |
| `Dvd` | dvd |
| `Absolute` | absolute |
| Name | Value |
| -------------- | -------------- |
| `None` | None |
| `TmdbAiring` | tmdbAiring |
| `TvdbAiring` | tvdbAiring |
| `TvdbDvd` | tvdbDvd |
| `TvdbAbsolute` | tvdbAbsolute |

View File

@@ -26,3 +26,4 @@ A key representing a specific tag within the section.
| `Resolution` | resolution |
| `FirstCharacter` | firstCharacter |
| `Folder` | folder |
| `Albums` | albums |

View File

@@ -18,3 +18,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
| `Season` | 3 |
| `Episode` | 4 |
| `Audio` | 8 |
| `Album` | 9 |
| `Track` | 10 |

View File

@@ -14,54 +14,8 @@ Activities are optional cancellable. If cancellable, they may be cancelled via t
### Available Operations
* [getServerActivities](#getserveractivities) - Get Server Activities
* [cancelServerActivities](#cancelserveractivities) - Cancel Server Activities
## getServerActivities
Get Server Activities
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->activities->getServerActivities(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetServerActivitiesResponse](../../Models/Operations/GetServerActivitiesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| Errors\GetServerActivitiesBadRequest | 400 | application/json |
| Errors\GetServerActivitiesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
* [getServerActivities](#getserveractivities) - Get Server Activities
## cancelServerActivities
@@ -78,13 +32,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -114,3 +62,43 @@ if ($response->statusCode === 200) {
| Errors\CancelServerActivitiesBadRequest | 400 | application/json |
| Errors\CancelServerActivitiesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getServerActivities
Get Server Activities
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->activities->getServerActivities(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetServerActivitiesResponse](../../Models/Operations/GetServerActivitiesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| Errors\GetServerActivitiesBadRequest | 400 | application/json |
| Errors\GetServerActivitiesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -8,68 +8,11 @@ API Calls regarding authentication for Plex Media Server
### Available Operations
* [getTransientToken](#gettransienttoken) - Get a Transient Token
* [getSourceConnectionInformation](#getsourceconnectioninformation) - Get Source Connection Information
* [getTokenDetails](#gettokendetails) - Get Token Details
* [getTransientToken](#gettransienttoken) - Get a Transient Token
* [postUsersSignInData](#postuserssignindata) - Get User Sign In Data
## getTransientToken
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->authentication->getTransientToken(
type: Operations\GetTransientTokenQueryParamType::Delegation,
scope: Operations\Scope::All
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `type` | [Operations\GetTransientTokenQueryParamType](../../Models/Operations/GetTransientTokenQueryParamType.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. |
| `scope` | [Operations\Scope](../../Models/Operations/Scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. |
### Response
**[?Operations\GetTransientTokenResponse](../../Models/Operations/GetTransientTokenResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
| Errors\GetTransientTokenBadRequest | 400 | application/json |
| Errors\GetTransientTokenUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getSourceConnectionInformation
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.
@@ -87,13 +30,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -139,13 +76,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -176,6 +107,57 @@ if ($response->userPlexAccount !== null) {
| Errors\GetTokenDetailsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getTransientToken
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->authentication->getTransientToken(
type: Operations\GetTransientTokenQueryParamType::Delegation,
scope: Operations\Scope::All
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `type` | [Operations\GetTransientTokenQueryParamType](../../Models/Operations/GetTransientTokenQueryParamType.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. |
| `scope` | [Operations\Scope](../../Models/Operations/Scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. |
### Response
**[?Operations\GetTransientTokenResponse](../../Models/Operations/GetTransientTokenResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
| Errors\GetTransientTokenBadRequest | 400 | application/json |
| Errors\GetTransientTokenUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## postUsersSignInData
Sign in user with username and password and return user data with Plex authentication token
@@ -190,15 +172,14 @@ require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->build();
$sdk = Plex_API\PlexAPI::builder()->build();
$request = new Operations\PostUsersSignInDataRequest(
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
clientName: 'Plex for Roku',
deviceNickname: 'Roku 3',
clientVersion: '2.4.1',
platform: 'Roku',
requestBody: new Operations\PostUsersSignInDataRequestBody(
login: 'username@email.com',
password: 'password123',

View File

@@ -10,8 +10,8 @@ Butler is the task manager of the Plex Media Server Ecosystem.
* [getButlerTasks](#getbutlertasks) - Get Butler tasks
* [startAllTasks](#startalltasks) - Start all Butler tasks
* [stopAllTasks](#stopalltasks) - Stop all Butler tasks
* [startTask](#starttask) - Start a single Butler task
* [stopAllTasks](#stopalltasks) - Stop all Butler tasks
* [stopTask](#stoptask) - Stop a single Butler task
## getButlerTasks
@@ -29,13 +29,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -80,13 +74,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -111,53 +99,6 @@ if ($response->statusCode === 200) {
| Errors\StartAllTasksUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## stopAllTasks
This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->butler->stopAllTasks(
);
if ($response->statusCode === 200) {
// handle response
}
```
### Response
**[?Operations\StopAllTasksResponse](../../Models/Operations/StopAllTasksResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------- | ------------------------------- | ------------------------------- |
| Errors\StopAllTasksBadRequest | 400 | application/json |
| Errors\StopAllTasksUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## startTask
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:
@@ -179,13 +120,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -216,6 +151,47 @@ if ($response->statusCode === 200) {
| Errors\StartTaskUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## stopAllTasks
This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->butler->stopAllTasks(
);
if ($response->statusCode === 200) {
// handle response
}
```
### Response
**[?Operations\StopAllTasksResponse](../../Models/Operations/StopAllTasksResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------- | ------------------------------- | ------------------------------- |
| Errors\StopAllTasksBadRequest | 400 | application/json |
| Errors\StopAllTasksUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## stopTask
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.
@@ -233,13 +209,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();

View File

@@ -8,66 +8,10 @@ Hubs are a structured two-dimensional container for media, generally represented
### Available Operations
* [getGlobalHubs](#getglobalhubs) - Get Global Hubs
* [getRecentlyAdded](#getrecentlyadded) - Get Recently Added
* [getGlobalHubs](#getglobalhubs) - Get Global Hubs
* [getLibraryHubs](#getlibraryhubs) - Get library specific hubs
## getGlobalHubs
Get Global Hubs filtered by the parameters provided.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->hubs->getGlobalHubs(
count: 1262.49,
onlyTransient: Operations\OnlyTransient::One
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `count` | *?float* | :heavy_minus_sign: | The number of items to return with each hub. |
| `onlyTransient` | [?Operations\OnlyTransient](../../Models/Operations/OnlyTransient.md) | :heavy_minus_sign: | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). |
### Response
**[?Operations\GetGlobalHubsResponse](../../Models/Operations/GetGlobalHubsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------- | -------------------------------- | -------------------------------- |
| Errors\GetGlobalHubsBadRequest | 400 | application/json |
| Errors\GetGlobalHubsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getRecentlyAdded
This endpoint will return the recently added content.
@@ -85,13 +29,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetRecentlyAddedRequest(
contentDirectoryID: 470161,
@@ -127,6 +65,56 @@ if ($response->object !== null) {
| ------------------- | ------------------- | ------------------- |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getGlobalHubs
Get Global Hubs filtered by the parameters provided.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->hubs->getGlobalHubs(
count: 1262.49,
onlyTransient: Operations\OnlyTransient::One
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `count` | *?float* | :heavy_minus_sign: | The number of items to return with each hub. |
| `onlyTransient` | [?Operations\OnlyTransient](../../Models/Operations/OnlyTransient.md) | :heavy_minus_sign: | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). |
### Response
**[?Operations\GetGlobalHubsResponse](../../Models/Operations/GetGlobalHubsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------- | -------------------------------- | -------------------------------- |
| Errors\GetGlobalHubsBadRequest | 400 | application/json |
| Errors\GetGlobalHubsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getLibraryHubs
This endpoint will return a list of library specific hubs
@@ -144,13 +132,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();

View File

@@ -8,23 +8,23 @@ API Calls interacting with Plex Media Server Libraries
### Available Operations
* [getFileHash](#getfilehash) - Get Hash Value
* [getRecentlyAddedLibrary](#getrecentlyaddedlibrary) - Get Recently Added
* [deleteLibrary](#deletelibrary) - Delete Library Section
* [getAllLibraries](#getalllibraries) - Get All Libraries
* [getLibraryDetails](#getlibrarydetails) - Get Library Details
* [deleteLibrary](#deletelibrary) - Delete Library Section
* [getLibraryItems](#getlibraryitems) - Get Library Items
* [getRefreshLibraryMetadata](#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
* [getSearchLibrary](#getsearchlibrary) - Search Library
* [getSearchAllLibraries](#getsearchalllibraries) - Search All Libraries
* [getMetaDataByRatingKey](#getmetadatabyratingkey) - Get Metadata by RatingKey
* [getRecentlyAddedLibrary](#getrecentlyaddedlibrary) - Get Recently Added
* [getRefreshLibraryMetadata](#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
* [getSearchAllLibraries](#getsearchalllibraries) - Search All Libraries
* [getSearchLibrary](#getsearchlibrary) - Search Library
* [getFileHash](#getfilehash) - Get Hash Value
* [getMetadataChildren](#getmetadatachildren) - Get Items Children
* [getTopWatchedContent](#gettopwatchedcontent) - Get Top Watched Content
* [getOnDeck](#getondeck) - Get On Deck
* [getTopWatchedContent](#gettopwatchedcontent) - Get Top Watched Content
## getFileHash
## deleteLibrary
This resource returns hash values for local files
Delete a library using a specific section id
### Example Usage
@@ -37,20 +37,12 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->library->getFileHash(
url: 'file://C:\Image.png&type=13',
type: 4462.17
$response = $sdk->library->deleteLibrary(
sectionKey: 9518
);
if ($response->statusCode === 200) {
@@ -60,97 +52,21 @@ if ($response->statusCode === 200) {
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| `url` | *string* | :heavy_check_mark: | This is the path to the local file, must be prefixed by `file://` | file://C:\Image.png&type=13 |
| `type` | *?float* | :heavy_minus_sign: | Item type | |
| Parameter | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library. <br/>Note: This is unique in the context of the Plex server.<br/> | 9518 |
### Response
**[?Operations\GetFileHashResponse](../../Models/Operations/GetFileHashResponse.md)**
**[?Operations\DeleteLibraryResponse](../../Models/Operations/DeleteLibraryResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| Errors\GetFileHashBadRequest | 400 | application/json |
| Errors\GetFileHashUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getRecentlyAddedLibrary
This endpoint will return the recently added content.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$request = new Operations\GetRecentlyAddedLibraryRequest(
type: Operations\QueryParamType::TvShow,
contentDirectoryID: 2,
pinnedContentDirectoryID: [
3,
5,
7,
13,
12,
1,
6,
14,
2,
10,
16,
17,
],
sectionID: 2,
includeMeta: Operations\QueryParamIncludeMeta::Enable,
xPlexContainerStart: 0,
xPlexContainerSize: 50,
);
$response = $sdk->library->getRecentlyAddedLibrary(
request: $request
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| `$request` | [Operations\GetRecentlyAddedLibraryRequest](../../Models/Operations/GetRecentlyAddedLibraryRequest.md) | :heavy_check_mark: | The request object to use for the request. |
### Response
**[?Operations\GetRecentlyAddedLibraryResponse](../../Models/Operations/GetRecentlyAddedLibraryResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
| Errors\GetRecentlyAddedLibraryBadRequest | 400 | application/json |
| Errors\GetRecentlyAddedLibraryUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| -------------------------------- | -------------------------------- | -------------------------------- |
| Errors\DeleteLibraryBadRequest | 400 | application/json |
| Errors\DeleteLibraryUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getAllLibraries
@@ -173,13 +89,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -259,13 +169,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -299,58 +203,6 @@ if ($response->object !== null) {
| Errors\GetLibraryDetailsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## deleteLibrary
Delete a library using a specific section id
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->library->deleteLibrary(
sectionKey: 9518
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library. <br/>Note: This is unique in the context of the Plex server.<br/> | 9518 |
### Response
**[?Operations\DeleteLibraryResponse](../../Models/Operations/DeleteLibraryResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------- | -------------------------------- | -------------------------------- |
| Errors\DeleteLibraryBadRequest | 400 | application/json |
| Errors\DeleteLibraryUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getLibraryItems
Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values:
@@ -373,6 +225,7 @@ Fetches details from a specific section of the library identified by a section k
- `resolution`: Items categorized by resolution.
- `firstCharacter`: Items categorized by the first letter.
- `folder`: Items categorized by folder.
- `albums`: Items categorized by album.
### Example Usage
@@ -387,13 +240,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetLibraryItemsRequest(
tag: Operations\Tag::Edition,
@@ -432,6 +279,122 @@ if ($response->object !== null) {
| Errors\GetLibraryItemsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getMetaDataByRatingKey
This endpoint will return the metadata of a library item specified with the ratingKey.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->library->getMetaDataByRatingKey(
ratingKey: 9518
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
| `ratingKey` | *int* | :heavy_check_mark: | the id of the library item to return the children of. | 9518 |
### Response
**[?Operations\GetMetaDataByRatingKeyResponse](../../Models/Operations/GetMetaDataByRatingKeyResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
| Errors\GetMetaDataByRatingKeyBadRequest | 400 | application/json |
| Errors\GetMetaDataByRatingKeyUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getRecentlyAddedLibrary
This endpoint will return the recently added content.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetRecentlyAddedLibraryRequest(
type: Operations\QueryParamType::TvShow,
contentDirectoryID: 2,
pinnedContentDirectoryID: [
3,
5,
7,
13,
12,
1,
6,
14,
2,
10,
16,
17,
],
sectionID: 2,
includeMeta: Operations\QueryParamIncludeMeta::Enable,
xPlexContainerStart: 0,
xPlexContainerSize: 50,
);
$response = $sdk->library->getRecentlyAddedLibrary(
request: $request
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| `$request` | [Operations\GetRecentlyAddedLibraryRequest](../../Models/Operations/GetRecentlyAddedLibraryRequest.md) | :heavy_check_mark: | The request object to use for the request. |
### Response
**[?Operations\GetRecentlyAddedLibraryResponse](../../Models/Operations/GetRecentlyAddedLibraryResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
| Errors\GetRecentlyAddedLibraryBadRequest | 400 | application/json |
| Errors\GetRecentlyAddedLibraryUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getRefreshLibraryMetadata
This endpoint Refreshes all the Metadata of the library.
@@ -449,13 +412,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -489,6 +446,62 @@ if ($response->statusCode === 200) {
| Errors\GetRefreshLibraryMetadataUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getSearchAllLibraries
Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetSearchAllLibrariesRequest(
query: '<value>',
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
searchTypes: [
Operations\SearchTypes::People,
],
includeCollections: Operations\QueryParamIncludeCollections::Enable,
includeExternalMedia: Operations\QueryParamIncludeExternalMedia::Enable,
);
$response = $sdk->library->getSearchAllLibraries(
request: $request
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `$request` | [Operations\GetSearchAllLibrariesRequest](../../Models/Operations/GetSearchAllLibrariesRequest.md) | :heavy_check_mark: | The request object to use for the request. |
### Response
**[?Operations\GetSearchAllLibrariesResponse](../../Models/Operations/GetSearchAllLibrariesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| Errors\GetSearchAllLibrariesBadRequest | 400 | application/json |
| Errors\GetSearchAllLibrariesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getSearchLibrary
Search for content within a specific section of the library.
@@ -523,13 +536,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -563,71 +570,9 @@ if ($response->object !== null) {
| Errors\GetSearchLibraryUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getSearchAllLibraries
Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$request = new Operations\GetSearchAllLibrariesRequest(
query: '<value>',
searchTypes: [
Operations\SearchTypes::People,
],
includeCollections: Operations\QueryParamIncludeCollections::Enable,
includeExternalMedia: Operations\QueryParamIncludeExternalMedia::Enable,
);
$response = $sdk->library->getSearchAllLibraries(
request: $request
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `$request` | [Operations\GetSearchAllLibrariesRequest](../../Models/Operations/GetSearchAllLibrariesRequest.md) | :heavy_check_mark: | The request object to use for the request. |
### Response
**[?Operations\GetSearchAllLibrariesResponse](../../Models/Operations/GetSearchAllLibrariesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| Errors\GetSearchAllLibrariesBadRequest | 400 | application/json |
| Errors\GetSearchAllLibrariesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getMetaDataByRatingKey
This endpoint will return the metadata of a library item specified with the ratingKey.
## getFileHash
This resource returns hash values for local files
### Example Usage
@@ -640,42 +585,39 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->library->getMetaDataByRatingKey(
ratingKey: 9518
$response = $sdk->library->getFileHash(
url: 'file://C:\Image.png&type=13',
type: 4462.17
);
if ($response->object !== null) {
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
| `ratingKey` | *int* | :heavy_check_mark: | the id of the library item to return the children of. | 9518 |
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| `url` | *string* | :heavy_check_mark: | This is the path to the local file, must be prefixed by `file://` | file://C:\Image.png&type=13 |
| `type` | *?float* | :heavy_minus_sign: | Item type | |
### Response
**[?Operations\GetMetaDataByRatingKeyResponse](../../Models/Operations/GetMetaDataByRatingKeyResponse.md)**
**[?Operations\GetFileHashResponse](../../Models/Operations/GetFileHashResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
| Errors\GetMetaDataByRatingKeyBadRequest | 400 | application/json |
| Errors\GetMetaDataByRatingKeyUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| Errors\GetFileHashBadRequest | 400 | application/json |
| Errors\GetFileHashUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getMetadataChildren
@@ -693,13 +635,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -733,6 +669,47 @@ if ($response->object !== null) {
| Errors\GetMetadataChildrenUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getOnDeck
This endpoint will return the on deck content.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->library->getOnDeck(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetOnDeckResponse](../../Models/Operations/GetOnDeckResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------- | ---------------------------- | ---------------------------- |
| Errors\GetOnDeckBadRequest | 400 | application/json |
| Errors\GetOnDeckUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getTopWatchedContent
This endpoint will return the top watched content from libraries of a certain type
@@ -750,13 +727,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -789,50 +760,3 @@ if ($response->object !== null) {
| Errors\GetTopWatchedContentBadRequest | 400 | application/json |
| Errors\GetTopWatchedContentUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getOnDeck
This endpoint will return the on deck content.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->library->getOnDeck(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetOnDeckResponse](../../Models/Operations/GetOnDeckResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------- | ---------------------------- | ---------------------------- |
| Errors\GetOnDeckBadRequest | 400 | application/json |
| Errors\GetOnDeckUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -8,9 +8,50 @@ Submit logs to the Log Handler for Plex Media Server
### Available Operations
* [enablePaperTrail](#enablepapertrail) - Enabling Papertrail
* [logLine](#logline) - Logging a single line message.
* [logMultiLine](#logmultiline) - Logging a multi-line message
* [enablePaperTrail](#enablepapertrail) - Enabling Papertrail
## enablePaperTrail
This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->log->enablePaperTrail(
);
if ($response->statusCode === 200) {
// handle response
}
```
### Response
**[?Operations\EnablePaperTrailResponse](../../Models/Operations/EnablePaperTrailResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
| Errors\EnablePaperTrailBadRequest | 400 | application/json |
| Errors\EnablePaperTrailUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## logLine
@@ -29,13 +70,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -107,13 +142,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = 'level=4&message=Test%20message%201&source=postman
level=3&message=Test%20message%202&source=postman
@@ -145,50 +174,3 @@ if ($response->statusCode === 200) {
| Errors\LogMultiLineBadRequest | 400 | application/json |
| Errors\LogMultiLineUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## enablePaperTrail
This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->log->enablePaperTrail(
);
if ($response->statusCode === 200) {
// handle response
}
```
### Response
**[?Operations\EnablePaperTrailResponse](../../Models/Operations/EnablePaperTrailResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
| Errors\EnablePaperTrailBadRequest | 400 | application/json |
| Errors\EnablePaperTrailUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -8,173 +8,11 @@ API Calls interacting with Plex Media Server Media
### Available Operations
* [getBannerImage](#getbannerimage) - Get Banner Image
* [getThumbImage](#getthumbimage) - Get Thumb Image
* [markPlayed](#markplayed) - Mark Media Played
* [markUnplayed](#markunplayed) - Mark Media Unplayed
* [updatePlayProgress](#updateplayprogress) - Update Media Play Progress
* [getBannerImage](#getbannerimage) - Get Banner Image
* [getThumbImage](#getthumbimage) - Get Thumb Image
## markPlayed
This will mark the provided media key as Played.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->media->markPlayed(
key: 59398
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `key` | *float* | :heavy_check_mark: | The media key to mark as played | 59398 |
### Response
**[?Operations\MarkPlayedResponse](../../Models/Operations/MarkPlayedResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------- | ----------------------------- | ----------------------------- |
| Errors\MarkPlayedBadRequest | 400 | application/json |
| Errors\MarkPlayedUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## markUnplayed
This will mark the provided media key as Unplayed.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->media->markUnplayed(
key: 59398
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- |
| `key` | *float* | :heavy_check_mark: | The media key to mark as Unplayed | 59398 |
### Response
**[?Operations\MarkUnplayedResponse](../../Models/Operations/MarkUnplayedResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------- | ------------------------------- | ------------------------------- |
| Errors\MarkUnplayedBadRequest | 400 | application/json |
| Errors\MarkUnplayedUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## updatePlayProgress
This API command can be used to update the play progress of a media item.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->media->updatePlayProgress(
key: '<key>',
time: 90000,
state: 'played'
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `key` | *string* | :heavy_check_mark: | the media key | |
| `time` | *float* | :heavy_check_mark: | The time, in milliseconds, used to set the media playback progress. | 90000 |
| `state` | *string* | :heavy_check_mark: | The playback state of the media item. | played |
### Response
**[?Operations\UpdatePlayProgressResponse](../../Models/Operations/UpdatePlayProgressResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
| Errors\UpdatePlayProgressBadRequest | 400 | application/json |
| Errors\UpdatePlayProgressUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getBannerImage
@@ -192,13 +30,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetBannerImageRequest(
ratingKey: 9518,
@@ -252,13 +84,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetThumbImageRequest(
ratingKey: 9518,
@@ -295,3 +121,147 @@ if ($response->bytes !== null) {
| Errors\GetThumbImageBadRequest | 400 | application/json |
| Errors\GetThumbImageUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## markPlayed
This will mark the provided media key as Played.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->media->markPlayed(
key: 59398
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `key` | *float* | :heavy_check_mark: | The media key to mark as played | 59398 |
### Response
**[?Operations\MarkPlayedResponse](../../Models/Operations/MarkPlayedResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------- | ----------------------------- | ----------------------------- |
| Errors\MarkPlayedBadRequest | 400 | application/json |
| Errors\MarkPlayedUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## markUnplayed
This will mark the provided media key as Unplayed.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->media->markUnplayed(
key: 59398
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- |
| `key` | *float* | :heavy_check_mark: | The media key to mark as Unplayed | 59398 |
### Response
**[?Operations\MarkUnplayedResponse](../../Models/Operations/MarkUnplayedResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------- | ------------------------------- | ------------------------------- |
| Errors\MarkUnplayedBadRequest | 400 | application/json |
| Errors\MarkUnplayedUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## updatePlayProgress
This API command can be used to update the play progress of a media item.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->media->updatePlayProgress(
key: '<key>',
time: 90000,
state: 'played'
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `key` | *string* | :heavy_check_mark: | the media key | |
| `time` | *float* | :heavy_check_mark: | The time, in milliseconds, used to set the media playback progress. | 90000 |
| `state` | *string* | :heavy_check_mark: | The playback state of the media item. | played |
### Response
**[?Operations\UpdatePlayProgressResponse](../../Models/Operations/UpdatePlayProgressResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
| Errors\UpdatePlayProgressBadRequest | 400 | application/json |
| Errors\UpdatePlayProgressUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -11,411 +11,16 @@ This may cause the duration and number of items to change.
### Available Operations
* [createPlaylist](#createplaylist) - Create a Playlist
* [getPlaylists](#getplaylists) - Get All Playlists
* [getPlaylist](#getplaylist) - Retrieve Playlist
* [deletePlaylist](#deleteplaylist) - Deletes a Playlist
* [updatePlaylist](#updateplaylist) - Update a Playlist
* [getPlaylistContents](#getplaylistcontents) - Retrieve Playlist Contents
* [clearPlaylistContents](#clearplaylistcontents) - Delete Playlist Contents
* [addPlaylistContents](#addplaylistcontents) - Adding to a Playlist
* [clearPlaylistContents](#clearplaylistcontents) - Delete Playlist Contents
* [createPlaylist](#createplaylist) - Create a Playlist
* [deletePlaylist](#deleteplaylist) - Deletes a Playlist
* [getPlaylist](#getplaylist) - Retrieve Playlist
* [getPlaylistContents](#getplaylistcontents) - Retrieve Playlist Contents
* [getPlaylists](#getplaylists) - Get All Playlists
* [updatePlaylist](#updateplaylist) - Update a Playlist
* [uploadPlaylist](#uploadplaylist) - Upload Playlist
## createPlaylist
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$request = new Operations\CreatePlaylistRequest(
title: '<value>',
type: Operations\CreatePlaylistQueryParamType::Photo,
smart: Operations\Smart::One,
uri: 'https://hoarse-testing.info/',
);
$response = $sdk->playlists->createPlaylist(
request: $request
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `$request` | [Operations\CreatePlaylistRequest](../../Models/Operations/CreatePlaylistRequest.md) | :heavy_check_mark: | The request object to use for the request. |
### Response
**[?Operations\CreatePlaylistResponse](../../Models/Operations/CreatePlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\CreatePlaylistBadRequest | 400 | application/json |
| Errors\CreatePlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getPlaylists
Get All Playlists given the specified filters.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->playlists->getPlaylists(
playlistType: Operations\PlaylistType::Audio,
smart: Operations\QueryParamSmart::Zero
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `playlistType` | [?Operations\PlaylistType](../../Models/Operations/PlaylistType.md) | :heavy_minus_sign: | limit to a type of playlist. |
| `smart` | [?Operations\QueryParamSmart](../../Models/Operations/QueryParamSmart.md) | :heavy_minus_sign: | type of playlists to return (default is all). |
### Response
**[?Operations\GetPlaylistsResponse](../../Models/Operations/GetPlaylistsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------- | ------------------------------- | ------------------------------- |
| Errors\GetPlaylistsBadRequest | 400 | application/json |
| Errors\GetPlaylistsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getPlaylist
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->playlists->getPlaylist(
playlistID: 4109.48
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ---------------------- | ---------------------- | ---------------------- | ---------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
### Response
**[?Operations\GetPlaylistResponse](../../Models/Operations/GetPlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| Errors\GetPlaylistBadRequest | 400 | application/json |
| Errors\GetPlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## deletePlaylist
This endpoint will delete a playlist
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->playlists->deletePlaylist(
playlistID: 216.22
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ---------------------- | ---------------------- | ---------------------- | ---------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
### Response
**[?Operations\DeletePlaylistResponse](../../Models/Operations/DeletePlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\DeletePlaylistBadRequest | 400 | application/json |
| Errors\DeletePlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## updatePlaylist
From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->playlists->updatePlaylist(
playlistID: 3915.00,
title: '<value>',
summary: '<value>'
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
| `title` | *?string* | :heavy_minus_sign: | name of the playlist |
| `summary` | *?string* | :heavy_minus_sign: | summary description of the playlist |
### Response
**[?Operations\UpdatePlaylistResponse](../../Models/Operations/UpdatePlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\UpdatePlaylistBadRequest | 400 | application/json |
| Errors\UpdatePlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getPlaylistContents
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->playlists->getPlaylistContents(
playlistID: 5004.46,
type: Operations\GetPlaylistContentsQueryParamType::TvShow
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist | |
| `type` | [Operations\GetPlaylistContentsQueryParamType](../../Models/Operations/GetPlaylistContentsQueryParamType.md) | :heavy_check_mark: | The type of media to retrieve.<br/>1 = movie<br/>2 = show<br/>3 = season<br/>4 = episode<br/>E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries<br/> | 2 |
### Response
**[?Operations\GetPlaylistContentsResponse](../../Models/Operations/GetPlaylistContentsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| Errors\GetPlaylistContentsBadRequest | 400 | application/json |
| Errors\GetPlaylistContentsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## clearPlaylistContents
Clears a playlist, only works with dumb playlists. Returns the playlist.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->playlists->clearPlaylistContents(
playlistID: 1893.18
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ---------------------- | ---------------------- | ---------------------- | ---------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
### Response
**[?Operations\ClearPlaylistContentsResponse](../../Models/Operations/ClearPlaylistContentsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| Errors\ClearPlaylistContentsBadRequest | 400 | application/json |
| Errors\ClearPlaylistContentsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## addPlaylistContents
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.
@@ -433,13 +38,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -475,6 +74,359 @@ if ($response->object !== null) {
| Errors\AddPlaylistContentsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## clearPlaylistContents
Clears a playlist, only works with dumb playlists. Returns the playlist.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->playlists->clearPlaylistContents(
playlistID: 1893.18
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ---------------------- | ---------------------- | ---------------------- | ---------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
### Response
**[?Operations\ClearPlaylistContentsResponse](../../Models/Operations/ClearPlaylistContentsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| Errors\ClearPlaylistContentsBadRequest | 400 | application/json |
| Errors\ClearPlaylistContentsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## createPlaylist
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\CreatePlaylistRequest(
title: '<value>',
type: Operations\CreatePlaylistQueryParamType::Photo,
smart: Operations\Smart::One,
uri: 'https://hoarse-testing.info/',
);
$response = $sdk->playlists->createPlaylist(
request: $request
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `$request` | [Operations\CreatePlaylistRequest](../../Models/Operations/CreatePlaylistRequest.md) | :heavy_check_mark: | The request object to use for the request. |
### Response
**[?Operations\CreatePlaylistResponse](../../Models/Operations/CreatePlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\CreatePlaylistBadRequest | 400 | application/json |
| Errors\CreatePlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## deletePlaylist
This endpoint will delete a playlist
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->playlists->deletePlaylist(
playlistID: 216.22
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ---------------------- | ---------------------- | ---------------------- | ---------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
### Response
**[?Operations\DeletePlaylistResponse](../../Models/Operations/DeletePlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\DeletePlaylistBadRequest | 400 | application/json |
| Errors\DeletePlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getPlaylist
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->playlists->getPlaylist(
playlistID: 4109.48
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ---------------------- | ---------------------- | ---------------------- | ---------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
### Response
**[?Operations\GetPlaylistResponse](../../Models/Operations/GetPlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| Errors\GetPlaylistBadRequest | 400 | application/json |
| Errors\GetPlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getPlaylistContents
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.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->playlists->getPlaylistContents(
playlistID: 5004.46,
type: Operations\GetPlaylistContentsQueryParamType::TvShow
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist | |
| `type` | [Operations\GetPlaylistContentsQueryParamType](../../Models/Operations/GetPlaylistContentsQueryParamType.md) | :heavy_check_mark: | The type of media to retrieve.<br/>1 = movie<br/>2 = show<br/>3 = season<br/>4 = episode<br/>E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries<br/> | 2 |
### Response
**[?Operations\GetPlaylistContentsResponse](../../Models/Operations/GetPlaylistContentsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| Errors\GetPlaylistContentsBadRequest | 400 | application/json |
| Errors\GetPlaylistContentsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getPlaylists
Get All Playlists given the specified filters.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->playlists->getPlaylists(
playlistType: Operations\PlaylistType::Audio,
smart: Operations\QueryParamSmart::Zero
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `playlistType` | [?Operations\PlaylistType](../../Models/Operations/PlaylistType.md) | :heavy_minus_sign: | limit to a type of playlist. |
| `smart` | [?Operations\QueryParamSmart](../../Models/Operations/QueryParamSmart.md) | :heavy_minus_sign: | type of playlists to return (default is all). |
### Response
**[?Operations\GetPlaylistsResponse](../../Models/Operations/GetPlaylistsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------- | ------------------------------- | ------------------------------- |
| Errors\GetPlaylistsBadRequest | 400 | application/json |
| Errors\GetPlaylistsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## updatePlaylist
From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->playlists->updatePlaylist(
playlistID: 3915.00,
title: '<value>',
summary: '<value>'
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
| `playlistID` | *float* | :heavy_check_mark: | the ID of the playlist |
| `title` | *?string* | :heavy_minus_sign: | name of the playlist |
| `summary` | *?string* | :heavy_minus_sign: | summary description of the playlist |
### Response
**[?Operations\UpdatePlaylistResponse](../../Models/Operations/UpdatePlaylistResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\UpdatePlaylistBadRequest | 400 | application/json |
| Errors\UpdatePlaylistUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## uploadPlaylist
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.
@@ -492,13 +444,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();

View File

@@ -8,13 +8,68 @@ API Calls that perform operations directly against https://Plex.tv
### Available Operations
* [getServerResources](#getserverresources) - Get Server Resources
* [getCompanionsData](#getcompanionsdata) - Get Companions Data
* [getUserFriends](#getuserfriends) - Get list of friends of the user logged in
* [getGeoData](#getgeodata) - Get Geo Data
* [getHomeData](#gethomedata) - Get Plex Home Data
* [getServerResources](#getserverresources) - Get Server Resources
* [getPin](#getpin) - Get a Pin
* [getTokenByPinId](#gettokenbypinid) - Get Access Token by PinId
* [getUserFriends](#getuserfriends) - Get list of friends of the user logged in
## getServerResources
Get Plex server access tokens and server connections
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->plex->getServerResources(
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
includeHttps: Operations\IncludeHttps::Enable,
includeRelay: Operations\IncludeRelay::Enable,
includeIPv6: Operations\IncludeIPv6::Enable
);
if ($response->plexDevices !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `clientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `includeHttps` | [?Operations\IncludeHttps](../../Models/Operations/IncludeHttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 |
| `includeRelay` | [?Operations\IncludeRelay](../../Models/Operations/IncludeRelay.md) | :heavy_minus_sign: | Include Relay addresses in the results <br/>E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400<br/> | 1 |
| `includeIPv6` | [?Operations\IncludeIPv6](../../Models/Operations/IncludeIPv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 |
| `$serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 |
### Response
**[?Operations\GetServerResourcesResponse](../../Models/Operations/GetServerResourcesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
| Errors\GetServerResourcesBadRequest | 400 | application/json |
| Errors\GetServerResourcesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getCompanionsData
@@ -31,13 +86,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -68,58 +117,6 @@ if ($response->responseBodies !== null) {
| Errors\GetCompanionsDataUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getUserFriends
Get friends of provided auth token.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->plex->getUserFriends(
);
if ($response->friends !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ |
| `$serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
### Response
**[?Operations\GetUserFriendsResponse](../../Models/Operations/GetUserFriendsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\GetUserFriendsBadRequest | 400 | application/json |
| Errors\GetUserFriendsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getGeoData
Returns the geolocation and locale data of the caller
@@ -133,13 +130,7 @@ require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->build();
$sdk = Plex_API\PlexAPI::builder()->build();
@@ -185,13 +176,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -216,67 +201,6 @@ if ($response->object !== null) {
| Errors\GetHomeDataUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getServerResources
Get Plex server access tokens and server connections
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->plex->getServerResources(
includeHttps: Operations\IncludeHttps::Enable,
includeRelay: Operations\IncludeRelay::Enable,
includeIPv6: Operations\IncludeIPv6::Enable,
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58'
);
if ($response->plexDevices !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `includeHttps` | [?Operations\IncludeHttps](../../Models/Operations/IncludeHttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 |
| `includeRelay` | [?Operations\IncludeRelay](../../Models/Operations/IncludeRelay.md) | :heavy_minus_sign: | Include Relay addresses in the results <br/>E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400<br/> | 1 |
| `includeIPv6` | [?Operations\IncludeIPv6](../../Models/Operations/IncludeIPv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 |
| `clientID` | *?string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 |
| `$serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 |
### Response
**[?Operations\GetServerResourcesResponse](../../Models/Operations/GetServerResourcesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
| Errors\GetServerResourcesBadRequest | 400 | application/json |
| Errors\GetServerResourcesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getPin
Retrieve a Pin ID from Plex.tv to use for authentication flows
@@ -291,15 +215,15 @@ require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->build();
$sdk = Plex_API\PlexAPI::builder()->build();
$request = new Operations\GetPinRequest();
$request = new Operations\GetPinRequest(
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
clientName: 'Plex for Roku',
deviceNickname: 'Roku 3',
clientVersion: '2.4.1',
platform: 'Roku',
);
$response = $sdk->plex->getPin(
request: $request
@@ -342,16 +266,15 @@ require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->build();
$sdk = Plex_API\PlexAPI::builder()->build();
$request = new Operations\GetTokenByPinIdRequest(
pinID: 408895,
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
clientName: 'Plex for Roku',
deviceNickname: 'Roku 3',
clientVersion: '2.4.1',
platform: 'Roku',
);
$response = $sdk->plex->getTokenByPinId(
@@ -381,3 +304,49 @@ if ($response->authPinContainer !== null) {
| Errors\GetTokenByPinIdBadRequest | 400 | application/json |
| Errors\GetTokenByPinIdResponseBody | 404 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getUserFriends
Get friends of provided auth token.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->plex->getUserFriends(
);
if ($response->friends !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ |
| `$serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
### Response
**[?Operations\GetUserFriendsResponse](../../Models/Operations/GetUserFriendsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| Errors\GetUserFriendsBadRequest | 400 | application/json |
| Errors\GetUserFriendsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -26,3 +26,6 @@ The following SDKs are generated from the OpenAPI Specification. They are automa
| PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
| Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
| C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | -
### Available Operations

View File

@@ -8,9 +8,55 @@ API Calls that perform search operations with Plex Media Server
### Available Operations
* [getSearchResults](#getsearchresults) - Get Search Results
* [performSearch](#performsearch) - Perform a search
* [performVoiceSearch](#performvoicesearch) - Perform a voice search
* [getSearchResults](#getsearchresults) - Get Search Results
## getSearchResults
This will search the database for the string provided.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->search->getSearchResults(
query: '110'
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ |
| `query` | *string* | :heavy_check_mark: | The search query string to use | 110 |
### Response
**[?Operations\GetSearchResultsResponse](../../Models/Operations/GetSearchResultsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
| Errors\GetSearchResultsBadRequest | 400 | application/json |
| Errors\GetSearchResultsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## performSearch
@@ -39,13 +85,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -100,13 +140,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -141,55 +175,3 @@ if ($response->statusCode === 200) {
| Errors\PerformVoiceSearchBadRequest | 400 | application/json |
| Errors\PerformVoiceSearchUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getSearchResults
This will search the database for the string provided.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->search->getSearchResults(
query: '110'
);
if ($response->object !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ |
| `query` | *string* | :heavy_check_mark: | The search query string to use | 110 |
### Response
**[?Operations\GetSearchResultsResponse](../../Models/Operations/GetSearchResultsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
| Errors\GetSearchResultsBadRequest | 400 | application/json |
| Errors\GetSearchResultsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -8,19 +8,19 @@ Operations against the Plex Media Server System.
### Available Operations
* [getServerCapabilities](#getservercapabilities) - Get Server Capabilities
* [getServerPreferences](#getserverpreferences) - Get Server Preferences
* [getMediaProviders](#getmediaproviders) - Get Media Providers
* [getServerIdentity](#getserveridentity) - Get Server Identity
* [getAvailableClients](#getavailableclients) - Get Available Clients
* [getDevices](#getdevices) - Get Devices
* [getServerIdentity](#getserveridentity) - Get Server Identity
* [getMyPlexAccount](#getmyplexaccount) - Get MyPlex Account
* [getResizedPhoto](#getresizedphoto) - Get a Resized Photo
* [getMediaProviders](#getmediaproviders) - Get Media Providers
* [getServerCapabilities](#getservercapabilities) - Get Server Capabilities
* [getServerList](#getserverlist) - Get Server List
* [getServerPreferences](#getserverpreferences) - Get Server Preferences
## getServerCapabilities
## getMediaProviders
Get Server Capabilities
Retrieves media providers and their features from the Plex server.
### Example Usage
@@ -33,18 +33,12 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->server->getServerCapabilities(
$response = $sdk->server->getMediaProviders(
xPlexToken: 'CV5xoxjTpFKUzBTShsaf'
);
if ($response->object !== null) {
@@ -52,21 +46,27 @@ if ($response->object !== null) {
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
| `xPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf |
### Response
**[?Operations\GetServerCapabilitiesResponse](../../Models/Operations/GetServerCapabilitiesResponse.md)**
**[?Operations\GetMediaProvidersResponse](../../Models/Operations/GetMediaProvidersResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| Errors\GetServerCapabilitiesBadRequest | 400 | application/json |
| Errors\GetServerCapabilitiesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
| Errors\GetMediaProvidersBadRequest | 400 | application/json |
| Errors\GetMediaProvidersUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getServerPreferences
## getServerIdentity
Get Server Preferences
This request is useful to determine if the server is online or offline
### Example Usage
@@ -77,19 +77,11 @@ require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->build();
$response = $sdk->server->getServerPreferences(
$response = $sdk->server->getServerIdentity(
);
@@ -100,15 +92,14 @@ if ($response->object !== null) {
### Response
**[?Operations\GetServerPreferencesResponse](../../Models/Operations/GetServerPreferencesResponse.md)**
**[?Operations\GetServerIdentityResponse](../../Models/Operations/GetServerIdentityResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------------- | --------------------------------------- | --------------------------------------- |
| Errors\GetServerPreferencesBadRequest | 400 | application/json |
| Errors\GetServerPreferencesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| Errors\GetServerIdentityRequestTimeout | 408 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getAvailableClients
@@ -125,13 +116,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -171,13 +156,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -202,49 +181,6 @@ if ($response->object !== null) {
| Errors\GetDevicesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getServerIdentity
This request is useful to determine if the server is online or offline
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->build();
$response = $sdk->server->getServerIdentity(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetServerIdentityResponse](../../Models/Operations/GetServerIdentityResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
| Errors\GetServerIdentityRequestTimeout | 408 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getMyPlexAccount
Returns MyPlex Account Information
@@ -260,13 +196,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -308,13 +238,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetResizedPhotoRequest(
width: 110,
@@ -353,9 +277,9 @@ if ($response->statusCode === 200) {
| Errors\GetResizedPhotoUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getMediaProviders
## getServerCapabilities
Retrieves media providers and their features from the Plex server.
Get Server Capabilities
### Example Usage
@@ -368,18 +292,12 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->server->getMediaProviders(
xPlexToken: 'CV5xoxjTpFKUzBTShsaf'
$response = $sdk->server->getServerCapabilities(
);
if ($response->object !== null) {
@@ -387,23 +305,17 @@ if ($response->object !== null) {
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
| `xPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf |
### Response
**[?Operations\GetMediaProvidersResponse](../../Models/Operations/GetMediaProvidersResponse.md)**
**[?Operations\GetServerCapabilitiesResponse](../../Models/Operations/GetServerCapabilitiesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
| Errors\GetMediaProvidersBadRequest | 400 | application/json |
| Errors\GetMediaProvidersUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| Errors\GetServerCapabilitiesBadRequest | 400 | application/json |
| Errors\GetServerCapabilitiesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getServerList
@@ -420,13 +332,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -450,3 +356,43 @@ if ($response->object !== null) {
| Errors\GetServerListBadRequest | 400 | application/json |
| Errors\GetServerListUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getServerPreferences
Get Server Preferences
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->server->getServerPreferences(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetServerPreferencesResponse](../../Models/Operations/GetServerPreferencesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------------------- | --------------------------------------- | --------------------------------------- |
| Errors\GetServerPreferencesBadRequest | 400 | application/json |
| Errors\GetServerPreferencesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -8,57 +8,11 @@ API Calls that perform search operations with Plex Media Server Sessions
### Available Operations
* [getSessions](#getsessions) - Get Active Sessions
* [getSessionHistory](#getsessionhistory) - Get Session History
* [getSessions](#getsessions) - Get Active Sessions
* [getTranscodeSessions](#gettranscodesessions) - Get Transcode Sessions
* [stopTranscodeSession](#stoptranscodesession) - Stop a Transcode Session
## getSessions
This will retrieve the "Now Playing" Information of the PMS.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->sessions->getSessions(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetSessionsResponse](../../Models/Operations/GetSessionsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| Errors\GetSessionsBadRequest | 400 | application/json |
| Errors\GetSessionsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getSessionHistory
This will Retrieve a listing of all history views.
@@ -75,13 +29,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$filter = new Operations\QueryParamFilter();
@@ -119,6 +67,46 @@ if ($response->object !== null) {
| Errors\GetSessionHistoryUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getSessions
This will retrieve the "Now Playing" Information of the PMS.
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->sessions->getSessions(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetSessionsResponse](../../Models/Operations/GetSessionsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ------------------------------ | ------------------------------ | ------------------------------ |
| Errors\GetSessionsBadRequest | 400 | application/json |
| Errors\GetSessionsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getTranscodeSessions
Get Transcode Sessions
@@ -134,13 +122,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -180,13 +162,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();

View File

@@ -8,13 +8,13 @@ API Calls that perform operations with Plex Media Server Statistics
### Available Operations
* [getStatistics](#getstatistics) - Get Media Statistics
* [getResourcesStatistics](#getresourcesstatistics) - Get Resources Statistics
* [getBandwidthStatistics](#getbandwidthstatistics) - Get Bandwidth Statistics
* [getResourcesStatistics](#getresourcesstatistics) - Get Resources Statistics
* [getStatistics](#getstatistics) - Get Media Statistics
## getStatistics
## getBandwidthStatistics
This will return the media statistics for the server
This will return the bandwidth statistics for the server
### Example Usage
@@ -27,17 +27,11 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->statistics->getStatistics(
$response = $sdk->statistics->getBandwidthStatistics(
timespan: 4
);
@@ -54,15 +48,15 @@ if ($response->object !== null) {
### Response
**[?Operations\GetStatisticsResponse](../../Models/Operations/GetStatisticsResponse.md)**
**[?Operations\GetBandwidthStatisticsResponse](../../Models/Operations/GetBandwidthStatisticsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| -------------------------------- | -------------------------------- | -------------------------------- |
| Errors\GetStatisticsBadRequest | 400 | application/json |
| Errors\GetStatisticsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
| Errors\GetBandwidthStatisticsBadRequest | 400 | application/json |
| Errors\GetBandwidthStatisticsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getResourcesStatistics
@@ -79,13 +73,7 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -116,9 +104,9 @@ if ($response->object !== null) {
| Errors\GetResourcesStatisticsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getBandwidthStatistics
## getStatistics
This will return the bandwidth statistics for the server
This will return the media statistics for the server
### Example Usage
@@ -131,17 +119,11 @@ use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->statistics->getBandwidthStatistics(
$response = $sdk->statistics->getStatistics(
timespan: 4
);
@@ -158,12 +140,12 @@ if ($response->object !== null) {
### Response
**[?Operations\GetBandwidthStatisticsResponse](../../Models/Operations/GetBandwidthStatisticsResponse.md)**
**[?Operations\GetStatisticsResponse](../../Models/Operations/GetStatisticsResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
| Errors\GetBandwidthStatisticsBadRequest | 400 | application/json |
| Errors\GetBandwidthStatisticsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| -------------------------------- | -------------------------------- | -------------------------------- |
| Errors\GetStatisticsBadRequest | 400 | application/json |
| Errors\GetStatisticsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -9,108 +9,9 @@ Updates to the status can be observed via the Event API.
### Available Operations
* [getUpdateStatus](#getupdatestatus) - Querying status of updates
* [checkForUpdates](#checkforupdates) - Checking for updates
* [applyUpdates](#applyupdates) - Apply Updates
## getUpdateStatus
Querying status of updates
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->updater->getUpdateStatus(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetUpdateStatusResponse](../../Models/Operations/GetUpdateStatusResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
| Errors\GetUpdateStatusBadRequest | 400 | application/json |
| Errors\GetUpdateStatusUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## checkForUpdates
Checking for updates
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$response = $sdk->updater->checkForUpdates(
download: Operations\Download::One
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- |
| `download` | [?Operations\Download](../../Models/Operations/Download.md) | :heavy_minus_sign: | Indicate that you want to start download any updates found. | 1 |
### Response
**[?Operations\CheckForUpdatesResponse](../../Models/Operations/CheckForUpdatesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
| Errors\CheckForUpdatesBadRequest | 400 | application/json |
| Errors\CheckForUpdatesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
* [checkForUpdates](#checkforupdates) - Checking for updates
* [getUpdateStatus](#getupdatestatus) - Querying status of updates
## applyUpdates
@@ -129,13 +30,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
@@ -168,3 +63,90 @@ if ($response->statusCode === 200) {
| Errors\ApplyUpdatesBadRequest | 400 | application/json |
| Errors\ApplyUpdatesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## checkForUpdates
Checking for updates
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->updater->checkForUpdates(
download: Operations\Download::One
);
if ($response->statusCode === 200) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description | Example |
| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- |
| `download` | [?Operations\Download](../../Models/Operations/Download.md) | :heavy_minus_sign: | Indicate that you want to start download any updates found. | 1 |
### Response
**[?Operations\CheckForUpdatesResponse](../../Models/Operations/CheckForUpdatesResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
| Errors\CheckForUpdatesBadRequest | 400 | application/json |
| Errors\CheckForUpdatesUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |
## getUpdateStatus
Querying status of updates
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$response = $sdk->updater->getUpdateStatus(
);
if ($response->object !== null) {
// handle response
}
```
### Response
**[?Operations\GetUpdateStatusResponse](../../Models/Operations/GetUpdateStatusResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
| Errors\GetUpdateStatusBadRequest | 400 | application/json |
| Errors\GetUpdateStatusUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -27,13 +27,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetTimelineRequest(
ratingKey: 23409,
@@ -91,13 +85,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\StartUniversalTranscodeRequest(
hasMDE: 1,

View File

@@ -26,13 +26,7 @@ use LukeHagar\Plex_API\Models\Operations;
$security = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setClientID('3381b62b-9ab7-4e37-827b-203e9809eb58')
->setClientName('Plex for Roku')
->setClientVersion('2.4.1')
->setPlatform('Roku')
->setDeviceNickname('Roku 3')
->setSecurity($security)->build();
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
$request = new Operations\GetWatchListRequest(
filter: Operations\Filter::Available,

View File

@@ -8,7 +8,9 @@ declare(strict_types=1);
namespace LukeHagar\Plex_API;
use LukeHagar\Plex_API\Hooks\HookContext;
use LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\Options;
use Speakeasy\Serializer\DeserializationContext;
class Activities
@@ -21,47 +23,84 @@ class Activities
{
$this->sdkConfiguration = $sdkConfig;
}
/**
* @param string $baseUrl
* @param array<string, string> $urlVariables
*
* @return string
*/
public function getUrl(string $baseUrl, array $urlVariables): string
{
$serverDetails = $this->sdkConfiguration->getServerDetails();
if ($baseUrl == null) {
$baseUrl = $serverDetails->baseUrl;
}
if ($urlVariables == null) {
$urlVariables = $serverDetails->options;
}
return Utils\Utils::templateUrl($baseUrl, $urlVariables);
}
/**
* Get Server Activities
* Cancel Server Activities
*
* Get Server Activities
* Cancel Server Activities
*
* @return Operations\GetServerActivitiesResponse
* @param string $activityUUID
* @return Operations\CancelServerActivitiesResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getServerActivities(): Operations\GetServerActivitiesResponse
public function cancelServerActivities(string $activityUUID, ?Options $options = null): Operations\CancelServerActivitiesResponse
{
$request = new Operations\CancelServerActivitiesRequest(
activityUUID: $activityUUID,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/activities');
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$url = Utils\Utils::generateUrl($baseUrl, '/activities/{activityUUID}', Operations\CancelServerActivitiesRequest::class, $request);
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url);
$hookContext = new HookContext('cancelServerActivities', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Operations\GetServerActivitiesResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetServerActivitiesResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
object: $obj);
return $response;
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\CancelServerActivitiesResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetServerActivitiesBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\CancelServerActivitiesBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -69,8 +108,11 @@ class Activities
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetServerActivitiesUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\CancelServerActivitiesUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -84,41 +126,67 @@ class Activities
}
/**
* Cancel Server Activities
* Get Server Activities
*
* Cancel Server Activities
* Get Server Activities
*
* @param string $activityUUID
* @return Operations\CancelServerActivitiesResponse
* @return Operations\GetServerActivitiesResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function cancelServerActivities(string $activityUUID): Operations\CancelServerActivitiesResponse
public function getServerActivities(?Options $options = null): Operations\GetServerActivitiesResponse
{
$request = new Operations\CancelServerActivitiesRequest(
activityUUID: $activityUUID,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/activities/{activityUUID}', Operations\CancelServerActivitiesRequest::class, $request, $this->sdkConfiguration->globals);
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$url = Utils\Utils::generateUrl($baseUrl, '/activities');
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$hookContext = new HookContext('getServerActivities', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
return new Operations\CancelServerActivitiesResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Operations\GetServerActivitiesResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetServerActivitiesResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
object: $obj);
return $response;
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\CancelServerActivitiesBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetServerActivitiesBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -126,8 +194,11 @@ class Activities
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\CancelServerActivitiesUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetServerActivitiesUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {

View File

@@ -8,7 +8,9 @@ declare(strict_types=1);
namespace LukeHagar\Plex_API;
use LukeHagar\Plex_API\Hooks\HookContext;
use LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\Options;
use Speakeasy\Serializer\DeserializationContext;
class Authentication
@@ -29,66 +31,25 @@ class Authentication
{
$this->sdkConfiguration = $sdkConfig;
}
/**
* Get a Transient Token
* @param string $baseUrl
* @param array<string, string> $urlVariables
*
* 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.
*
*
* @param Operations\GetTransientTokenQueryParamType $type
* @param Operations\Scope $scope
* @return Operations\GetTransientTokenResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
* @return string
*/
public function getTransientToken(Operations\GetTransientTokenQueryParamType $type, Operations\Scope $scope): Operations\GetTransientTokenResponse
public function getUrl(string $baseUrl, array $urlVariables): string
{
$request = new Operations\GetTransientTokenRequest(
type: $type,
scope: $scope,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/security/token');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetTransientTokenRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$serverDetails = $this->sdkConfiguration->getServerDetails();
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 200) {
return new Operations\GetTransientTokenResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetTransientTokenBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetTransientTokenUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
if ($baseUrl == null) {
$baseUrl = $serverDetails->baseUrl;
}
if ($urlVariables == null) {
$urlVariables = $serverDetails->options;
}
return Utils\Utils::templateUrl($baseUrl, $urlVariables);
}
/**
@@ -102,25 +63,45 @@ class Authentication
* @return Operations\GetSourceConnectionInformationResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getSourceConnectionInformation(string $source): Operations\GetSourceConnectionInformationResponse
public function getSourceConnectionInformation(string $source, ?Options $options = null): Operations\GetSourceConnectionInformationResponse
{
$request = new Operations\GetSourceConnectionInformationRequest(
source: $source,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/security/resources');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetSourceConnectionInformationRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\GetSourceConnectionInformationRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('getSourceConnectionInformation', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\GetSourceConnectionInformationResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -128,8 +109,11 @@ class Authentication
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetSourceConnectionInformationBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetSourceConnectionInformationBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -137,8 +121,11 @@ class Authentication
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetSourceConnectionInformationUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetSourceConnectionInformationUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -156,11 +143,11 @@ class Authentication
*
* Get the User data from the provided X-Plex-Token
*
* @param string $serverURL
* @param ?string $serverURL
* @return Operations\GetTokenDetailsResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getTokenDetails(?string $serverURL = null): Operations\GetTokenDetailsResponse
public function getTokenDetails(?string $serverURL = null, ?Options $options = null): Operations\GetTokenDetailsResponse
{
$baseUrl = Utils\Utils::templateUrl(Authentication::GET_TOKEN_DETAILS_SERVERS[0], [
]);
@@ -168,20 +155,39 @@ class Authentication
$baseUrl = $serverURL;
}
$url = Utils\Utils::generateUrl($baseUrl, '/user');
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('getTokenDetails', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Operations\GetTokenDetailsUserPlexAccount', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Operations\GetTokenDetailsUserPlexAccount', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetTokenDetailsResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -194,8 +200,11 @@ class Authentication
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetTokenDetailsBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetTokenDetailsBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -203,8 +212,98 @@ class Authentication
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetTokenDetailsUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetTokenDetailsUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Get a Transient Token
*
* 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.
*
*
* @param Operations\GetTransientTokenQueryParamType $type
* @param Operations\Scope $scope
* @return Operations\GetTransientTokenResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getTransientToken(Operations\GetTransientTokenQueryParamType $type, Operations\Scope $scope, ?Options $options = null): Operations\GetTransientTokenResponse
{
$request = new Operations\GetTransientTokenRequest(
type: $type,
scope: $scope,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/security/token');
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\GetTransientTokenRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$hookContext = new HookContext('getTransientToken', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\GetTransientTokenResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetTransientTokenBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetTransientTokenUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -222,12 +321,12 @@ class Authentication
*
* Sign in user with username and password and return user data with Plex authentication token
*
* @param ?Operations\PostUsersSignInDataRequest $request
* @param string $serverURL
* @param Operations\PostUsersSignInDataRequest $request
* @param ?string $serverURL
* @return Operations\PostUsersSignInDataResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function postUsersSignInData(?Operations\PostUsersSignInDataRequest $request = null, ?string $serverURL = null): Operations\PostUsersSignInDataResponse
public function postUsersSignInData(Operations\PostUsersSignInDataRequest $request, ?string $serverURL = null, ?Options $options = null): Operations\PostUsersSignInDataResponse
{
$baseUrl = Utils\Utils::templateUrl(Authentication::POST_USERS_SIGN_IN_DATA_SERVERS[0], [
]);
@@ -235,26 +334,47 @@ class Authentication
$baseUrl = $serverURL;
}
$url = Utils\Utils::generateUrl($baseUrl, '/users/signin');
$options = ['http_errors' => false];
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$body = Utils\Utils::serializeRequestBody($request, 'requestBody', 'form');
if ($body !== null) {
$options = array_merge_recursive($options, $body);
$httpOptions = array_merge_recursive($httpOptions, $body);
}
$options = array_merge_recursive($options, Utils\Utils::getHeaders($request, $this->sdkConfiguration->globals));
if (! array_key_exists('headers', $options)) {
$options['headers'] = [];
$httpOptions = array_merge_recursive($httpOptions, Utils\Utils::getHeaders($request));
if (! array_key_exists('headers', $httpOptions)) {
$httpOptions['headers'] = [];
}
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url);
$httpResponse = $this->sdkConfiguration->defaultClient->send($httpRequest, $options);
$hookContext = new HookContext('post-users-sign-in-data', null, null);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 201) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Operations\PostUsersSignInDataUserPlexAccount', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Operations\PostUsersSignInDataUserPlexAccount', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\PostUsersSignInDataResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -267,8 +387,11 @@ class Authentication
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\PostUsersSignInDataBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\PostUsersSignInDataBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -276,8 +399,11 @@ class Authentication
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\PostUsersSignInDataUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\PostUsersSignInDataUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {

View File

@@ -8,7 +8,9 @@ declare(strict_types=1);
namespace LukeHagar\Plex_API;
use LukeHagar\Plex_API\Hooks\HookContext;
use LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\Options;
use Speakeasy\Serializer\DeserializationContext;
class Butler
@@ -21,6 +23,26 @@ class Butler
{
$this->sdkConfiguration = $sdkConfig;
}
/**
* @param string $baseUrl
* @param array<string, string> $urlVariables
*
* @return string
*/
public function getUrl(string $baseUrl, array $urlVariables): string
{
$serverDetails = $this->sdkConfiguration->getServerDetails();
if ($baseUrl == null) {
$baseUrl = $serverDetails->baseUrl;
}
if ($urlVariables == null) {
$urlVariables = $serverDetails->options;
}
return Utils\Utils::templateUrl($baseUrl, $urlVariables);
}
/**
* Get Butler tasks
@@ -30,24 +52,43 @@ class Butler
* @return Operations\GetButlerTasksResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getButlerTasks(): Operations\GetButlerTasksResponse
public function getButlerTasks(?Options $options = null): Operations\GetButlerTasksResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/butler');
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('getButlerTasks', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Operations\GetButlerTasksResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Operations\GetButlerTasksResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetButlerTasksResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -60,8 +101,11 @@ class Butler
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetButlerTasksBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetButlerTasksBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -69,8 +113,11 @@ class Butler
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetButlerTasksUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetButlerTasksUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -96,21 +143,39 @@ class Butler
* @return Operations\StartAllTasksResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function startAllTasks(): Operations\StartAllTasksResponse
public function startAllTasks(?Options $options = null): Operations\StartAllTasksResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/butler');
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('startAllTasks', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\StartAllTasksResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -118,8 +183,11 @@ class Butler
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StartAllTasksBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StartAllTasksBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -127,62 +195,11 @@ class Butler
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StartAllTasksUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Stop all Butler tasks
*
* This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
*
*
* @return Operations\StopAllTasksResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function stopAllTasks(): Operations\StopAllTasksResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/butler');
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 200) {
return new Operations\StopAllTasksResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StopAllTasksBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StopAllTasksUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StartAllTasksUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -209,24 +226,42 @@ class Butler
* @return Operations\StartTaskResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function startTask(Operations\TaskName $taskName): Operations\StartTaskResponse
public function startTask(Operations\TaskName $taskName, ?Options $options = null): Operations\StartTaskResponse
{
$request = new Operations\StartTaskRequest(
taskName: $taskName,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/butler/{taskName}', Operations\StartTaskRequest::class, $request, $this->sdkConfiguration->globals);
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$url = Utils\Utils::generateUrl($baseUrl, '/butler/{taskName}', Operations\StartTaskRequest::class, $request);
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('startTask', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if (in_array($statusCode, [200, 202])) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\StartTaskResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -234,8 +269,11 @@ class Butler
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StartTaskBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StartTaskBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -243,8 +281,89 @@ class Butler
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StartTaskUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StartTaskUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Stop all Butler tasks
*
* This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
*
*
* @return Operations\StopAllTasksResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function stopAllTasks(?Options $options = null): Operations\StopAllTasksResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/butler');
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url);
$hookContext = new HookContext('stopAllTasks', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\StopAllTasksResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StopAllTasksBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StopAllTasksUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -267,24 +386,42 @@ class Butler
* @return Operations\StopTaskResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function stopTask(Operations\PathParamTaskName $taskName): Operations\StopTaskResponse
public function stopTask(Operations\PathParamTaskName $taskName, ?Options $options = null): Operations\StopTaskResponse
{
$request = new Operations\StopTaskRequest(
taskName: $taskName,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/butler/{taskName}', Operations\StopTaskRequest::class, $request, $this->sdkConfiguration->globals);
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$url = Utils\Utils::generateUrl($baseUrl, '/butler/{taskName}', Operations\StopTaskRequest::class, $request);
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('stopTask', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode == 404 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\StopTaskResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -292,8 +429,11 @@ class Butler
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StopTaskBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StopTaskBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -301,8 +441,11 @@ class Butler
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\StopTaskUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\StopTaskUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {

View File

@@ -0,0 +1,32 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class AfterErrorContext extends HookContext
{
public function __construct(HookContext $hookCtx)
{
parent::__construct($hookCtx->operationID, $hookCtx->oauth2Scopes, $hookCtx->securitySource);
}
/**
* @param string $name
* @param array<mixed> $args
* @return mixed
*/
public function __call($name, $args): mixed
{
if ($name === 'securitySource') {
return call_user_func_array($this->securitySource, $args);
}
return null;
}
}

View File

@@ -0,0 +1,17 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
use Psr\Http\Message\ResponseInterface;
interface AfterErrorHook
{
public function afterError(AfterErrorContext $context, ?ResponseInterface $response, \Throwable $exception): ErrorResponseContext;
}

View File

@@ -0,0 +1,18 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class AfterSuccessContext extends HookContext
{
public function __construct(HookContext $hookCtx)
{
parent::__construct($hookCtx->operationID, $hookCtx->oauth2Scopes, $hookCtx->securitySource);
}
}

View File

@@ -0,0 +1,17 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
use Psr\Http\Message\ResponseInterface;
interface AfterSuccessHook
{
public function afterSuccess(AfterSuccessContext $context, ResponseInterface $response): ResponseInterface;
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class BeforeRequestContext extends HookContext
{
public function __construct(HookContext $hookCtx)
{
parent::__construct($hookCtx->operationID, $hookCtx->oauth2Scopes, $hookCtx->securitySource);
}
/**
* @param string $name
* @param array<mixed> $args
* @return mixed
*/
public function __call($name, $args): mixed
{
if ($name === 'securitySource') {
return call_user_func_array($this->securitySource, $args);
}
return null;
}
}

View File

@@ -0,0 +1,17 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
use Psr\Http\Message\RequestInterface;
interface BeforeRequestHook
{
public function beforeRequest(BeforeRequestContext $context, RequestInterface $request): RequestInterface;
}

24
src/Hooks/Credentials.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class Credentials
{
public string $clientID;
public string $clientSecret;
public string $tokenURL;
public function __construct(string $clientID, string $clientSecret, string $tokenURL)
{
$this->clientID = $clientID;
$this->clientSecret = $clientSecret;
$this->tokenURL = $tokenURL;
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
use Psr\Http\Message\ResponseInterface;
class ErrorResponseContext
{
public ?ResponseInterface $response;
public ?\Throwable $e;
public function __construct(?ResponseInterface $response, ?\Throwable $e)
{
$this->response = $response;
$this->e = $e;
}
}

View File

@@ -0,0 +1,14 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class FailEarlyException extends \Exception
{
}

51
src/Hooks/HookContext.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class HookContext
{
/**
* @var string $operationID
*/
public string $operationID;
/**
* @var ?array<string> $oauth2Scopes;
*/
public ?array $oauth2Scopes;
/**
* @var ?\Closure(): ?mixed $securitySource
*/
public ?\Closure $securitySource;
/**
* @param string $operationID
* @param ?array<string> $oauth2Scopes
* @param ?\Closure(): ?mixed $securitySource
*/
public function __construct(string $operationID, ?array $oauth2Scopes, ?\Closure $securitySource)
{
$this->operationID = $operationID;
$this->oauth2Scopes = $oauth2Scopes;
$this->securitySource = $securitySource;
}
/**
* @param string $name
* @param array<mixed> $args
* @return mixed
*/
public function __call($name, $args): mixed
{
if ($name === 'securitySource') {
return call_user_func_array($this->securitySource, $args);
}
return null;
}
}

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
/*
* This file is only ever generated once on the first generation and then is free to be modified.
* Any hooks you wish to add should be registered in the initHooks function. Feel free to define
* your hooks in this file or in separate files in the hooks package.
*
* Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance.
*/
class HookRegistration
{
/**
* @param Hooks $hooks
*/
public static function initHooks(Hooks $hooks): void
{
// $myHook = new MyHook();
// $hooks->registerSDKInitHook($myHook);
// $hooks->registerBeforeRequestHook($myHook);
// $hooks->registerAfterSuccessHook($myHook);
// $hooks->registerAfterErrorHook($myHook);
}
}

20
src/Hooks/Hooks.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
interface Hooks
{
public function registerSDKInitHook(SDKInitHook $hook): void;
public function registerBeforeRequestHook(BeforeRequestHook $hook): void;
public function registerAfterSuccessHook(AfterSuccessHook $hook): void;
public function registerAfterErrorHook(AfterErrorHook $hook): void;
}

118
src/Hooks/SDKHooks.php Normal file
View File

@@ -0,0 +1,118 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
class SDKHooks implements Hooks
{
/**
* @var array<SDKInitHook> $sdkInitHooks
*/
private array $sdkInitHooks = [];
/**
* @var array<BeforeRequestHook> $beforeRequestHooks
*/
private array $beforeRequestHooks = [];
/**
* @var array<AfterSuccessHook> $afterSuccessHooks
*/
private array $afterSuccessHooks = [];
/**
* @var array<AfterErrorHook> $afterErrorHooks
*/
private array $afterErrorHooks = [];
public function __construct()
{
HookRegistration::initHooks($this);
}
public function registerSDKInitHook(SDKInitHook $hook): void
{
$this->sdkInitHooks[] = $hook;
}
public function registerBeforeRequestHook(BeforeRequestHook $hook): void
{
$this->beforeRequestHooks[] = $hook;
}
public function registerAfterSuccessHook(AfterSuccessHook $hook): void
{
$this->afterSuccessHooks[] = $hook;
}
public function registerAfterErrorHook(AfterErrorHook $hook): void
{
$this->afterErrorHooks[] = $hook;
}
public function sdkInit(string $baseUrl, \GuzzleHttp\ClientInterface $client): SDKRequestContext
{
$rc = new SDKRequestContext($baseUrl, $client);
foreach ($this->sdkInitHooks as $hook) {
try {
$rc = $hook->sdkInit($rc->url, $rc->client);
} catch (\Exception $e) {
throw new \Exception('An error occurred while calling SDKInit hook.', $e->getCode(), $e);
}
}
return $rc;
}
public function beforeRequest(BeforeRequestContext $context, RequestInterface $request): RequestInterface
{
foreach ($this->beforeRequestHooks as $hook) {
try {
$request = $hook->beforeRequest($context, $request);
} catch (\Exception $e) {
throw new \Exception('An error occurred while calling BeforeRequest hook.', $e->getCode(), $e);
}
}
return $request;
}
public function afterSuccess(AfterSuccessContext $context, ResponseInterface $response): ResponseInterface
{
foreach ($this->afterSuccessHooks as $hook) {
try {
$response = $hook->afterSuccess($context, $response);
} catch (\Exception $e) {
throw new \Exception('An error occurred while calling AfterSuccess hook.', $e->getCode(), $e);
}
}
return $response;
}
public function afterError(AfterErrorContext $context, ?ResponseInterface $response, ?\Throwable $exception): ResponseInterface
{
$errorContext = new ErrorResponseContext($response, $exception);
foreach ($this->afterErrorHooks as $hook) {
try {
$errorContext = $hook->afterError($context, $errorContext->response, $errorContext->e);
} catch (FailEarlyException $e) {
throw $e;
} catch (\Exception $e) {
throw new \Exception('An error occurred while calling AfterError hook.', $e->getCode(), $e);
}
}
if ($errorContext->e !== null) {
throw $errorContext->e;
} else {
return $errorContext->response;
}
}
}

15
src/Hooks/SDKInitHook.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
interface SDKInitHook
{
public function sdkInit(string $baseUrl, \GuzzleHttp\ClientInterface $client): SDKRequestContext;
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class SDKRequestContext
{
public string $url;
public \GuzzleHttp\ClientInterface $client;
public function __construct(string $url, \GuzzleHttp\ClientInterface $client)
{
$this->url = $url;
$this->client = $client;
}
}

37
src/Hooks/Session.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
use Brick\DateTime\LocalTime;
class Session
{
public Credentials $credentials;
public string $token;
/**
* @var array<string> scopes
*/
public array $scopes;
public ?LocalTime $expiresAt;
/**
* @param Credentials $credentials
* @param string $token
* @param array<string> $scopes
* @param ?LocalTime $expiresAt
*/
public function __construct(Credentials $credentials, string $token, array $scopes, ?LocalTime $expiresAt = null)
{
$this->credentials = $credentials;
$this->token = $token;
$this->scopes = $scopes;
$this->expiresAt = $expiresAt;
}
}

View File

@@ -0,0 +1,17 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Hooks;
class TokenResponse
{
public ?string $accessToken;
public ?string $tokenType;
public ?float $expiresIn;
}

View File

@@ -8,7 +8,9 @@ declare(strict_types=1);
namespace LukeHagar\Plex_API;
use LukeHagar\Plex_API\Hooks\HookContext;
use LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\Options;
use Speakeasy\Serializer\DeserializationContext;
class Hubs
@@ -21,73 +23,25 @@ class Hubs
{
$this->sdkConfiguration = $sdkConfig;
}
/**
* Get Global Hubs
* @param string $baseUrl
* @param array<string, string> $urlVariables
*
* Get Global Hubs filtered by the parameters provided.
*
* @param ?float $count
* @param ?Operations\OnlyTransient $onlyTransient
* @return Operations\GetGlobalHubsResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
* @return string
*/
public function getGlobalHubs(?float $count = null, ?Operations\OnlyTransient $onlyTransient = null): Operations\GetGlobalHubsResponse
public function getUrl(string $baseUrl, array $urlVariables): string
{
$request = new Operations\GetGlobalHubsRequest(
count: $count,
onlyTransient: $onlyTransient,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/hubs');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetGlobalHubsRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$serverDetails = $this->sdkConfiguration->getServerDetails();
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Operations\GetGlobalHubsResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetGlobalHubsResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
object: $obj);
return $response;
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetGlobalHubsBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetGlobalHubsUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
if ($baseUrl == null) {
$baseUrl = $serverDetails->baseUrl;
}
if ($urlVariables == null) {
$urlVariables = $serverDetails->options;
}
return Utils\Utils::templateUrl($baseUrl, $urlVariables);
}
/**
@@ -100,25 +54,46 @@ class Hubs
* @return Operations\GetRecentlyAddedResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getRecentlyAdded(Operations\GetRecentlyAddedRequest $request): Operations\GetRecentlyAddedResponse
public function getRecentlyAdded(Operations\GetRecentlyAddedRequest $request, ?Options $options = null): Operations\GetRecentlyAddedResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/hubs/home/recentlyAdded');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetRecentlyAddedRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\GetRecentlyAddedRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('get-recently-added', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Operations\GetRecentlyAddedResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Operations\GetRecentlyAddedResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetRecentlyAddedResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -136,6 +111,101 @@ class Hubs
}
}
/**
* Get Global Hubs
*
* Get Global Hubs filtered by the parameters provided.
*
* @param ?float $count
* @param ?Operations\OnlyTransient $onlyTransient
* @return Operations\GetGlobalHubsResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getGlobalHubs(?float $count = null, ?Operations\OnlyTransient $onlyTransient = null, ?Options $options = null): Operations\GetGlobalHubsResponse
{
$request = new Operations\GetGlobalHubsRequest(
count: $count,
onlyTransient: $onlyTransient,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/hubs');
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\GetGlobalHubsRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$hookContext = new HookContext('getGlobalHubs', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Operations\GetGlobalHubsResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetGlobalHubsResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
object: $obj);
return $response;
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetGlobalHubsBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetGlobalHubsUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Get library specific hubs
*
@@ -148,7 +218,7 @@ class Hubs
* @return Operations\GetLibraryHubsResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getLibraryHubs(float $sectionId, ?float $count = null, ?Operations\QueryParamOnlyTransient $onlyTransient = null): Operations\GetLibraryHubsResponse
public function getLibraryHubs(float $sectionId, ?float $count = null, ?Operations\QueryParamOnlyTransient $onlyTransient = null, ?Options $options = null): Operations\GetLibraryHubsResponse
{
$request = new Operations\GetLibraryHubsRequest(
sectionId: $sectionId,
@@ -156,22 +226,43 @@ class Hubs
onlyTransient: $onlyTransient,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/hubs/sections/{sectionId}', Operations\GetLibraryHubsRequest::class, $request, $this->sdkConfiguration->globals);
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetLibraryHubsRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$url = Utils\Utils::generateUrl($baseUrl, '/hubs/sections/{sectionId}', Operations\GetLibraryHubsRequest::class, $request);
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\GetLibraryHubsRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('getLibraryHubs', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Operations\GetLibraryHubsResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Operations\GetLibraryHubsResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$response = new Operations\GetLibraryHubsResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -184,8 +275,11 @@ class Hubs
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetLibraryHubsBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetLibraryHubsBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -193,8 +287,11 @@ class Hubs
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetLibraryHubsUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetLibraryHubsUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,9 @@ declare(strict_types=1);
namespace LukeHagar\Plex_API;
use LukeHagar\Plex_API\Hooks\HookContext;
use LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\Options;
use Speakeasy\Serializer\DeserializationContext;
class Log
@@ -21,6 +23,104 @@ class Log
{
$this->sdkConfiguration = $sdkConfig;
}
/**
* @param string $baseUrl
* @param array<string, string> $urlVariables
*
* @return string
*/
public function getUrl(string $baseUrl, array $urlVariables): string
{
$serverDetails = $this->sdkConfiguration->getServerDetails();
if ($baseUrl == null) {
$baseUrl = $serverDetails->baseUrl;
}
if ($urlVariables == null) {
$urlVariables = $serverDetails->options;
}
return Utils\Utils::templateUrl($baseUrl, $urlVariables);
}
/**
* Enabling Papertrail
*
* This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
*
*
* @return Operations\EnablePaperTrailResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function enablePaperTrail(?Options $options = null): Operations\EnablePaperTrailResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/log/networked');
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$hookContext = new HookContext('enablePaperTrail', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode == 403 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\EnablePaperTrailResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\EnablePaperTrailBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\EnablePaperTrailUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 403 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Logging a single line message.
@@ -34,7 +134,7 @@ class Log
* @return Operations\LogLineResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function logLine(Operations\Level $level, string $message, string $source): Operations\LogLineResponse
public function logLine(Operations\Level $level, string $message, string $source, ?Options $options = null): Operations\LogLineResponse
{
$request = new Operations\LogLineRequest(
level: $level,
@@ -43,18 +143,38 @@ class Log
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/log');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\LogLineRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\LogLineRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('logLine', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\LogLineResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -62,8 +182,11 @@ class Log
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\LogLineBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\LogLineBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -71,8 +194,11 @@ class Log
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\LogLineUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\LogLineUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -115,26 +241,44 @@ class Log
* @return Operations\LogMultiLineResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function logMultiLine(string $request): Operations\LogMultiLineResponse
public function logMultiLine(string $request, ?Options $options = null): Operations\LogMultiLineResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/log');
$options = ['http_errors' => false];
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$body = Utils\Utils::serializeRequestBody($request, 'request', 'string');
if ($body === null) {
throw new \Exception('Request body is required');
}
$options = array_merge_recursive($options, $body);
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpOptions = array_merge_recursive($httpOptions, $body);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('logMultiLine', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\LogMultiLineResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -142,8 +286,11 @@ class Log
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\LogMultiLineBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\LogMultiLineBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -151,8 +298,11 @@ class Log
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\LogMultiLineUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\LogMultiLineUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -165,58 +315,4 @@ class Log
}
}
/**
* Enabling Papertrail
*
* This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
*
*
* @return Operations\EnablePaperTrailResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function enablePaperTrail(): Operations\EnablePaperTrailResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/log/networked');
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 200) {
return new Operations\EnablePaperTrailResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\EnablePaperTrailBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\EnablePaperTrailUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 403 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
}

View File

@@ -8,7 +8,9 @@ declare(strict_types=1);
namespace LukeHagar\Plex_API;
use LukeHagar\Plex_API\Hooks\HookContext;
use LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\Options;
use Speakeasy\Serializer\DeserializationContext;
class Media
@@ -21,6 +23,210 @@ class Media
{
$this->sdkConfiguration = $sdkConfig;
}
/**
* @param string $baseUrl
* @param array<string, string> $urlVariables
*
* @return string
*/
public function getUrl(string $baseUrl, array $urlVariables): string
{
$serverDetails = $this->sdkConfiguration->getServerDetails();
if ($baseUrl == null) {
$baseUrl = $serverDetails->baseUrl;
}
if ($urlVariables == null) {
$urlVariables = $serverDetails->options;
}
return Utils\Utils::templateUrl($baseUrl, $urlVariables);
}
/**
* Get Banner Image
*
* Gets the banner image of the media item
*
* @param Operations\GetBannerImageRequest $request
* @return Operations\GetBannerImageResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getBannerImage(Operations\GetBannerImageRequest $request, ?Options $options = null): Operations\GetBannerImageResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/library/metadata/{ratingKey}/banner', Operations\GetBannerImageRequest::class, $request);
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\GetBannerImageRequest::class, $request, $urlOverride);
$httpOptions = array_merge_recursive($httpOptions, Utils\Utils::getHeaders($request));
if (! array_key_exists('headers', $httpOptions)) {
$httpOptions['headers'] = [];
}
$httpOptions['headers']['Accept'] = 'image/jpeg';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$hookContext = new HookContext('get-banner-image', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'image/jpeg')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$obj = $httpResponse->getBody()->getContents();
return new Operations\GetBannerImageResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
headers: $httpResponse->getHeaders(),
bytes: $obj);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetBannerImageBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetBannerImageUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Get Thumb Image
*
* Gets the thumbnail image of the media item
*
* @param Operations\GetThumbImageRequest $request
* @return Operations\GetThumbImageResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getThumbImage(Operations\GetThumbImageRequest $request, ?Options $options = null): Operations\GetThumbImageResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/library/metadata/{ratingKey}/thumb', Operations\GetThumbImageRequest::class, $request);
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\GetThumbImageRequest::class, $request, $urlOverride);
$httpOptions = array_merge_recursive($httpOptions, Utils\Utils::getHeaders($request));
if (! array_key_exists('headers', $httpOptions)) {
$httpOptions['headers'] = [];
}
$httpOptions['headers']['Accept'] = 'image/jpeg';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$hookContext = new HookContext('get-thumb-image', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'image/jpeg')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$obj = $httpResponse->getBody()->getContents();
return new Operations\GetThumbImageResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
headers: $httpResponse->getHeaders(),
bytes: $obj);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetThumbImageBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\GetThumbImageUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Mark Media Played
@@ -31,25 +237,45 @@ class Media
* @return Operations\MarkPlayedResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function markPlayed(float $key): Operations\MarkPlayedResponse
public function markPlayed(float $key, ?Options $options = null): Operations\MarkPlayedResponse
{
$request = new Operations\MarkPlayedRequest(
key: $key,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/:/scrobble');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\MarkPlayedRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\MarkPlayedRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('markPlayed', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\MarkPlayedResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -57,8 +283,11 @@ class Media
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\MarkPlayedBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\MarkPlayedBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -66,8 +295,11 @@ class Media
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\MarkPlayedUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\MarkPlayedUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -89,25 +321,45 @@ class Media
* @return Operations\MarkUnplayedResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function markUnplayed(float $key): Operations\MarkUnplayedResponse
public function markUnplayed(float $key, ?Options $options = null): Operations\MarkUnplayedResponse
{
$request = new Operations\MarkUnplayedRequest(
key: $key,
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/:/unscrobble');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\MarkUnplayedRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\MarkUnplayedRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('markUnplayed', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\MarkUnplayedResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -115,8 +367,11 @@ class Media
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\MarkUnplayedBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\MarkUnplayedBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -124,8 +379,11 @@ class Media
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\MarkUnplayedUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\MarkUnplayedUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -150,7 +408,7 @@ class Media
* @return Operations\UpdatePlayProgressResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function updatePlayProgress(string $key, float $time, string $state): Operations\UpdatePlayProgressResponse
public function updatePlayProgress(string $key, float $time, string $state, ?Options $options = null): Operations\UpdatePlayProgressResponse
{
$request = new Operations\UpdatePlayProgressRequest(
key: $key,
@@ -159,18 +417,38 @@ class Media
);
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/:/progress');
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\UpdatePlayProgressRequest::class, $request, $this->sdkConfiguration->globals));
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$qp = Utils\Utils::getQueryParams(Operations\UpdatePlayProgressRequest::class, $request, $urlOverride);
$httpOptions['headers']['Accept'] = 'application/json';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('POST', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$hookContext = new HookContext('updatePlayProgress', null, $this->sdkConfiguration->securitySource);
$httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest);
$httpOptions['query'] = Utils\QueryParameters::standardizeQueryParams($httpRequest, $qp);
$httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions);
$httpRequest = Utils\Utils::removeHeaders($httpRequest);
try {
$httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions);
} catch (\GuzzleHttp\Exception\GuzzleException $error) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error);
if ($res !== null) {
$httpResponse = $res;
}
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 400 || $statusCode == 401 || $statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
if ($res !== null) {
$httpResponse = $res;
}
}
if ($statusCode == 200) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
return new Operations\UpdatePlayProgressResponse(
statusCode: $statusCode,
contentType: $contentType,
@@ -178,8 +456,11 @@ class Media
);
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\UpdatePlayProgressBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\UpdatePlayProgressBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
@@ -187,140 +468,11 @@ class Media
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\UpdatePlayProgressUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Get Banner Image
*
* Gets the banner image of the media item
*
* @param Operations\GetBannerImageRequest $request
* @return Operations\GetBannerImageResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getBannerImage(Operations\GetBannerImageRequest $request): Operations\GetBannerImageResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/library/metadata/{ratingKey}/banner', Operations\GetBannerImageRequest::class, $request, $this->sdkConfiguration->globals);
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetBannerImageRequest::class, $request, $this->sdkConfiguration->globals));
$options = array_merge_recursive($options, Utils\Utils::getHeaders($request, $this->sdkConfiguration->globals));
if (! array_key_exists('headers', $options)) {
$options['headers'] = [];
}
$options['headers']['Accept'] = 'image/jpeg';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'image/jpeg')) {
$obj = $httpResponse->getBody()->getContents();
return new Operations\GetBannerImageResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
headers: $httpResponse->getHeaders(),
bytes: $obj);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetBannerImageBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetBannerImageUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode >= 400 && $statusCode < 500 || $statusCode >= 500 && $statusCode < 600) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
}
/**
* Get Thumb Image
*
* Gets the thumbnail image of the media item
*
* @param Operations\GetThumbImageRequest $request
* @return Operations\GetThumbImageResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getThumbImage(Operations\GetThumbImageRequest $request): Operations\GetThumbImageResponse
{
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/library/metadata/{ratingKey}/thumb', Operations\GetThumbImageRequest::class, $request, $this->sdkConfiguration->globals);
$options = ['http_errors' => false];
$options = array_merge_recursive($options, Utils\Utils::getQueryParams(Operations\GetThumbImageRequest::class, $request, $this->sdkConfiguration->globals));
$options = array_merge_recursive($options, Utils\Utils::getHeaders($request, $this->sdkConfiguration->globals));
if (! array_key_exists('headers', $options)) {
$options['headers'] = [];
}
$options['headers']['Accept'] = 'image/jpeg';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if ($statusCode == 200) {
if (Utils\Utils::matchContentType($contentType, 'image/jpeg')) {
$obj = $httpResponse->getBody()->getContents();
return new Operations\GetThumbImageResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
headers: $httpResponse->getHeaders(),
bytes: $obj);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 400) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetThumbImageBadRequest', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif ($statusCode == 401) {
if (Utils\Utils::matchContentType($contentType, 'application/json')) {
$serializer = Utils\JSON::createSerializer();
$obj = $serializer->deserialize((string) $httpResponse->getBody(), '\LukeHagar\Plex_API\Models\Errors\GetThumbImageUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$responseData = (string) $httpResponse->getBody();
$obj = $serializer->deserialize($responseData, '\LukeHagar\Plex_API\Models\Errors\UpdatePlayProgressUnauthorized', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true));
$obj->rawResponse = $httpResponse;
throw $obj->toException();
} else {

View File

@@ -11,6 +11,13 @@ namespace LukeHagar\Plex_API\Models\Operations;
class Feature
{
/**
*
* @var string $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
public string $type;
/**
*
* @var ?string $key
@@ -19,13 +26,6 @@ class Feature
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $key = null;
/**
*
* @var string $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
public string $type;
/**
*
* @var ?string $flavor

View File

@@ -19,14 +19,6 @@ class Friend
#[\Speakeasy\Serializer\Annotation\SerializedName('email')]
public string $email;
/**
* The account full name
*
* @var ?string $friendlyName
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('friendlyName')]
public ?string $friendlyName;
/**
* If the account is a Plex Home user
*
@@ -43,15 +35,6 @@ class Friend
#[\Speakeasy\Serializer\Annotation\SerializedName('id')]
public int $id;
/**
* If the account is a Plex Home managed user
*
* @var ?bool $restricted
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('restricted')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $restricted = null;
/**
* $sharedServers
*
@@ -111,6 +94,23 @@ class Friend
#[\Speakeasy\Serializer\Annotation\SerializedName('uuid')]
public string $uuid;
/**
* The account full name
*
* @var ?string $friendlyName
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('friendlyName')]
public ?string $friendlyName;
/**
* If the account is a Plex Home managed user
*
* @var ?bool $restricted
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('restricted')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $restricted = null;
/**
* @param string $email
* @param bool $home

View File

@@ -44,15 +44,6 @@ class GeoData
#[\Speakeasy\Serializer\Annotation\SerializedName('city')]
public string $city;
/**
* Indicates if the country is a member of the European Union.
*
* @var ?bool $europeanUnionMember
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('european_union_member')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $europeanUnionMember = null;
/**
* The time zone of the country.
*
@@ -69,6 +60,31 @@ class GeoData
#[\Speakeasy\Serializer\Annotation\SerializedName('postal_code')]
public string $postalCode;
/**
* The name of the primary administrative subdivision.
*
* @var string $subdivisions
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('subdivisions')]
public string $subdivisions;
/**
* The geographical coordinates (latitude, longitude) of the location.
*
* @var string $coordinates
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('coordinates')]
public string $coordinates;
/**
* Indicates if the country is a member of the European Union.
*
* @var ?bool $europeanUnionMember
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('european_union_member')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $europeanUnionMember = null;
/**
* Indicates if the country has privacy restrictions.
*
@@ -87,22 +103,6 @@ class GeoData
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $inPrivacyRestrictedRegion = null;
/**
* The name of the primary administrative subdivision.
*
* @var string $subdivisions
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('subdivisions')]
public string $subdivisions;
/**
* The geographical coordinates (latitude, longitude) of the location.
*
* @var string $coordinates
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('coordinates')]
public string $coordinates;
/**
* @param string $code
* @param string $continentCode

View File

@@ -32,13 +32,6 @@ class GetBannerImageResponse
*/
public \Psr\Http\Message\ResponseInterface $rawResponse;
/**
* Successful response returning an image
*
* @var ?string $bytes
*/
public ?string $bytes = null;
/**
* $headers
*
@@ -46,6 +39,13 @@ class GetBannerImageResponse
*/
public array $headers;
/**
* Successful response returning an image
*
* @var ?string $bytes
*/
public ?string $bytes = null;
/**
* @param string $contentType
* @param int $statusCode

View File

@@ -44,15 +44,6 @@ class GetGeoDataGeoData
#[\Speakeasy\Serializer\Annotation\SerializedName('city')]
public string $city;
/**
* Indicates if the country is a member of the European Union.
*
* @var ?bool $europeanUnionMember
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('european_union_member')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $europeanUnionMember = null;
/**
* The time zone of the country.
*
@@ -69,6 +60,31 @@ class GetGeoDataGeoData
#[\Speakeasy\Serializer\Annotation\SerializedName('postal_code')]
public string $postalCode;
/**
* The name of the primary administrative subdivision.
*
* @var string $subdivisions
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('subdivisions')]
public string $subdivisions;
/**
* The geographical coordinates (latitude, longitude) of the location.
*
* @var string $coordinates
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('coordinates')]
public string $coordinates;
/**
* Indicates if the country is a member of the European Union.
*
* @var ?bool $europeanUnionMember
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('european_union_member')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $europeanUnionMember = null;
/**
* Indicates if the country has privacy restrictions.
*
@@ -87,22 +103,6 @@ class GetGeoDataGeoData
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $inPrivacyRestrictedRegion = null;
/**
* The name of the primary administrative subdivision.
*
* @var string $subdivisions
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('subdivisions')]
public string $subdivisions;
/**
* The geographical coordinates (latitude, longitude) of the location.
*
* @var string $coordinates
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('coordinates')]
public string $coordinates;
/**
* @param string $code
* @param string $continentCode

View File

@@ -11,6 +11,20 @@ namespace LukeHagar\Plex_API\Models\Operations;
class GetLibraryItemsLibrarySort
{
/**
*
* @var string $key
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var ?string $default
@@ -27,6 +41,22 @@ class GetLibraryItemsLibrarySort
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $active = null;
/**
*
* @var ?string $descKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('descKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $descKey = null;
/**
*
* @var ?string $firstCharacterKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('firstCharacterKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $firstCharacterKey = null;
/**
* The direction of the sort. Can be either `asc` or `desc`.
*
@@ -51,36 +81,6 @@ class GetLibraryItemsLibrarySort
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsLibraryDefaultDirection $defaultDirection = null;
/**
*
* @var ?string $descKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('descKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $descKey = null;
/**
*
* @var ?string $firstCharacterKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('firstCharacterKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $firstCharacterKey = null;
/**
*
* @var string $key
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
* @param string $key
* @param string $title
@@ -97,9 +97,9 @@ class GetLibraryItemsLibrarySort
$this->title = $title;
$this->default = $default;
$this->active = $active;
$this->activeDirection = $activeDirection;
$this->defaultDirection = $defaultDirection;
$this->descKey = $descKey;
$this->firstCharacterKey = $firstCharacterKey;
$this->activeDirection = $activeDirection;
$this->defaultDirection = $defaultDirection;
}
}

View File

@@ -18,6 +18,22 @@ class GetLibraryItemsMedia
#[\Speakeasy\Serializer\Annotation\SerializedName('id')]
public int $id;
/**
*
* @var string $container
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('container')]
public string $container;
/**
* $part
*
* @var array<GetLibraryItemsPart> $part
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('Part')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsPart>')]
public array $part;
/**
*
* @var ?int $duration
@@ -98,13 +114,6 @@ class GetLibraryItemsMedia
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $videoResolution = null;
/**
*
* @var string $container
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('container')]
public string $container;
/**
*
* @var ?string $videoFrameRate
@@ -129,15 +138,6 @@ class GetLibraryItemsMedia
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $hasVoiceActivity = null;
/**
*
* @var ?GetLibraryItemsOptimizedForStreaming $optimizedForStreaming
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('optimizedForStreaming')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsOptimizedForStreaming|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsOptimizedForStreaming $optimizedForStreaming = null;
/**
*
* @var ?bool $has64bitOffsets
@@ -147,13 +147,13 @@ class GetLibraryItemsMedia
public ?bool $has64bitOffsets = null;
/**
* $part
*
* @var array<GetLibraryItemsPart> $part
* @var ?GetLibraryItemsOptimizedForStreaming $optimizedForStreaming
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('Part')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsPart>')]
public array $part;
#[\Speakeasy\Serializer\Annotation\SerializedName('optimizedForStreaming')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsOptimizedForStreaming|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsOptimizedForStreaming $optimizedForStreaming = null;
/**
* @param int $id
@@ -193,7 +193,7 @@ class GetLibraryItemsMedia
$this->videoFrameRate = $videoFrameRate;
$this->videoProfile = $videoProfile;
$this->hasVoiceActivity = $hasVoiceActivity;
$this->optimizedForStreaming = $optimizedForStreaming;
$this->has64bitOffsets = $has64bitOffsets;
$this->optimizedForStreaming = $optimizedForStreaming;
}
}

View File

@@ -16,26 +16,6 @@ namespace LukeHagar\Plex_API\Models\Operations;
*/
class GetLibraryItemsMediaContainer
{
/**
* $type
*
* @var ?array<GetLibraryItemsType> $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('Type')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsType>|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $type = null;
/**
* $fieldType
*
* @var ?array<GetLibraryItemsFieldType> $fieldType
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('FieldType')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsFieldType>|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $fieldType = null;
/**
*
* @var int $size
@@ -71,14 +51,6 @@ class GetLibraryItemsMediaContainer
#[\Speakeasy\Serializer\Annotation\SerializedName('allowSync')]
public bool $allowSync;
/**
*
* @var ?bool $nocache
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('nocache')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $nocache = null;
/**
*
* @var string $art
@@ -156,6 +128,34 @@ class GetLibraryItemsMediaContainer
#[\Speakeasy\Serializer\Annotation\SerializedName('viewGroup')]
public string $viewGroup;
/**
* $type
*
* @var ?array<GetLibraryItemsType> $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('Type')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsType>|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $type = null;
/**
* $fieldType
*
* @var ?array<GetLibraryItemsFieldType> $fieldType
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('FieldType')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsFieldType>|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $fieldType = null;
/**
*
* @var ?bool $nocache
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('nocache')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $nocache = null;
/**
*
* @var ?int $viewMode

View File

@@ -36,6 +36,39 @@ class GetLibraryItemsMetadata
#[\Speakeasy\Serializer\Annotation\SerializedName('guid')]
public string $guid;
/**
* The type of media content
*
*
*
* @var GetLibraryItemsLibraryType $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsLibraryType')]
public GetLibraryItemsLibraryType $type;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var string $summary
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('summary')]
public string $summary;
/**
* Unix epoch datetime in seconds
*
* @var int $addedAt
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('addedAt')]
public int $addedAt;
/**
*
* @var ?string $studio
@@ -76,24 +109,6 @@ class GetLibraryItemsMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $librarySectionKey = null;
/**
* The type of media content
*
*
*
* @var GetLibraryItemsLibraryType $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsLibraryType')]
public GetLibraryItemsLibraryType $type;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var ?string $slug
@@ -110,13 +125,6 @@ class GetLibraryItemsMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $contentRating = null;
/**
*
* @var string $summary
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('summary')]
public string $summary;
/**
*
* @var ?float $rating
@@ -157,23 +165,14 @@ class GetLibraryItemsMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $tagline = null;
/**
*
* @var ?GetLibraryItemsFlattenSeasons $flattenSeasons
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('flattenSeasons')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsFlattenSeasons|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsFlattenSeasons $flattenSeasons = null;
/**
* Setting that indicates the episode ordering for the show
*
* None = Library default,
* tmdbAiring = The Movie Database (Aired),
* aired = TheTVDB (Aired),
* dvd = TheTVDB (DVD),
* absolute = TheTVDB (Absolute)).
* tvdbAiring = TheTVDB (Aired),
* tvdbDvd = TheTVDB (DVD),
* tvdbAbsolute = TheTVDB (Absolute)).
*
*
* @var ?GetLibraryItemsShowOrdering $showOrdering
@@ -223,14 +222,6 @@ class GetLibraryItemsMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?LocalDate $originallyAvailableAt = null;
/**
* Unix epoch datetime in seconds
*
* @var int $addedAt
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('addedAt')]
public int $addedAt;
/**
* Unix epoch datetime in seconds
*
@@ -646,6 +637,15 @@ class GetLibraryItemsMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $parentTheme = null;
/**
*
* @var ?GetLibraryItemsFlattenSeasons $flattenSeasons
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('flattenSeasons')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsFlattenSeasons|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsFlattenSeasons $flattenSeasons = null;
/**
* @param string $ratingKey
* @param string $key
@@ -743,7 +743,6 @@ class GetLibraryItemsMetadata
$this->year = $year;
$this->seasonCount = $seasonCount;
$this->tagline = $tagline;
$this->flattenSeasons = $flattenSeasons;
$this->showOrdering = $showOrdering;
$this->thumb = $thumb;
$this->art = $art;
@@ -798,5 +797,6 @@ class GetLibraryItemsMetadata
$this->parentYear = $parentYear;
$this->parentThumb = $parentThumb;
$this->parentTheme = $parentTheme;
$this->flattenSeasons = $flattenSeasons;
}
}

View File

@@ -25,14 +25,6 @@ class GetLibraryItemsPart
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var ?int $duration
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('duration')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $duration = null;
/**
*
* @var string $file
@@ -57,6 +49,14 @@ class GetLibraryItemsPart
#[\Speakeasy\Serializer\Annotation\SerializedName('container')]
public string $container;
/**
*
* @var ?int $duration
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('duration')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $duration = null;
/**
*
* @var ?string $audioProfile
@@ -97,15 +97,6 @@ class GetLibraryItemsPart
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $indexes = null;
/**
*
* @var ?GetLibraryItemsHasThumbnail $hasThumbnail
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('hasThumbnail')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsHasThumbnail|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsHasThumbnail $hasThumbnail = null;
/**
* $stream
*
@@ -116,6 +107,15 @@ class GetLibraryItemsPart
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $stream = null;
/**
*
* @var ?GetLibraryItemsHasThumbnail $hasThumbnail
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('hasThumbnail')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetLibraryItemsHasThumbnail|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsHasThumbnail $hasThumbnail = null;
/**
* @param int $id
* @param string $key
@@ -144,7 +144,7 @@ class GetLibraryItemsPart
$this->optimizedForStreaming = $optimizedForStreaming;
$this->videoProfile = $videoProfile;
$this->indexes = $indexes;
$this->hasThumbnail = $hasThumbnail;
$this->stream = $stream;
$this->hasThumbnail = $hasThumbnail;
}
}

View File

@@ -26,4 +26,6 @@ enum GetLibraryItemsQueryParamType: int
case Season = 3;
case Episode = 4;
case Audio = 8;
case Album = 9;
case Track = 10;
}

View File

@@ -20,14 +20,15 @@ class GetLibraryItemsRequest
public Tag $tag;
/**
* Adds the Guids object to the response
* The unique key of the Plex library.
*
* Note: This is unique in the context of the Plex server.
*
*
*
* @var ?IncludeGuids $includeGuids
* @var int $sectionKey
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=includeGuids')]
public ?IncludeGuids $includeGuids = null;
#[SpeakeasyMetadata('pathParam:style=simple,explode=false,name=sectionKey')]
public int $sectionKey;
/**
* The type of media to retrieve.
@@ -45,15 +46,14 @@ class GetLibraryItemsRequest
public ?GetLibraryItemsQueryParamType $type = null;
/**
* The unique key of the Plex library.
*
* Note: This is unique in the context of the Plex server.
* Adds the Guids object to the response
*
*
* @var int $sectionKey
*
* @var ?IncludeGuids $includeGuids
*/
#[SpeakeasyMetadata('pathParam:style=simple,explode=false,name=sectionKey')]
public int $sectionKey;
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=includeGuids')]
public ?IncludeGuids $includeGuids = null;
/**
* Adds the Meta object to the response
@@ -102,8 +102,8 @@ class GetLibraryItemsRequest
{
$this->tag = $tag;
$this->sectionKey = $sectionKey;
$this->includeGuids = $includeGuids;
$this->type = $type;
$this->includeGuids = $includeGuids;
$this->includeMeta = $includeMeta;
$this->xPlexContainerStart = $xPlexContainerStart;
$this->xPlexContainerSize = $xPlexContainerSize;

View File

@@ -14,16 +14,16 @@ namespace LukeHagar\Plex_API\Models\Operations;
*
* None = Library default,
* tmdbAiring = The Movie Database (Aired),
* aired = TheTVDB (Aired),
* dvd = TheTVDB (DVD),
* absolute = TheTVDB (Absolute)).
* tvdbAiring = TheTVDB (Aired),
* tvdbDvd = TheTVDB (DVD),
* tvdbAbsolute = TheTVDB (Absolute)).
*
*/
enum GetLibraryItemsShowOrdering: string
{
case None = 'None';
case TmdbAiring = 'tmdbAiring';
case Aired = 'aired';
case Dvd = 'dvd';
case Absolute = 'absolute';
case TvdbAiring = 'tvdbAiring';
case TvdbDvd = 'tvdbDvd';
case TvdbAbsolute = 'tvdbAbsolute';
}

View File

@@ -11,6 +11,20 @@ namespace LukeHagar\Plex_API\Models\Operations;
class GetLibraryItemsSort
{
/**
*
* @var string $key
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var ?string $default
@@ -27,6 +41,22 @@ class GetLibraryItemsSort
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $active = null;
/**
*
* @var ?string $descKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('descKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $descKey = null;
/**
*
* @var ?string $firstCharacterKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('firstCharacterKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $firstCharacterKey = null;
/**
* The direction of the sort. Can be either `asc` or `desc`.
*
@@ -51,36 +81,6 @@ class GetLibraryItemsSort
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetLibraryItemsDefaultDirection $defaultDirection = null;
/**
*
* @var ?string $descKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('descKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $descKey = null;
/**
*
* @var ?string $firstCharacterKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('firstCharacterKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $firstCharacterKey = null;
/**
*
* @var string $key
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
* @param string $key
* @param string $title
@@ -97,9 +97,9 @@ class GetLibraryItemsSort
$this->title = $title;
$this->default = $default;
$this->active = $active;
$this->activeDirection = $activeDirection;
$this->defaultDirection = $defaultDirection;
$this->descKey = $descKey;
$this->firstCharacterKey = $firstCharacterKey;
$this->activeDirection = $activeDirection;
$this->defaultDirection = $defaultDirection;
}
}

View File

@@ -26,6 +26,22 @@ class GetLibraryItemsStream
#[\Speakeasy\Serializer\Annotation\SerializedName('streamType')]
public int $streamType;
/**
* Codec used by the stream
*
* @var string $codec
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('codec')]
public string $codec;
/**
* The index of the stream
*
* @var int $index
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('index')]
public int $index;
/**
* Indicates if this is the default stream
*
@@ -44,22 +60,6 @@ class GetLibraryItemsStream
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $selected = null;
/**
* Codec used by the stream
*
* @var string $codec
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('codec')]
public string $codec;
/**
* The index of the stream
*
* @var int $index
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('index')]
public int $index;
/**
* The bitrate of the stream in kbps
*

View File

@@ -83,6 +83,51 @@ class GetMetaDataByRatingKeyMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $librarySectionKey = null;
/**
* The name of the album artist for the track when audio, and the name of the TV show for the episode when video.
*
* @var ?string $grandparentTitle
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('grandparentTitle')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $grandparentTitle = null;
/**
* The name of the album for the track when audio, and the name of the season for the episode when TV show.
*
* @var ?string $parentTitle
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('parentTitle')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $parentTitle = null;
/**
* The orginal untranslated name of the media item when non-english.
*
* @var ?string $originalTitle
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('originalTitle')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $originalTitle = null;
/**
* The index starting from 0 of this media item in the MetaData array.
*
* @var ?int $index
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('index')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $index = null;
/**
* The parent index starting from 0 of this media item in the parent MetaData array.
*
* @var ?int $parentIndex
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('parentIndex')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $parentIndex = null;
/**
*
* @var ?string $contentRating
@@ -303,6 +348,11 @@ class GetMetaDataByRatingKeyMetadata
* @param ?string $librarySectionTitle
* @param ?int $librarySectionID
* @param ?string $librarySectionKey
* @param ?string $grandparentTitle
* @param ?string $parentTitle
* @param ?string $originalTitle
* @param ?int $index
* @param ?int $parentIndex
* @param ?string $contentRating
* @param ?string $summary
* @param ?float $rating
@@ -328,7 +378,7 @@ class GetMetaDataByRatingKeyMetadata
* @param ?array<GetMetaDataByRatingKeyRole> $role
* @param ?array<Producer> $producer
*/
public function __construct(?string $ratingKey = null, ?string $key = null, ?string $guid = null, ?string $studio = null, ?string $type = null, ?string $title = null, ?string $librarySectionTitle = null, ?int $librarySectionID = null, ?string $librarySectionKey = null, ?string $contentRating = null, ?string $summary = null, ?float $rating = null, ?float $audienceRating = null, ?int $year = null, ?string $tagline = null, ?string $thumb = null, ?string $art = null, ?int $duration = null, ?LocalDate $originallyAvailableAt = null, ?int $addedAt = null, ?int $updatedAt = null, ?string $audienceRatingImage = null, ?string $hasPremiumPrimaryExtra = null, ?string $ratingImage = null, ?array $media = null, ?array $genre = null, ?array $country = null, ?array $guids = null, ?array $ratings = null, ?array $director = null, ?array $writer = null, ?array $role = null, ?array $producer = null)
public function __construct(?string $ratingKey = null, ?string $key = null, ?string $guid = null, ?string $studio = null, ?string $type = null, ?string $title = null, ?string $librarySectionTitle = null, ?int $librarySectionID = null, ?string $librarySectionKey = null, ?string $grandparentTitle = null, ?string $parentTitle = null, ?string $originalTitle = null, ?int $index = null, ?int $parentIndex = null, ?string $contentRating = null, ?string $summary = null, ?float $rating = null, ?float $audienceRating = null, ?int $year = null, ?string $tagline = null, ?string $thumb = null, ?string $art = null, ?int $duration = null, ?LocalDate $originallyAvailableAt = null, ?int $addedAt = null, ?int $updatedAt = null, ?string $audienceRatingImage = null, ?string $hasPremiumPrimaryExtra = null, ?string $ratingImage = null, ?array $media = null, ?array $genre = null, ?array $country = null, ?array $guids = null, ?array $ratings = null, ?array $director = null, ?array $writer = null, ?array $role = null, ?array $producer = null)
{
$this->ratingKey = $ratingKey;
$this->key = $key;
@@ -339,6 +389,11 @@ class GetMetaDataByRatingKeyMetadata
$this->librarySectionTitle = $librarySectionTitle;
$this->librarySectionID = $librarySectionID;
$this->librarySectionKey = $librarySectionKey;
$this->grandparentTitle = $grandparentTitle;
$this->parentTitle = $parentTitle;
$this->originalTitle = $originalTitle;
$this->index = $index;
$this->parentIndex = $parentIndex;
$this->contentRating = $contentRating;
$this->summary = $summary;
$this->rating = $rating;

View File

@@ -33,14 +33,6 @@ class GetPinAuthPinContainer
#[\Speakeasy\Serializer\Annotation\SerializedName('product')]
public string $product;
/**
*
* @var ?bool $trusted
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('trusted')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $trusted = null;
/**
*
* @var string $qr
@@ -65,15 +57,6 @@ class GetPinAuthPinContainer
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GeoData')]
public GeoData $location;
/**
* The number of seconds this pin expires, by default 900 seconds
*
* @var ?int $expiresIn
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('expiresIn')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $expiresIn = null;
/**
*
* @var \DateTime $createdAt
@@ -105,6 +88,23 @@ class GetPinAuthPinContainer
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public mixed $newRegistration = null;
/**
*
* @var ?bool $trusted
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('trusted')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $trusted = null;
/**
* The number of seconds this pin expires, by default 900 seconds
*
* @var ?int $expiresIn
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('expiresIn')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $expiresIn = null;
/**
* @param int $id
* @param string $code
@@ -129,9 +129,9 @@ class GetPinAuthPinContainer
$this->location = $location;
$this->createdAt = $createdAt;
$this->expiresAt = $expiresAt;
$this->trusted = $trusted;
$this->expiresIn = $expiresIn;
$this->authToken = $authToken;
$this->newRegistration = $newRegistration;
$this->trusted = $trusted;
$this->expiresIn = $expiresIn;
}
}

View File

@@ -11,25 +11,13 @@ namespace LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\SpeakeasyMetadata;
class GetPinRequest
{
/**
* Determines the kind of code returned by the API call
*
* Strong codes are used for Pin authentication flows
* Non-Strong codes are used for `Plex.tv/link`
*
*
* @var ?bool $strong
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=strong')]
public ?bool $strong = null;
/**
* An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
*
* @var ?string $clientID
* @var string $clientID
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Client-Identifier')]
public ?string $clientID = null;
public string $clientID;
/**
* The name of the client application. (Plex Web, Plex Media Server, etc.)
@@ -64,20 +52,32 @@ class GetPinRequest
public ?string $platform = null;
/**
* Determines the kind of code returned by the API call
*
* Strong codes are used for Pin authentication flows
* Non-Strong codes are used for `Plex.tv/link`
*
*
* @var ?bool $strong
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=strong')]
public ?bool $strong = null;
/**
* @param string $clientID
* @param ?bool $strong
* @param ?string $clientID
* @param ?string $clientName
* @param ?string $deviceNickname
* @param ?string $clientVersion
* @param ?string $platform
*/
public function __construct(?string $clientID = null, ?string $clientName = null, ?string $deviceNickname = null, ?string $clientVersion = null, ?string $platform = null, ?bool $strong = false)
public function __construct(string $clientID, ?string $clientName = null, ?string $deviceNickname = null, ?string $clientVersion = null, ?string $platform = null, ?bool $strong = false)
{
$this->strong = $strong;
$this->clientID = $clientID;
$this->clientName = $clientName;
$this->deviceNickname = $deviceNickname;
$this->clientVersion = $clientVersion;
$this->platform = $platform;
$this->strong = $strong;
}
}

View File

@@ -26,4 +26,6 @@ enum GetPlaylistContentsQueryParamType: int
case Season = 3;
case Episode = 4;
case Audio = 8;
case Album = 9;
case Track = 10;
}

View File

@@ -11,6 +11,21 @@ namespace LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\SpeakeasyMetadata;
class GetRecentlyAddedLibraryRequest
{
/**
* The type of media to retrieve.
*
* 1 = movie
* 2 = show
* 3 = season
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*
*
* @var QueryParamType $type
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=type')]
public QueryParamType $type;
/**
*
* @var ?int $contentDirectoryID
@@ -34,21 +49,6 @@ class GetRecentlyAddedLibraryRequest
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=sectionID')]
public ?int $sectionID = null;
/**
* The type of media to retrieve.
*
* 1 = movie
* 2 = show
* 3 = season
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*
*
* @var QueryParamType $type
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=type')]
public QueryParamType $type;
/**
* Adds the Meta object to the response
*

View File

@@ -36,6 +36,39 @@ class GetRecentlyAddedMetadata
#[\Speakeasy\Serializer\Annotation\SerializedName('guid')]
public string $guid;
/**
* The type of media content
*
*
*
* @var GetRecentlyAddedHubsType $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetRecentlyAddedHubsType')]
public GetRecentlyAddedHubsType $type;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var string $summary
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('summary')]
public string $summary;
/**
* Unix epoch datetime in seconds
*
* @var int $addedAt
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('addedAt')]
public int $addedAt;
/**
*
* @var ?string $studio
@@ -76,24 +109,6 @@ class GetRecentlyAddedMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $librarySectionKey = null;
/**
* The type of media content
*
*
*
* @var GetRecentlyAddedHubsType $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetRecentlyAddedHubsType')]
public GetRecentlyAddedHubsType $type;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var ?string $slug
@@ -110,13 +125,6 @@ class GetRecentlyAddedMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $contentRating = null;
/**
*
* @var string $summary
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('summary')]
public string $summary;
/**
*
* @var ?float $rating
@@ -157,23 +165,14 @@ class GetRecentlyAddedMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $tagline = null;
/**
*
* @var ?FlattenSeasons $flattenSeasons
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('flattenSeasons')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\FlattenSeasons|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?FlattenSeasons $flattenSeasons = null;
/**
* Setting that indicates the episode ordering for the show
*
* None = Library default,
* tmdbAiring = The Movie Database (Aired),
* aired = TheTVDB (Aired),
* dvd = TheTVDB (DVD),
* absolute = TheTVDB (Absolute)).
* tvdbAiring = TheTVDB (Aired),
* tvdbDvd = TheTVDB (DVD),
* tvdbAbsolute = TheTVDB (Absolute)).
*
*
* @var ?ShowOrdering $showOrdering
@@ -223,14 +222,6 @@ class GetRecentlyAddedMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?LocalDate $originallyAvailableAt = null;
/**
* Unix epoch datetime in seconds
*
* @var int $addedAt
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('addedAt')]
public int $addedAt;
/**
* Unix epoch datetime in seconds
*
@@ -646,6 +637,15 @@ class GetRecentlyAddedMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $parentTheme = null;
/**
*
* @var ?FlattenSeasons $flattenSeasons
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('flattenSeasons')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\FlattenSeasons|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?FlattenSeasons $flattenSeasons = null;
/**
* @param string $ratingKey
* @param string $key
@@ -743,7 +743,6 @@ class GetRecentlyAddedMetadata
$this->year = $year;
$this->seasonCount = $seasonCount;
$this->tagline = $tagline;
$this->flattenSeasons = $flattenSeasons;
$this->showOrdering = $showOrdering;
$this->thumb = $thumb;
$this->art = $art;
@@ -798,5 +797,6 @@ class GetRecentlyAddedMetadata
$this->parentYear = $parentYear;
$this->parentThumb = $parentThumb;
$this->parentTheme = $parentTheme;
$this->flattenSeasons = $flattenSeasons;
}
}

View File

@@ -19,6 +19,21 @@ class GetRecentlyAddedRequest
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=contentDirectoryID')]
public int $contentDirectoryID;
/**
* The type of media to retrieve.
*
* 1 = movie
* 2 = show
* 3 = season
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*
*
* @var Type $type
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=type')]
public Type $type;
/**
* Comma-separated list of pinned content directory IDs.
*
@@ -35,21 +50,6 @@ class GetRecentlyAddedRequest
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=sectionID')]
public ?int $sectionID = null;
/**
* The type of media to retrieve.
*
* 1 = movie
* 2 = show
* 3 = season
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*
*
* @var Type $type
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=type')]
public Type $type;
/**
* Adds the Meta object to the response
*

View File

@@ -11,6 +11,20 @@ namespace LukeHagar\Plex_API\Models\Operations;
class GetRecentlyAddedSort
{
/**
*
* @var string $key
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var ?string $default
@@ -27,6 +41,22 @@ class GetRecentlyAddedSort
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $active = null;
/**
*
* @var ?string $descKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('descKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $descKey = null;
/**
*
* @var ?string $firstCharacterKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('firstCharacterKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $firstCharacterKey = null;
/**
* The direction of the sort. Can be either `asc` or `desc`.
*
@@ -51,36 +81,6 @@ class GetRecentlyAddedSort
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetRecentlyAddedDefaultDirection $defaultDirection = null;
/**
*
* @var ?string $descKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('descKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $descKey = null;
/**
*
* @var ?string $firstCharacterKey
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('firstCharacterKey')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $firstCharacterKey = null;
/**
*
* @var string $key
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
* @param string $key
* @param string $title
@@ -97,9 +97,9 @@ class GetRecentlyAddedSort
$this->title = $title;
$this->default = $default;
$this->active = $active;
$this->activeDirection = $activeDirection;
$this->defaultDirection = $defaultDirection;
$this->descKey = $descKey;
$this->firstCharacterKey = $firstCharacterKey;
$this->activeDirection = $activeDirection;
$this->defaultDirection = $defaultDirection;
}
}

View File

@@ -27,14 +27,6 @@ class GetResizedPhotoRequest
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=height')]
public float $height;
/**
* The opacity for the resized photo
*
* @var int $opacity
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=opacity')]
public int $opacity;
/**
* The width for the resized photo
*
@@ -67,6 +59,14 @@ class GetResizedPhotoRequest
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=url')]
public string $url;
/**
* The opacity for the resized photo
*
* @var int $opacity
*/
#[SpeakeasyMetadata('queryParam:style=form,explode=true,name=opacity')]
public int $opacity;
/**
* @param float $width
* @param float $height
@@ -80,10 +80,10 @@ class GetResizedPhotoRequest
{
$this->width = $width;
$this->height = $height;
$this->opacity = $opacity;
$this->blur = $blur;
$this->minSize = $minSize;
$this->upscale = $upscale;
$this->url = $url;
$this->opacity = $opacity;
}
}

View File

@@ -18,6 +18,22 @@ class GetSearchAllLibrariesMedia
#[\Speakeasy\Serializer\Annotation\SerializedName('id')]
public int $id;
/**
*
* @var string $container
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('container')]
public string $container;
/**
* $part
*
* @var array<GetSearchAllLibrariesPart> $part
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('Part')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesPart>')]
public array $part;
/**
*
* @var ?int $duration
@@ -98,13 +114,6 @@ class GetSearchAllLibrariesMedia
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $videoResolution = null;
/**
*
* @var string $container
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('container')]
public string $container;
/**
*
* @var ?string $videoFrameRate
@@ -129,15 +138,6 @@ class GetSearchAllLibrariesMedia
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $hasVoiceActivity = null;
/**
*
* @var ?GetSearchAllLibrariesOptimizedForStreaming $optimizedForStreaming
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('optimizedForStreaming')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesOptimizedForStreaming|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetSearchAllLibrariesOptimizedForStreaming $optimizedForStreaming = null;
/**
*
* @var ?bool $has64bitOffsets
@@ -147,13 +147,13 @@ class GetSearchAllLibrariesMedia
public ?bool $has64bitOffsets = null;
/**
* $part
*
* @var array<GetSearchAllLibrariesPart> $part
* @var ?GetSearchAllLibrariesOptimizedForStreaming $optimizedForStreaming
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('Part')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesPart>')]
public array $part;
#[\Speakeasy\Serializer\Annotation\SerializedName('optimizedForStreaming')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesOptimizedForStreaming|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetSearchAllLibrariesOptimizedForStreaming $optimizedForStreaming = null;
/**
* @param int $id
@@ -193,7 +193,7 @@ class GetSearchAllLibrariesMedia
$this->videoFrameRate = $videoFrameRate;
$this->videoProfile = $videoProfile;
$this->hasVoiceActivity = $hasVoiceActivity;
$this->optimizedForStreaming = $optimizedForStreaming;
$this->has64bitOffsets = $has64bitOffsets;
$this->optimizedForStreaming = $optimizedForStreaming;
}
}

View File

@@ -36,6 +36,39 @@ class GetSearchAllLibrariesMetadata
#[\Speakeasy\Serializer\Annotation\SerializedName('guid')]
public string $guid;
/**
* The type of media content
*
*
*
* @var GetSearchAllLibrariesType $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesType')]
public GetSearchAllLibrariesType $type;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var string $summary
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('summary')]
public string $summary;
/**
* Unix epoch datetime in seconds
*
* @var int $addedAt
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('addedAt')]
public int $addedAt;
/**
*
* @var ?string $studio
@@ -76,24 +109,6 @@ class GetSearchAllLibrariesMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $librarySectionKey = null;
/**
* The type of media content
*
*
*
* @var GetSearchAllLibrariesType $type
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('type')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesType')]
public GetSearchAllLibrariesType $type;
/**
*
* @var string $title
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('title')]
public string $title;
/**
*
* @var ?string $slug
@@ -110,13 +125,6 @@ class GetSearchAllLibrariesMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $contentRating = null;
/**
*
* @var string $summary
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('summary')]
public string $summary;
/**
*
* @var ?float $rating
@@ -157,23 +165,14 @@ class GetSearchAllLibrariesMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $tagline = null;
/**
*
* @var ?GetSearchAllLibrariesFlattenSeasons $flattenSeasons
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('flattenSeasons')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesFlattenSeasons|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetSearchAllLibrariesFlattenSeasons $flattenSeasons = null;
/**
* Setting that indicates the episode ordering for the show
*
* None = Library default,
* tmdbAiring = The Movie Database (Aired),
* aired = TheTVDB (Aired),
* dvd = TheTVDB (DVD),
* absolute = TheTVDB (Absolute)).
* tvdbAiring = TheTVDB (Aired),
* tvdbDvd = TheTVDB (DVD),
* tvdbAbsolute = TheTVDB (Absolute)).
*
*
* @var ?GetSearchAllLibrariesShowOrdering $showOrdering
@@ -223,14 +222,6 @@ class GetSearchAllLibrariesMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?LocalDate $originallyAvailableAt = null;
/**
* Unix epoch datetime in seconds
*
* @var int $addedAt
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('addedAt')]
public int $addedAt;
/**
* Unix epoch datetime in seconds
*
@@ -646,6 +637,15 @@ class GetSearchAllLibrariesMetadata
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $parentTheme = null;
/**
*
* @var ?GetSearchAllLibrariesFlattenSeasons $flattenSeasons
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('flattenSeasons')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesFlattenSeasons|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetSearchAllLibrariesFlattenSeasons $flattenSeasons = null;
/**
* @param string $ratingKey
* @param string $key
@@ -743,7 +743,6 @@ class GetSearchAllLibrariesMetadata
$this->year = $year;
$this->seasonCount = $seasonCount;
$this->tagline = $tagline;
$this->flattenSeasons = $flattenSeasons;
$this->showOrdering = $showOrdering;
$this->thumb = $thumb;
$this->art = $art;
@@ -798,5 +797,6 @@ class GetSearchAllLibrariesMetadata
$this->parentYear = $parentYear;
$this->parentThumb = $parentThumb;
$this->parentTheme = $parentTheme;
$this->flattenSeasons = $flattenSeasons;
}
}

View File

@@ -25,14 +25,6 @@ class GetSearchAllLibrariesPart
#[\Speakeasy\Serializer\Annotation\SerializedName('key')]
public string $key;
/**
*
* @var ?int $duration
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('duration')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $duration = null;
/**
*
* @var string $file
@@ -57,6 +49,14 @@ class GetSearchAllLibrariesPart
#[\Speakeasy\Serializer\Annotation\SerializedName('container')]
public string $container;
/**
*
* @var ?int $duration
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('duration')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $duration = null;
/**
*
* @var ?string $audioProfile
@@ -97,15 +97,6 @@ class GetSearchAllLibrariesPart
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $indexes = null;
/**
*
* @var ?GetSearchAllLibrariesHasThumbnail $hasThumbnail
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('hasThumbnail')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesHasThumbnail|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetSearchAllLibrariesHasThumbnail $hasThumbnail = null;
/**
* $stream
*
@@ -116,6 +107,15 @@ class GetSearchAllLibrariesPart
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $stream = null;
/**
*
* @var ?GetSearchAllLibrariesHasThumbnail $hasThumbnail
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('hasThumbnail')]
#[\Speakeasy\Serializer\Annotation\Type('\LukeHagar\Plex_API\Models\Operations\GetSearchAllLibrariesHasThumbnail|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?GetSearchAllLibrariesHasThumbnail $hasThumbnail = null;
/**
* @param int $id
* @param string $key
@@ -144,7 +144,7 @@ class GetSearchAllLibrariesPart
$this->optimizedForStreaming = $optimizedForStreaming;
$this->videoProfile = $videoProfile;
$this->indexes = $indexes;
$this->hasThumbnail = $hasThumbnail;
$this->stream = $stream;
$this->hasThumbnail = $hasThumbnail;
}
}

View File

@@ -22,10 +22,10 @@ class GetSearchAllLibrariesRequest
/**
* An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
*
* @var ?string $clientID
* @var string $clientID
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Client-Identifier')]
public ?string $clientID = null;
public string $clientID;
/**
* Limit the number of results returned.
@@ -63,13 +63,13 @@ class GetSearchAllLibrariesRequest
/**
* @param string $query
* @param ?string $clientID
* @param string $clientID
* @param ?int $limit
* @param ?array<SearchTypes> $searchTypes
* @param ?QueryParamIncludeCollections $includeCollections
* @param ?QueryParamIncludeExternalMedia $includeExternalMedia
*/
public function __construct(string $query, ?string $clientID = null, ?int $limit = null, ?array $searchTypes = null, ?QueryParamIncludeCollections $includeCollections = QueryParamIncludeCollections::Disable, ?QueryParamIncludeExternalMedia $includeExternalMedia = QueryParamIncludeExternalMedia::Disable)
public function __construct(string $query, string $clientID, ?int $limit = null, ?array $searchTypes = null, ?QueryParamIncludeCollections $includeCollections = QueryParamIncludeCollections::Disable, ?QueryParamIncludeExternalMedia $includeExternalMedia = QueryParamIncludeExternalMedia::Disable)
{
$this->query = $query;
$this->clientID = $clientID;

View File

@@ -14,16 +14,16 @@ namespace LukeHagar\Plex_API\Models\Operations;
*
* None = Library default,
* tmdbAiring = The Movie Database (Aired),
* aired = TheTVDB (Aired),
* dvd = TheTVDB (DVD),
* absolute = TheTVDB (Absolute)).
* tvdbAiring = TheTVDB (Aired),
* tvdbDvd = TheTVDB (DVD),
* tvdbAbsolute = TheTVDB (Absolute)).
*
*/
enum GetSearchAllLibrariesShowOrdering: string
{
case None = 'None';
case TmdbAiring = 'tmdbAiring';
case Aired = 'aired';
case Dvd = 'dvd';
case Absolute = 'absolute';
case TvdbAiring = 'tvdbAiring';
case TvdbDvd = 'tvdbDvd';
case TvdbAbsolute = 'tvdbAbsolute';
}

View File

@@ -26,6 +26,22 @@ class GetSearchAllLibrariesStream
#[\Speakeasy\Serializer\Annotation\SerializedName('streamType')]
public int $streamType;
/**
* Codec used by the stream
*
* @var string $codec
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('codec')]
public string $codec;
/**
* The index of the stream
*
* @var int $index
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('index')]
public int $index;
/**
* Indicates if this is the default stream
*
@@ -44,22 +60,6 @@ class GetSearchAllLibrariesStream
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?bool $selected = null;
/**
* Codec used by the stream
*
* @var string $codec
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('codec')]
public string $codec;
/**
* The index of the stream
*
* @var int $index
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('index')]
public int $index;
/**
* The bitrate of the stream in kbps
*

View File

@@ -26,4 +26,6 @@ enum GetSearchLibraryQueryParamType: int
case Season = 3;
case Episode = 4;
case Audio = 8;
case Album = 9;
case Track = 10;
}

View File

@@ -11,6 +11,14 @@ namespace LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\SpeakeasyMetadata;
class GetServerResourcesRequest
{
/**
* An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
*
* @var string $clientID
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Client-Identifier')]
public string $clientID;
/**
* Include Https entries in the results
*
@@ -39,24 +47,16 @@ class GetServerResourcesRequest
public ?IncludeIPv6 $includeIPv6 = null;
/**
* An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
*
* @var ?string $clientID
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Client-Identifier')]
public ?string $clientID = null;
/**
* @param string $clientID
* @param ?IncludeHttps $includeHttps
* @param ?IncludeRelay $includeRelay
* @param ?IncludeIPv6 $includeIPv6
* @param ?string $clientID
*/
public function __construct(?string $clientID = null, ?IncludeHttps $includeHttps = IncludeHttps::Disable, ?IncludeRelay $includeRelay = IncludeRelay::Disable, ?IncludeIPv6 $includeIPv6 = IncludeIPv6::Disable)
public function __construct(string $clientID, ?IncludeHttps $includeHttps = IncludeHttps::Disable, ?IncludeRelay $includeRelay = IncludeRelay::Disable, ?IncludeIPv6 $includeIPv6 = IncludeIPv6::Disable)
{
$this->clientID = $clientID;
$this->includeHttps = $includeHttps;
$this->includeRelay = $includeRelay;
$this->includeIPv6 = $includeIPv6;
$this->clientID = $clientID;
}
}

Some files were not shown because too many files have changed in this diff Show More