Files
plexgo/docs/sdks/updater/README.md

8.7 KiB
Raw Blame History

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

Querying status of updates

Example Usage

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 ✔️ The context to use for the request.

Response

*operations.GetUpdateStatusResponse, error

Error Object Status Code Content Type
sdkerrors.GetUpdateStatusResponseBody 401 application/json
sdkerrors.SDKError 4xx-5xx /

CheckForUpdates

Checking for updates

Example Usage

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 ✔️ The context to use for the request.
download *operations.Download Indicate that you want to start download any updates found.

Response

*operations.CheckForUpdatesResponse, 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

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 ✔️ The context to use for the request.
tonight *operations.Tonight 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 Indicate that the latest version should be marked as skipped. The entry for this version will have the state set to skipped.

Response

*operations.ApplyUpdatesResponse, error

Error Object Status Code Content Type
sdkerrors.ApplyUpdatesResponseBody 401 application/json
sdkerrors.SDKError 4xx-5xx /