mirror of
https://github.com/LukeHagar/plexphp.git
synced 2025-12-06 04:20:51 +00:00
8.4 KiB
8.4 KiB
Hubs
Overview
Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
Available Operations
- getGlobalHubs - Get Global Hubs
- getLibraryHubs - Get library specific hubs
getGlobalHubs
Get Global Hubs filtered by the parameters provided.
Example Usage
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Components;
use LukeHagar\Plex_API\Models\Operations;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->hubs->getGlobalHubs(1262.49, Operations\OnlyTransient::One);
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
count |
float | ➖ | The number of items to return with each hub. |
onlyTransient |
Operations\OnlyTransient | ➖ | 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
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetGlobalHubsResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getLibraryHubs
This endpoint will return a list of library specific hubs
Example Usage
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Components;
use LukeHagar\Plex_API\Models\Operations;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->hubs->getLibraryHubs(6728.76, 9010.22, Operations\QueryParamOnlyTransient::Zero);
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sectionId |
float | ✔️ | the Id of the library to query |
count |
float | ➖ | The number of items to return with each hub. |
onlyTransient |
Operations\QueryParamOnlyTransient | ➖ | 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\GetLibraryHubsResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetLibraryHubsResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |