mirror of
https://github.com/LukeHagar/plexgo.git
synced 2025-12-06 04:20:46 +00:00
170 lines
8.7 KiB
Markdown
170 lines
8.7 KiB
Markdown
# Updater
|
|
(*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
|
|
|
|
```go
|
|
package main
|
|
|
|
import(
|
|
"github.com/LukeHagar/plexgo/models/components"
|
|
"github.com/LukeHagar/plexgo"
|
|
"context"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
s := plexgo.New(
|
|
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
|
)
|
|
|
|
ctx := context.Background()
|
|
res, err := s.Updater.GetUpdateStatus(ctx)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if res.Object != nil {
|
|
// handle response
|
|
}
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
|
|
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
|
|
|
|
|
|
### Response
|
|
|
|
**[*operations.GetUpdateStatusResponse](../../models/operations/getupdatestatusresponse.md), error**
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
|
|
| sdkerrors.GetUpdateStatusResponseBody | 401 | application/json |
|
|
| sdkerrors.SDKError | 4xx-5xx | */* |
|
|
|
|
## CheckForUpdates
|
|
|
|
Checking for updates
|
|
|
|
### Example Usage
|
|
|
|
```go
|
|
package main
|
|
|
|
import(
|
|
"github.com/LukeHagar/plexgo/models/components"
|
|
"github.com/LukeHagar/plexgo"
|
|
"github.com/LukeHagar/plexgo/models/operations"
|
|
"context"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
s := plexgo.New(
|
|
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
|
)
|
|
|
|
|
|
var download *operations.Download = operations.DownloadOne.ToPointer()
|
|
|
|
ctx := context.Background()
|
|
res, err := s.Updater.CheckForUpdates(ctx, download)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if res != nil {
|
|
// handle response
|
|
}
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- |
|
|
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
|
|
| `download` | [*operations.Download](../../models/operations/download.md) | :heavy_minus_sign: | Indicate that you want to start download any updates found. |
|
|
|
|
|
|
### Response
|
|
|
|
**[*operations.CheckForUpdatesResponse](../../models/operations/checkforupdatesresponse.md), error**
|
|
| Error Object | Status Code | Content Type |
|
|
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
|
|
| sdkerrors.CheckForUpdatesResponseBody | 401 | application/json |
|
|
| sdkerrors.SDKError | 4xx-5xx | */* |
|
|
|
|
## 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
|
|
|
|
```go
|
|
package main
|
|
|
|
import(
|
|
"github.com/LukeHagar/plexgo/models/components"
|
|
"github.com/LukeHagar/plexgo"
|
|
"github.com/LukeHagar/plexgo/models/operations"
|
|
"context"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
s := plexgo.New(
|
|
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
|
)
|
|
|
|
|
|
var tonight *operations.Tonight = operations.TonightOne.ToPointer()
|
|
|
|
var skip *operations.Skip = operations.SkipZero.ToPointer()
|
|
|
|
ctx := context.Background()
|
|
res, err := s.Updater.ApplyUpdates(ctx, tonight, skip)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if res != nil {
|
|
// handle response
|
|
}
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
|
|
| `tonight` | [*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` | [*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
|
|
|
|
**[*operations.ApplyUpdatesResponse](../../models/operations/applyupdatesresponse.md), error**
|
|
| Error Object | Status Code | Content Type |
|
|
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
|
| sdkerrors.ApplyUpdatesResponseBody | 401 | application/json |
|
|
| sdkerrors.SDKError | 4xx-5xx | */* |
|