mirror of
https://github.com/LukeHagar/plexphp.git
synced 2025-12-06 04:20:51 +00:00
10 KiB
10 KiB
Hubs
(hubs)
Overview
Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
Available Operations
- getRecentlyAdded - Get Recently Added
- getGlobalHubs - Get Global Hubs
- getLibraryHubs - Get library specific hubs
getRecentlyAdded
This endpoint will return the recently added content.
Example Usage
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$request = new Operations\GetRecentlyAddedRequest(
contentDirectoryID: 470161,
type: Operations\Type::TvShow,
sectionID: 2,
);
$response = $sdk->hubs->getRecentlyAdded(
request: $request
);
if ($response->object !== null) {
// handle response
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\GetRecentlyAddedRequest | ✔️ | The request object to use for the request. |
Response
?Operations\GetRecentlyAddedResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\SDKException | 4XX, 5XX | */* |
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\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->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 | ➖ | 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 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
Example Usage
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$response = $sdk->hubs->getLibraryHubs(
sectionId: 6728.76,
count: 639.24,
onlyTransient: Operations\QueryParamOnlyTransient::One
);
if ($response->object !== null) {
// handle response
}
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 Type | Status Code | Content Type |
|---|---|---|
| Errors\GetLibraryHubsBadRequest | 400 | application/json |
| Errors\GetLibraryHubsUnauthorized | 401 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |