ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.487.0

This commit is contained in:
speakeasybot
2025-02-07 00:11:21 +00:00
parent 358a060449
commit 1d1827ef73
58 changed files with 1658 additions and 30 deletions

View File

@@ -1,12 +1,12 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: 01a51eb2-5d90-4a24-b154-68e491d02c36 id: 01a51eb2-5d90-4a24-b154-68e491d02c36
management: management:
docChecksum: 14b35829d4be91a88269761c3ed01426 docChecksum: 7dec92ab9151a1b5a35df5faa81811ba
docVersion: 0.0.3 docVersion: 0.0.3
speakeasyVersion: 1.484.1 speakeasyVersion: 1.487.0
generationVersion: 2.503.2 generationVersion: 2.506.0
releaseVersion: 0.12.6 releaseVersion: 0.12.7
configChecksum: 0b21cc9558844e2166d52a79210c893d configChecksum: a1e3ba7fcb508e0bcf094e7a0bbffe76
repoURL: https://github.com/LukeHagar/plexphp.git repoURL: https://github.com/LukeHagar/plexphp.git
repoSubDirectory: . repoSubDirectory: .
installationURL: https://github.com/LukeHagar/plexphp installationURL: https://github.com/LukeHagar/plexphp
@@ -267,6 +267,10 @@ generatedFiles:
- docs/Models/Errors/GetUserFriendsErrors.md - docs/Models/Errors/GetUserFriendsErrors.md
- docs/Models/Errors/GetUserFriendsPlexErrors.md - docs/Models/Errors/GetUserFriendsPlexErrors.md
- docs/Models/Errors/GetUserFriendsUnauthorized.md - docs/Models/Errors/GetUserFriendsUnauthorized.md
- docs/Models/Errors/GetUsersBadRequest.md
- docs/Models/Errors/GetUsersErrors.md
- docs/Models/Errors/GetUsersUnauthorized.md
- docs/Models/Errors/GetUsersUsersErrors.md
- docs/Models/Errors/GetWatchListBadRequest.md - docs/Models/Errors/GetWatchListBadRequest.md
- docs/Models/Errors/GetWatchListErrors.md - docs/Models/Errors/GetWatchListErrors.md
- docs/Models/Errors/GetWatchListUnauthorized.md - docs/Models/Errors/GetWatchListUnauthorized.md
@@ -344,6 +348,12 @@ generatedFiles:
- docs/Models/Operations/AddPlaylistContentsRequest.md - docs/Models/Operations/AddPlaylistContentsRequest.md
- docs/Models/Operations/AddPlaylistContentsResponse.md - docs/Models/Operations/AddPlaylistContentsResponse.md
- docs/Models/Operations/AddPlaylistContentsResponseBody.md - docs/Models/Operations/AddPlaylistContentsResponseBody.md
- docs/Models/Operations/AllLibraries.md
- docs/Models/Operations/AllowCameraUpload.md
- docs/Models/Operations/AllowChannels.md
- docs/Models/Operations/AllowSubtitleAdmin.md
- docs/Models/Operations/AllowSync.md
- docs/Models/Operations/AllowTuners.md
- docs/Models/Operations/ApplyUpdatesRequest.md - docs/Models/Operations/ApplyUpdatesRequest.md
- docs/Models/Operations/ApplyUpdatesResponse.md - docs/Models/Operations/ApplyUpdatesResponse.md
- docs/Models/Operations/AutoSelectSubtitle.md - docs/Models/Operations/AutoSelectSubtitle.md
@@ -706,6 +716,7 @@ generatedFiles:
- docs/Models/Operations/GetTopWatchedContentResponse.md - docs/Models/Operations/GetTopWatchedContentResponse.md
- docs/Models/Operations/GetTopWatchedContentResponseBody.md - docs/Models/Operations/GetTopWatchedContentResponseBody.md
- docs/Models/Operations/GetTopWatchedContentRole.md - docs/Models/Operations/GetTopWatchedContentRole.md
- docs/Models/Operations/GetTopWatchedContentUser.md
- docs/Models/Operations/GetTranscodeSessionsMediaContainer.md - docs/Models/Operations/GetTranscodeSessionsMediaContainer.md
- docs/Models/Operations/GetTranscodeSessionsResponse.md - docs/Models/Operations/GetTranscodeSessionsResponse.md
- docs/Models/Operations/GetTranscodeSessionsResponseBody.md - docs/Models/Operations/GetTranscodeSessionsResponseBody.md
@@ -716,11 +727,17 @@ generatedFiles:
- docs/Models/Operations/GetUpdateStatusResponse.md - docs/Models/Operations/GetUpdateStatusResponse.md
- docs/Models/Operations/GetUpdateStatusResponseBody.md - docs/Models/Operations/GetUpdateStatusResponseBody.md
- docs/Models/Operations/GetUserFriendsResponse.md - docs/Models/Operations/GetUserFriendsResponse.md
- docs/Models/Operations/GetUsersMediaContainer.md
- docs/Models/Operations/GetUsersRequest.md
- docs/Models/Operations/GetUsersResponse.md
- docs/Models/Operations/GetUsersResponseBody.md
- docs/Models/Operations/GetUsersServer.md
- docs/Models/Operations/GetWatchListRequest.md - docs/Models/Operations/GetWatchListRequest.md
- docs/Models/Operations/GetWatchListResponse.md - docs/Models/Operations/GetWatchListResponse.md
- docs/Models/Operations/GetWatchListResponseBody.md - docs/Models/Operations/GetWatchListResponseBody.md
- docs/Models/Operations/Guids.md - docs/Models/Operations/Guids.md
- docs/Models/Operations/HasThumbnail.md - docs/Models/Operations/HasThumbnail.md
- docs/Models/Operations/Home.md
- docs/Models/Operations/Hub.md - docs/Models/Operations/Hub.md
- docs/Models/Operations/Image.md - docs/Models/Operations/Image.md
- docs/Models/Operations/IncludeCollections.md - docs/Models/Operations/IncludeCollections.md
@@ -756,9 +773,11 @@ generatedFiles:
- docs/Models/Operations/OnlyTransient.md - docs/Models/Operations/OnlyTransient.md
- docs/Models/Operations/Operator.md - docs/Models/Operations/Operator.md
- docs/Models/Operations/OptimizedForStreaming.md - docs/Models/Operations/OptimizedForStreaming.md
- docs/Models/Operations/Owned.md
- docs/Models/Operations/Part.md - docs/Models/Operations/Part.md
- docs/Models/Operations/PastSubscription.md - docs/Models/Operations/PastSubscription.md
- docs/Models/Operations/PathParamTaskName.md - docs/Models/Operations/PathParamTaskName.md
- docs/Models/Operations/Pending.md
- docs/Models/Operations/PerformSearchRequest.md - docs/Models/Operations/PerformSearchRequest.md
- docs/Models/Operations/PerformSearchResponse.md - docs/Models/Operations/PerformSearchResponse.md
- docs/Models/Operations/PerformVoiceSearchRequest.md - docs/Models/Operations/PerformVoiceSearchRequest.md
@@ -786,6 +805,7 @@ generatedFiles:
- docs/Models/Operations/PostUsersSignInDataUserProfile.md - docs/Models/Operations/PostUsersSignInDataUserProfile.md
- docs/Models/Operations/PostUsersSignInDataWatchedIndicator.md - docs/Models/Operations/PostUsersSignInDataWatchedIndicator.md
- docs/Models/Operations/Producer.md - docs/Models/Operations/Producer.md
- docs/Models/Operations/ProtectedT.md
- docs/Models/Operations/Protocol.md - docs/Models/Operations/Protocol.md
- docs/Models/Operations/Provider.md - docs/Models/Operations/Provider.md
- docs/Models/Operations/QueryParamFilter.md - docs/Models/Operations/QueryParamFilter.md
@@ -799,6 +819,7 @@ generatedFiles:
- docs/Models/Operations/Ratings.md - docs/Models/Operations/Ratings.md
- docs/Models/Operations/Release.md - docs/Models/Operations/Release.md
- docs/Models/Operations/ResponseBody.md - docs/Models/Operations/ResponseBody.md
- docs/Models/Operations/Restricted.md
- docs/Models/Operations/Role.md - docs/Models/Operations/Role.md
- docs/Models/Operations/Scope.md - docs/Models/Operations/Scope.md
- docs/Models/Operations/SearchResult.md - docs/Models/Operations/SearchResult.md
@@ -863,6 +884,7 @@ generatedFiles:
- docs/sdks/sessions/README.md - docs/sdks/sessions/README.md
- docs/sdks/statistics/README.md - docs/sdks/statistics/README.md
- docs/sdks/updater/README.md - docs/sdks/updater/README.md
- docs/sdks/users/README.md
- docs/sdks/video/README.md - docs/sdks/video/README.md
- docs/sdks/watchlist/README.md - docs/sdks/watchlist/README.md
- phpstan.neon - phpstan.neon
@@ -1246,6 +1268,12 @@ generatedFiles:
- src/Models/Errors/GetUserFriendsPlexErrors.php - src/Models/Errors/GetUserFriendsPlexErrors.php
- src/Models/Errors/GetUserFriendsUnauthorized.php - src/Models/Errors/GetUserFriendsUnauthorized.php
- src/Models/Errors/GetUserFriendsUnauthorizedThrowable.php - src/Models/Errors/GetUserFriendsUnauthorizedThrowable.php
- src/Models/Errors/GetUsersBadRequest.php
- src/Models/Errors/GetUsersBadRequestThrowable.php
- src/Models/Errors/GetUsersErrors.php
- src/Models/Errors/GetUsersUnauthorized.php
- src/Models/Errors/GetUsersUnauthorizedThrowable.php
- src/Models/Errors/GetUsersUsersErrors.php
- src/Models/Errors/GetWatchListBadRequest.php - src/Models/Errors/GetWatchListBadRequest.php
- src/Models/Errors/GetWatchListBadRequestThrowable.php - src/Models/Errors/GetWatchListBadRequestThrowable.php
- src/Models/Errors/GetWatchListErrors.php - src/Models/Errors/GetWatchListErrors.php
@@ -1358,6 +1386,12 @@ generatedFiles:
- src/Models/Operations/AddPlaylistContentsRequest.php - src/Models/Operations/AddPlaylistContentsRequest.php
- src/Models/Operations/AddPlaylistContentsResponse.php - src/Models/Operations/AddPlaylistContentsResponse.php
- src/Models/Operations/AddPlaylistContentsResponseBody.php - src/Models/Operations/AddPlaylistContentsResponseBody.php
- src/Models/Operations/AllLibraries.php
- src/Models/Operations/AllowCameraUpload.php
- src/Models/Operations/AllowChannels.php
- src/Models/Operations/AllowSubtitleAdmin.php
- src/Models/Operations/AllowSync.php
- src/Models/Operations/AllowTuners.php
- src/Models/Operations/ApplyUpdatesRequest.php - src/Models/Operations/ApplyUpdatesRequest.php
- src/Models/Operations/ApplyUpdatesResponse.php - src/Models/Operations/ApplyUpdatesResponse.php
- src/Models/Operations/AutoSelectSubtitle.php - src/Models/Operations/AutoSelectSubtitle.php
@@ -1720,6 +1754,7 @@ generatedFiles:
- src/Models/Operations/GetTopWatchedContentResponse.php - src/Models/Operations/GetTopWatchedContentResponse.php
- src/Models/Operations/GetTopWatchedContentResponseBody.php - src/Models/Operations/GetTopWatchedContentResponseBody.php
- src/Models/Operations/GetTopWatchedContentRole.php - src/Models/Operations/GetTopWatchedContentRole.php
- src/Models/Operations/GetTopWatchedContentUser.php
- src/Models/Operations/GetTranscodeSessionsMediaContainer.php - src/Models/Operations/GetTranscodeSessionsMediaContainer.php
- src/Models/Operations/GetTranscodeSessionsResponse.php - src/Models/Operations/GetTranscodeSessionsResponse.php
- src/Models/Operations/GetTranscodeSessionsResponseBody.php - src/Models/Operations/GetTranscodeSessionsResponseBody.php
@@ -1730,11 +1765,17 @@ generatedFiles:
- src/Models/Operations/GetUpdateStatusResponse.php - src/Models/Operations/GetUpdateStatusResponse.php
- src/Models/Operations/GetUpdateStatusResponseBody.php - src/Models/Operations/GetUpdateStatusResponseBody.php
- src/Models/Operations/GetUserFriendsResponse.php - src/Models/Operations/GetUserFriendsResponse.php
- src/Models/Operations/GetUsersMediaContainer.php
- src/Models/Operations/GetUsersRequest.php
- src/Models/Operations/GetUsersResponse.php
- src/Models/Operations/GetUsersResponseBody.php
- src/Models/Operations/GetUsersServer.php
- src/Models/Operations/GetWatchListRequest.php - src/Models/Operations/GetWatchListRequest.php
- src/Models/Operations/GetWatchListResponse.php - src/Models/Operations/GetWatchListResponse.php
- src/Models/Operations/GetWatchListResponseBody.php - src/Models/Operations/GetWatchListResponseBody.php
- src/Models/Operations/Guids.php - src/Models/Operations/Guids.php
- src/Models/Operations/HasThumbnail.php - src/Models/Operations/HasThumbnail.php
- src/Models/Operations/Home.php
- src/Models/Operations/Hub.php - src/Models/Operations/Hub.php
- src/Models/Operations/Image.php - src/Models/Operations/Image.php
- src/Models/Operations/IncludeCollections.php - src/Models/Operations/IncludeCollections.php
@@ -1770,9 +1811,11 @@ generatedFiles:
- src/Models/Operations/OnlyTransient.php - src/Models/Operations/OnlyTransient.php
- src/Models/Operations/Operator.php - src/Models/Operations/Operator.php
- src/Models/Operations/OptimizedForStreaming.php - src/Models/Operations/OptimizedForStreaming.php
- src/Models/Operations/Owned.php
- src/Models/Operations/Part.php - src/Models/Operations/Part.php
- src/Models/Operations/PastSubscription.php - src/Models/Operations/PastSubscription.php
- src/Models/Operations/PathParamTaskName.php - src/Models/Operations/PathParamTaskName.php
- src/Models/Operations/Pending.php
- src/Models/Operations/PerformSearchRequest.php - src/Models/Operations/PerformSearchRequest.php
- src/Models/Operations/PerformSearchResponse.php - src/Models/Operations/PerformSearchResponse.php
- src/Models/Operations/PerformVoiceSearchRequest.php - src/Models/Operations/PerformVoiceSearchRequest.php
@@ -1800,6 +1843,7 @@ generatedFiles:
- src/Models/Operations/PostUsersSignInDataUserProfile.php - src/Models/Operations/PostUsersSignInDataUserProfile.php
- src/Models/Operations/PostUsersSignInDataWatchedIndicator.php - src/Models/Operations/PostUsersSignInDataWatchedIndicator.php
- src/Models/Operations/Producer.php - src/Models/Operations/Producer.php
- src/Models/Operations/ProtectedT.php
- src/Models/Operations/Protocol.php - src/Models/Operations/Protocol.php
- src/Models/Operations/Provider.php - src/Models/Operations/Provider.php
- src/Models/Operations/QueryParamFilter.php - src/Models/Operations/QueryParamFilter.php
@@ -1813,6 +1857,7 @@ generatedFiles:
- src/Models/Operations/Ratings.php - src/Models/Operations/Ratings.php
- src/Models/Operations/Release.php - src/Models/Operations/Release.php
- src/Models/Operations/ResponseBody.php - src/Models/Operations/ResponseBody.php
- src/Models/Operations/Restricted.php
- src/Models/Operations/Role.php - src/Models/Operations/Role.php
- src/Models/Operations/Scope.php - src/Models/Operations/Scope.php
- src/Models/Operations/SearchResult.php - src/Models/Operations/SearchResult.php
@@ -1873,6 +1918,7 @@ generatedFiles:
- src/Sessions.php - src/Sessions.php
- src/Statistics.php - src/Statistics.php
- src/Updater.php - src/Updater.php
- src/Users.php
- src/Utils/BigDecimalHandler.php - src/Utils/BigDecimalHandler.php
- src/Utils/BigIntHandler.php - src/Utils/BigIntHandler.php
- src/Utils/DateHandler.php - src/Utils/DateHandler.php
@@ -2920,5 +2966,29 @@ examples:
application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]}
"401": "401":
application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}]} application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}]}
get-users:
"":
parameters:
header:
X-Plex-Client-Identifier: "3381b62b-9ab7-4e37-827b-203e9809eb58"
X-Plex-Product: "Plex for Roku"
X-Plex-Device: "Roku 3"
X-Plex-Device-Name: "Chrome"
X-Plex-Device-Screen-Resolution: "1487x1165,2560x1440"
X-Plex-Version: "2.4.1"
X-Plex-Platform: "Roku"
X-Plex-Features: "external-media,indirect-media,hub-style-list"
X-Plex-Model: "4200X"
X-Plex-Session-Id: "97e136ef-4ddd-4ff3-89a7-a5820c96c2ca"
X-Plex-Language: "en"
X-Plex-Platform-Version: "4.3 build 1057"
X-Plex-Token: "CV5xoxjTpFKUzBTShsaf"
responses:
"200":
application/xml: "0xa9CdebeF9E"
"400":
application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]}
"401":
application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}]}
examplesVersion: 1.0.0 examplesVersion: 1.0.0
generatedTests: {} generatedTests: {}

View File

@@ -13,7 +13,7 @@ generation:
oAuth2ClientCredentialsEnabled: false oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false oAuth2PasswordEnabled: false
php: php:
version: 0.12.6 version: 0.12.7
additionalDependencies: additionalDependencies:
autoload: {} autoload: {}
autoload-dev: {} autoload-dev: {}

View File

@@ -1,4 +1,4 @@
speakeasyVersion: 1.484.1 speakeasyVersion: 1.487.0
sources: sources:
my-source: my-source:
sourceNamespace: my-source sourceNamespace: my-source
@@ -9,19 +9,19 @@ sources:
- main - main
plexapi: plexapi:
sourceNamespace: plexapi sourceNamespace: plexapi
sourceRevisionDigest: sha256:0b88c8bfc41def63e19e91fdd4d51bab07cb947cc3d39d2b44e8523a209cec10 sourceRevisionDigest: sha256:e6ab335dd91a4165f4510e4a3af8a55819c6310b7e66251266d2384376f3ccae
sourceBlobDigest: sha256:89d5b8427d4fb61b25751aebbaf71f9613958e9e91073fc084fed2c2ec62ce55 sourceBlobDigest: sha256:89d1b1133e400c89f0d06efe5e5168f5ba25a413e1ab8380d442d6b233e2e5a9
tags: tags:
- latest - latest
- speakeasy-sdk-regen-1738800603 - speakeasy-sdk-regen-1738886997
targets: targets:
plexphp: plexphp:
source: plexapi source: plexapi
sourceNamespace: plexapi sourceNamespace: plexapi
sourceRevisionDigest: sha256:0b88c8bfc41def63e19e91fdd4d51bab07cb947cc3d39d2b44e8523a209cec10 sourceRevisionDigest: sha256:e6ab335dd91a4165f4510e4a3af8a55819c6310b7e66251266d2384376f3ccae
sourceBlobDigest: sha256:89d5b8427d4fb61b25751aebbaf71f9613958e9e91073fc084fed2c2ec62ce55 sourceBlobDigest: sha256:89d1b1133e400c89f0d06efe5e5168f5ba25a413e1ab8380d442d6b233e2e5a9
codeSamplesNamespace: code-samples-php-plexphp codeSamplesNamespace: code-samples-php-plexphp
codeSamplesRevisionDigest: sha256:e5a939240be5566d8e8fc18b364210b4cc1c2f946f46075abc1aa7c9126eab07 codeSamplesRevisionDigest: sha256:4cdb3c552dcc421fe1fec7e86a97ef907ac0ec2e7879d80bcaf8776e93aff650
workflow: workflow:
workflowVersion: 1.0.0 workflowVersion: 1.0.0
speakeasyVersion: latest speakeasyVersion: latest

View File

@@ -259,6 +259,10 @@ if ($response->object !== null) {
* [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates * [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates
* [getUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) - Querying status of updates * [getUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) - Querying status of updates
### [users](docs/sdks/users/README.md)
* [getUsers](docs/sdks/users/README.md#getusers) - Get list of all connected users
### [video](docs/sdks/video/README.md) ### [video](docs/sdks/video/README.md)
* [getTimeline](docs/sdks/video/README.md#gettimeline) - Get the timeline for a media item * [getTimeline](docs/sdks/video/README.md#gettimeline) - Get the timeline for a media item

View File

@@ -763,3 +763,13 @@ Based on:
- [php v0.12.6] . - [php v0.12.6] .
### Releases ### Releases
- [Composer v0.12.6] https://packagist.org/packages/lukehagar/plex-api#v0.12.6 - . - [Composer v0.12.6] https://packagist.org/packages/lukehagar/plex-api#v0.12.6 - .
## 2025-02-07 00:09:42
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.487.0 (2.506.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [php v0.12.7] .
### Releases
- [Composer v0.12.7] https://packagist.org/packages/lukehagar/plex-api#v0.12.7 - .

View File

@@ -2210,6 +2210,44 @@ actions:
if ($response->userPlexAccount !== null) { if ($response->userPlexAccount !== null) {
// handle response // handle response
} }
- target: $["paths"]["/users"]["get"]
update:
x-codeSamples:
- lang: php
label: users
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()->build();
$request = new Operations\GetUsersRequest(
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
clientName: 'Plex for Roku',
deviceNickname: 'Roku 3',
deviceName: 'Chrome',
deviceScreenResolution: '1487x1165,2560x1440',
clientVersion: '2.4.1',
platform: 'Roku',
clientFeatures: 'external-media,indirect-media,hub-style-list',
model: '4200X',
xPlexSessionId: '97e136ef-4ddd-4ff3-89a7-a5820c96c2ca',
xPlexLanguage: 'en',
platformVersion: '4.3 build 1057',
xPlexToken: 'CV5xoxjTpFKUzBTShsaf',
);
$response = $sdk->users->getUsers(
request: $request
);
if ($response->body !== null) {
// handle response
}
- target: $["paths"]["/users/signin"]["post"] - target: $["paths"]["/users/signin"]["post"]
update: update:
x-codeSamples: x-codeSamples:

View File

@@ -0,0 +1,11 @@
# GetUsersBadRequest
Bad Request - A parameter was not specified, or was specified incorrectly.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `errors` | array<[Errors\GetUsersErrors](../../Models/Errors/GetUsersErrors.md)> | :heavy_minus_sign: | N/A |
| `rawResponse` | [\Psr\Http\Message\ResponseInterface](https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |

View File

@@ -0,0 +1,10 @@
# GetUsersErrors
## Fields
| Field | Type | Required | Description | Example |
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
| `code` | *?int* | :heavy_minus_sign: | N/A | 1000 |
| `message` | *?string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing |
| `status` | *?int* | :heavy_minus_sign: | N/A | 400 |

View File

@@ -0,0 +1,11 @@
# GetUsersUnauthorized
Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `errors` | array<[Errors\GetUsersUsersErrors](../../Models/Errors/GetUsersUsersErrors.md)> | :heavy_minus_sign: | N/A |
| `rawResponse` | [\Psr\Http\Message\ResponseInterface](https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |

View File

@@ -0,0 +1,10 @@
# GetUsersUsersErrors
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- |
| `code` | *?int* | :heavy_minus_sign: | N/A | 1001 |
| `message` | *?string* | :heavy_minus_sign: | N/A | User could not be authenticated |
| `status` | *?int* | :heavy_minus_sign: | N/A | 401 |

View File

@@ -0,0 +1,11 @@
# AllLibraries
Indicates if the user has access to all libraries.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowCameraUpload
Indicates if the user is allowed to upload from a camera.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowChannels
Indicates if the user has access to channels.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowSubtitleAdmin
Indicates if the user can manage subtitles.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowSync
Indicates if the user is allowed to sync media.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# AllowTuners
Indicates if the user is allowed to use tuners.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -36,4 +36,4 @@
| `country` | array<[Operations\GetTopWatchedContentCountry](../../Models/Operations/GetTopWatchedContentCountry.md)> | :heavy_minus_sign: | N/A | | | `country` | array<[Operations\GetTopWatchedContentCountry](../../Models/Operations/GetTopWatchedContentCountry.md)> | :heavy_minus_sign: | N/A | |
| `guids` | array<[Operations\GetTopWatchedContentGuids](../../Models/Operations/GetTopWatchedContentGuids.md)> | :heavy_minus_sign: | N/A | | | `guids` | array<[Operations\GetTopWatchedContentGuids](../../Models/Operations/GetTopWatchedContentGuids.md)> | :heavy_minus_sign: | N/A | |
| `role` | array<[Operations\GetTopWatchedContentRole](../../Models/Operations/GetTopWatchedContentRole.md)> | :heavy_minus_sign: | N/A | | | `role` | array<[Operations\GetTopWatchedContentRole](../../Models/Operations/GetTopWatchedContentRole.md)> | :heavy_minus_sign: | N/A | |
| `user` | array<[Operations\User](../../Models/Operations/User.md)> | :heavy_minus_sign: | N/A | | | `user` | array<[Operations\GetTopWatchedContentUser](../../Models/Operations/GetTopWatchedContentUser.md)> | :heavy_minus_sign: | N/A | |

View File

@@ -0,0 +1,8 @@
# GetTopWatchedContentUser
## Fields
| Field | Type | Required | Description | Example |
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
| `id` | *?int* | :heavy_minus_sign: | N/A | 220 |

View File

@@ -0,0 +1,15 @@
# GetUsersMediaContainer
Container holding user and server details.
## Fields
| Field | Type | Required | Description | Example |
| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- |
| `friendlyName` | *string* | :heavy_check_mark: | The friendly name of the Plex instance. | myPlex |
| `identifier` | *string* | :heavy_check_mark: | N/A | com.plexapp.plugins.myplex |
| `machineIdentifier` | *string* | :heavy_check_mark: | Unique Machine identifier of the Plex server. | 3dff4c4da3b1229a649aa574a9e2b419a684a20e |
| `totalSize` | *int* | :heavy_check_mark: | Total number of users. | 30 |
| `size` | *int* | :heavy_check_mark: | Number of users in the current response. | 30 |
| `user` | array<[Operations\User](../../Models/Operations/User.md)> | :heavy_check_mark: | List of users with access to the Plex server. | |

View File

@@ -0,0 +1,20 @@
# GetUsersRequest
## Fields
| 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 |
| `xPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf |
| `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 |
| `deviceName` | *?string* | :heavy_minus_sign: | The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) | Chrome |
| `deviceScreenResolution` | *?string* | :heavy_minus_sign: | The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) | 1487x1165,2560x1440 |
| `clientVersion` | *?string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 |
| `platform` | *?string* | :heavy_minus_sign: | The platform of the client application. | Roku |
| `clientFeatures` | *?string* | :heavy_minus_sign: | The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) | external-media,indirect-media,hub-style-list |
| `model` | *?string* | :heavy_minus_sign: | A potentially less friendly identifier for the device model | 4200X |
| `xPlexSessionId` | *?string* | :heavy_minus_sign: | The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) | 97e136ef-4ddd-4ff3-89a7-a5820c96c2ca |
| `xPlexLanguage` | *?string* | :heavy_minus_sign: | The language of the client application. | en |
| `platformVersion` | *?string* | :heavy_minus_sign: | The version of the platform | 4.3 build 1057 |

View File

@@ -0,0 +1,11 @@
# GetUsersResponse
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation |
| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
| `rawResponse` | [\Psr\Http\Message\ResponseInterface](https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
| `body` | *?string* | :heavy_minus_sign: | N/A |

View File

@@ -0,0 +1,10 @@
# GetUsersResponseBody
Successful response with media container data in XML
## Fields
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `mediaContainer` | [?Operations\GetUsersMediaContainer](../../Models/Operations/GetUsersMediaContainer.md) | :heavy_minus_sign: | Container holding user and server details. |

View File

@@ -0,0 +1,16 @@
# GetUsersServer
## Fields
| Field | Type | Required | Description | Example |
| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `id` | *int* | :heavy_check_mark: | Unique ID of the server of the connected user | 907759180 |
| `serverId` | *int* | :heavy_check_mark: | ID of the actual Plex server. | 9999999 |
| `machineIdentifier` | *string* | :heavy_check_mark: | Machine identifier of the Plex server. | fbb8aa6be6e0c997c6268bc2b4431c8807f70a3 |
| `name` | *string* | :heavy_check_mark: | Name of the Plex server of the connected user. | ConnectedUserFlix |
| `lastSeenAt` | *int* | :heavy_check_mark: | N/A | 1556281940 |
| `numLibraries` | *int* | :heavy_check_mark: | Number of libraries in the server this user has access to. | 16 |
| `allLibraries` | [?Operations\AllLibraries](../../Models/Operations/AllLibraries.md) | :heavy_minus_sign: | N/A | 1 |
| `owned` | [?Operations\Owned](../../Models/Operations/Owned.md) | :heavy_minus_sign: | N/A | 1 |
| `pending` | [?Operations\Pending](../../Models/Operations/Pending.md) | :heavy_minus_sign: | N/A | 1 |

View File

@@ -0,0 +1,11 @@
# Home
Indicates if the user is part of a home group.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# Owned
Indicates if the user owns the server.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# Pending
Indicates if the server is pending approval.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# ProtectedT
Indicates whether the account is protected.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -0,0 +1,11 @@
# Restricted
Indicates if the user has restricted access.
## Values
| Name | Value |
| --------- | --------- |
| `Disable` | 0 |
| `Enable` | 1 |

View File

@@ -3,6 +3,25 @@
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `id` | *?int* | :heavy_minus_sign: | N/A | 220 | | `id` | *int* | :heavy_check_mark: | User's unique ID. | 22526914 |
| `title` | *string* | :heavy_check_mark: | User's display name. | Plex User |
| `username` | *string* | :heavy_check_mark: | User's username. | zgfuc7krcqfimrmb9lsl5j |
| `email` | *string* | :heavy_check_mark: | User's email address. | zgfuc7krcqfimrmb9lsl5j@protonmail.com |
| `thumb` | *string* | :heavy_check_mark: | URL to the user's avatar image. | https://plex.tv/users/3346028014e93acd/avatar?c=1731605021 |
| `server` | array<[Operations\GetUsersServer](../../Models/Operations/GetUsersServer.md)> | :heavy_check_mark: | List of servers owned by the user. | |
| `protected` | [?Operations\ProtectedT](../../Models/Operations/ProtectedT.md) | :heavy_minus_sign: | N/A | 1 |
| `home` | [?Operations\Home](../../Models/Operations/Home.md) | :heavy_minus_sign: | N/A | 1 |
| `allowTuners` | [?Operations\AllowTuners](../../Models/Operations/AllowTuners.md) | :heavy_minus_sign: | N/A | 1 |
| `allowSync` | [?Operations\AllowSync](../../Models/Operations/AllowSync.md) | :heavy_minus_sign: | N/A | 1 |
| `allowCameraUpload` | [?Operations\AllowCameraUpload](../../Models/Operations/AllowCameraUpload.md) | :heavy_minus_sign: | N/A | 1 |
| `allowChannels` | [?Operations\AllowChannels](../../Models/Operations/AllowChannels.md) | :heavy_minus_sign: | N/A | 1 |
| `allowSubtitleAdmin` | [?Operations\AllowSubtitleAdmin](../../Models/Operations/AllowSubtitleAdmin.md) | :heavy_minus_sign: | N/A | 1 |
| `filterTelevision` | *?string* | :heavy_minus_sign: | Filters applied for television. | |
| `restricted` | [?Operations\Restricted](../../Models/Operations/Restricted.md) | :heavy_minus_sign: | N/A | 1 |
| `recommendationsPlaylistId` | *?string* | :heavy_minus_sign: | ID of the user's recommendation playlist. | |
| `filterAll` | *?string* | :heavy_minus_sign: | Filters applied for all content. | |
| `filterMovies` | *?string* | :heavy_minus_sign: | Filters applied for movies. | |
| `filterMusic` | *?string* | :heavy_minus_sign: | Filters applied for music. | |
| `filterPhotos` | *?string* | :heavy_minus_sign: | Filters applied for photos. | |

68
docs/sdks/users/README.md Normal file
View File

@@ -0,0 +1,68 @@
# Users
(*users*)
## Overview
### Available Operations
* [getUsers](#getusers) - Get list of all connected users
## getUsers
Get list of all users that are friends and have library access with the provided Plex authentication token
### Example Usage
```php
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()->build();
$request = new Operations\GetUsersRequest(
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
xPlexToken: 'CV5xoxjTpFKUzBTShsaf',
clientName: 'Plex for Roku',
deviceNickname: 'Roku 3',
deviceName: 'Chrome',
deviceScreenResolution: '1487x1165,2560x1440',
clientVersion: '2.4.1',
platform: 'Roku',
clientFeatures: 'external-media,indirect-media,hub-style-list',
model: '4200X',
xPlexSessionId: '97e136ef-4ddd-4ff3-89a7-a5820c96c2ca',
xPlexLanguage: 'en',
platformVersion: '4.3 build 1057',
);
$response = $sdk->users->getUsers(
request: $request
);
if ($response->body !== null) {
// handle response
}
```
### Parameters
| Parameter | Type | Required | Description |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `$request` | [Operations\GetUsersRequest](../../Models/Operations/GetUsersRequest.md) | :heavy_check_mark: | The request object to use for the request. |
| `$serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
### Response
**[?Operations\GetUsersResponse](../../Models/Operations/GetUsersResponse.md)**
### Errors
| Error Type | Status Code | Content Type |
| --------------------------- | --------------------------- | --------------------------- |
| Errors\GetUsersBadRequest | 400 | application/json |
| Errors\GetUsersUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | \*/\* |

View File

@@ -0,0 +1,53 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Errors;
use LukeHagar\Plex_API\Utils;
/** GetUsersBadRequest - Bad Request - A parameter was not specified, or was specified incorrectly. */
class GetUsersBadRequest
{
/**
* $errors
*
* @var ?array<GetUsersErrors> $errors
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('errors')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Errors\GetUsersErrors>|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $errors = null;
/**
* Raw HTTP response; suitable for custom response parsing
*
* @var ?\Psr\Http\Message\ResponseInterface $rawResponse
*/
#[\Speakeasy\Serializer\Annotation\Exclude]
public ?\Psr\Http\Message\ResponseInterface $rawResponse = null;
/**
* @param ?array<GetUsersErrors> $errors
* @param ?\Psr\Http\Message\ResponseInterface $rawResponse
* @phpstan-pure
*/
public function __construct(?array $errors = null, ?\Psr\Http\Message\ResponseInterface $rawResponse = null)
{
$this->errors = $errors;
$this->rawResponse = $rawResponse;
}
public function toException(): GetUsersBadRequestThrowable
{
$serializer = Utils\JSON::createSerializer();
$message = $serializer->serialize($this, 'json');
$code = -1;
return new GetUsersBadRequestThrowable($message, (int) $code, $this);
}
}

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\Models\Errors;
class GetUsersBadRequestThrowable extends \RuntimeException
{
public GetUsersBadRequest $container;
public function __construct(string $message, int $statusCode, GetUsersBadRequest $container)
{
parent::__construct($message, $statusCode);
$this->container = $container;
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Errors;
class GetUsersErrors
{
/**
*
* @var ?int $code
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('code')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $code = null;
/**
*
* @var ?string $message
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('message')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $message = null;
/**
*
* @var ?int $status
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('status')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $status = null;
/**
* @param ?int $code
* @param ?string $message
* @param ?int $status
* @phpstan-pure
*/
public function __construct(?int $code = null, ?string $message = null, ?int $status = null)
{
$this->code = $code;
$this->message = $message;
$this->status = $status;
}
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Errors;
use LukeHagar\Plex_API\Utils;
/** GetUsersUnauthorized - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. */
class GetUsersUnauthorized
{
/**
* $errors
*
* @var ?array<GetUsersUsersErrors> $errors
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('errors')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Errors\GetUsersUsersErrors>|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $errors = null;
/**
* Raw HTTP response; suitable for custom response parsing
*
* @var ?\Psr\Http\Message\ResponseInterface $rawResponse
*/
#[\Speakeasy\Serializer\Annotation\Exclude]
public ?\Psr\Http\Message\ResponseInterface $rawResponse = null;
/**
* @param ?array<GetUsersUsersErrors> $errors
* @param ?\Psr\Http\Message\ResponseInterface $rawResponse
* @phpstan-pure
*/
public function __construct(?array $errors = null, ?\Psr\Http\Message\ResponseInterface $rawResponse = null)
{
$this->errors = $errors;
$this->rawResponse = $rawResponse;
}
public function toException(): GetUsersUnauthorizedThrowable
{
$serializer = Utils\JSON::createSerializer();
$message = $serializer->serialize($this, 'json');
$code = -1;
return new GetUsersUnauthorizedThrowable($message, (int) $code, $this);
}
}

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\Models\Errors;
class GetUsersUnauthorizedThrowable extends \RuntimeException
{
public GetUsersUnauthorized $container;
public function __construct(string $message, int $statusCode, GetUsersUnauthorized $container)
{
parent::__construct($message, $statusCode);
$this->container = $container;
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Errors;
class GetUsersUsersErrors
{
/**
*
* @var ?int $code
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('code')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $code = null;
/**
*
* @var ?string $message
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('message')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?string $message = null;
/**
*
* @var ?int $status
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('status')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $status = null;
/**
* @param ?int $code
* @param ?string $message
* @param ?int $status
* @phpstan-pure
*/
public function __construct(?int $code = null, ?string $message = null, ?int $status = null)
{
$this->code = $code;
$this->message = $message;
$this->status = $status;
}
}

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\Models\Operations;
/** Indicates if the user has access to all libraries. */
enum AllLibraries: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the user is allowed to upload from a camera. */
enum AllowCameraUpload: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the user has access to channels. */
enum AllowChannels: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the user can manage subtitles. */
enum AllowSubtitleAdmin: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the user is allowed to sync media. */
enum AllowSync: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the user is allowed to use tuners. */
enum AllowTuners: int
{
case Disable = 0;
case Enable = 1;
}

View File

@@ -270,10 +270,10 @@ class GetTopWatchedContentMetadata
/** /**
* $user * $user
* *
* @var ?array<User> $user * @var ?array<GetTopWatchedContentUser> $user
*/ */
#[\Speakeasy\Serializer\Annotation\SerializedName('User')] #[\Speakeasy\Serializer\Annotation\SerializedName('User')]
#[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\User>|null')] #[\Speakeasy\Serializer\Annotation\Type('array<\LukeHagar\Plex_API\Models\Operations\GetTopWatchedContentUser>|null')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull] #[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?array $user = null; public ?array $user = null;
@@ -309,7 +309,7 @@ class GetTopWatchedContentMetadata
* @param ?array<GetTopWatchedContentCountry> $country * @param ?array<GetTopWatchedContentCountry> $country
* @param ?array<GetTopWatchedContentGuids> $guids * @param ?array<GetTopWatchedContentGuids> $guids
* @param ?array<GetTopWatchedContentRole> $role * @param ?array<GetTopWatchedContentRole> $role
* @param ?array<User> $user * @param ?array<GetTopWatchedContentUser> $user
* @phpstan-pure * @phpstan-pure
*/ */
public function __construct(?string $ratingKey = null, ?string $key = null, ?string $guid = null, ?string $slug = 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, ?int $index = null, ?float $audienceRating = null, ?int $year = null, ?string $tagline = null, ?string $thumb = null, ?string $art = null, ?int $duration = null, ?LocalDate $originallyAvailableAt = null, ?int $leafCount = null, ?int $viewedLeafCount = null, ?int $childCount = null, ?int $addedAt = null, ?int $updatedAt = null, ?int $globalViewCount = null, ?string $audienceRatingImage = null, ?array $genre = null, ?array $country = null, ?array $guids = null, ?array $role = null, ?array $user = null) public function __construct(?string $ratingKey = null, ?string $key = null, ?string $guid = null, ?string $slug = 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, ?int $index = null, ?float $audienceRating = null, ?int $year = null, ?string $tagline = null, ?string $thumb = null, ?string $art = null, ?int $duration = null, ?LocalDate $originallyAvailableAt = null, ?int $leafCount = null, ?int $viewedLeafCount = null, ?int $childCount = null, ?int $addedAt = null, ?int $updatedAt = null, ?int $globalViewCount = null, ?string $audienceRatingImage = null, ?array $genre = null, ?array $country = null, ?array $guids = null, ?array $role = null, ?array $user = null)

View File

@@ -0,0 +1,30 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Operations;
class GetTopWatchedContentUser
{
/**
*
* @var ?int $id
*/
#[\Speakeasy\Serializer\Annotation\SerializedName('id')]
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $id = null;
/**
* @param ?int $id
* @phpstan-pure
*/
public function __construct(?int $id = null)
{
$this->id = $id;
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Operations;
/** GetUsersMediaContainer - Container holding user and server details. */
class GetUsersMediaContainer
{
/**
* The friendly name of the Plex instance.
*
* @var string $friendlyName
*/
public string $friendlyName;
/**
*
* @var string $identifier
*/
public string $identifier;
/**
* Unique Machine identifier of the Plex server.
*
* @var string $machineIdentifier
*/
public string $machineIdentifier;
/**
* Total number of users.
*
* @var int $totalSize
*/
public int $totalSize;
/**
* Number of users in the current response.
*
* @var int $size
*/
public int $size;
/**
* List of users with access to the Plex server.
*
* @var array<User> $user
*/
public array $user;
/**
* @param string $friendlyName
* @param string $identifier
* @param string $machineIdentifier
* @param int $totalSize
* @param int $size
* @param array<User> $user
* @phpstan-pure
*/
public function __construct(string $friendlyName, string $identifier, string $machineIdentifier, int $totalSize, int $size, array $user)
{
$this->friendlyName = $friendlyName;
$this->identifier = $identifier;
$this->machineIdentifier = $machineIdentifier;
$this->totalSize = $totalSize;
$this->size = $size;
$this->user = $user;
}
}

View File

@@ -0,0 +1,150 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Operations;
use LukeHagar\Plex_API\Utils\SpeakeasyMetadata;
class GetUsersRequest
{
/**
* 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;
/**
* An authentication token, obtained from plex.tv
*
* @var string $xPlexToken
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Token')]
public string $xPlexToken;
/**
* The name of the client application. (Plex Web, Plex Media Server, etc.)
*
* @var ?string $clientName
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Product')]
public ?string $clientName = null;
/**
* A relatively friendly name for the client device
*
* @var ?string $deviceNickname
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Device')]
public ?string $deviceNickname = null;
/**
* The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.)
*
* @var ?string $deviceName
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Device-Name')]
public ?string $deviceName = null;
/**
* The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440)
*
* @var ?string $deviceScreenResolution
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Device-Screen-Resolution')]
public ?string $deviceScreenResolution = null;
/**
* The version of the client application.
*
* @var ?string $clientVersion
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Version')]
public ?string $clientVersion = null;
/**
* The platform of the client application.
*
* @var ?string $platform
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Platform')]
public ?string $platform = null;
/**
* The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list)
*
* @var ?string $clientFeatures
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Features')]
public ?string $clientFeatures = null;
/**
* A potentially less friendly identifier for the device model
*
* @var ?string $model
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Model')]
public ?string $model = null;
/**
* The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca)
*
* @var ?string $xPlexSessionId
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Session-Id')]
public ?string $xPlexSessionId = null;
/**
* The language of the client application.
*
* @var ?string $xPlexLanguage
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Language')]
public ?string $xPlexLanguage = null;
/**
* The version of the platform
*
* @var ?string $platformVersion
*/
#[SpeakeasyMetadata('header:style=simple,explode=false,name=X-Plex-Platform-Version')]
public ?string $platformVersion = null;
/**
* @param string $clientID
* @param string $xPlexToken
* @param ?string $clientName
* @param ?string $deviceNickname
* @param ?string $deviceName
* @param ?string $deviceScreenResolution
* @param ?string $clientVersion
* @param ?string $platform
* @param ?string $clientFeatures
* @param ?string $model
* @param ?string $xPlexSessionId
* @param ?string $xPlexLanguage
* @param ?string $platformVersion
* @phpstan-pure
*/
public function __construct(string $clientID, string $xPlexToken, ?string $clientName = null, ?string $deviceNickname = null, ?string $deviceName = null, ?string $deviceScreenResolution = null, ?string $clientVersion = null, ?string $platform = null, ?string $clientFeatures = null, ?string $model = null, ?string $xPlexSessionId = null, ?string $xPlexLanguage = null, ?string $platformVersion = null)
{
$this->clientID = $clientID;
$this->xPlexToken = $xPlexToken;
$this->clientName = $clientName;
$this->deviceNickname = $deviceNickname;
$this->deviceName = $deviceName;
$this->deviceScreenResolution = $deviceScreenResolution;
$this->clientVersion = $clientVersion;
$this->platform = $platform;
$this->clientFeatures = $clientFeatures;
$this->model = $model;
$this->xPlexSessionId = $xPlexSessionId;
$this->xPlexLanguage = $xPlexLanguage;
$this->platformVersion = $platformVersion;
}
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Operations;
class GetUsersResponse
{
/**
* HTTP response content type for this operation
*
* @var string $contentType
*/
public string $contentType;
/**
* HTTP response status code for this operation
*
* @var int $statusCode
*/
public int $statusCode;
/**
* Raw HTTP response; suitable for custom response parsing
*
* @var \Psr\Http\Message\ResponseInterface $rawResponse
*/
public \Psr\Http\Message\ResponseInterface $rawResponse;
/**
*
* @var ?string $body
*/
public ?string $body = null;
/**
* @param string $contentType
* @param int $statusCode
* @param \Psr\Http\Message\ResponseInterface $rawResponse
* @param ?string $body
* @phpstan-pure
*/
public function __construct(string $contentType, int $statusCode, \Psr\Http\Message\ResponseInterface $rawResponse, ?string $body = null)
{
$this->contentType = $contentType;
$this->statusCode = $statusCode;
$this->rawResponse = $rawResponse;
$this->body = $body;
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Operations;
/** GetUsersResponseBody - Successful response with media container data in XML */
class GetUsersResponseBody
{
/**
* Container holding user and server details.
*
* @var ?GetUsersMediaContainer $mediaContainer
*/
public ?GetUsersMediaContainer $mediaContainer = null;
/**
* @param ?GetUsersMediaContainer $mediaContainer
* @phpstan-pure
*/
public function __construct(?GetUsersMediaContainer $mediaContainer = null)
{
$this->mediaContainer = $mediaContainer;
}
}

View File

@@ -0,0 +1,97 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
declare(strict_types=1);
namespace LukeHagar\Plex_API\Models\Operations;
class GetUsersServer
{
/**
* Unique ID of the server of the connected user
*
* @var int $id
*/
public int $id;
/**
* ID of the actual Plex server.
*
* @var int $serverId
*/
public int $serverId;
/**
* Machine identifier of the Plex server.
*
* @var string $machineIdentifier
*/
public string $machineIdentifier;
/**
* Name of the Plex server of the connected user.
*
* @var string $name
*/
public string $name;
/**
*
* @var int $lastSeenAt
*/
public int $lastSeenAt;
/**
* Number of libraries in the server this user has access to.
*
* @var int $numLibraries
*/
public int $numLibraries;
/**
*
* @var ?AllLibraries $allLibraries
*/
public ?AllLibraries $allLibraries = null;
/**
*
* @var ?Owned $owned
*/
public ?Owned $owned = null;
/**
*
* @var ?Pending $pending
*/
public ?Pending $pending = null;
/**
* @param int $id
* @param int $serverId
* @param string $machineIdentifier
* @param string $name
* @param int $lastSeenAt
* @param int $numLibraries
* @param ?AllLibraries $allLibraries
* @param ?Owned $owned
* @param ?Pending $pending
* @phpstan-pure
*/
public function __construct(int $id, int $serverId, string $machineIdentifier, string $name, int $lastSeenAt, int $numLibraries, ?AllLibraries $allLibraries = AllLibraries::Disable, ?Owned $owned = Owned::Disable, ?Pending $pending = Pending::Disable)
{
$this->id = $id;
$this->serverId = $serverId;
$this->machineIdentifier = $machineIdentifier;
$this->name = $name;
$this->lastSeenAt = $lastSeenAt;
$this->numLibraries = $numLibraries;
$this->allLibraries = $allLibraries;
$this->owned = $owned;
$this->pending = $pending;
}
}

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\Models\Operations;
/** Indicates if the user is part of a home group. */
enum Home: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the user owns the server. */
enum Owned: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the server is pending approval. */
enum Pending: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates whether the account is protected. */
enum ProtectedT: int
{
case Disable = 0;
case Enable = 1;
}

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\Models\Operations;
/** Indicates if the user has restricted access. */
enum Restricted: int
{
case Disable = 0;
case Enable = 1;
}

View File

@@ -12,19 +12,181 @@ namespace LukeHagar\Plex_API\Models\Operations;
class User class User
{ {
/** /**
* User's unique ID.
* *
* @var ?int $id * @var int $id
*/ */
#[\Speakeasy\Serializer\Annotation\SerializedName('id')] public int $id;
#[\Speakeasy\Serializer\Annotation\SkipWhenNull]
public ?int $id = null;
/** /**
* @param ?int $id * User's display name.
*
* @var string $title
*/
public string $title;
/**
* User's username.
*
* @var string $username
*/
public string $username;
/**
* User's email address.
*
* @var string $email
*/
public string $email;
/**
* URL to the user's avatar image.
*
* @var string $thumb
*/
public string $thumb;
/**
* List of servers owned by the user.
*
* @var array<GetUsersServer> $server
*/
public array $server;
/**
* Filters applied for television.
*
* @var ?string $filterTelevision
*/
public ?string $filterTelevision = null;
/**
* ID of the user's recommendation playlist.
*
* @var ?string $recommendationsPlaylistId
*/
public ?string $recommendationsPlaylistId = null;
/**
* Filters applied for all content.
*
* @var ?string $filterAll
*/
public ?string $filterAll = null;
/**
* Filters applied for movies.
*
* @var ?string $filterMovies
*/
public ?string $filterMovies = null;
/**
* Filters applied for music.
*
* @var ?string $filterMusic
*/
public ?string $filterMusic = null;
/**
* Filters applied for photos.
*
* @var ?string $filterPhotos
*/
public ?string $filterPhotos = null;
/**
*
* @var ?ProtectedT $protected
*/
public ?ProtectedT $protected = null;
/**
*
* @var ?Home $home
*/
public ?Home $home = null;
/**
*
* @var ?AllowTuners $allowTuners
*/
public ?AllowTuners $allowTuners = null;
/**
*
* @var ?AllowSync $allowSync
*/
public ?AllowSync $allowSync = null;
/**
*
* @var ?AllowCameraUpload $allowCameraUpload
*/
public ?AllowCameraUpload $allowCameraUpload = null;
/**
*
* @var ?AllowChannels $allowChannels
*/
public ?AllowChannels $allowChannels = null;
/**
*
* @var ?AllowSubtitleAdmin $allowSubtitleAdmin
*/
public ?AllowSubtitleAdmin $allowSubtitleAdmin = null;
/**
*
* @var ?Restricted $restricted
*/
public ?Restricted $restricted = null;
/**
* @param int $id
* @param string $title
* @param string $username
* @param string $email
* @param string $thumb
* @param array<GetUsersServer> $server
* @param ?ProtectedT $protected
* @param ?Home $home
* @param ?AllowTuners $allowTuners
* @param ?AllowSync $allowSync
* @param ?AllowCameraUpload $allowCameraUpload
* @param ?AllowChannels $allowChannels
* @param ?AllowSubtitleAdmin $allowSubtitleAdmin
* @param ?string $filterTelevision
* @param ?Restricted $restricted
* @param ?string $recommendationsPlaylistId
* @param ?string $filterAll
* @param ?string $filterMovies
* @param ?string $filterMusic
* @param ?string $filterPhotos
* @phpstan-pure * @phpstan-pure
*/ */
public function __construct(?int $id = null) public function __construct(int $id, string $title, string $username, string $email, string $thumb, array $server, ?string $filterTelevision = null, ?string $recommendationsPlaylistId = null, ?string $filterAll = null, ?string $filterMovies = null, ?string $filterMusic = null, ?string $filterPhotos = null, ?ProtectedT $protected = ProtectedT::Disable, ?Home $home = Home::Disable, ?AllowTuners $allowTuners = AllowTuners::Disable, ?AllowSync $allowSync = AllowSync::Disable, ?AllowCameraUpload $allowCameraUpload = AllowCameraUpload::Disable, ?AllowChannels $allowChannels = AllowChannels::Disable, ?AllowSubtitleAdmin $allowSubtitleAdmin = AllowSubtitleAdmin::Disable, ?Restricted $restricted = Restricted::Disable)
{ {
$this->id = $id; $this->id = $id;
$this->title = $title;
$this->username = $username;
$this->email = $email;
$this->thumb = $thumb;
$this->server = $server;
$this->filterTelevision = $filterTelevision;
$this->recommendationsPlaylistId = $recommendationsPlaylistId;
$this->filterAll = $filterAll;
$this->filterMovies = $filterMovies;
$this->filterMusic = $filterMusic;
$this->filterPhotos = $filterPhotos;
$this->protected = $protected;
$this->home = $home;
$this->allowTuners = $allowTuners;
$this->allowSync = $allowSync;
$this->allowCameraUpload = $allowCameraUpload;
$this->allowChannels = $allowChannels;
$this->allowSubtitleAdmin = $allowSubtitleAdmin;
$this->restricted = $restricted;
} }
} }

View File

@@ -200,6 +200,8 @@ class PlexAPI
*/ */
public Updater $updater; public Updater $updater;
public Users $users;
/** /**
* Returns a new instance of the SDK builder used to configure and create the SDK instance. * Returns a new instance of the SDK builder used to configure and create the SDK instance.
* *
@@ -232,6 +234,7 @@ class PlexAPI
$this->statistics = new Statistics($this->sdkConfiguration); $this->statistics = new Statistics($this->sdkConfiguration);
$this->sessions = new Sessions($this->sdkConfiguration); $this->sessions = new Sessions($this->sdkConfiguration);
$this->updater = new Updater($this->sdkConfiguration); $this->updater = new Updater($this->sdkConfiguration);
$this->users = new Users($this->sdkConfiguration);
$this->sdkConfiguration->client = $this->sdkConfiguration->initHooks($this->sdkConfiguration->client); $this->sdkConfiguration->client = $this->sdkConfiguration->initHooks($this->sdkConfiguration->client);
} }

View File

@@ -33,11 +33,11 @@ class SDKConfiguration
public string $openapiDocVersion = '0.0.3'; public string $openapiDocVersion = '0.0.3';
public string $sdkVersion = '0.12.6'; public string $sdkVersion = '0.12.7';
public string $genVersion = '2.503.2'; public string $genVersion = '2.506.0';
public string $userAgent = 'speakeasy-sdk/php 0.12.6 2.503.2 0.0.3 lukehagar/plex-api'; public string $userAgent = 'speakeasy-sdk/php 0.12.7 2.506.0 0.0.3 lukehagar/plex-api';
public ?RetryConfig $retryConfig = null; public ?RetryConfig $retryConfig = null;

142
src/Users.php Normal file
View File

@@ -0,0 +1,142 @@
<?php
/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
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 Users
{
public const GET_USERS_SERVERS = [
'https://plex.tv/api',
];
private SDKConfiguration $sdkConfiguration;
/**
* @param SDKConfiguration $sdkConfig
*/
public function __construct(public SDKConfiguration $sdkConfig)
{
$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 list of all connected users
*
* Get list of all users that are friends and have library access with the provided Plex authentication token
*
* @param Operations\GetUsersRequest $request
* @param ?string $serverURL
* @return Operations\GetUsersResponse
* @throws \LukeHagar\Plex_API\Models\Errors\SDKException
*/
public function getUsers(Operations\GetUsersRequest $request, ?string $serverURL = null, ?Options $options = null): Operations\GetUsersResponse
{
$baseUrl = Utils\Utils::templateUrl(Users::GET_USERS_SERVERS[0], [
]);
if (! empty($serverURL)) {
$baseUrl = $serverURL;
}
$url = Utils\Utils::generateUrl($baseUrl, '/users');
$urlOverride = null;
$httpOptions = ['http_errors' => false];
$httpOptions = array_merge_recursive($httpOptions, Utils\Utils::getHeaders($request));
if (! array_key_exists('headers', $httpOptions)) {
$httpOptions['headers'] = [];
}
$httpOptions['headers']['Accept'] = 'application/xml';
$httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$hookContext = new HookContext('get-users', 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);
$httpResponse = $res;
}
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';
$statusCode = $httpResponse->getStatusCode();
if (Utils\Utils::matchStatusCodes($statusCode, ['400', '401', '4XX', '5XX'])) {
$res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null);
$httpResponse = $res;
}
if (Utils\Utils::matchStatusCodes($statusCode, ['200'])) {
if (Utils\Utils::matchContentType($contentType, 'application/xml')) {
$httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse);
$obj = $httpResponse->getBody()->getContents();
return new Operations\GetUsersResponse(
statusCode: $statusCode,
contentType: $contentType,
rawResponse: $httpResponse,
body: $obj);
} else {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
}
} elseif (Utils\Utils::matchStatusCodes($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\GetUsersBadRequest', '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 (Utils\Utils::matchStatusCodes($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\GetUsersUnauthorized', '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 (Utils\Utils::matchStatusCodes($statusCode, ['4XX'])) {
throw new \LukeHagar\Plex_API\Models\Errors\SDKException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse);
} elseif (Utils\Utils::matchStatusCodes($statusCode, ['5XX'])) {
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);
}
}
}