mirror of
https://github.com/LukeHagar/plexphp.git
synced 2025-12-06 04:20:51 +00:00
155 lines
6.3 KiB
Markdown
155 lines
6.3 KiB
Markdown
# Updater
|
|
|
|
|
|
## Overview
|
|
|
|
This describes the API for searching and applying updates to the Plex Media Server.
|
|
Updates to the status can be observed via the Event API.
|
|
|
|
|
|
### 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
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use \LukeHagar\Plex_API;
|
|
use \LukeHagar\Plex_API\Models\Components;
|
|
|
|
$security = new Components\Security();
|
|
$security->accessToken = '<YOUR_API_KEY_HERE>';
|
|
|
|
$sdk = Plex_API\PlexAPI::builder()
|
|
->setXPlexClientIdentifier('<value>')
|
|
->setSecurity($security)->build();
|
|
|
|
try {
|
|
$response = $sdk->updater->getUpdateStatus();
|
|
|
|
if ($response->twoHundredApplicationJsonObject !== null) {
|
|
// handle response
|
|
}
|
|
} catch (Throwable $e) {
|
|
// handle exception
|
|
}
|
|
```
|
|
|
|
|
|
### Response
|
|
|
|
**[?\LukeHagar\Plex_API\Models\Operations\GetUpdateStatusResponse](../../Models/Operations/GetUpdateStatusResponse.md)**
|
|
|
|
|
|
## checkForUpdates
|
|
|
|
Checking for updates
|
|
|
|
### Example Usage
|
|
|
|
```php
|
|
<?php
|
|
|
|
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('<value>')
|
|
->setSecurity($security)->build();
|
|
|
|
try {
|
|
|
|
|
|
$response = $sdk->updater->checkForUpdates(Operations\Download::One);
|
|
|
|
if ($response->statusCode === 200) {
|
|
// handle response
|
|
}
|
|
} catch (Throwable $e) {
|
|
// handle exception
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
| `download` | [\LukeHagar\Plex_API\Models\Operations\Download](../../Models/Operations/Download.md) | :heavy_minus_sign: | Indicate that you want to start download any updates found. |
|
|
|
|
|
|
### Response
|
|
|
|
**[?\LukeHagar\Plex_API\Models\Operations\CheckForUpdatesResponse](../../Models/Operations/CheckForUpdatesResponse.md)**
|
|
|
|
|
|
## applyUpdates
|
|
|
|
Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
|
|
|
|
|
|
### Example Usage
|
|
|
|
```php
|
|
<?php
|
|
|
|
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('<value>')
|
|
->setSecurity($security)->build();
|
|
|
|
try {
|
|
|
|
|
|
$response = $sdk->updater->applyUpdates(Operations\Tonight::One, Operations\Skip::Zero);
|
|
|
|
if ($response->statusCode === 200) {
|
|
// handle response
|
|
}
|
|
} catch (Throwable $e) {
|
|
// handle exception
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `tonight` | [\LukeHagar\Plex_API\Models\Operations\Tonight](../../Models/Operations/Tonight.md) | :heavy_minus_sign: | Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install |
|
|
| `skip` | [\LukeHagar\Plex_API\Models\Operations\Skip](../../Models/Operations/Skip.md) | :heavy_minus_sign: | Indicate that the latest version should be marked as skipped. The <Release> entry for this version will have the `state` set to `skipped`. |
|
|
|
|
|
|
### Response
|
|
|
|
**[?\LukeHagar\Plex_API\Models\Operations\ApplyUpdatesResponse](../../Models/Operations/ApplyUpdatesResponse.md)**
|
|
|