plexgo

package module
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 14 Imported by: 3

README

github.com/LukeHagar/plexgo

Summary

Plex Media Server: OpenAPI specification for the Plex Media Server (PMS) API and the plex.tv cloud API.

Base URLs

  • PMS (local server): http(s)://{host}:{port} — Most endpoints in this spec target the local PMS.
  • plex.tv v2: https://plex.tv/api/v2 — Authentication, account, and social endpoints.
  • plex.tv v1 (legacy): https://plex.tv/api — Legacy XML endpoints (friends, home users, claims).
  • Cloud providers: https://discover.provider.plex.tv, https://metadata.provider.plex.tv, etc.

Endpoints that target plex.tv or cloud providers declare an override servers array.

Authentication

  • X-Plex-Token: Pass via the X-Plex-Token header on every request. It may also be passed as a query parameter (?X-Plex-Token=...) on all endpoints.
  • X-Plex-Client-Identifier: Mandatory for OAuth PIN flow (/pins) and JWT device registration. Must be a unique, persistent identifier for the client application.
  • OAuth PIN Flow: POST /pins → user visits https://plex.tv/linkGET /pins/{pinId} → obtain authToken.

Response Formats

  • PMS endpoints: Return XML by default. Send Accept: application/json to receive JSON.
  • plex.tv v2: Returns JSON by default.
  • Legacy v1 endpoints (/pins.xml, /api/resources, /api/users/): Return XML only.

Rate Limiting

plex.tv auth endpoints (PIN creation, sign-in) enforce rate limits. Clients should implement exponential backoff and reuse tokens rather than re-authenticating on every request.

Table of Contents

SDK Installation

To add the SDK as a dependency to your project:

go get github.com/LukeHagar/plexgo

SDK Example Usage

Example
package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
	)

	res, err := s.Transcoder.StartTranscodeSession(ctx, operations.StartTranscodeSessionRequest{
		TranscodeType:             components.TranscodeTypeMusic,
		AdvancedSubtitles:         components.AdvancedSubtitlesBurn.ToPointer(),
		Extension:                 operations.ExtensionMpd,
		AudioBoost:                plexgo.Pointer[int64](50),
		AudioChannelCount:         plexgo.Pointer[int64](5),
		AutoAdjustQuality:         components.BoolIntTrue.ToPointer(),
		AutoAdjustSubtitle:        components.BoolIntTrue.ToPointer(),
		DirectPlay:                components.BoolIntTrue.ToPointer(),
		DirectStream:              components.BoolIntTrue.ToPointer(),
		DirectStreamAudio:         components.BoolIntTrue.ToPointer(),
		DisableResolutionRotation: components.BoolIntTrue.ToPointer(),
		HasMDE:                    components.BoolIntTrue.ToPointer(),
		Location:                  operations.StartTranscodeSessionQueryParamLocationWan.ToPointer(),
		MediaBufferSize:           plexgo.Pointer[int64](102400),
		MediaIndex:                plexgo.Pointer[int64](0),
		MusicBitrate:              plexgo.Pointer[int64](5000),
		Offset:                    plexgo.Pointer[float64](90.5),
		PartIndex:                 plexgo.Pointer[int64](0),
		Path:                      plexgo.Pointer("/library/metadata/151671"),
		PeakBitrate:               plexgo.Pointer[int64](12000),
		PhotoResolution:           plexgo.Pointer("1080x1080"),
		Protocol:                  operations.StartTranscodeSessionQueryParamProtocolDash.ToPointer(),
		SecondsPerSegment:         plexgo.Pointer[int64](5),
		SubtitleSize:              plexgo.Pointer[int64](50),
		Subtitles:                 operations.StartTranscodeSessionQueryParamSubtitlesBurn.ToPointer(),
		VideoResolution:           plexgo.Pointer("1080x1080"),
		Copyts:                    components.BoolIntTrue.ToPointer(),
		VideoBitrate:              plexgo.Pointer[int64](12000),
		VideoQuality:              plexgo.Pointer[int64](50),
		XPlexClientProfileExtra:   plexgo.Pointer("add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)"),
		XPlexClientProfileName:    plexgo.Pointer("generic"),
	})
	if err != nil {
		log.Fatal(err)
	}
	if res.TwoHundredApplicationVndAppleMpegurlBinaryResponse != nil {
		// handle response
	}
}

Available Resources and Operations

Available methods
Activities
Authentication
Butler
Collections
Content
Devices
DownloadQueue
DVRs
Epg
Events
General
Hubs
Library
LibraryCollections
LibraryPlaylists
LiveTV
Log
  • WriteLog - Logging a multi-line message to the Plex Media Server log
  • WriteMessage - Logging a single-line message to the Plex Media Server log
  • EnablePapertrail - Enabling Papertrail
PlayQueue
Playback
Playlist
Playlists
Plex
Preferences
Provider
Rate
Status
Subscriptions
Timeline
Transcoder
UltraBlur
Updater
Users

Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a retry.Config object to the call by using the WithRetries option:

package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"github.com/LukeHagar/plexgo/retry"
	"log"
	"models/operations"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
	)

	res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{}, operations.WithRetries(
		retry.Config{
			Strategy: "backoff",
			Backoff: &retry.BackoffStrategy{
				InitialInterval: 1,
				MaxInterval:     50,
				Exponent:        1.1,
				MaxElapsedTime:  100,
			},
			RetryConnectionErrors: false,
		}))
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

If you'd like to override the default retry strategy for all operations that support retries, you can use the WithRetryConfig option at SDK initialization:

package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"github.com/LukeHagar/plexgo/retry"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithRetryConfig(
			retry.Config{
				Strategy: "backoff",
				Backoff: &retry.BackoffStrategy{
					InitialInterval: 1,
					MaxInterval:     50,
					Exponent:        1.1,
					MaxElapsedTime:  100,
				},
				RetryConnectionErrors: false,
			}),
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
	)

	res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{})
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both.

By Default, an API error will return sdkerrors.SDKError. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective Errors tables in SDK docs for more details on possible error types for each operation.

For example, the GetServerInfo function may return the following errors:

Error Type Status Code Content Type
sdkerrors.Error 401 application/json
sdkerrors.SDKError 4XX, 5XX */*
Example
package main

import (
	"context"
	"errors"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"github.com/LukeHagar/plexgo/models/sdkerrors"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
	)

	res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{})
	if err != nil {

		var e *sdkerrors.Error
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}

		var e *sdkerrors.SDKError
		if errors.As(err, &e) {
			// handle error
			log.Fatal(e.Error())
		}
	}
}

Server Selection

Select Server by Index

You can override the default server globally using the WithServerIndex(serverIndex int) option when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

# Server Variables Description
0 https://{IP-description}.{identifier}.plex.direct:{port} identifier
IP-description
port
1 {protocol}://{host}:{port} host
port
protocol
2 https://{full_server_url} full_server_url

If the selected server has variables, you may override its default values using the associated option(s):

Variable Option Default Description
identifier WithIdentifier(identifier string) "0123456789abcdef0123456789abcdef" The unique identifier of this particular PMS
IP-description WithIPDescription(ipDescription string) "1-2-3-4" A - separated string of the IPv4 or IPv6 address components
port WithPort(port string) "32400" The Port number configured on the PMS. Typically (32400).
If using a reverse proxy, this would be the port number configured on the proxy.
host WithHost(host string) "localhost" The Host of the PMS.
If using on a local network, this is the internal IP address of the server hosting the PMS.
If using on an external network, this is the external IP address for your network, and requires port forwarding.
If using a reverse proxy, this would be the external DNS domain for your network, and requires the proxy handle port forwarding.
protocol WithProtocol(protocol string) "http" The network protocol to use. Typically (http or https)
full_server_url WithFullServerURL(fullServerURL string) "http://localhost:32400" The full manual URL to access the PMS
Example
package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithServerIndex(0),
		plexgo.WithIdentifier("0123456789abcdef0123456789abcdef"),
		plexgo.WithIPDescription("1-2-3-4"),
		plexgo.WithPort("32400"),
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
	)

	res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{})
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

Override Server URL Per-Client

The default server can also be overridden globally using the WithServerURL(serverURL string) option when initializing the SDK client instance. For example:

package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithServerURL("https://http://localhost:32400"),
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
	)

	res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{})
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

Override Server URL Per-Operation

The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:

package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
	)

	res, err := s.General.GetUserWebhooks(ctx, operations.WithServerURL("https://plex.tv/api/v2"))
	if err != nil {
		log.Fatal(err)
	}
	if res.WebhookPayload != nil {
		// handle response
	}
}

Custom HTTP Client

The Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

The built-in net/http client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.

import (
	"net/http"
	"time"

	"github.com/LukeHagar/plexgo"
)

var (
	httpClient = &http.Client{Timeout: 30 * time.Second}
	sdkClient  = plexgo.New(plexgo.WithClient(httpClient))
)

This can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
Token apiKey API key

You can configure it using the WithSecurity option when initializing the SDK client instance. For example:

package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
	)

	res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{})
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:

package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
	ctx := context.Background()

	s := plexgo.New(
		plexgo.WithAccepts(components.AcceptsApplicationXML),
		plexgo.WithClientIdentifier("abc123"),
		plexgo.WithProduct("Plex for Roku"),
		plexgo.WithVersion("2.4.1"),
		plexgo.WithPlatform("Roku"),
		plexgo.WithPlatformVersion("4.3 build 1057"),
		plexgo.WithDevice("Roku 3"),
		plexgo.WithModel("4200X"),
		plexgo.WithDeviceVendor("Roku"),
		plexgo.WithDeviceName("Living Room TV"),
		plexgo.WithMarketplace("googlePlay"),
	)

	res, err := s.Authentication.CreateOAuthPin(ctx, operations.CreateOAuthPinRequest{}, operations.CreateOAuthPinSecurity{
		ClientIdentifier: "<YOUR_API_KEY_HERE>",
	})
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

Special Types

This SDK defines the following custom types to assist with marshalling and unmarshalling data.

Date

types.Date is a wrapper around time.Time that allows for JSON marshaling a date string formatted as "2006-01-02".

Usage
d1 := types.NewDate(time.Now()) // returns *types.Date

d2 := types.DateFromTime(time.Now()) // returns types.Date

d3, err := types.NewDateFromString("2019-01-01") // returns *types.Date, error

d4, err := types.DateFromString("2019-01-01") // returns types.Date, error

d5 := types.MustNewDateFromString("2019-01-01") // returns *types.Date and panics on error

d6 := types.MustDateFromString("2019-01-01") // returns types.Date and panics on error

Development

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!

SDK Created by Speakeasy

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{
	"https://{IP-description}.{identifier}.plex.direct:{port}",
	"{protocol}://{host}:{port}",
	"https://{full_server_url}",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func Pointer added in v0.11.6

func Pointer[T any](v T) *T

Pointer provides a helper function to return a pointer to a type

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type Activities

type Activities struct {
	// contains filtered or unexported fields
}

Activities provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.

Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.

Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint.

func (*Activities) CancelActivity added in v0.26.0

CancelActivity - Cancel a running activity Cancel a running activity. Admins can cancel all activities but other users can only cancel their own

If set, this operation will use [Security.Token] from the global security.

func (*Activities) ListActivities added in v0.26.0

func (s *Activities) ListActivities(ctx context.Context, opts ...operations.Option) (*operations.ListActivitiesResponse, error)

ListActivities - Get all activities List all activities on the server. Admins can see all activities but other users can only see their own

type Authentication added in v0.4.1

type Authentication struct {
	// contains filtered or unexported fields
}

Plex Authentication operations

func (*Authentication) ChangePassword added in v0.29.0

ChangePassword - Change Password Change or reset the logged-in user's password.

func (*Authentication) CreateLegacyPin added in v0.29.0

CreateLegacyPin - Create Legacy PIN Legacy PIN creation (XML).

func (*Authentication) CreateOAuthPin added in v0.29.0

CreateOAuthPin - Create OAuth PIN Create a 4-character PIN for device linking via OAuth. The user must visit https://plex.tv/link and enter the PIN to authorize the device.

func (*Authentication) ExchangeJWTToken added in v0.29.0

ExchangeJWTToken - Exchange JWT Token Exchange a signed client JWT for a Plex JWT token.

func (*Authentication) GetAuthKeys added in v0.29.0

GetAuthKeys - Get Auth Keys Get Plex public JWKs for signature verification.

func (*Authentication) GetAuthNonce added in v0.29.0

GetAuthNonce - Get Auth Nonce Get a nonce to sign in client JWT authentication flow.

func (*Authentication) GetClaimToken added in v0.29.0

GetClaimToken - Get Claim Token Get a claim token for new server setup.

func (*Authentication) GetFeatures added in v0.29.0

GetFeatures - Get Features Get Plex Pass feature flags for the logged-in user.

func (*Authentication) GetOAuthPin added in v0.29.0

GetOAuthPin - Get OAuth PIN Status Poll the PIN status. Returns authToken when the user has linked the device.

func (*Authentication) GetServerAccessTokens added in v0.29.0

GetServerAccessTokens - Get Server Access Tokens List access tokens for the server.

func (*Authentication) GetTokenDetails added in v0.11.2

GetTokenDetails - Get Token Details Get the User data from the provided X-Plex-Token

func (*Authentication) LinkOAuthPin added in v0.29.0

LinkOAuthPin - Link OAuth PIN Link a PIN to an account (OAuth completion).

func (*Authentication) Ping added in v0.29.0

Ping the server Health / latency check. No authentication required.

func (*Authentication) PostUsersSignInData added in v0.11.1

PostUsersSignInData - Get User Sign In Data Sign in user with username and password and return user data with Plex authentication token

func (*Authentication) RegisterDeviceJWK added in v0.29.0

RegisterDeviceJWK - Register Device JWK Register a device public key (JWK) for JWT-based authentication.

func (*Authentication) SignOut added in v0.29.0

SignOut - Sign Out Invalidate the current authentication token.

func (*Authentication) SwitchHomeUser added in v0.29.0

SwitchHomeUser - Switch Home User Switch to a Plex Home user and return a new auth token.

type Butler

type Butler struct {
	// contains filtered or unexported fields
}

Butler - The butler is responsible for running periodic tasks. Some tasks run daily, others every few days, and some weekly. These includes database maintenance, metadata updating, thumbnail generation, media analysis, and other tasks.

func (*Butler) GetTasks added in v0.26.0

func (s *Butler) GetTasks(ctx context.Context, opts ...operations.Option) (*operations.GetTasksResponse, error)

GetTasks - Get all Butler tasks Get the list of butler tasks and their scheduling

If set, this operation will use [Security.Token] from the global security.

func (*Butler) StartTask

StartTask - Start a single Butler task This endpoint will attempt to start a specific Butler task by name.

If set, this operation will use [Security.Token] from the global security.

func (*Butler) StartTasks added in v0.26.0

func (s *Butler) StartTasks(ctx context.Context, opts ...operations.Option) (*operations.StartTasksResponse, error)

StartTasks - Start all Butler tasks This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:

  1. Any tasks not scheduled to run on the current day will be skipped.
  2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
  3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
  4. If we are outside the configured window, the task will start immediately.

If set, this operation will use [Security.Token] from the global security.

func (*Butler) StopTask

StopTask - Stop a single Butler task This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists

If set, this operation will use [Security.Token] from the global security.

func (*Butler) StopTasks added in v0.26.0

func (s *Butler) StopTasks(ctx context.Context, opts ...operations.Option) (*operations.StopTasksResponse, error)

StopTasks - Stop all Butler tasks This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.

If set, this operation will use [Security.Token] from the global security.

type Collections added in v0.26.0

type Collections struct {
	// contains filtered or unexported fields
}

Collections - API Operations against the Collections

func (*Collections) CreateCollection added in v0.26.0

CreateCollection - Create collection Create a collection in the library

type Content added in v0.26.0

type Content struct {
	// contains filtered or unexported fields
}

Content - The actual content of the media provider

func (*Content) GetAlbums added in v0.26.0

GetAlbums - Set section albums Get all albums in a music section

func (*Content) GetAllLeaves added in v0.26.0

GetAllLeaves - Set section leaves Get all leaves in a section (such as episodes in a show section)

func (*Content) GetArts added in v0.26.0

GetArts - Set section artwork Get artwork for a library section

func (*Content) GetCategories added in v0.26.0

GetCategories - Set section categories Get categories in a library section

func (*Content) GetCluster added in v0.26.0

GetCluster - Set section clusters Get clusters in a library section (typically for photos)

func (*Content) GetCollectionImage added in v0.26.0

GetCollectionImage - Get a collection's image Get an image for the collection based on the items within

func (*Content) GetCollectionItems added in v0.26.0

GetCollectionItems - Get items in a collection Get items in a collection. Note if this collection contains more than 100 items, paging must be used.

func (*Content) GetFolders added in v0.26.0

GetFolders - Get all folder locations Get all folder locations of the media in a section

func (*Content) GetMetadataItem added in v0.26.0

GetMetadataItem - Get a metadata item Get one or more metadata items.

func (*Content) GetSonicPath added in v0.26.0

GetSonicPath - Similar tracks to transition from one to another Get a list of audio tracks starting at one and ending at another which are similar across the path

func (*Content) GetSonicallySimilar added in v0.26.0

GetSonicallySimilar - The nearest audio tracks Get the nearest audio tracks to a particular analysis

func (*Content) ListContent added in v0.26.0

ListContent - Get items in the section Get the items in a section, potentially filtering them. When `includeCollections=1` is passed, the response may also contain `Collection` items.

If set, this operation will use [Security.Token] from the global security.

func (*Content) ListMoments added in v0.26.0

ListMoments - Set section moments Get moments in a library section (typically for photos)

type DVRs added in v0.26.0

type DVRs struct {
	// contains filtered or unexported fields
}

DVRs - The DVR provides means to watch and record live TV. This section of endpoints describes how to setup the DVR itself

func (*DVRs) AddDeviceToDVR added in v0.26.0

AddDeviceToDVR - Add a device to an existing DVR Add a device to an existing DVR

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) AddLineup added in v0.26.0

AddLineup - Add a DVR Lineup Add a lineup to a DVR device's set of lineups.

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) CreateDVR added in v0.26.0

CreateDVR - Create a DVR Creation of a DVR, after creation of a device and a lineup is selected

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) DeleteDVR added in v0.26.0

DeleteDVR - Delete a single DVR Delete a single DVR by its id (key)

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) DeleteLineup added in v0.26.0

DeleteLineup - Delete a DVR Lineup Deletes a DVR device's lineup.

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) GetDVR added in v0.26.0

GetDVR - Get a single DVR Get a single DVR by its id (key)

func (*DVRs) GetDVRChannels added in v0.29.0

GetDVRChannels - Get DVR Channels List channels directly associated with a DVR.

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) GetDVRGuide added in v0.29.0

GetDVRGuide - Get DVR Guide Fetch program guide/schedule for a DVR.

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) ListDVRs added in v0.26.0

func (s *DVRs) ListDVRs(ctx context.Context, uuid *string, lineup *string, opts ...operations.Option) (*operations.ListDVRsResponse, error)

ListDVRs - Get DVRs Get the list of all available DVRs

func (*DVRs) PatchDVRSettings added in v0.29.0

PatchDVRSettings - Update DVR Settings Update DVR settings.

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) ReloadGuide added in v0.26.0

ReloadGuide - Tell a DVR to reload program guide Tell a DVR to reload program guide

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) RemoveDeviceFromDVR added in v0.26.0

RemoveDeviceFromDVR - Remove a device from an existing DVR Remove a device from an existing DVR

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) SetDVRPreferences added in v0.26.0

SetDVRPreferences - Set DVR preferences Set DVR preferences by name and value

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) StopDVRReload added in v0.26.0

StopDVRReload - Tell a DVR to stop reloading program guide Tell a DVR to stop reloading program guide

If set, this operation will use [Security.Token] from the global security.

func (*DVRs) TuneChannel added in v0.26.0

TuneChannel - Tune a channel on a DVR Tune a channel on a DVR to the provided channel

func (*DVRs) UpdateDVRSettings added in v0.29.0

UpdateDVRSettings - Update DVR Settings Update DVR settings.

If set, this operation will use [Security.Token] from the global security.

type Devices added in v0.26.0

type Devices struct {
	// contains filtered or unexported fields
}

Devices - Media grabbers provide ways for media to be obtained for a given protocol. The simplest ones are `stream` and `download`. More complex grabbers can have associated devices

Network tuners can present themselves on the network using the Simple Service Discovery Protocol and Plex Media Server will discover them. The following XML is an example of the data returned from SSDP. The `deviceType`, `serviceType`, and `serviceId` values must remain as they are in the example in order for PMS to properly discover the device. Other less-obvious fields are described in the parameters section below.

Example SSDP output ``` <root xmlns="urn:schemas-upnp-org:device-1-0">

<specVersion>
    <major>1</major>
    <minor>0</minor>
</specVersion>
<device>
    <deviceType>urn:plex-tv:device:Media:1</deviceType>
    <friendlyName>Turing Hopper 3000</friendlyName>
    <manufacturer>Plex, Inc.</manufacturer>
    <manufacturerURL>https://plex.tv/</manufacturerURL>
    <modelDescription>Turing Hopper 3000 Media Grabber</modelDescription>
    <modelName>Plex Media Grabber</modelName>
    <modelNumber>1</modelNumber>
    <modelURL>https://plex.tv</modelURL>
    <UDN>uuid:42fde8e4-93b6-41e5-8a63-12d848655811</UDN>
    <serviceList>
        <service>
            <URLBase>http://10.0.0.5:8088</URLBase>
            <serviceType>urn:plex-tv:service:MediaGrabber:1</serviceType>
            <serviceId>urn:plex-tv:serviceId:MediaGrabber</serviceId>
        </service>
    </serviceList>
</device>

</root> ```

  • UDN: (string) A UUID for the device. This should be unique across models of a device at minimum.
  • URLBase: (string) The base HTTP URL for the device from which all of the other endpoints are hosted.

Note: This tag covers media grabber and network tuner devices only. For client device discovery, use `/clients` or `/resources`.

func (*Devices) AddDevice added in v0.26.0

AddDevice - Add a device This endpoint adds a device to an existing grabber. The device is identified, and added to the correct grabber.

If set, this operation will use [Security.Token] from the global security.

func (*Devices) DiscoverDevices added in v0.26.0

func (s *Devices) DiscoverDevices(ctx context.Context, protocol *operations.Protocol, grabberIdentifier *string, opts ...operations.Option) (*operations.DiscoverDevicesResponse, error)

DiscoverDevices - Tell grabbers to discover devices Tell grabbers to discover devices

If set, this operation will use [Security.Token] from the global security.

func (*Devices) GetAvailableGrabbers added in v0.26.0

GetAvailableGrabbers - Get available grabbers Get available grabbers visible to the server

func (*Devices) GetDeviceDetails added in v0.26.0

GetDeviceDetails - Get device details Get a device's details by its id

If set, this operation will use [Security.Token] from the global security.

func (*Devices) GetDevicesChannels added in v0.26.0

GetDevicesChannels - Get a device's channels Get a device's channels by its id

If set, this operation will use [Security.Token] from the global security.

func (*Devices) GetThumb added in v0.26.0

GetThumb - Get device thumb Get a device's thumb for display to the user

If set, this operation will use [Security.Token] from the global security.

func (*Devices) ListDevices added in v0.26.0

func (s *Devices) ListDevices(ctx context.Context, opts ...operations.Option) (*operations.ListDevicesResponse, error)

ListDevices - Get all devices Get the list of all devices present

If set, this operation will use [Security.Token] from the global security.

func (*Devices) ModifyDevice added in v0.26.0

ModifyDevice - Enable or disable a device Enable or disable a device by its id

If set, this operation will use [Security.Token] from the global security.

func (*Devices) RemoveDevice added in v0.26.0

RemoveDevice - Remove a device Remove a devices by its id along with its channel mappings

If set, this operation will use [Security.Token] from the global security.

func (*Devices) Scan added in v0.26.0

Scan - Tell a device to scan for channels Tell a device to scan for channels

func (*Devices) SetChannelmap added in v0.26.0

SetChannelmap - Set a device's channel mapping Set a device's channel mapping

func (*Devices) SetDevicePreferences added in v0.26.0

SetDevicePreferences - Set device preferences Set device preferences by its id

If set, this operation will use [Security.Token] from the global security.

func (*Devices) StopScan added in v0.26.0

StopScan - Tell a device to stop scanning for channels Tell a device to stop scanning for channels

type DownloadQueue added in v0.26.0

type DownloadQueue struct {
	// contains filtered or unexported fields
}

DownloadQueue - API Operations against the Download Queue. Note: The Download Queue is distinct from the Play Queue. The Download Queue manages offline/downloaded content, while the Play Queue manages active playback sessions.

func (*DownloadQueue) AddDownloadQueueItems added in v0.26.0

AddDownloadQueueItems - Add to download queue Available: 0.2.0

Add items to the download queue

func (*DownloadQueue) CreateDownloadQueue added in v0.26.0

func (s *DownloadQueue) CreateDownloadQueue(ctx context.Context, opts ...operations.Option) (*operations.CreateDownloadQueueResponse, error)

CreateDownloadQueue - Create download queue Available: 0.2.0

Creates a download queue for this client if one doesn't exist, or returns the existing queue for this client and user.

func (*DownloadQueue) GetDownloadQueue added in v0.26.0

GetDownloadQueue - Get a download queue Available: 0.2.0

Get a download queue by its id

func (*DownloadQueue) GetDownloadQueueItems added in v0.26.0

GetDownloadQueueItems - Get download queue items Available: 0.2.0

Get items from a download queue

func (*DownloadQueue) GetDownloadQueueMedia added in v0.26.0

GetDownloadQueueMedia - Grab download queue media Available: 0.2.0

Grab the media for a download queue item

func (*DownloadQueue) GetItemDecision added in v0.26.0

GetItemDecision - Grab download queue item decision Available: 0.2.0

Grab the decision for a download queue item

func (*DownloadQueue) ListDownloadQueueItems added in v0.26.0

ListDownloadQueueItems - Get download queue items Available: 0.2.0

Get items from a download queue

func (*DownloadQueue) RemoveDownloadQueueItems added in v0.26.0

RemoveDownloadQueueItems - Delete download queue items delete items from a download queue

func (*DownloadQueue) RestartProcessingDownloadQueueItems added in v0.26.0

RestartProcessingDownloadQueueItems - Restart processing of items from the decision Available: 0.2.0

Reprocess download queue items with previous decision parameters

type Epg added in v0.26.0

type Epg struct {
	// contains filtered or unexported fields
}

Epg - The EPG (Electronic Program Guide) is responsible for obtaining metadata for what is airing on each channel and when

func (*Epg) ComputeChannelMap added in v0.26.0

ComputeChannelMap - Compute the best channel map Compute the best channel map, given device and lineup

func (*Epg) GetAllLanguages added in v0.26.0

func (s *Epg) GetAllLanguages(ctx context.Context, opts ...operations.Option) (*operations.GetAllLanguagesResponse, error)

GetAllLanguages - Get all languages Returns a list of all possible languages for EPG data.

func (*Epg) GetChannels added in v0.26.0

GetChannels - Get channels for a lineup Get channels for a lineup within an EPG provider

func (*Epg) GetCountries added in v0.26.0

func (s *Epg) GetCountries(ctx context.Context, opts ...operations.Option) (*operations.GetCountriesResponse, error)

GetCountries - Get all countries This endpoint returns a list of countries which EPG data is available for. There are three flavors, as specfied by the `flavor` attribute

func (*Epg) GetCountriesLineups added in v0.26.0

GetCountriesLineups - Get lineups for a country via postal code Returns a list of lineups for a given country, EPG provider and postal code

func (*Epg) GetCountryRegions added in v0.26.0

GetCountryRegions - Get regions for a country Get regions for a country within an EPG provider

func (*Epg) GetEPGGuide added in v0.29.0

func (s *Epg) GetEPGGuide(ctx context.Context, opts ...operations.Option) (*operations.GetEPGGuideResponse, error)

GetEPGGuide - Get EPG Guide Fetch the global electronic program guide.

If set, this operation will use [Security.Token] from the global security.

func (*Epg) GetLineup added in v0.26.0

GetLineup - Compute the best lineup Compute the best lineup, given lineup group and device

func (*Epg) GetLineupChannels added in v0.26.0

GetLineupChannels - Get the channels for multiple lineups Get the channels across multiple lineups

func (*Epg) ListLineups added in v0.26.0

ListLineups - Get lineups for a region Get lineups for a region within an EPG provider

func (*Epg) SearchEPG added in v0.29.0

SearchEPG - Search EPG Search the electronic program guide for upcoming airings.

If set, this operation will use [Security.Token] from the global security.

type Events added in v0.26.0

type Events struct {
	// contains filtered or unexported fields
}

Events - The server can notify clients in real-time of a wide range of events, from library scanning, to preferences being modified, to changes to media, and many other things. This is also the mechanism by which activity progress is reported.

Two protocols for receiving the events are available: EventSource (also known as SSE), and WebSocket.

func (*Events) ConnectWebSocket added in v0.26.0

ConnectWebSocket - Connect to WebSocket Connect to the web socket to get a stream of events

func (*Events) GetNotifications added in v0.26.0

GetNotifications - Connect to Eventsource Connect to the event source to get a stream of events

func (*Events) GetWebsocketNotifications added in v0.29.0

GetWebsocketNotifications - Get WebSocket Notifications WebSocket endpoint for real-time notifications (plural alias). Connect with X-Plex-Token header. Delivers NotificationContainer messages.

type General added in v0.26.0

type General struct {
	// contains filtered or unexported fields
}

General endpoints for basic PMS operation not specific to any media provider

func (*General) AddUserWebhook added in v0.29.0

AddUserWebhook - Add User Webhook Add a webhook URL for the logged-in user.

func (*General) AddWebhook added in v0.29.0

AddWebhook - Add Webhook Add a webhook URL for the logged-in user.

func (*General) BrowseFilesystem added in v0.29.0

BrowseFilesystem - Browse Filesystem Browse filesystem paths accessible to the server.

If set, this operation will use [Security.Token] from the global security.

func (*General) BrowseFilesystemPath added in v0.29.0

BrowseFilesystemPath - Browse Filesystem Path Browse a specific filesystem path.

If set, this operation will use [Security.Token] from the global security.

func (*General) CheckForSystemUpdates added in v0.29.0

CheckForSystemUpdates - Check for System Updates Check for available PMS updates.

If set, this operation will use [Security.Token] from the global security.

func (*General) ClaimServer added in v0.29.0

ClaimServer - Claim Server Claim the local PMS server using a claim token obtained from plex.tv.

func (*General) CreateTransientToken added in v0.29.0

CreateTransientToken - Get Transient Tokens This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted. Note: This endpoint responds to all HTTP verbs but POST in preferred

func (*General) DownloadDatabaseDiagnostics added in v0.29.0

DownloadDatabaseDiagnostics - Download Database Diagnostics Download server database diagnostics bundle.

If set, this operation will use [Security.Token] from the global security.

func (*General) DownloadLogBundle added in v0.29.0

DownloadLogBundle - Download Log Bundle Download server logs bundle.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetBandwidthStatistics added in v0.29.0

GetBandwidthStatistics - Get Bandwidth Statistics Get dashboard bandwidth data.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetClients added in v0.29.0

GetClients - Get Clients Get a list of connected Plex clients.

func (*General) GetCloudServer added in v0.29.0

GetCloudServer - Get Cloud Server Get Plex Cloud server status for the logged-in user.

func (*General) GetDiagnostics added in v0.29.0

GetDiagnostics - Get Diagnostics Get server diagnostics overview.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetGeoIP added in v0.29.0

GetGeoIP - Get GeoIP Get GeoIP lookup information for the current request.

func (*General) GetIP added in v0.29.0

GetIP - Get IP Get the public IP address detected by Plex.

func (*General) GetIdentity added in v0.26.0

func (s *General) GetIdentity(ctx context.Context, opts ...operations.Option) (*operations.GetIdentityResponse, error)

GetIdentity - Get PMS identity Get details about this PMS's identity

func (*General) GetLocalServers added in v0.29.0

GetLocalServers - Get Local Servers Get a list of local servers.

func (*General) GetMetadataAgentDetails added in v0.29.0

GetMetadataAgentDetails - Get Metadata Agent Details Get details and settings for a specific metadata agent.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetMetadataAgents added in v0.29.0

GetMetadataAgents - Get Metadata Agents Get a list of available metadata agents.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetPlexDownloads added in v0.29.0

GetPlexDownloads - Get Plex Downloads Get available Plex update downloads for a specific channel (e.g. `plexpass`, `public`).

func (*General) GetResourceStatistics added in v0.29.0

GetResourceStatistics - Get Resource Statistics Get dashboard resource data.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetServerInfo added in v0.26.0

GetServerInfo - Get PMS info Information about this PMS setup and configuration

func (*General) GetSourceConnectionInformation added in v0.26.0

GetSourceConnectionInformation - Get Source Connection Information If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.

func (*General) GetSyncItem added in v0.29.0

GetSyncItem - Get Sync Item Get sync item details.

func (*General) GetSyncItems added in v0.29.0

GetSyncItems - Get Sync Items Get sync items list.

func (*General) GetSyncQueue added in v0.29.0

GetSyncQueue - Get Sync Queue Get sync queue.

func (*General) GetSyncStatus added in v0.29.0

GetSyncStatus - Get Sync Status Get sync status overview.

func (*General) GetSyncTranscodeQueue added in v0.29.0

GetSyncTranscodeQueue - Get Sync Transcode Queue Get sync transcode queue status.

func (*General) GetSystemAccounts added in v0.29.0

GetSystemAccounts - Get System Accounts Get a list of local system accounts.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetSystemDevices added in v0.29.0

GetSystemDevices - Get System Devices Get a list of local system devices.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetSystemSettings added in v0.29.0

GetSystemSettings - Get System Settings Get system-level settings.

If set, this operation will use [Security.Token] from the global security.

func (*General) GetUserWebhooks added in v0.29.0

func (s *General) GetUserWebhooks(ctx context.Context, opts ...operations.Option) (*operations.GetUserWebhooksResponse, error)

GetUserWebhooks - User Webhooks List webhook URLs for the logged-in user.

func (*General) GetWebhooks added in v0.29.0

GetWebhooks - Get Webhooks List configured webhook URLs for the logged-in user.

func (*General) RefreshReachability added in v0.29.0

func (s *General) RefreshReachability(ctx context.Context, opts ...operations.Option) (*operations.RefreshReachabilityResponse, error)

RefreshReachability - Refresh Reachability Refresh remote access port mapping.

If set, this operation will use [Security.Token] from the global security.

func (*General) RefreshSyncContent added in v0.29.0

RefreshSyncContent - Refresh Sync Content Force PMS to refresh content for known SyncLists.

func (*General) RefreshSyncLists added in v0.29.0

RefreshSyncLists - Refresh Sync Lists Force PMS to download new SyncList from plex.tv.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for supplying the SDK with a custom HTTP client

type Hubs

type Hubs struct {
	// contains filtered or unexported fields
}

Hubs - The hubs within a media provider

func (*Hubs) CreateCustomHub added in v0.26.0

CreateCustomHub - Create a custom hub Create a custom hub based on a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Hubs) DeleteCustomHub added in v0.26.0

DeleteCustomHub - Delete a custom hub Delete a custom hub from the server

If set, this operation will use [Security.Token] from the global security.

func (*Hubs) GetAllHubs added in v0.26.0

GetAllHubs - Get global hubs Get the global hubs in this PMS

func (*Hubs) GetContinueWatching added in v0.26.0

GetContinueWatching - Get the continue watching hub Get the global continue watching hub

func (*Hubs) GetContinueWatchingItems added in v0.29.0

GetContinueWatchingItems - Get Continue Watching Items Get direct access to Continue Watching items.

If set, this operation will use [Security.Token] from the global security.

func (*Hubs) GetHomeRecentlyAdded added in v0.29.0

GetHomeRecentlyAdded - Get home hubs Recently Added Get the recently added hub for the home screen.

If set, this operation will use [Security.Token] from the global security.

func (*Hubs) GetHubItems added in v0.26.0

GetHubItems - Get a hub's items Get the items within a single hub specified by identifier

func (*Hubs) GetMetadataHubs added in v0.26.0

GetMetadataHubs - Get hubs for section by metadata item Get the hubs for a section by metadata item. Currently only for music sections

func (*Hubs) GetPostplayHubs added in v0.26.0

GetPostplayHubs - Get postplay hubs Get the hubs for a metadata to be displayed in post play

func (*Hubs) GetPromotedHubs added in v0.26.0

GetPromotedHubs - Get the hubs which are promoted Get the global hubs which are promoted (should be displayed on the home screen)

func (*Hubs) GetRelatedHubs added in v0.26.0

GetRelatedHubs - Get related hubs Get the hubs for a metadata related to the provided metadata item

func (*Hubs) GetSectionHubs added in v0.26.0

GetSectionHubs - Get section hubs Get the hubs for a single section

func (*Hubs) ListHubs added in v0.26.0

ListHubs - Get hubs Get the list of hubs including both built-in and custom

If set, this operation will use [Security.Token] from the global security.

func (*Hubs) MoveHub added in v0.26.0

MoveHub - Move Hub Changed the ordering of a hub among others hubs

If set, this operation will use [Security.Token] from the global security.

func (*Hubs) ResetSectionDefaults added in v0.26.0

ResetSectionDefaults - Reset hubs to defaults Reset hubs for this section to defaults and delete custom hubs

If set, this operation will use [Security.Token] from the global security.

func (*Hubs) UpdateHubVisibility added in v0.26.0

UpdateHubVisibility - Change hub visibility Changed the visibility of a hub for both the admin and shared users

If set, this operation will use [Security.Token] from the global security.

type Library

type Library struct {
	// contains filtered or unexported fields
}

Library endpoints which are outside of the Media Provider API. Typically this is manipulation of the library (adding/removing sections, modifying preferences, etc).

func (*Library) AddExtras added in v0.26.0

AddExtras - Add to an item's extras Add an extra to a metadata item

func (*Library) AddSection added in v0.26.0

AddSection - Add a library section Add a new library section to the server

If set, this operation will use [Security.Token] from the global security.

func (*Library) AnalyzeMetadata added in v0.26.0

AnalyzeMetadata - Analyze an item Start the analysis of a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) Autocomplete added in v0.26.0

Autocomplete - Get autocompletions for search The field to autocomplete on is specified by the `{field}.query` parameter. For example `genre.query` or `title.query`. Returns a set of items from the filtered items whose `{field}` starts with `{field}.query`. In the results, a `{field}.queryRange` will be present to express the range of the match

func (*Library) CancelRefresh added in v0.26.0

CancelRefresh - Cancel section refresh Cancel the refresh of a section

If set, this operation will use [Security.Token] from the global security.

func (*Library) CleanBundles added in v0.26.0

func (s *Library) CleanBundles(ctx context.Context, opts ...operations.Option) (*operations.CleanBundlesResponse, error)

CleanBundles - Clean bundles Clean out any now unused bundles. Bundles can become unused when media is deleted

If set, this operation will use [Security.Token] from the global security.

func (*Library) ComputeSonicPath added in v0.29.0

ComputeSonicPath - Compute Sonic Path Compute a sonic adventure path from a starting track.

If set, this operation will use [Security.Token] from the global security.

func (*Library) CreateMarker added in v0.26.0

CreateMarker - Create a marker Create a marker for this user on the metadata item

func (*Library) DeleteCaches added in v0.26.0

func (s *Library) DeleteCaches(ctx context.Context, opts ...operations.Option) (*operations.DeleteCachesResponse, error)

DeleteCaches - Delete library caches Delete the hub caches so they are recomputed on next request

If set, this operation will use [Security.Token] from the global security.

func (*Library) DeleteCollection added in v0.26.0

DeleteCollection - Delete a collection Delete a library collection from the PMS

If set, this operation will use [Security.Token] from the global security.

func (*Library) DeleteIndexes added in v0.26.0

DeleteIndexes - Delete section indexes Delete all the indexes in a section

If set, this operation will use [Security.Token] from the global security.

func (*Library) DeleteIntros added in v0.26.0

DeleteIntros - Delete section intro markers Delete all the intro markers in a section

If set, this operation will use [Security.Token] from the global security.

func (*Library) DeleteLibrarySection added in v0.26.0

DeleteLibrarySection - Delete a library section Delete a library section by id

If set, this operation will use [Security.Token] from the global security.

func (*Library) DeleteMarker added in v0.26.0

DeleteMarker - Delete a marker Delete a marker for this user on the metadata item

func (*Library) DeleteMediaItem added in v0.26.0

DeleteMediaItem - Delete a media item Delete a single media from a metadata item in the library

If set, this operation will use [Security.Token] from the global security.

func (*Library) DeleteMetadataItem added in v0.26.0

DeleteMetadataItem - Delete a metadata item Delete a single metadata item from the library, deleting media as well

If set, this operation will use [Security.Token] from the global security.

func (*Library) DeleteStream added in v0.26.0

DeleteStream - Delete a stream Delete a stream. Only applies to downloaded subtitle streams or a sidecar subtitle when media deletion is enabled.

func (*Library) DetectAds added in v0.26.0

DetectAds - Ad-detect an item Start the detection of ads in a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) DetectCredits added in v0.26.0

DetectCredits - Credit detect a metadata item Start credit detection on a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) DetectIntros added in v0.26.0

DetectIntros - Intro detect an item Start the detection of intros in a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) DetectVoiceActivity added in v0.26.0

DetectVoiceActivity - Detect voice activity Start the detection of voice in a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) EditLibrarySection added in v0.29.0

EditLibrarySection - Edit Section Update library section metadata.

If set, this operation will use [Security.Token] from the global security.

func (*Library) EditMarker added in v0.26.0

EditMarker - Edit a marker Edit a marker for this user on the metadata item

func (*Library) EditMetadataItem added in v0.26.0

EditMetadataItem - Edit a metadata item Edit metadata items setting fields

If set, this operation will use [Security.Token] from the global security.

func (*Library) EditSection added in v0.26.0

EditSection - Edit a library section Edit a library section by id setting parameters

If set, this operation will use [Security.Token] from the global security.

func (*Library) EmptyTrash added in v0.26.0

EmptyTrash - Get Empty Trash Permanently remove items from the trash for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) EmptyTrashPost added in v0.29.0

EmptyTrashPost - Empty Trash Permanently remove items from the trash for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) EmptyTrashPut added in v0.29.0

EmptyTrashPut - Empty section trash Empty trash in the section, permanently deleting media/metadata for missing media

If set, this operation will use [Security.Token] from the global security.

func (*Library) GenerateThumbs added in v0.26.0

GenerateThumbs - Generate thumbs of chapters for an item Start the chapter thumb generation for an item

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetAllItemLeaves added in v0.26.0

GetAllItemLeaves - Get the leaves of an item Get the leaves for a metadata item such as the episodes in a show

func (*Library) GetAugmentationStatus added in v0.26.0

GetAugmentationStatus - Get augmentation status Get augmentation status and potentially wait for completion

func (*Library) GetAvailableSorts added in v0.26.0

GetAvailableSorts - Get a section sorts Get the sort mechanisms available in a section

func (*Library) GetByContentRating added in v0.29.0

GetByContentRating - Get By Content Rating Browse items in a library section grouped by content rating.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetByDecade added in v0.29.0

GetByDecade - Get By Decade Browse items in a library section grouped by decade.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetByFolder added in v0.29.0

GetByFolder - Get By Folder Browse items in a library section by underlying filesystem folder.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetByResolution added in v0.29.0

GetByResolution - Get By Resolution Browse items in a library section grouped by resolution.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetByYear added in v0.29.0

GetByYear - Get By Year Browse items in a library section grouped by year.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetChapterImage added in v0.26.0

GetChapterImage - Get a chapter image Get a single chapter image for a piece of media

func (*Library) GetCollections added in v0.26.0

GetCollections - Get collections in a section Get all collections in a section

func (*Library) GetCommon added in v0.26.0

GetCommon - Get common fields for items Represents a "Common" item. It contains only the common attributes of the items selected by the provided filter Fields which are not common will be expressed in the `mixedFields` field

func (*Library) GetExtras added in v0.26.0

GetExtras - Get an item's extras Get the extras for a metadata item

func (*Library) GetFile added in v0.26.0

GetFile - Get a file from a metadata or media bundle Get a bundle file for a metadata or media item. This is either an image or a mp3 (for a show's theme)

func (*Library) GetFirstCharacters added in v0.26.0

GetFirstCharacters - Get list of first characters Get list of first characters in this section

func (*Library) GetImageFromBif added in v0.26.0

GetImageFromBif - Get an image from part BIF Extract an image from the BIF for a part at a particular offset

func (*Library) GetItemArtwork added in v0.26.0

GetItemArtwork - Get an item's artwork, theme, etc Get the artwork, thumb, element for a metadata item

func (*Library) GetItemTree added in v0.26.0

GetItemTree - Get metadata items as a tree Get a tree of metadata items, such as the seasons/episodes of a show

func (*Library) GetLibraryDetails added in v0.11.1

GetLibraryDetails - Get a library section by id Returns details for the library. This can be thought of as an interstitial endpoint because it contains information about the library, rather than content itself. It often contains a list of `Directory` metadata objects: These used to be used by clients to build a menuing system.

func (*Library) GetLibraryItems

GetLibraryItems - Get all items in library Request all metadata items according to a query.

func (*Library) GetLibraryMatches added in v0.26.0

GetLibraryMatches - Get library matches The matches endpoint is used to match content external to the library with content inside the library. This is done by passing a series of semantic "hints" about the content (its type, name, or release year). Each type (e.g. movie) has a canonical set of minimal required hints. This ability to match content is useful in a variety of scenarios. For example, in the DVR, the EPG uses the endpoint to match recording rules against airing content. And in the cloud, the UMP uses the endpoint to match up a piece of media with rich metadata. The endpoint response can including multiple matches, if there is ambiguity, each one containing a `score` from 0 to 100. For somewhat historical reasons, anything over 85 is considered a positive match (we prefer false negatives over false positives in general for matching). The `guid` hint is somewhat special, in that it generally represents a unique identity for a piece of media (e.g. the IMDB `ttXXX`) identifier, in contrast with other hints which can be much more ambiguous (e.g. a title of `Jane Eyre`, which could refer to the 1943 or the 2011 version). Episodes require either a season/episode pair, or an air date (or both). Either the path must be sent, or the show title

func (*Library) GetLibrarySectionHubs added in v0.29.0

GetLibrarySectionHubs - Get Section Hubs Get hubs for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetLibrarySectionsFallback added in v0.29.0

func (s *Library) GetLibrarySectionsFallback(ctx context.Context, opts ...operations.Option) (*operations.GetLibrarySectionsFallbackResponse, error)

GetLibrarySectionsFallback - Get Library Sections (Fallback) Fallback for non-owners to list library sections.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetMediaPart added in v0.26.0

GetMediaPart - Get a media part Get a media part for streaming or download.

  • streaming: This is the default scenario. Bandwidth usage on this endpoint will be guaranteed (on the server's end) to be at least the bandwidth reservation given in the decision. If no decision exists, an ad-hoc decision will be created if sufficient bandwidth exists. Clients should not rely on ad-hoc decisions being made as this may be removed in the future.
  • download: Indicated if the query parameter indicates this is a download. Bandwidth will be prioritized behind playbacks and will get a fair share of what remains.

func (*Library) GetMetadataChildren

GetMetadataChildren - Get Metadata Children Get children of a show, season, artist, or album.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetMetadataGrandchildren added in v0.29.0

GetMetadataGrandchildren - Get Metadata Grandchildren Get grandchildren (e.g. episodes under a show).

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetMetadataGrandparent added in v0.29.0

GetMetadataGrandparent - Get Metadata Grandparent Get grandparent metadata shortcut.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetMetadataOnDeck added in v0.29.0

GetMetadataOnDeck - Get Metadata On Deck Get On Deck status for a show or season.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetMetadataParent added in v0.29.0

GetMetadataParent - Get Metadata Parent Get parent metadata shortcut.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetMetadataReviews added in v0.29.0

GetMetadataReviews - Get Metadata Reviews Get user reviews for a metadata item.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetNearestMetadata added in v0.29.0

GetNearestMetadata - Get Nearest Metadata Get sonically similar items for a music track.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetNewestForSection added in v0.29.0

GetNewestForSection - Get Newest for Section Get the newest additions for a specific library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetOnDeckForSection added in v0.29.0

GetOnDeckForSection - Get On Deck for Section Get the On Deck items for a specific library section.

func (*Library) GetPartIndex added in v0.26.0

GetPartIndex - Get BIF index for a part Get BIF index for a part by index type

func (*Library) GetPerson added in v0.26.0

GetPerson - Get person details Get details for a single actor.

func (*Library) GetRandomArtwork added in v0.26.0

GetRandomArtwork - Get random artwork Get random artwork across sections. This is commonly used for a screensaver.

This retrieves 100 random artwork paths in the specified sections and returns them. Restrictions are put in place to not return artwork for items the user is not allowed to access. Artwork will be for Movies, Shows, and Artists only.

func (*Library) GetRecentlyAddedForSection added in v0.29.0

GetRecentlyAddedForSection - Get Recently Added for Section Get recently added items for a specific library section.

func (*Library) GetRecentlyAddedGlobal added in v0.29.0

GetRecentlyAddedGlobal - Get Global Recently Added Get recently added items across all library sections.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetRelatedItems added in v0.26.0

GetRelatedItems - Get related items Get a hub of related items to a metadata item

func (*Library) GetRootLibrary added in v0.29.0

func (s *Library) GetRootLibrary(ctx context.Context, opts ...operations.Option) (*operations.GetRootLibraryResponse, error)

GetRootLibrary - Get Root Library Get the root library object.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionAgents added in v0.29.0

GetSectionAgents - Get Section Agents Get available metadata agents for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionArtists added in v0.29.0

GetSectionArtists - Get Section Artists Get artists for a music library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionClips added in v0.29.0

GetSectionClips - Get Section Clips Get clips for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionEdit added in v0.29.0

GetSectionEdit - Edit Section Get library section metadata.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionEpisodes added in v0.29.0

GetSectionEpisodes - Get Section Episodes Get episodes for a TV library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionFilters added in v0.26.0

GetSectionFilters - Get section filters Get common filters on a section

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionImage added in v0.26.0

GetSectionImage - Get a section composite image Get a composite image of images in this section

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionLabels added in v0.29.0

GetSectionLabels - Get Section Labels Get labels for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionMovies added in v0.29.0

GetSectionMovies - Get Section Movies Get movies for a movie library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionPhotos added in v0.29.0

GetSectionPhotos - Get Section Photos Get photos for a photo library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionPlaylists added in v0.29.0

GetSectionPlaylists - Get Section Playlists Get playlists belonging to a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionPreferences added in v0.26.0

GetSectionPreferences - Get section prefs Get the prefs for a section by id and potentially overriding the agent

func (*Library) GetSectionSettings added in v0.29.0

GetSectionSettings - Get Section Settings Get section-specific settings.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionShows added in v0.29.0

GetSectionShows - Get Section Shows Get shows for a TV library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionTags added in v0.29.0

GetSectionTags - Get Section Tags Get tags in a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSectionTimeline added in v0.29.0

GetSectionTimeline - Get Section Timeline Get section timeline data.

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetSections added in v0.26.0

func (s *Library) GetSections(ctx context.Context, opts ...operations.Option) (*operations.GetSectionsResponse, error)

GetSections - Get library sections (main Media Provider Only) A library section (commonly referred to as just a library) is a collection of media. Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat. Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year).

func (*Library) GetSectionsPrefs added in v0.26.0

GetSectionsPrefs - Get section prefs Get a section's preferences for a metadata type

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetStream added in v0.26.0

GetStream - Get a stream Get a stream (such as a sidecar subtitle stream)

func (*Library) GetStreamLevels added in v0.26.0

GetStreamLevels - Get loudness about a stream in json The the loudness of a stream in db, one entry per 100ms

func (*Library) GetStreamLoudness added in v0.26.0

GetStreamLoudness - Get loudness about a stream The the loudness of a stream in db, one number per line, one entry per 100ms

func (*Library) GetSubtitles added in v0.29.0

GetSubtitles - Get subtitles Add a subtitle to a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) GetTags added in v0.26.0

GetTags - Get all library tags of a type Get all library tags of a type

func (*Library) GetUnwatchedForSection added in v0.29.0

GetUnwatchedForSection - Get Unwatched for Section Get unwatched items for a specific library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) IngestTransientItem added in v0.26.0

IngestTransientItem - Ingest a transient item This endpoint takes a file path specified in the `url` parameter, matches it using the scanner's match mechanism, downloads rich metadata, and then ingests the item as a transient item (without a library section). In the case where the file represents an episode, the entire tree (show, season, and episode) is added as transient items. At this time, movies and episodes are the only supported types, which are gleaned automatically from the file path. Note that any of the parameters passed to the metadata details endpoint (e.g. `includeExtras=1`) work here.

func (*Library) ListMatches added in v0.26.0

ListMatches - Get metadata matches for an item Get the list of metadata matches for a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) ListPersonMedia added in v0.26.0

ListPersonMedia - Get media for a person Get all the media for a single actor.

func (*Library) ListSimilar added in v0.26.0

ListSimilar - Get similar items Get a list of similar items to a metadata item

func (*Library) ListTopUsers added in v0.26.0

ListTopUsers - Get metadata top users Get the list of users which have played this item starting with the most

If set, this operation will use [Security.Token] from the global security.

func (*Library) MatchItem added in v0.26.0

MatchItem - Match a metadata item Match a metadata item to a guid

If set, this operation will use [Security.Token] from the global security.

func (*Library) MatchSectionItems added in v0.29.0

MatchSectionItems - Match Section Items Match items in a library section against metadata providers.

If set, this operation will use [Security.Token] from the global security.

func (*Library) MergeItems added in v0.26.0

MergeItems - Merge a metadata item Merge a metadata item with other items

If set, this operation will use [Security.Token] from the global security.

func (*Library) MoveSection added in v0.29.0

MoveSection - Move Section Move library section paths.

If set, this operation will use [Security.Token] from the global security.

func (*Library) OptimizeDatabase added in v0.26.0

OptimizeDatabase - Optimize the Database Initiate optimize on the database.

If set, this operation will use [Security.Token] from the global security.

func (*Library) OptimizeLibrary added in v0.29.0

OptimizeLibrary - Get Optimize Library Optimize the database globally across all library sections.

If set, this operation will use [Security.Token] from the global security.

func (*Library) OptimizeLibraryPost added in v0.29.0

OptimizeLibraryPost - Optimize Library Optimize the database globally across all library sections.

If set, this operation will use [Security.Token] from the global security.

func (*Library) OptimizeSection added in v0.29.0

OptimizeSection - Get Optimize Section Optimize the database for a specific library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) OptimizeSectionPost added in v0.29.0

OptimizeSectionPost - Optimize Section Optimize the database for a specific library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) RefreshItemsMetadata added in v0.26.0

RefreshItemsMetadata - Refresh a metadata item Refresh a metadata item from the agent

If set, this operation will use [Security.Token] from the global security.

func (*Library) RefreshSection added in v0.26.0

RefreshSection - Get Refresh Section Trigger a metadata refresh for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) RefreshSectionPost added in v0.29.0

RefreshSectionPost - Refresh Section Trigger a metadata refresh for a library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) RefreshSectionsMetadata added in v0.26.0

RefreshSectionsMetadata - Refresh all sections Tell PMS to refresh all section metadata

If set, this operation will use [Security.Token] from the global security.

func (*Library) SearchSection added in v0.29.0

SearchSection - Search Section Search within a specific library section.

If set, this operation will use [Security.Token] from the global security.

func (*Library) SetItemArtwork added in v0.26.0

SetItemArtwork - Set an item's artwork, theme, etc Set the artwork, thumb, element for a metadata item Generally only the admin can perform this action. The exception is if the metadata is a playlist created by the user

func (*Library) SetItemPreferences added in v0.26.0

SetItemPreferences - Set metadata preferences Set the preferences on a metadata item

If set, this operation will use [Security.Token] from the global security.

func (*Library) SetSectionPreferences added in v0.26.0

SetSectionPreferences - Set section prefs Set the prefs for a section by id

If set, this operation will use [Security.Token] from the global security.

func (*Library) SetStreamOffset added in v0.26.0

SetStreamOffset - Set a stream offset Set a stream offset in ms. This may not be respected by all clients

func (*Library) SetStreamSelection added in v0.26.0

SetStreamSelection - Set stream selection Set which streams (audio/subtitle) are selected by this user

func (*Library) SplitItem added in v0.26.0

SplitItem - Split a metadata item Split a metadata item into multiple items

If set, this operation will use [Security.Token] from the global security.

func (*Library) StartAnalysis added in v0.26.0

StartAnalysis - Analyze a section Start analysis of all items in a section. If BIF generation is enabled, this will also be started on this section

If set, this operation will use [Security.Token] from the global security.

func (*Library) StartBifGeneration added in v0.26.0

StartBifGeneration - Start BIF generation of an item Start the indexing (BIF generation) of an item

If set, this operation will use [Security.Token] from the global security.

func (*Library) StopAllRefreshes added in v0.26.0

func (s *Library) StopAllRefreshes(ctx context.Context, opts ...operations.Option) (*operations.StopAllRefreshesResponse, error)

StopAllRefreshes - Stop refresh Stop all refreshes across all sections

If set, this operation will use [Security.Token] from the global security.

func (*Library) Unmatch added in v0.26.0

Unmatch a metadata item Unmatch a metadata item to info fetched from the agent

If set, this operation will use [Security.Token] from the global security.

func (*Library) UnmatchSectionItems added in v0.29.0

UnmatchSectionItems - Unmatch Section Items Unmatch items in a library section from metadata providers.

If set, this operation will use [Security.Token] from the global security.

func (*Library) UpdateItemArtwork added in v0.26.0

UpdateItemArtwork - Set an item's artwork, theme, etc Set the artwork, thumb, element for a metadata item Generally only the admin can perform this action. The exception is if the metadata is a playlist created by the user

func (*Library) UpdateItems added in v0.26.0

UpdateItems - Set the fields of the filtered items This endpoint takes an large possible set of values. Here are some examples. - **Parameters, extra documentation**

  • artist.title.value
  • When used with track, both artist.title.value and album.title.value need to be specified
  • title.value usage
  • Summary
  • Tracks always rename and never merge
  • Albums and Artists
  • if single item and item without title does not exist, it is renamed.
  • if single item and item with title does exist they are merged.
  • if multiple they are always merged.
  • Tracks
  • Works as expected will update the track's title
  • Single track: `/library/sections/{id}/all?type=10&id=42&title.value=NewName`
  • Multiple tracks: `/library/sections/{id}/all?type=10&id=42,43,44&title.value=NewName`
  • All tracks: `/library/sections/{id}/all?type=10&title.value=NewName`
  • Albums
  • Functionality changes depending on the existence of an album with the same title
  • Album exists
  • Single album: `/library/sections/{id}/all?type=9&id=42&title.value=Album 2`
  • Album with id 42 is merged into album titled "Album 2"
  • Multiple/All albums: `/library/sections/{id}/all?type=9&title.value=Moo Album`
  • All albums are merged into the existing album titled "Moo Album"
  • Album does not exist
  • Single album: `/library/sections/{id}/all?type=9&id=42&title.value=NewAlbumTitle`
  • Album with id 42 has title modified to "NewAlbumTitle"
  • Multiple/All albums: `/library/sections/{id}/all?type=9&title.value=NewAlbumTitle`
  • All albums are merged into a new album with title="NewAlbumTitle"
  • Artists
  • Functionaly changes depending on the existence of an artist with the same title.
  • Artist exists
  • Single artist: `/library/sections/{id}/all?type=8&id=42&title.value=Artist 2`
  • Artist with id 42 is merged into existing artist titled "Artist 2"
  • Multiple/All artists: `/library/sections/{id}/all?type=8&title.value=Artist 3`
  • All artists are merged into the existing artist titled "Artist 3"
  • Artist does not exist
  • Single artist: `/library/sections/{id}/all?type=8&id=42&title.value=NewArtistTitle`
  • Artist with id 42 has title modified to "NewArtistTitle"
  • Multiple/All artists: `/library/sections/{id}/all?type=8&title.value=NewArtistTitle`
  • All artists are merged into a new artist with title="NewArtistTitle"

- **Notes**

  • Technically square brackets are not allowed in an URI except the Internet Protocol Literal Address
  • RFC3513: A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where square bracket characters are allowed in the URI syntax.
  • Escaped square brackets are allowed, but don't render well

func (*Library) UploadArt added in v0.29.0

UploadArt - Upload media art Art Upload custom background art for a metadata item.

If set, this operation will use [Security.Token] from the global security.

func (*Library) UploadPoster added in v0.29.0

UploadPoster - Upload media art Poster Upload a custom poster image for a metadata item.

If set, this operation will use [Security.Token] from the global security.

type LibraryCollections added in v0.26.0

type LibraryCollections struct {
	// contains filtered or unexported fields
}

LibraryCollections - Endpoints for manipulating collections. In addition to these endpoints, `/library/collections/:collectionId/X` will be rerouted to `/library/metadata/:collectionId/X` and respond to those endpoints as well.

func (*LibraryCollections) AddCollectionItems added in v0.26.0

AddCollectionItems - Add items to a collection Add items to a collection by uri

If set, this operation will use [Security.Token] from the global security.

func (*LibraryCollections) MoveCollectionItem added in v0.26.0

MoveCollectionItem - Reorder an item in the collection Reorder items in a collection with one item after another

If set, this operation will use [Security.Token] from the global security.

func (*LibraryCollections) UpdateCollectionItem added in v0.29.0

UpdateCollectionItem - Update an item in a collection Delete an item from a collection

If set, this operation will use [Security.Token] from the global security.

type LibraryPlaylists added in v0.26.0

type LibraryPlaylists struct {
	// contains filtered or unexported fields
}

LibraryPlaylists - Endpoints for manipulating playlists.

func (*LibraryPlaylists) AddPlaylistItems added in v0.26.0

AddPlaylistItems - Adding to a Playlist Adds a generator to a playlist, same parameters as the POST above. With a dumb playlist, this adds the specified items to the playlist. With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.

func (*LibraryPlaylists) ClearPlaylistItems added in v0.26.0

ClearPlaylistItems - Clearing a playlist Clears a playlist, only works with dumb playlists. Returns the playlist.

func (*LibraryPlaylists) CreatePlaylist added in v0.26.0

CreatePlaylist - Create a Playlist Create a new playlist. By default the playlist is blank.

func (*LibraryPlaylists) DeletePlaylist added in v0.26.0

DeletePlaylist - Delete a Playlist Deletes a playlist by provided id

func (*LibraryPlaylists) DeletePlaylistItem added in v0.26.0

DeletePlaylistItem - Delete a Generator Deletes an item from a playlist. Only works with dumb playlists.

func (*LibraryPlaylists) GetPlaylistGenerator added in v0.26.0

GetPlaylistGenerator - Get a playlist generator Get a playlist's generator. Only used for optimized versions

func (*LibraryPlaylists) GetPlaylistGeneratorItems added in v0.26.0

GetPlaylistGeneratorItems - Get a playlist generator's items Get a playlist generator's items

func (*LibraryPlaylists) GetPlaylistGenerators added in v0.26.0

GetPlaylistGenerators - Get a playlist's generators Get all the generators in a playlist

func (*LibraryPlaylists) ModifyPlaylistGenerator added in v0.26.0

ModifyPlaylistGenerator - Modify a Generator Modify a playlist generator. Only used for optimizer

func (*LibraryPlaylists) MovePlaylistItem added in v0.26.0

MovePlaylistItem - Moving items in a playlist Moves an item in a playlist. Only works with dumb playlists.

func (*LibraryPlaylists) RefreshPlaylist added in v0.26.0

RefreshPlaylist - Reprocess a generator Make a generator reprocess (refresh)

func (*LibraryPlaylists) UpdatePlaylist added in v0.26.0

UpdatePlaylist - Editing a Playlist Edits a playlist in the same manner as [editing metadata](#tag/Provider/operation/metadataPutItem)

func (*LibraryPlaylists) UploadPlaylist added in v0.26.0

UploadPlaylist - Upload media art Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file.

If set, this operation will use [Security.Token] from the global security.

type LiveTV added in v0.26.0

type LiveTV struct {
	// contains filtered or unexported fields
}

LiveTV contains the playback sessions of a channel from a DVR device

func (*LiveTV) DeleteLiveTVSession added in v0.29.0

DeleteLiveTVSession - Delete Live TV Session Terminate a Live TV session.

If set, this operation will use [Security.Token] from the global security.

func (*LiveTV) GetDVRRecordings added in v0.29.0

GetDVRRecordings - Get DVR Recordings List completed DVR recordings.

If set, this operation will use [Security.Token] from the global security.

func (*LiveTV) GetDVRRecordingsByDVR added in v0.29.0

GetDVRRecordingsByDVR - Get DVR Recordings by DVR List completed DVR recordings for a specific DVR.

If set, this operation will use [Security.Token] from the global security.

func (*LiveTV) GetLiveTVSession added in v0.26.0

GetLiveTVSession - Get a single session Get a single livetv session and metadata

func (*LiveTV) GetSessionPlaylistIndex added in v0.26.0

GetSessionPlaylistIndex - Get a session playlist index Get a playlist index for playing this session

func (*LiveTV) GetSessionSegment added in v0.26.0

GetSessionSegment - Get a single session segment Get a single LiveTV session segment

func (*LiveTV) GetSessions added in v0.26.0

func (s *LiveTV) GetSessions(ctx context.Context, dvrID *int64, channel *int64, opts ...operations.Option) (*operations.GetSessionsResponse, error)

GetSessions - Get all sessions Get all livetv sessions and metadata

type Log

type Log struct {
	// contains filtered or unexported fields
}

Log - Logging mechanism to allow clients to log to the server

func (*Log) EnablePapertrail added in v0.26.0

EnablePapertrail - Enabling Papertrail This endpoint will enable all Plex Media Server logs to be sent to the Papertrail networked logging site for a period of time

Note: This endpoint responds to all HTTP verbs but POST is preferred

If set, this operation will use [Security.Token] from the global security.

func (*Log) WriteLog added in v0.26.0

func (s *Log) WriteLog(ctx context.Context, request any, opts ...operations.Option) (*operations.WriteLogResponse, error)

WriteLog - Logging a multi-line message to the Plex Media Server log This endpoint will write multiple lines to the main Plex Media Server log in a single request. It takes a set of query strings as would normally sent to the above PUT endpoint as a linefeed-separated block of POST data. The parameters for each query string match as above.

If set, this operation will use [Security.Token] from the global security.

func (*Log) WriteMessage added in v0.26.0

WriteMessage - Logging a single-line message to the Plex Media Server log This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.

Note: This endpoint responds to all HTTP verbs **except POST** but PUT is preferred

If set, this operation will use [Security.Token] from the global security.

type PlayQueue added in v0.26.0

type PlayQueue struct {
	// contains filtered or unexported fields
}

PlayQueue - The playqueue feature within a media provider A play queue represents the current list of media for playback. Although queues are persisted by the server, they should be regarded by the user as a fairly lightweight, an ephemeral list of items queued up for playback in a session. There is generally one active queue for each type of media (music, video, photos) that can be added to or destroyed and replaced with a fresh queue. Play Queues has a region, which we refer to in this doc (partially for historical reasons) as "Up Next". This region is defined by `playQueueLastAddedItemID` existing on the media container. This follows iTunes' terminology. It is a special region after the currently playing item but before the originally-played items. This enables "Party Mode" listening/viewing, where items can be added on-the-fly, and normal queue playback resumed when completed. You can visualize the play queue as a sliding window in the complete list of media queued for playback. This model is important when scaling to larger play queues (e.g. shuffling 40,000 audio tracks). The client only needs visibility into small areas of the queue at any given time, and the server can optimize access in this fashion. All created play queues will have an empty "Up Next" area - unless the item is an album and no `key` is provided. In this case the "Up Next" area will be populated by the contents of the album. This is to allow queueing of multiple albums - since the 'Add to Up Next' will insert after all the tracks. This means that If you're creating a PQ from an album, you can only shuffle it if you set `key`. This is due to the above implicit queueing of albums when no `key` is provided as well as the current limitation that you cannot shuffle a PQ with an "Up Next" area. The play queue window advances as the server receives timeline requests. The client needs to retrieve the play queue as the “now playing” item changes. There is no play queue API to update the playing item.

func (*PlayQueue) AddToPlayQueue added in v0.26.0

AddToPlayQueue - Add a generator or playlist to a play queue Adds an item to a play queue (e.g. party mode). Increments the version of the play queue. Takes the following parameters (`uri` and `playlistID` are mutually exclusive). Returns the modified play queue.

func (*PlayQueue) ClearPlayQueue added in v0.26.0

ClearPlayQueue - Clear a play queue Deletes all items in the play queue, and increases the version of the play queue.

func (*PlayQueue) CreatePlayQueue added in v0.26.0

CreatePlayQueue - Create a play queue Makes a new play queue for a device. The source of the playqueue can either be a URI, or a playlist. The response is a media container with the initial items in the queue. Each item in the queue will be a regular item but with `playQueueItemID` - a unique ID since the queue could have repeated items with the same `ratingKey`. Note: Either `uri` or `playlistID` must be specified

func (*PlayQueue) DeletePlayQueueItem added in v0.26.0

DeletePlayQueueItem - Delete an item from a play queue Deletes an item in a play queue. Increments the version of the play queue. Returns the modified play queue.

func (*PlayQueue) GetPlayQueue added in v0.26.0

GetPlayQueue - Retrieve a play queue Retrieves the play queue, centered at current item. This can be treated as a regular container by play queue-oblivious clients, but they may wish to request a large window onto the queue since they won't know to refresh.

func (*PlayQueue) MovePlayQueueItem added in v0.26.0

MovePlayQueueItem - Move an item in a play queue Moves an item in a play queue, and increases the version of the play queue. Returns the modified play queue.

func (*PlayQueue) ResetPlayQueue added in v0.26.0

ResetPlayQueue - Reset a play queue Reset a play queue to the first item being the current item

func (*PlayQueue) Shuffle added in v0.26.0

Shuffle a play queue Shuffle a play queue (or reshuffles if already shuffled). The currently selected item is maintained. Note that this is currently only supported for play queues *without* an Up Next area. Returns the modified play queue.

func (*PlayQueue) Unshuffle added in v0.26.0

Unshuffle a play queue Unshuffles a play queue and restores "natural order". Note that this is currently only supported for play queues *without* an Up Next area. Returns the modified play queue.

type Playback added in v0.29.0

type Playback struct {
	// contains filtered or unexported fields
}

Plex Playback operations

func (*Playback) GetClientResources added in v0.29.0

GetClientResources - Get Client Resources Get client capabilities and device info.

func (*Playback) GetProgress added in v0.29.0

GetProgress - Get Progress Get or update watch progress for a media item.

If set, this operation will use [Security.Token] from the global security.

func (*Playback) PlayerAudioStream added in v0.29.0

PlayerAudioStream - Player Audio Stream Change the active audio stream.

func (*Playback) PlayerMute added in v0.29.0

PlayerMute - Player Mute Mute the client audio

func (*Playback) PlayerPause added in v0.29.0

PlayerPause - Player Pause Pause playback on the client

func (*Playback) PlayerPlay added in v0.29.0

PlayerPlay - Player Play Start playback on the client

func (*Playback) PlayerPlayMedia added in v0.29.0

PlayerPlayMedia - Player Play Media Play a specific media item on the client.

func (*Playback) PlayerPollTimeline added in v0.29.0

PlayerPollTimeline - Player Poll Timeline Poll the client for current playback timeline.

func (*Playback) PlayerRefreshplayqueue added in v0.29.0

PlayerRefreshplayqueue - Player Refresh Play Queue Refresh the play queue on the client

func (*Playback) PlayerSeek added in v0.29.0

PlayerSeek - Player Seek Seek to a specific time in the current playback.

func (*Playback) PlayerSetParameters added in v0.29.0

PlayerSetParameters - Player Set Parameters Set shuffle, repeat, and volume parameters.

func (*Playback) PlayerSetRating added in v0.29.0

PlayerSetRating - Player Set Rating Rate the currently playing item.

func (*Playback) PlayerSetState added in v0.29.0

PlayerSetState - Player Set State Set the playback state directly.

func (*Playback) PlayerSetStreams added in v0.29.0

PlayerSetStreams - Player Set Streams Set active audio, subtitle, and video streams.

func (*Playback) PlayerSetTextStream added in v0.29.0

PlayerSetTextStream - Player Set Text Stream Set the active text stream.

func (*Playback) PlayerSetViewOffset added in v0.29.0

PlayerSetViewOffset - Player Set View Offset Set the resume offset for the current item.

func (*Playback) PlayerSkipBy added in v0.29.0

PlayerSkipBy - Player Skip By Skip forward or backward by a number of items.

func (*Playback) PlayerSkipTo added in v0.29.0

PlayerSkipTo - Player Skip To Skip to a specific item in the play queue.

func (*Playback) PlayerStepback added in v0.29.0

PlayerStepback - Player Step Back Step back one frame

func (*Playback) PlayerStepforward added in v0.29.0

PlayerStepforward - Player Step Forward Step forward one frame

func (*Playback) PlayerStop added in v0.29.0

PlayerStop - Player Stop Stop playback on the client

func (*Playback) PlayerSubtitleStream added in v0.29.0

PlayerSubtitleStream - Player Subtitle Stream Change the active subtitle stream.

func (*Playback) PlayerUnmute added in v0.29.0

PlayerUnmute - Player Unmute Unmute the client audio

func (*Playback) PlayerVideoStream added in v0.29.0

PlayerVideoStream - Player Video Stream Change the active video stream.

func (*Playback) PlayerVolume added in v0.29.0

PlayerVolume - Player Volume Set the client volume.

func (*Playback) RemoveFromContinueWatching added in v0.29.0

RemoveFromContinueWatching - Remove From Continue Watching Remove an item from the Continue Watching list.

If set, this operation will use [Security.Token] from the global security.

type Playlist added in v0.26.0

type Playlist struct {
	// contains filtered or unexported fields
}

Playlist - Media playlists that can be created and played back

func (*Playlist) GetPlaylist added in v0.26.0

GetPlaylist - Retrieve Playlist Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item: Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing.

func (*Playlist) GetPlaylistItems added in v0.26.0

GetPlaylistItems - Retrieve Playlist Contents Gets the contents of a playlist. Should be paged by clients via standard mechanisms. By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter. For example, you could use this to display a list of recently added albums vis a smart playlist. Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.

func (*Playlist) ListPlaylists added in v0.26.0

ListPlaylists - List playlists Gets a list of playlists and playlist folders for a user. General filters are permitted, such as `sort=lastViewedAt:desc`. A flat playlist list can be retrieved using `type=15` to limit the collection to just playlists.

type Playlists

type Playlists struct {
	// contains filtered or unexported fields
}

Plex Playlists operations

func (*Playlists) DeletePlaylistByRatingKey added in v0.29.0

DeletePlaylistByRatingKey - Delete Playlist Delete a playlist.

If set, this operation will use [Security.Token] from the global security.

type Plex added in v0.2.0

type Plex struct {
	// contains filtered or unexported fields
}

Plex Plex operations

func (*Plex) GetServerResources added in v0.11.1

GetServerResources - Get Server Resources Get Plex server access tokens and server connections

type PlexAPI

type PlexAPI struct {
	SDKVersion string
	// General endpoints for basic PMS operation not specific to any media provider
	General *General
	// The server can notify clients in real-time of a wide range of events, from library scanning, to preferences being modified, to changes to media, and many other things. This is also the mechanism by which activity progress is reported.
	//
	// Two protocols for receiving the events are available: EventSource (also known as SSE), and WebSocket.
	Events *Events
	// API Operations against the Preferences
	Preferences *Preferences
	// Plex Playback operations
	Playback *Playback
	// Operations for rating media items (thumbs up/down, star ratings, etc.)
	Rate *Rate
	// The actions feature within a media provider
	Timeline *Timeline
	// Media providers are the starting points for the entire Plex Media Server media library API.  It defines the paths for the groups of endpoints.  The `/media/providers` should be the only hard-coded path in clients when accessing the media library.  Non-media library endpoints are outside the scope of the media provider.  See the description in See [the section in API Info](#section/API-Info/Media-Providers) for more information on how to use media providers.
	// Note: Dynamic proxy paths such as `/{provider}/search`, `/{provider}/metadata`, and other provider-relative routes are resolved through the media provider API.
	Provider *Provider
	// Activities provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.
	//
	// Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.
	//
	// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint.
	Activities *Activities
	// Plex Users operations
	Users *Users
	// Plex Authentication operations
	Authentication *Authentication
	// The butler is responsible for running periodic tasks.  Some tasks run daily, others every few days, and some weekly.  These includes database maintenance, metadata updating, thumbnail generation, media analysis, and other tasks.
	Butler *Butler
	// API Operations against the Download Queue.
	// Note: The Download Queue is distinct from the Play Queue. The Download Queue manages offline/downloaded content, while the Play Queue manages active playback sessions.
	DownloadQueue *DownloadQueue
	// The hubs within a media provider
	Hubs *Hubs
	// The search feature within a media provider
	Search *Search
	// Library endpoints which are outside of the Media Provider API.  Typically this is manipulation of the library (adding/removing sections, modifying preferences, etc).
	Library *Library
	// API Operations against the Collections
	Collections *Collections
	// The DVR provides means to watch and record live TV.  This section of endpoints describes how to setup the DVR itself
	DVRs *DVRs
	// The EPG (Electronic Program Guide) is responsible for obtaining metadata for what is airing on each channel and when
	Epg *Epg
	// LiveTV contains the playback sessions of a channel from a DVR device
	LiveTV *LiveTV
	// Logging mechanism to allow clients to log to the server
	Log *Log
	// Media grabbers provide ways for media to be obtained for a given protocol. The simplest ones are `stream` and `download`. More complex grabbers can have associated devices
	//
	// Network tuners can present themselves on the network using the Simple Service Discovery Protocol and Plex Media Server will discover them. The following XML is an example of the data returned from SSDP. The `deviceType`, `serviceType`, and `serviceId` values must remain as they are in the example in order for PMS to properly discover the device. Other less-obvious fields are described in the parameters section below.
	//
	// Example SSDP output
	// “`
	// <root xmlns="urn:schemas-upnp-org:device-1-0">
	//     <specVersion>
	//         <major>1</major>
	//         <minor>0</minor>
	//     </specVersion>
	//     <device>
	//         <deviceType>urn:plex-tv:device:Media:1</deviceType>
	//         <friendlyName>Turing Hopper 3000</friendlyName>
	//         <manufacturer>Plex, Inc.</manufacturer>
	//         <manufacturerURL>https://plex.tv/</manufacturerURL>
	//         <modelDescription>Turing Hopper 3000 Media Grabber</modelDescription>
	//         <modelName>Plex Media Grabber</modelName>
	//         <modelNumber>1</modelNumber>
	//         <modelURL>https://plex.tv</modelURL>
	//         <UDN>uuid:42fde8e4-93b6-41e5-8a63-12d848655811</UDN>
	//         <serviceList>
	//             <service>
	//                 <URLBase>http://10.0.0.5:8088</URLBase>
	//                 <serviceType>urn:plex-tv:service:MediaGrabber:1</serviceType>
	//                 <serviceId>urn:plex-tv:serviceId:MediaGrabber</serviceId>
	//             </service>
	//         </serviceList>
	//     </device>
	// </root>
	// “`
	//
	//   - UDN: (string) A UUID for the device. This should be unique across models of a device at minimum.
	//   - URLBase: (string) The base HTTP URL for the device from which all of the other endpoints are hosted.
	//
	// Note: This tag covers media grabber and network tuner devices only. For client device discovery, use `/clients` or `/resources`.
	Devices *Devices
	// Subscriptions determine which media will be recorded and the criteria for selecting an airing when multiple are available
	Subscriptions *Subscriptions
	// API Operations against the Transcoder
	Transcoder *Transcoder
	// Plex Playlists operations
	Playlists *Playlists
	// Media playlists that can be created and played back
	Playlist *Playlist
	// Endpoints for manipulating playlists.
	LibraryPlaylists *LibraryPlaylists
	// The playqueue feature within a media provider
	// A play queue represents the current list of media for playback. Although queues are persisted by the server, they should be regarded by the user as a fairly lightweight, an ephemeral list of items queued up for playback in a session.  There is generally one active queue for each type of media (music, video, photos) that can be added to or destroyed and replaced with a fresh queue.
	// Play Queues has a region, which we refer to in this doc (partially for historical reasons) as "Up Next". This region is defined by `playQueueLastAddedItemID` existing on the media container. This follows iTunes' terminology. It is a special region after the currently playing item but before the originally-played items. This enables "Party Mode" listening/viewing, where items can be added on-the-fly, and normal queue playback resumed when completed.
	// You can visualize the play queue as a sliding window in the complete list of media queued for playback. This model is important when scaling to larger play queues (e.g. shuffling 40,000 audio tracks). The client only needs visibility into small areas of the queue at any given time, and the server can optimize access in this fashion.
	// All created play queues will have an empty "Up Next" area - unless the item is an album and no `key` is provided. In this case the "Up Next" area will be populated by the contents of the album. This is to allow queueing of multiple albums - since the 'Add to Up Next' will insert after all the tracks. This means that If you're creating a PQ from an album, you can only shuffle it if you set `key`. This is due to the above implicit queueing of albums when no `key` is provided as well as the current limitation that you cannot shuffle a PQ with an "Up Next" area.
	// The play queue window advances as the server receives timeline requests. The client needs to retrieve the play queue as the “now playing” item changes. There is no play queue API to update the playing item.
	PlayQueue *PlayQueue
	// Plex Plex operations
	Plex *Plex
	// Service provided to compute UltraBlur colors and images.
	UltraBlur *UltraBlur
	// The status endpoints give you information about current playbacks, play history, and even terminating sessions.
	Status *Status
	// 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.
	Updater *Updater
	// The actual content of the media provider
	Content *Content
	// Endpoints for manipulating collections.  In addition to these endpoints, `/library/collections/:collectionId/X` will be rerouted to `/library/metadata/:collectionId/X` and respond to those endpoints as well.
	LibraryCollections *LibraryCollections
	// contains filtered or unexported fields
}

PlexAPI - Plex Media Server: OpenAPI specification for the Plex Media Server (PMS) API and the plex.tv cloud API.

## Base URLs

- **PMS (local server)**: `http(s)://{host}:{port}` — Most endpoints in this spec target the local PMS. - **plex.tv v2**: `https://plex.tv/api/v2` — Authentication, account, and social endpoints. - **plex.tv v1 (legacy)**: `https://plex.tv/api` — Legacy XML endpoints (friends, home users, claims). - **Cloud providers**: `https://discover.provider.plex.tv`, `https://metadata.provider.plex.tv`, etc.

Endpoints that target plex.tv or cloud providers declare an override `servers` array.

## Authentication

- **X-Plex-Token**: Pass via the `X-Plex-Token` header on every request. It may also be passed as a query parameter (`?X-Plex-Token=...`) on all endpoints. - **X-Plex-Client-Identifier**: Mandatory for OAuth PIN flow (`/pins`) and JWT device registration. Must be a unique, persistent identifier for the client application. - **OAuth PIN Flow**: `POST /pins` → user visits `https://plex.tv/link` → `GET /pins/{pinId}` → obtain `authToken`.

## Response Formats

- **PMS endpoints**: Return XML by default. Send `Accept: application/json` to receive JSON. - **plex.tv v2**: Returns JSON by default. - **Legacy v1 endpoints** (`/pins.xml`, `/api/resources`, `/api/users/`): Return XML only.

## Rate Limiting

plex.tv auth endpoints (PIN creation, sign-in) enforce rate limits. Clients should implement exponential backoff and reuse tokens rather than re-authenticating on every request.

func New

func New(opts ...SDKOption) *PlexAPI

New creates a new instance of the SDK with the provided options

type Preferences added in v0.26.0

type Preferences struct {
	// contains filtered or unexported fields
}

Preferences - API Operations against the Preferences

func (*Preferences) GetAllPreferences added in v0.26.0

func (s *Preferences) GetAllPreferences(ctx context.Context, opts ...operations.Option) (*operations.GetAllPreferencesResponse, error)

GetAllPreferences - Get all preferences Get the list of all preferences

func (*Preferences) GetPreference added in v0.26.0

GetPreference - Get a preferences Get a single preference and value

func (*Preferences) SetPreferences added in v0.26.0

SetPreferences - Set preferences Set a set of preferences in query parameters

type Provider added in v0.26.0

type Provider struct {
	// contains filtered or unexported fields
}

Provider - Media providers are the starting points for the entire Plex Media Server media library API. It defines the paths for the groups of endpoints. The `/media/providers` should be the only hard-coded path in clients when accessing the media library. Non-media library endpoints are outside the scope of the media provider. See the description in See [the section in API Info](#section/API-Info/Media-Providers) for more information on how to use media providers. Note: Dynamic proxy paths such as `/{provider}/search`, `/{provider}/metadata`, and other provider-relative routes are resolved through the media provider API.

func (*Provider) AddProvider added in v0.26.0

AddProvider - Add a media provider This endpoint registers a media provider with the server. Once registered, the media server acts as a reverse proxy to the provider, allowing both local and remote providers to work.

func (*Provider) AddToWatchlist added in v0.29.0

AddToWatchlist - Add to Watchlist Add an item to the user's Plex Discover watchlist.

func (*Provider) DeleteMediaProvider added in v0.26.0

DeleteMediaProvider - Delete a media provider Deletes a media provider with the given id

func (*Provider) GetWatchlist added in v0.29.0

GetWatchlist - Get Watchlist Get the user's Plex Discover watchlist.

func (*Provider) ListProviders added in v0.26.0

func (s *Provider) ListProviders(ctx context.Context, opts ...operations.Option) (*operations.ListProvidersResponse, error)

ListProviders - Get the list of available media providers Get the list of all available media providers for this PMS. This will generally include the library provider and possibly EPG if DVR is set up.

func (*Provider) RefreshProviders added in v0.26.0

func (s *Provider) RefreshProviders(ctx context.Context, opts ...operations.Option) (*operations.RefreshProvidersResponse, error)

RefreshProviders - Refresh media providers Refresh all known media providers. This is useful in case a provider has updated features.

func (*Provider) RemoveFromWatchlist added in v0.29.0

RemoveFromWatchlist - Remove from Watchlist Remove an item from the user's Plex Discover watchlist.

func (*Provider) SearchDiscover added in v0.29.0

SearchDiscover - Search Discover Search movies and shows in Plex Discover.

type Rate added in v0.26.0

type Rate struct {
	// contains filtered or unexported fields
}

Rate - Operations for rating media items (thumbs up/down, star ratings, etc.)

func (*Rate) SetRating added in v0.26.0

SetRating - Rate an item Set the rating on an item. This API does respond to the GET verb but applications should use PUT

type SDKOption

type SDKOption func(*PlexAPI)

func WithAccepts added in v0.26.0

func WithAccepts(accepts components.Accepts) SDKOption

WithAccepts allows setting the Accepts parameter for all supported operations

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithClientIdentifier added in v0.26.0

func WithClientIdentifier(clientIdentifier string) SDKOption

WithClientIdentifier allows setting the ClientIdentifier parameter for all supported operations

func WithDevice added in v0.26.0

func WithDevice(device string) SDKOption

WithDevice allows setting the Device parameter for all supported operations

func WithDeviceName added in v0.11.11

func WithDeviceName(deviceName string) SDKOption

WithDeviceName allows setting the DeviceName parameter for all supported operations

func WithDeviceVendor added in v0.26.0

func WithDeviceVendor(deviceVendor string) SDKOption

WithDeviceVendor allows setting the DeviceVendor parameter for all supported operations

func WithFullServerURL added in v0.27.0

func WithFullServerURL(fullServerURL string) SDKOption

WithFullServerURL allows setting the full_server_url variable for url substitution

func WithHost added in v0.26.0

func WithHost(host string) SDKOption

WithHost allows setting the host variable for url substitution

func WithIPDescription added in v0.26.0

func WithIPDescription(ipDescription string) SDKOption

WithIPDescription allows setting the IP-description variable for url substitution

func WithIdentifier added in v0.26.0

func WithIdentifier(identifier string) SDKOption

WithIdentifier allows setting the identifier variable for url substitution

func WithMarketplace added in v0.26.0

func WithMarketplace(marketplace string) SDKOption

WithMarketplace allows setting the Marketplace parameter for all supported operations

func WithModel added in v0.26.0

func WithModel(model string) SDKOption

WithModel allows setting the Model parameter for all supported operations

func WithPlatform added in v0.15.0

func WithPlatform(platform string) SDKOption

WithPlatform allows setting the Platform parameter for all supported operations

func WithPlatformVersion added in v0.26.0

func WithPlatformVersion(platformVersion string) SDKOption

WithPlatformVersion allows setting the PlatformVersion parameter for all supported operations

func WithPort

func WithPort(port string) SDKOption

WithPort allows setting the port variable for url substitution

func WithProduct added in v0.26.0

func WithProduct(product string) SDKOption

WithProduct allows setting the Product parameter for all supported operations

func WithProtocol

func WithProtocol(protocol string) SDKOption

WithProtocol allows setting the protocol variable for url substitution

func WithRetryConfig

func WithRetryConfig(retryConfig retry.Config) SDKOption

func WithSecurity

func WithSecurity(token string) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource added in v0.2.1

func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServerIndex

func WithServerIndex(serverIndex int) SDKOption

WithServerIndex allows the overriding of the default server by index

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows providing an alternative server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

func WithTimeout added in v0.11.1

func WithTimeout(timeout time.Duration) SDKOption

WithTimeout Optional request timeout applied to each operation

func WithVersion added in v0.26.0

func WithVersion(version string) SDKOption

WithVersion allows setting the Version parameter for all supported operations

type Search struct {
	// contains filtered or unexported fields
}

Search - The search feature within a media provider

func (*Search) SearchHubs added in v0.26.0

SearchHubs - Search Hub Perform a search and get the result as hubs

This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).

In the response's items, the following extra attributes are returned to further describe or disambiguate the result:

- `reason`: The reason for the result, if not because of a direct search term match; can be either:

  • `section`: There are multiple identical results from different sections.
  • `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language).
  • `<hub identifier>`: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor`

- `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold"). - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID.

This request is intended to be very fast, and called as the user types.

func (*Search) VoiceSearchHubs added in v0.26.0

VoiceSearchHubs - Voice Search Hub Perform a search tailored to voice input and get the result as hubs

This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint. It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint. Whenever possible, clients should limit the search to the appropriate type.

Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.

type Status added in v0.26.0

type Status struct {
	// contains filtered or unexported fields
}

Status - The status endpoints give you information about current playbacks, play history, and even terminating sessions.

func (*Status) DeleteHistory added in v0.26.0

DeleteHistory - Delete Single History Item Delete a single history item by id

If set, this operation will use [Security.Token] from the global security.

func (*Status) GetBackgroundTasks added in v0.26.0

func (s *Status) GetBackgroundTasks(ctx context.Context, opts ...operations.Option) (*operations.GetBackgroundTasksResponse, error)

GetBackgroundTasks - Get background tasks Get the list of all background tasks

If set, this operation will use [Security.Token] from the global security.

func (*Status) GetHistoryItem added in v0.26.0

GetHistoryItem - Get Single History Item Get a single history item by id

If set, this operation will use [Security.Token] from the global security.

func (*Status) ListPlaybackHistory added in v0.26.0

ListPlaybackHistory - List Playback History List all playback history (Admin can see all users, others can only see their own). Pagination should be used on this endpoint. Additionally this endpoint supports `includeFields`, `excludeFields`, `includeElements`, and `excludeElements` parameters.

func (*Status) ListSessions added in v0.26.0

func (s *Status) ListSessions(ctx context.Context, opts ...operations.Option) (*operations.ListSessionsResponse, error)

ListSessions - List Sessions List all current playbacks on this server

If set, this operation will use [Security.Token] from the global security.

func (*Status) TerminateSession added in v0.26.0

TerminateSession - Terminate a session Terminate a playback session kicking off the user

If set, this operation will use [Security.Token] from the global security.

type Subscriptions added in v0.26.0

type Subscriptions struct {
	// contains filtered or unexported fields
}

Subscriptions determine which media will be recorded and the criteria for selecting an airing when multiple are available

func (*Subscriptions) CancelGrab added in v0.26.0

CancelGrab - Cancel an existing grab Cancels an existing media grab (recording). It can be used to resolve a conflict which exists for a rolling subscription. Note: This cancellation does not persist across a server restart, but neither does a rolling subscription itself.

func (*Subscriptions) CreateSubscription added in v0.26.0

CreateSubscription - Create a subscription Create a subscription. The query parameters should be mostly derived from the [template](#tag/Subscriptions/operation/mediaSubscriptionsGetTemplate)

func (*Subscriptions) DeleteSubscription added in v0.26.0

DeleteSubscription - Delete a subscription Delete a subscription, cancelling all of its grabs as well

func (*Subscriptions) EditSubscriptionPreferences added in v0.26.0

EditSubscriptionPreferences - Edit a subscription Edit a subscription's preferences

func (*Subscriptions) GetAllSubscriptions added in v0.26.0

GetAllSubscriptions - Get all subscriptions Get all subscriptions and potentially the grabs too

func (*Subscriptions) GetScheduledRecordings added in v0.26.0

func (s *Subscriptions) GetScheduledRecordings(ctx context.Context, opts ...operations.Option) (*operations.GetScheduledRecordingsResponse, error)

GetScheduledRecordings - Get all scheduled recordings Get all scheduled recordings across all subscriptions

func (*Subscriptions) GetSubscription added in v0.26.0

GetSubscription - Get a single subscription Get a single subscription and potentially the grabs too

func (*Subscriptions) GetTemplate added in v0.26.0

GetTemplate - Get the subscription template Get the templates for a piece of media which could include fetching one airing, season, the whole show, etc.

func (*Subscriptions) ProcessSubscriptions added in v0.26.0

func (s *Subscriptions) ProcessSubscriptions(ctx context.Context, opts ...operations.Option) (*operations.ProcessSubscriptionsResponse, error)

ProcessSubscriptions - Process all subscriptions Process all subscriptions asynchronously

func (*Subscriptions) ReorderSubscription added in v0.26.0

ReorderSubscription - Re-order a subscription Re-order a subscription to change its priority

If set, this operation will use [Security.Token] from the global security.

type Timeline added in v0.26.0

type Timeline struct {
	// contains filtered or unexported fields
}

Timeline - The actions feature within a media provider

func (*Timeline) GetConversionQueue added in v0.29.0

GetConversionQueue - Get Conversion Queue Get the conversion/optimization queue.

If set, this operation will use [Security.Token] from the global security.

func (*Timeline) MarkPlayed added in v0.26.0

MarkPlayed - Mark an item as played Mark an item as played. Note, this does not create any view history of this item but rather just sets the state as played. The client must provide either the `key` or `uri` query parameter This API does respond to the GET verb but applications should use PUT

func (*Timeline) Report added in v0.26.0

Report media timeline This endpoint is hit during media playback for an item. It must be hit whenever the play state changes, or in the absence of a play state change, in a regular fashion (generally this means every 10 seconds on a LAN/WAN, and every 20 seconds over cellular).

func (*Timeline) Unscrobble added in v0.26.0

Unscrobble - Mark an item as unplayed Mark an item as unplayed. The client must provide either the `key` or `uri` query parameter This API does respond to the GET verb but applications should use PUT

type Transcoder added in v0.26.0

type Transcoder struct {
	// contains filtered or unexported fields
}

Transcoder - API Operations against the Transcoder

func (*Transcoder) GetDASHSegment added in v0.29.0

GetDASHSegment - Get DASH Segment DASH segment delivery for adaptive streaming.

If set, this operation will use [Security.Token] from the global security.

func (*Transcoder) GetHLSSegment added in v0.29.0

GetHLSSegment - Get HLS Segment HLS TS segment delivery for adaptive streaming.

If set, this operation will use [Security.Token] from the global security.

func (*Transcoder) GetTranscodeSessions added in v0.29.0

func (s *Transcoder) GetTranscodeSessions(ctx context.Context, opts ...operations.Option) (*operations.GetTranscodeSessionsResponse, error)

GetTranscodeSessions - Get Transcode Sessions Get active transcode sessions.

If set, this operation will use [Security.Token] from the global security.

func (*Transcoder) MakeDecision added in v0.26.0

MakeDecision - Make a decision on media playback Make a decision on media playback based on client profile, and requested settings such as bandwidth and resolution.

func (*Transcoder) StartTranscodeSession added in v0.26.0

StartTranscodeSession - Start A Transcoding Session Starts the transcoder and returns the corresponding streaming resource document.

func (*Transcoder) TranscodeImage added in v0.26.0

TranscodeImage - Transcode an image Transcode an image, possibly changing format or size

func (*Transcoder) TranscodeMusic added in v0.29.0

TranscodeMusic - Transcode Music Audio transcode endpoint for music playback.

If set, this operation will use [Security.Token] from the global security.

func (*Transcoder) TranscodeSubtitles added in v0.26.0

TranscodeSubtitles - Transcode subtitles Only transcode subtitle streams.

func (*Transcoder) TriggerFallback added in v0.26.0

TriggerFallback - Manually trigger a transcoder fallback Manually trigger a transcoder fallback ex: HEVC to h.264 or hw to sw

type UltraBlur added in v0.26.0

type UltraBlur struct {
	// contains filtered or unexported fields
}

UltraBlur - Service provided to compute UltraBlur colors and images.

func (*UltraBlur) GetColors added in v0.26.0

GetColors - Get UltraBlur Colors Retrieves the four colors extracted from an image for clients to use to generate an ultrablur image.

func (*UltraBlur) GetImage added in v0.26.0

GetImage - Get UltraBlur Image Retrieves a server-side generated UltraBlur image based on the provided color inputs. Clients should always call this via the photo transcoder endpoint.

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater - 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.

func (*Updater) ApplyUpdates

ApplyUpdates - Applying updates Apply any downloaded updates. Note that the two parameters `tonight` and `skip` are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed.

If set, this operation will use [Security.Token] from the global security.

func (*Updater) CheckUpdates added in v0.26.0

CheckUpdates - Checking for updates Perform an update check and potentially download

If set, this operation will use [Security.Token] from the global security.

func (*Updater) GetUpdatesStatus added in v0.26.0

func (s *Updater) GetUpdatesStatus(ctx context.Context, opts ...operations.Option) (*operations.GetUpdatesStatusResponse, error)

GetUpdatesStatus - Querying status of updates Get the status of updating the server

If set, this operation will use [Security.Token] from the global security.

type Users added in v0.18.0

type Users struct {
	// contains filtered or unexported fields
}

Plex Users operations

func (*Users) CreateHomeUser added in v0.29.0

CreateHomeUser - Create Home User Create a new Plex Home user.

func (*Users) DeleteHomeUser added in v0.29.0

DeleteHomeUser - Delete Home User Remove a Plex Home user.

func (*Users) GetAccountJSON added in v0.29.0

GetAccountJSON - Get Account (JSON) Get the logged-in user's account details in JSON format (legacy v1 endpoint).

func (*Users) GetAccountXML added in v0.29.0

GetAccountXML - Get Account (XML) Get the logged-in user's account details in XML format (legacy v1 endpoint).

func (*Users) GetFriends added in v0.29.0

GetFriends - Get Friends Get the list of friends and shared users.

func (*Users) GetHome added in v0.29.0

func (s *Users) GetHome(ctx context.Context, opts ...operations.Option) (*operations.GetHomeResponse, error)

GetHome - Get home hubs Get Plex Home user list.

func (*Users) GetHomeUsers added in v0.29.0

GetHomeUsers - Get home hubs Users Get the list of Plex Home users.

func (*Users) GetLegacyResources added in v0.29.0

func (s *Users) GetLegacyResources(ctx context.Context, opts ...operations.Option) (*operations.GetLegacyResourcesResponse, error)

GetLegacyResources - Get Legacy Resources Get legacy published server connections (XML).

func (*Users) GetLegacyUsers added in v0.29.0

func (s *Users) GetLegacyUsers(ctx context.Context, opts ...operations.Option) (*operations.GetLegacyUsersResponse, error)

GetLegacyUsers - Get Legacy Users Get legacy friends list (XML).

func (*Users) GetMyPlexAccount added in v0.29.0

func (s *Users) GetMyPlexAccount(ctx context.Context, opts ...operations.Option) (*operations.GetMyPlexAccountResponse, error)

GetMyPlexAccount - Get MyPlex Account Get linked MyPlex account info on PMS.

If set, this operation will use [Security.Token] from the global security.

func (*Users) GetServerDetails added in v0.29.0

GetServerDetails - Get Server Details Get server details for sharing.

func (*Users) GetServerUserFeatures added in v0.29.0

GetServerUserFeatures - Get Server User Features Get features enabled per shared user for the server.

func (*Users) GetUserOptOuts added in v0.29.0

GetUserOptOuts - Get User Opt-Outs Get online media source opt-out settings for a user.

func (*Users) GetUserServer added in v0.29.0

GetUserServer - Get User Server Association Get server association information for the logged-in user.

func (*Users) GetUsers added in v0.18.0

GetUsers - Get list of all connected users Get list of all users that are friends and have library access with the provided Plex authentication token

func (*Users) RemoveShare added in v0.29.0

RemoveShare - Remove Share Remove a share / friend.

func (*Users) ShareServer added in v0.29.0

ShareServer - Share Server Share a server with a friend or managed user.

func (*Users) ShareServerLegacy added in v0.29.0

ShareServerLegacy - Share Server (Legacy v1) Share a library with a friend (legacy v1 XML endpoint).

func (*Users) UpdateHomeUser added in v0.29.0

UpdateHomeUser - Update Home User Update a Plex Home user.

func (*Users) UpdateRestrictedUser added in v0.29.0

UpdateRestrictedUser - Update Restricted User Update restricted (managed) home user settings.

func (*Users) UpdateShare added in v0.29.0

UpdateShare - Update Share Update friend filters (allowSync, filterMovies, etc.).

func (*Users) UpdateViewStateSync added in v0.29.0

UpdateViewStateSync - Update View State Sync Enable or disable watch-state sync consent for the logged-in user.

Directories

Path Synopsis
internal
models

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL