From 657753a722e2a6a5cca42b9911026bb53bf5cd0f Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Thu, 20 Nov 2025 00:33:40 +0000 Subject: [PATCH] ci: regenerated with Speakeasy CLI v1.658.2 --- .speakeasy/workflow.lock | 10 +- openapi-with-code-samples.yaml | 64644 +++++++++++++++++++------------ 2 files changed, 40616 insertions(+), 24038 deletions(-) diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e313beb..b4ddc90 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,13 +1,13 @@ -speakeasyVersion: 1.509.0 +speakeasyVersion: 1.658.2 sources: merge-code-samples-into-spec: sourceNamespace: merge-code-samples-into-spec - sourceRevisionDigest: sha256:b28c0b9e22357a682f336b10552700fc8a8094798cbfcca03dafeeaf2f045ce2 - sourceBlobDigest: sha256:930f342a125400a8bc5ea62a4dfc5fbd47fdfae7ce9f0aff42137f533b32e1de + sourceRevisionDigest: sha256:4224026fd13e77a9f098a3c474fd5bdb9e082fd91dfc9e33391f146c590af7d0 + sourceBlobDigest: sha256:9801f773e37702120b0a2269f79d59f48381ac91ee0d3cb2a79745b76c50591e tags: - latest - - speakeasy-sdk-regen-1727310453 - - 0.0.3 + - speakeasy-sdk-regen-1741134607 + - 1.1.1 targets: {} workflow: workflowVersion: 1.0.0 diff --git a/openapi-with-code-samples.yaml b/openapi-with-code-samples.yaml index 3526f7e..cbb17f6 100644 --- a/openapi-with-code-samples.yaml +++ b/openapi-with-code-samples.yaml @@ -1,245 +1,231 @@ -openapi: 3.1.0 +openapi: 3.1.1 info: - version: 0.0.3 - title: Plex-API - summary: An Open API Spec for interacting with Plex.tv and Plex Media Server - description: | - # Plex Media Server OpenAPI Specification - - An Open Source OpenAPI Specification for Plex Media Server - - Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/) - - ## Documentation - - [API Documentation](https://plexapi.dev) - - ## SDKs - - The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the [main specification Repository](https://github.com/LukeHagar/plex-api-spec). - - | Language | Repository | Releases | Other | - | --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- | - | Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - | - | JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - | - | Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) | - | Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - | - | Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - | - | PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - | - | Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - | - | C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | - - contact: - name: Luke Hagar - url: 'https://www.LukeHagar.com' - email: Lukeslakemail@gmail.com + title: Plex Media Server + version: 1.1.1 license: - url: 'https://opensource.org/license/mit' - name: MIT + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html servers: - - url: '{protocol}://{ip}:{port}' - description: The full address of your Plex Server + - url: "https://{IP-description}.{identifier}.plex.direct:{port}" variables: - protocol: - default: https - enum: - - http - - https - ip: - default: 10.10.10.47 + identifier: + description: The unique identifier of this particular PMS + default: 0123456789abcdef0123456789abcdef + IP-description: + description: A `-` separated string of the IPv4 or IPv6 address components + default: 1-2-3-4 port: default: '32400' + - url: "{protocol}://{host}:{port}" + variables: + protocol: + description: The network protocol to use. Typically (`http` or `https`) + default: http + host: + description: "The Host of the PMS.\nIf using on a local network, this is the internal IP address of the server hosting the PMS.\nIf using on an external network, this is the external IP address for your network, and requires port forwarding.\nIf using a reverse proxy, this would be the external DNS domain for your network, and requires the proxy handle port forwarding. \n" + default: localhost + port: + description: "The Port number configured on the PMS. Typically (`32400`). \nIf using a reverse proxy, this would be the port number configured on the proxy.\n" + default: '32400' + - url: "{full_server_url}" + variables: + full_server_url: + description: The full manual URL to access the PMS + default: http://localhost:32400 security: - - accessToken: [] -components: - securitySchemes: - accessToken: - description: Plex Authentication Token - type: apiKey - in: header - name: X-Plex-Token + - token: + - shared user + - admin +x-speakeasy-globals: + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" +tags: + - name: Activities + description: | + 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. + - name: Butler + description: 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. + - name: Collections + description: API Operations against the Collections + - name: Content + description: The actual content of the media provider + - name: Devices + description: | + 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 + ``` + + + 1 + 0 + + + urn:plex-tv:device:Media:1 + Turing Hopper 3000 + Plex, Inc. + https://plex.tv/ + Turing Hopper 3000 Media Grabber + Plex Media Grabber + 1 + https://plex.tv + uuid:42fde8e4-93b6-41e5-8a63-12d848655811 + + + http://10.0.0.5:8088 + urn:plex-tv:service:MediaGrabber:1 + urn:plex-tv:serviceId:MediaGrabber + + + + + ``` + + - 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. + - name: Download Queue + description: API Operations against the Download Queue + - name: DVRs + description: | + The DVR provides means to watch and record live TV. This section of endpoints describes how to setup the DVR itself + - name: EPG + description: | + The EPG (Electronic Program Guide) is responsible for obtaining metadata for what is airing on each channel and when + - name: Events + description: | + 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. + - name: General + description: General endpoints for basic PMS operation not specific to any media provider + - name: Hubs + description: The hubs within a media provider + - name: Library + description: Library endpoints which are outside of the Media Provider API. Typically this is manipulation of the library (adding/removing sections, modifying preferences, etc). + - name: Library Collections + description: 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. + x-displayName: 'Library: Collections' + - name: Library Playlists + description: Endpoints for manipulating playlists. + x-displayName: 'Library: Playlists' + - name: Live TV + description: | + LiveTV contains the playback sessions of a channel from a DVR device + - name: Log + description: Logging mechanism to allow clients to log to the server + - name: Play Queue + description: "The playqueue feature within a media provider\nA 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.\nPlay 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. \nYou 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.\nAll 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.\nThe 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." + - name: Playlist + description: Media playlists that can be created and played back + - name: Preferences + description: API Operations against the Preferences + - name: Provider + description: 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. + - name: Rate + description: Operations for rating media items (thumbs up/down, star ratings, etc.) + - name: Search + description: The search feature within a media provider + - name: Status + description: The status endpoints give you information about current playbacks, play history, and even terminating sessions. + - name: Subscriptions + description: | + Subscriptions determine which media will be recorded and the criteria for selecting an airing when multiple are available + - name: Timeline + description: The actions feature within a media provider + - name: Transcoder + description: API Operations against the Transcoder + - name: UltraBlur + description: Service provided to compute UltraBlur colors and images. + - name: Updater + description: | + 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. +x-tagGroups: + - name: General + tags: + - General + - Library + - Library Playlists + - Library Collections + - Status + - Activities + - Updater + - Butler + - Events + - Log + - Preferences + - Download Queue + - UltraBlur + - Transcoder + - name: Playback & Sessions + tags: + - Status + - Timeline + - Play Queue + - Transcoder + - name: Media Provider + tags: + - Provider + - Content + - Hubs + - Search + - Rate + - Playlist + - Play Queue + - Timeline + - name: DVR + tags: + - DVRs + - Devices + - EPG + - Subscriptions + - Live TV paths: /: get: + summary: Get PMS info + operationId: getServerInfo + description: Information about this PMS setup and configuration tags: - - Server - summary: Get Server Capabilities - description: Get Server Capabilities - operationId: getServerCapabilities + - General + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" responses: '200': - description: The Server Capabilities + description: OK content: application/json: schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: number - allowCameraUpload: - type: boolean - allowChannelAccess: - type: boolean - allowMediaDeletion: - type: boolean - allowSharing: - type: boolean - allowSync: - type: boolean - allowTuners: - type: boolean - backgroundProcessing: - type: boolean - certificate: - type: boolean - companionProxy: - type: boolean - countryCode: - type: string - diagnostics: - type: string - eventStream: - type: boolean - friendlyName: - type: string - hubSearch: - type: boolean - itemClusters: - type: boolean - livetv: - type: number - machineIdentifier: - type: string - mediaProviders: - type: boolean - multiuser: - type: boolean - musicAnalysis: - type: number - myPlex: - type: boolean - myPlexMappingState: - type: string - myPlexSigninState: - type: string - myPlexSubscription: - type: boolean - myPlexUsername: - type: string - offlineTranscode: - type: number - ownerFeatures: - type: string - photoAutoTag: - type: boolean - platform: - type: string - platformVersion: - type: string - pluginHost: - type: boolean - pushNotifications: - type: boolean - readOnlyLibraries: - type: boolean - streamingBrainABRVersion: - type: number - streamingBrainVersion: - type: number - sync: - type: boolean - transcoderActiveVideoSessions: - type: number - transcoderAudio: - type: boolean - transcoderLyrics: - type: boolean - transcoderPhoto: - type: boolean - transcoderSubtitles: - type: boolean - transcoderVideo: - type: boolean - transcoderVideoBitrates: - type: string - transcoderVideoQualities: - type: string - transcoderVideoResolutions: - type: string - updatedAt: - type: number - updater: - type: boolean - version: - type: string - voiceSearch: - type: boolean - Directory: - type: array - items: - type: object - properties: - count: - type: number - key: - type: string - title: - type: string - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/schemas/MediaContainerWithDirectory' x-codeSamples: - lang: php - label: getServerCapabilities + label: PlexPHP source: |- declare(strict_types=1); @@ -263,165 +249,295 @@ paths: // handle response } - lang: ruby - label: getServerCapabilities - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.server.get_server_capabilities()\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.server.get_server_capabilities() + + if ! res.object.nil? + # handle response + end - lang: go - label: getServerCapabilities - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetServerCapabilities(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{}) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDirectory != nil { + // handle response + } + } - lang: java - label: getServerCapabilities + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetServerCapabilitiesBadRequest; - import dev.plexapi.plexapi.models.errors.GetServerCapabilitiesUnauthorized; - import dev.plexapi.plexapi.models.operations.GetServerCapabilitiesResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetServerInfoRequest; + import dev.plexapi.sdk.models.operations.GetServerInfoResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetServerCapabilitiesBadRequest, GetServerCapabilitiesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities() + GetServerInfoRequest req = GetServerInfoRequest.builder() + .build(); + + GetServerInfoResponse res = sdk.general().getServerInfo() + .request(req) .call(); - if (res.object().isPresent()) { + if (res.mediaContainerWithDirectory().isPresent()) { // handle response } } } - lang: typescript - label: getServerCapabilities + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.server.getServerCapabilities(); + const result = await plexAPI.general.getServerInfo({}); - // Handle the result console.log(result); } run(); - '/:/prefs': + /:/eventsource/notifications: get: + summary: Connect to Eventsource + operationId: getNotifications + description: Connect to the event source to get a stream of events tags: - - Server - summary: Get Server Preferences - description: Get Server Preferences - operationId: getServerPreferences + - Events + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: filter + description: | + By default, all events except logs are sent. A rich filtering mechanism is provided to allow clients to opt into or out of each event type using the `filters` parameter. For example: + + - `filters=-log`: All event types except logs (the default). + - `filters=foo,bar`: Only the foo and bar event types. + - `filters=`: All events types. + - `filters=-foo,bar`: All event types except foo and bar. + in: query + schema: + type: array + items: + type: string responses: '200': - description: Server Preferences + description: OK + content: + application/octet-stream: + schema: + format: binary + type: string + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Events.GetNotifications(ctx, operations.GetNotificationsRequest{}) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetNotificationsRequest; + import dev.plexapi.sdk.models.operations.GetNotificationsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetNotificationsRequest req = GetNotificationsRequest.builder() + .build(); + + GetNotificationsResponse res = sdk.events().getNotifications() + .request(req) + .call(); + + if (res.responseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.events.getNotifications({}); + + console.log(result); + } + + run(); + /:/prefs: + get: + summary: Get all preferences + operationId: getAllPreferences + description: Get the list of all preferences + tags: + - Preferences + responses: + '200': + description: OK content: application/json: schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 161 - Setting: - type: array - items: - type: object - properties: - id: - type: string - example: EnableDatabaseTrace - label: - type: string - example: '' - summary: - type: string - example: '' - type: - type: string - example: bool - default: - type: boolean - example: false - value: - type: boolean - example: false - hidden: - type: boolean - example: true - advanced: - type: boolean - example: false - group: - type: string - example: '' - enumValues: - type: string - example: '1:admin only|2:everyone' - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/schemas/MediaContainerWithSettings' x-codeSamples: - lang: php - label: getServerPreferences + label: PlexPHP source: |- declare(strict_types=1); @@ -445,31 +561,981 @@ paths: // handle response } - lang: ruby - label: getServerPreferences - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.server.get_server_preferences()\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.server.get_server_preferences() + + if ! res.object.nil? + # handle response + end - lang: go - label: getServerPreferences - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetServerPreferences(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Preferences.GetAllPreferences(ctx) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithSettings != nil { + // handle response + } + } - lang: java - label: getServerPreferences + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetServerPreferencesBadRequest; - import dev.plexapi.plexapi.models.errors.GetServerPreferencesUnauthorized; - import dev.plexapi.plexapi.models.operations.GetServerPreferencesResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAllPreferencesResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetServerPreferencesBadRequest, GetServerPreferencesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetServerPreferencesResponse res = sdk.server().getServerPreferences() + GetAllPreferencesResponse res = sdk.preferences().getAllPreferences() + .call(); + + if (res.mediaContainerWithSettings().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.preferences.getAllPreferences(); + + console.log(result); + } + + run(); + put: + summary: Set preferences + operationId: setPreferences + description: Set a set of preferences in query parameters + tags: + - Preferences + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: prefs + in: query + required: true + schema: + type: object + example: + FriendlyName: My Server + ScheduledLibraryUpdateInterval: 3600 + sendCrashReports: 1 + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Attempt to set a preferences that doesn't exist + content: + text/html: {} + '403': + description: Attempt to set a preferences that doesn't exist + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Preferences.SetPreferences(ctx, operations.SetPreferencesRequest{ + Prefs: operations.Prefs{}, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetPreferencesRequest req = SetPreferencesRequest.builder() + .prefs(Prefs.builder() + .build()) + .build(); + + SetPreferencesResponse res = sdk.preferences().setPreferences() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.preferences.setPreferences({ + prefs: {}, + }); + + console.log(result); + } + + run(); + /:/prefs/get: + get: + summary: Get a preferences + operationId: getPreference + description: Get a single preference and value + tags: + - Preferences + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: id + description: The preference to fetch + in: query + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithSettings' + '404': + description: No preference with the provided name found. + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Preferences.GetPreference(ctx, operations.GetPreferenceRequest{}) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithSettings != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPreferenceRequest; + import dev.plexapi.sdk.models.operations.GetPreferenceResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPreferenceRequest req = GetPreferenceRequest.builder() + .build(); + + GetPreferenceResponse res = sdk.preferences().getPreference() + .request(req) + .call(); + + if (res.mediaContainerWithSettings().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.preferences.getPreference({}); + + console.log(result); + } + + run(); + /:/rate: + put: + summary: Rate an item + operationId: setRating + description: |- + Set the rating on an item. + This API does respond to the GET verb but applications should use PUT + tags: + - Rate + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: identifier + description: The identifier of the media provider containing the media to rate. Typically `com.plexapp.plugins.library` + in: query + required: true + schema: + type: string + - name: key + description: The key of the item to rate. This is the `ratingKey` found in metadata items + in: query + required: true + schema: + type: string + - name: rating + description: The rating to give the item. + in: query + required: true + schema: + maximum: 10 + minimum: 0 + type: number + - name: ratedAt + description: The time when the rating occurred. If not present, interpreted as now. + in: query + required: false + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Bad Request. Can occur when parameters are of the wrong type, missing, or if the `ratedAt` is in the future + content: + text/html: {} + '404': + description: Indicates that no library with the provide identifier can be found or no item can be found with the rating key + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Rate.SetRating(ctx, operations.SetRatingRequest{ + Identifier: "", + Key: "", + Rating: 8722.46, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SetRatingRequest; + import dev.plexapi.sdk.models.operations.SetRatingResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetRatingRequest req = SetRatingRequest.builder() + .identifier("") + .key("") + .rating(8722.46) + .build(); + + SetRatingResponse res = sdk.rate().setRating() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.rate.setRating({ + identifier: "", + key: "", + rating: 8722.46, + }); + + console.log(result); + } + + run(); + /:/scrobble: + put: + summary: Mark an item as played + operationId: markPlayed + description: |- + 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 + tags: + - Timeline + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: identifier + description: The identifier of the media provider containing the media to rate. Typically `com.plexapp.plugins.library` + in: query + required: true + schema: + type: string + - name: key + description: The key of the item to rate. This is the `ratingKey` found in metadata items + in: query + required: false + schema: + type: string + - name: uri + description: The URI of the item to mark as played. See intro for description of the URIs + in: query + required: false + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Bad Request. Can occur when parameters are of the wrong type, or missing + content: + text/html: {} + '404': + description: Indicates that no library with the provide identifier can be found or no item can be found with the rating key + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Timeline.MarkPlayed(ctx, operations.MarkPlayedRequest{ + Identifier: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.MarkPlayedRequest; + import dev.plexapi.sdk.models.operations.MarkPlayedResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MarkPlayedRequest req = MarkPlayedRequest.builder() + .identifier("") + .build(); + + MarkPlayedResponse res = sdk.timeline().markPlayed() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.timeline.markPlayed({ + identifier: "", + }); + + console.log(result); + } + + run(); + /:/timeline: + post: + summary: Report media timeline + operationId: report + description: | + 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). + tags: + - Timeline + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: key + description: The details key for the item. + in: query + schema: + type: string + example: /foo + - name: ratingKey + description: The rating key attribute for the item. + in: query + schema: + type: string + example: xyz + - name: state + description: The current state of the media. + in: query + schema: + type: string + enum: + - stopped + - buffering + - playing + - paused + example: playing + - name: playQueueItemID + description: If playing media from a play queue, the play queue's ID. + in: query + schema: + type: string + example: 123 + - name: time + description: The current time offset of playback in ms. + in: query + schema: + type: integer + example: 0 + - name: duration + description: The total duration of the item in ms. + in: query + schema: + type: integer + example: 10000 + - name: continuing + description: When state is `stopped`, a flag indicating whether or not the client is going to continue playing anothe item. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: updated + description: Used when a sync client comes online and is syncing media timelines, holds the time at which the playback state was last updated. + in: query + schema: + type: integer + example: 14200000 + - name: offline + description: Also used by sync clients, used to indicate that a timeline is being synced from being offline, as opposed to being "live". + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: timeToFirstFrame + description: Time in seconds till first frame is displayed. Sent only on the first playing timeline request. + in: query + schema: + type: integer + example: 1000 + - name: timeStalled + description: Time in seconds spent buffering since last request. + in: query + schema: + type: integer + example: 1000 + - name: bandwidth + description: Bandwidth in kbps as estimated by the client. + in: query + schema: + type: integer + example: 100 + - name: bufferedTime + description: Amount of time in seconds buffered by client. Omit if computed by `bufferedSize` below. + in: query + schema: + type: integer + example: 100 + - name: bufferedSize + description: Size in kilobytes of data buffered by client. Omit if computed by `bufferedTime` above + in: query + schema: + type: integer + example: 1024 + - name: X-Plex-Client-Identifier + description: Unique per client. + in: header + required: true + schema: + type: string + - name: X-Plex-Session-Identifier + description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs) + in: header + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/ServerConfiguration' + - properties: + Bandwidths: + description: A list of media times and bandwidths when trascoding is using with auto adjustment of bandwidth + properties: + Bandwidth: + items: + properties: + bandwidth: + description: The bandwidth at this time in kbps + type: integer + resolution: + description: The user-friendly resolution at this time + type: string + time: + description: Media playback time where this bandwidth started + type: integer + type: object + type: array + type: object + terminationCode: + description: A code describing why the session was terminated by the server. + type: integer + terminationText: + description: A user friendly and localized text describing why the session was terminated by the server. + type: string + type: object + type: object + '400': + $ref: '#/components/responses/400' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Timeline.Report(ctx, operations.ReportRequest{ + Key: plexgo.Pointer("/foo"), + RatingKey: plexgo.Pointer("xyz"), + State: operations.StatePlaying.ToPointer(), + PlayQueueItemID: plexgo.Pointer("123"), + Time: plexgo.Pointer[int64](0), + Duration: plexgo.Pointer[int64](10000), + Continuing: components.BoolIntOne.ToPointer(), + Updated: plexgo.Pointer[int64](14200000), + Offline: components.BoolIntOne.ToPointer(), + TimeToFirstFrame: plexgo.Pointer[int64](1000), + TimeStalled: plexgo.Pointer[int64](1000), + Bandwidth: plexgo.Pointer[int64](100), + BufferedTime: plexgo.Pointer[int64](100), + BufferedSize: plexgo.Pointer[int64](1024), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ReportRequest req = ReportRequest.builder() + .key("/foo") + .ratingKey("xyz") + .state(State.PLAYING) + .playQueueItemID("123") + .time(0L) + .duration(10000L) + .continuing(BoolInt.ONE) + .updated(14200000L) + .offline(BoolInt.ONE) + .timeToFirstFrame(1000L) + .timeStalled(1000L) + .bandwidth(100L) + .bufferedTime(100L) + .bufferedSize(1024L) + .build(); + + ReportResponse res = sdk.timeline().report() + .request(req) .call(); if (res.object().isPresent()) { @@ -478,680 +1544,175 @@ paths: } } - lang: typescript - label: getServerPreferences + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { ReportState } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.server.getServerPreferences(); - - // Handle the result - console.log(result); - } - - run(); - '/:/scrobble': - get: - tags: - - Media - summary: Mark Media Played - description: This will mark the provided media key as Played. - operationId: markPlayed - parameters: - - name: key - description: The media key to mark as played - in: query - schema: - type: number - example: 59398 - required: true - responses: - '200': - description: Media is marked Played - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: markPlayed - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->media->markPlayed( - key: 59398 - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: markPlayed - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.media.mark_played(key=59398.0)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: markPlayed - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.MarkPlayed(ctx, 59398)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: markPlayed - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.MarkPlayedBadRequest; - import dev.plexapi.plexapi.models.errors.MarkPlayedUnauthorized; - import dev.plexapi.plexapi.models.operations.MarkPlayedResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws MarkPlayedBadRequest, MarkPlayedUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - MarkPlayedResponse res = sdk.media().markPlayed() - .key(59398d) - .call(); - - // handle response - } - } - - lang: typescript - label: markPlayed - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.media.markPlayed(59398); - - // Handle the result - console.log(result); - } - - run(); - '/:/unscrobble': - get: - tags: - - Media - summary: Mark Media Unplayed - description: This will mark the provided media key as Unplayed. - operationId: markUnplayed - parameters: - - name: key - description: The media key to mark as Unplayed - in: query - schema: - type: number - example: 59398 - required: true - responses: - '200': - description: Media is marked Unplayed - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: markUnplayed - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->media->markUnplayed( - key: 59398 - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: markUnplayed - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.media.mark_unplayed(key=59398.0)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: markUnplayed - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.MarkUnplayed(ctx, 59398)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: markUnplayed - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.MarkUnplayedBadRequest; - import dev.plexapi.plexapi.models.errors.MarkUnplayedUnauthorized; - import dev.plexapi.plexapi.models.operations.MarkUnplayedResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws MarkUnplayedBadRequest, MarkUnplayedUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - MarkUnplayedResponse res = sdk.media().markUnplayed() - .key(59398d) - .call(); - - // handle response - } - } - - lang: typescript - label: markUnplayed - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.media.markUnplayed(59398); - - // Handle the result - console.log(result); - } - - run(); - '/:/progress': - post: - tags: - - Media - summary: Update Media Play Progress - description: | - This API command can be used to update the play progress of a media item. - operationId: updatePlayProgress - parameters: - - name: key - description: the media key - in: query - schema: - type: string - required: true - - name: time - description: 'The time, in milliseconds, used to set the media playback progress.' - in: query - schema: - type: number - example: 90000 - required: true - - name: state - description: The playback state of the media item. - in: query - schema: - type: string - example: played - required: true - responses: - '200': - description: Success - The request was successful. - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: updatePlayProgress - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->media->updatePlayProgress( - key: '', - time: 90000, - state: 'played' - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: updatePlayProgress - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.media.update_play_progress(key=\"\", time=90000.0, state=\"played\")\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: updatePlayProgress - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.UpdatePlayProgress(ctx, \"\", 90000, \"played\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: updatePlayProgress - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.UpdatePlayProgressBadRequest; - import dev.plexapi.plexapi.models.errors.UpdatePlayProgressUnauthorized; - import dev.plexapi.plexapi.models.operations.UpdatePlayProgressResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws UpdatePlayProgressBadRequest, UpdatePlayProgressUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - UpdatePlayProgressResponse res = sdk.media().updatePlayProgress() - .key("") - .time(90000d) - .state("played") - .call(); - - // handle response - } - } - - lang: typescript - label: updatePlayProgress - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.media.updatePlayProgress("", 90000, "played"); - - // Handle the result - console.log(result); - } - - run(); - '/:/timeline': - get: - tags: - - Video - summary: Get the timeline for a media item - description: Get the timeline for a media item - operationId: getTimeline - parameters: - - name: ratingKey - description: The rating key of the media item - required: true - in: query - schema: - type: number - example: 23409 - - name: key - description: The key of the media item to get the timeline for - required: true - in: query - schema: - type: string - example: /library/metadata/23409 - - name: state - description: The state of the media item - required: true - in: query - schema: - type: string - enum: - - playing - - paused - - stopped - example: playing - - name: hasMDE - description: Whether the media item has MDE - required: true - in: query - schema: - type: number - example: 1 - - name: time - description: The time of the media item - required: true - in: query - schema: - type: number - example: 2000 - - name: duration - description: The duration of the media item - required: true - in: query - schema: - type: number - example: 10000 - - name: context - description: The context of the media item - required: true - in: query - schema: - type: string - example: 'home:hub.continueWatching' - - name: playQueueItemID - description: The play queue item ID of the media item - required: true - in: query - schema: - type: number - example: 1 - - name: playBackTime - description: The playback time of the media item - required: true - in: query - schema: - type: number - example: 2000 - - name: row - description: The row of the media item - required: true - in: query - schema: - type: number - example: 1 - responses: - '200': - description: The timeline for the media item - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getTimeline - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetTimelineRequest( - ratingKey: 23409, - key: '/library/metadata/23409', - state: Operations\State::Playing, - hasMDE: 1, - time: 2000, + const result = await plexAPI.timeline.report({ + key: "/foo", + ratingKey: "xyz", + state: ReportState.Playing, + playQueueItemID: "123", + time: 0, duration: 10000, - context: 'home:hub.continueWatching', - playQueueItemID: 1, - playBackTime: 2000, - row: 1, - ); + continuing: BoolInt.One, + updated: 14200000, + offline: BoolInt.One, + timeToFirstFrame: 1000, + timeStalled: 1000, + bandwidth: 100, + bufferedTime: 100, + bufferedSize: 1024, + }); - $response = $sdk->video->getTimeline( - request: $request - ); - - if ($response->statusCode === 200) { - // handle response + console.log(result); } - - lang: ruby - label: getTimeline - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetTimelineRequest.new(\n rating_key: 23409.0,\n key: \"/library/metadata/23409\",\n state: ::PlexRubySDK::Operations::State::PLAYING,\n has_mde: 1.0,\n time: 2000.0,\n duration: 10000.0,\n context: \"home:hub.continueWatching\",\n play_queue_item_id: 1.0,\n play_back_time: 2000.0,\n row: 1.0,\n)\n \nres = s.video.get_timeline(req)\n\nif res.status_code == 200\n # handle response\nend" + + run(); + /:/unscrobble: + put: + summary: Mark an item as unplayed + operationId: unscrobble + description: |- + 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 + tags: + - Timeline + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: identifier + description: The identifier of the media provider containing the media to rate. Typically `com.plexapp.plugins.library` + in: query + required: true + schema: + type: string + - name: key + description: The key of the item to rate. This is the `ratingKey` found in metadata items + in: query + required: false + schema: + type: string + - name: uri + description: The URI of the item to mark as played. See intro for description of the URIs + in: query + required: false + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Bad Request. Can occur when parameters are of the wrong type, or missing + content: + text/html: {} + '404': + description: Indicates that no library with the provide identifier can be found or no item can be found with the rating key + content: + text/html: {} + x-codeSamples: - lang: go - label: getTimeline - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Video.GetTimeline(ctx, operations.GetTimelineRequest{\n RatingKey: 23409,\n Key: \"/library/metadata/23409\",\n State: operations.StatePlaying,\n HasMDE: 1,\n Time: 2000,\n Duration: 10000,\n Context: \"home:hub.continueWatching\",\n PlayQueueItemID: 1,\n PlayBackTime: 2000,\n Row: 1,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Timeline.Unscrobble(ctx, operations.UnscrobbleRequest{ + Identifier: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: getTimeline + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetTimelineBadRequest; - import dev.plexapi.plexapi.models.errors.GetTimelineUnauthorized; - import dev.plexapi.plexapi.models.operations.GetTimelineRequest; - import dev.plexapi.plexapi.models.operations.GetTimelineResponse; - import dev.plexapi.plexapi.models.operations.State; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.UnscrobbleRequest; + import dev.plexapi.sdk.models.operations.UnscrobbleResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetTimelineBadRequest, GetTimelineUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetTimelineRequest req = GetTimelineRequest.builder() - .ratingKey(23409d) - .key("/library/metadata/23409") - .state(State.PLAYING) - .hasMDE(1d) - .time(2000d) - .duration(10000d) - .context("home:hub.continueWatching") - .playQueueItemID(1d) - .playBackTime(2000d) - .row(1d) + UnscrobbleRequest req = UnscrobbleRequest.builder() + .identifier("") .build(); - GetTimelineResponse res = sdk.video().getTimeline() + UnscrobbleResponse res = sdk.timeline().unscrobble() .request(req) .call(); @@ -1159,131 +1720,241 @@ paths: } } - lang: typescript - label: getTimeline + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { State } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.video.getTimeline({ - ratingKey: 23409, - key: "/library/metadata/23409", - state: State.Playing, - hasMDE: 1, - time: 2000, - duration: 10000, - context: "home:hub.continueWatching", - playQueueItemID: 1, - playBackTime: 2000, - row: 1, + const result = await plexAPI.timeline.unscrobble({ + identifier: "", }); - // Handle the result + console.log(result); + } + + run(); + /:/websocket/notifications: + get: + summary: Connect to WebSocket + operationId: connectWebSocket + description: Connect to the web socket to get a stream of events + tags: + - Events + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: filter + description: | + By default, all events except logs are sent. A rich filtering mechanism is provided to allow clients to opt into or out of each event type using the `filters` parameter. For example: + + - `filters=-log`: All event types except logs (the default). + - `filters=foo,bar`: Only the foo and bar event types. + - `filters=`: All events types. + - `filters=-foo,bar`: All event types except foo and bar. + in: query + schema: + type: array + items: + type: string + responses: + '200': + description: OK + content: + application/octet-stream: + schema: + format: binary + type: string + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Events.ConnectWebSocket(ctx, operations.ConnectWebSocketRequest{}) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ConnectWebSocketRequest; + import dev.plexapi.sdk.models.operations.ConnectWebSocketResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ConnectWebSocketRequest req = ConnectWebSocketRequest.builder() + .build(); + + ConnectWebSocketResponse res = sdk.events().connectWebSocket() + .request(req) + .call(); + + if (res.responseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.events.connectWebSocket({}); + console.log(result); } run(); /activities: get: + summary: Get all activities + operationId: listActivities + description: List all activities on the server. Admins can see all activities but other users can only see their own tags: - Activities - summary: Get Server Activities - description: Get Server Activities - operationId: getServerActivities responses: '200': - description: The Server Activities + description: OK content: application/json: schema: - type: object properties: MediaContainer: - type: object - properties: - size: - type: number - Activity: - type: array - items: - type: object - properties: - uuid: - type: string - type: - type: string - cancellable: - type: boolean - userID: - type: number - title: - type: string - subtitle: - type: string - progress: - type: number - Context: - type: object + allOf: + - properties: + Activity: + items: properties: - librarySectionID: + cancellable: + description: Indicates whether this activity can be cancelled + type: boolean + Context: + description: An object with additional values + additionalProperties: true + type: object + progress: + description: A progress percentage. A value of -1 means the progress is indeterminate + maximum: 100 + minimum: -1 + type: number + Response: + description: An object with the response to the async opperation + additionalProperties: true + type: object + subtitle: + description: A user-friendly sub-title for this activity type: string - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + title: + description: A user-friendly title for this activity + type: string + type: + description: The type of activity + type: string + userID: + description: The user this activity belongs to + type: integer + uuid: + description: The ID of the activity + type: string + type: object + type: array + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - lang: php - label: getServerActivities + label: PlexPHP source: |- declare(strict_types=1); @@ -1307,31 +1978,65 @@ paths: // handle response } - lang: ruby - label: getServerActivities - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.activities.get_server_activities()\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.activities.get_server_activities() + + if ! res.object.nil? + # handle response + end - lang: go - label: getServerActivities - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Activities.GetServerActivities(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Activities.ListActivities(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: getServerActivities + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetServerActivitiesBadRequest; - import dev.plexapi.plexapi.models.errors.GetServerActivitiesUnauthorized; - import dev.plexapi.plexapi.models.operations.GetServerActivitiesResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListActivitiesResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetServerActivitiesBadRequest, GetServerActivitiesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetServerActivitiesResponse res = sdk.activities().getServerActivities() + ListActivitiesResponse res = sdk.activities().listActivities() .call(); if (res.object().isPresent()) { @@ -1340,528 +2045,35 @@ paths: } } - lang: typescript - label: getServerActivities + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - const plexAPI = new PlexAPI({ - accessToken: "", - }); + const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.activities.getServerActivities(); + const result = await plexAPI.activities.listActivities(); - // Handle the result - console.log(result); - } - - run(); - '/activities/{activityUUID}': - delete: - tags: - - Activities - summary: Cancel Server Activities - description: Cancel Server Activities - operationId: cancelServerActivities - parameters: - - name: activityUUID - description: The UUID of the activity to cancel. - in: path - schema: - type: string - example: 25b71ed5-0f9d-461c-baa7-d404e9e10d3e - required: true - responses: - '200': - description: The Server Activity was canceled - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: cancelServerActivities - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->activities->cancelServerActivities( - activityUUID: '25b71ed5-0f9d-461c-baa7-d404e9e10d3e' - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: cancelServerActivities - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.activities.cancel_server_activities(activity_uuid=\"25b71ed5-0f9d-461c-baa7-d404e9e10d3e\")\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: cancelServerActivities - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Activities.CancelServerActivities(ctx, \"25b71ed5-0f9d-461c-baa7-d404e9e10d3e\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: cancelServerActivities - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.CancelServerActivitiesBadRequest; - import dev.plexapi.plexapi.models.errors.CancelServerActivitiesUnauthorized; - import dev.plexapi.plexapi.models.operations.CancelServerActivitiesResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws CancelServerActivitiesBadRequest, CancelServerActivitiesUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - CancelServerActivitiesResponse res = sdk.activities().cancelServerActivities() - .activityUUID("25b71ed5-0f9d-461c-baa7-d404e9e10d3e") - .call(); - - // handle response - } - } - - lang: typescript - label: cancelServerActivities - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.activities.cancelServerActivities("25b71ed5-0f9d-461c-baa7-d404e9e10d3e"); - - // Handle the result console.log(result); } run(); /butler: - get: - tags: - - Butler - summary: Get Butler tasks - description: Returns a list of butler tasks - operationId: getButlerTasks - responses: - '200': - description: All butler tasks - content: - application/json: - schema: - type: object - properties: - ButlerTasks: - type: object - properties: - ButlerTask: - type: array - items: - type: object - properties: - name: - type: string - example: BackupDatabase - interval: - type: number - example: 3 - scheduleRandomized: - type: boolean - enabled: - type: boolean - title: - type: string - example: Backup Database - description: - type: string - example: Create a backup copy of the server's database in the configured backup directory - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getButlerTasks - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->butler->getButlerTasks( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getButlerTasks - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.butler.get_butler_tasks()\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getButlerTasks - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.GetButlerTasks(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getButlerTasks - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetButlerTasksBadRequest; - import dev.plexapi.plexapi.models.errors.GetButlerTasksUnauthorized; - import dev.plexapi.plexapi.models.operations.GetButlerTasksResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetButlerTasksBadRequest, GetButlerTasksUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetButlerTasksResponse res = sdk.butler().getButlerTasks() - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getButlerTasks - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.butler.getButlerTasks(); - - // Handle the result - console.log(result); - } - - run(); - post: - tags: - - Butler - summary: Start all Butler tasks - description: | - 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. - operationId: startAllTasks - responses: - '200': - description: All tasks were started - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: startAllTasks - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->butler->startAllTasks( - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: startAllTasks - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.butler.start_all_tasks()\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: startAllTasks - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StartAllTasks(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: startAllTasks - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.StartAllTasksBadRequest; - import dev.plexapi.plexapi.models.errors.StartAllTasksUnauthorized; - import dev.plexapi.plexapi.models.operations.StartAllTasksResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws StartAllTasksBadRequest, StartAllTasksUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - StartAllTasksResponse res = sdk.butler().startAllTasks() - .call(); - - // handle response - } - } - - lang: typescript - label: startAllTasks - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.butler.startAllTasks(); - - // Handle the result - console.log(result); - } - - run(); delete: + summary: Stop all Butler tasks + operationId: stopTasks + description: This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue. tags: - Butler - summary: Stop all Butler tasks - description: | - This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue. - operationId: stopAllTasks + security: + - token: + - admin responses: '200': - description: All tasks were stopped - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/200' x-codeSamples: - lang: php - label: stopAllTasks + label: PlexPHP source: |- declare(strict_types=1); @@ -1885,1421 +2097,131 @@ paths: // handle response } - lang: ruby - label: stopAllTasks - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.butler.stop_all_tasks()\n\nif res.status_code == 200\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.butler.stop_all_tasks() + + if res.status_code == 200 + # handle response + end - lang: go - label: stopAllTasks - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StopAllTasks(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Butler.StopTasks(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: stopAllTasks + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.StopAllTasksBadRequest; - import dev.plexapi.plexapi.models.errors.StopAllTasksUnauthorized; - import dev.plexapi.plexapi.models.operations.StopAllTasksResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.StopTasksResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws StopAllTasksBadRequest, StopAllTasksUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - StopAllTasksResponse res = sdk.butler().stopAllTasks() + StopTasksResponse res = sdk.butler().stopTasks() .call(); // handle response } } - lang: typescript - label: stopAllTasks - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.butler.stopAllTasks(); - - // Handle the result - console.log(result); - } - - run(); - '/butler/{taskName}': - post: - tags: - - Butler - summary: Start a single Butler task - description: | - This endpoint will attempt to start a single Butler task that is 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. - operationId: startTask - parameters: - - name: taskName - description: the name of the task to be started. - in: path - schema: - type: string - enum: - - BackupDatabase - - BuildGracenoteCollections - - CheckForUpdates - - CleanOldBundles - - CleanOldCacheFiles - - DeepMediaAnalysis - - GenerateAutoTags - - GenerateChapterThumbs - - GenerateMediaIndexFiles - - OptimizeDatabase - - RefreshLibraries - - RefreshLocalMedia - - RefreshPeriodicMetadata - - UpgradeMediaAnalysis - required: true - responses: - '200': - description: The task was started successfully - '202': - description: The task was already running. - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: startTask - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->butler->startTask( - taskName: Operations\TaskName::CleanOldBundles - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: startTask - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.butler.start_task(task_name=::PlexRubySDK::Operations::TaskName::CLEAN_OLD_BUNDLES)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: startTask - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StartTask(ctx, operations.TaskNameCleanOldBundles)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: startTask - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.StartTaskBadRequest; - import dev.plexapi.plexapi.models.errors.StartTaskUnauthorized; - import dev.plexapi.plexapi.models.operations.StartTaskResponse; - import dev.plexapi.plexapi.models.operations.TaskName; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws StartTaskBadRequest, StartTaskUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - StartTaskResponse res = sdk.butler().startTask() - .taskName(TaskName.CLEAN_OLD_BUNDLES) - .call(); - - // handle response - } - } - - lang: typescript - label: startTask - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { TaskName } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.butler.startTask(TaskName.CleanOldBundles); - - // Handle the result - console.log(result); - } - - run(); - delete: - tags: - - Butler - summary: Stop a single Butler task - description: | - This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint. - operationId: stopTask - parameters: - - name: taskName - description: The name of the task to be started. - in: path - schema: - type: string - enum: - - BackupDatabase - - BuildGracenoteCollections - - CheckForUpdates - - CleanOldBundles - - CleanOldCacheFiles - - DeepMediaAnalysis - - GenerateAutoTags - - GenerateChapterThumbs - - GenerateMediaIndexFiles - - OptimizeDatabase - - RefreshLibraries - - RefreshLocalMedia - - RefreshPeriodicMetadata - - UpgradeMediaAnalysis - required: true - responses: - '200': - description: The task was stopped - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - '404': - description: The task was not running - x-codeSamples: - - lang: php - label: stopTask - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->butler->stopTask( - taskName: Operations\PathParamTaskName::BackupDatabase - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: stopTask - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.butler.stop_task(task_name=::PlexRubySDK::Operations::PathParamTaskName::BACKUP_DATABASE)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: stopTask - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StopTask(ctx, operations.PathParamTaskNameBackupDatabase)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: stopTask - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.StopTaskBadRequest; - import dev.plexapi.plexapi.models.errors.StopTaskUnauthorized; - import dev.plexapi.plexapi.models.operations.PathParamTaskName; - import dev.plexapi.plexapi.models.operations.StopTaskResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws StopTaskBadRequest, StopTaskUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - StopTaskResponse res = sdk.butler().stopTask() - .taskName(PathParamTaskName.BACKUP_DATABASE) - .call(); - - // handle response - } - } - - lang: typescript - label: stopTask - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { PathParamTaskName } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.butler.stopTask(PathParamTaskName.BackupDatabase); - - // Handle the result - console.log(result); - } - - run(); - /clients: - get: - tags: - - Server - summary: Get Available Clients - description: Get Available Clients - operationId: getAvailableClients - responses: - '200': - description: Available Clients - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: number - example: 1 - Server: - type: array - items: - type: object - properties: - name: - type: string - example: iPad - host: - type: string - example: 10.10.10.102 - address: - type: string - example: 10.10.10.102 - port: - type: number - example: 32500 - machineIdentifier: - type: string - example: A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05 - version: - type: string - example: '8.17' - protocol: - type: string - example: plex - product: - type: string - example: Plex for iOS - deviceClass: - type: string - example: tablet - protocolVersion: - type: number - example: 2 - protocolCapabilities: - type: string - example: 'playback,playqueues,timeline,provider-playback' - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getAvailableClients - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->server->getAvailableClients( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getAvailableClients - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.server.get_available_clients()\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getAvailableClients - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetAvailableClients(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getAvailableClients - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetAvailableClientsBadRequest; - import dev.plexapi.plexapi.models.errors.GetAvailableClientsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetAvailableClientsResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetAvailableClientsBadRequest, GetAvailableClientsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetAvailableClientsResponse res = sdk.server().getAvailableClients() - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getAvailableClients - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.server.getAvailableClients(); - - // Handle the result - console.log(result); - } - - run(); - /devices: - get: - tags: - - Server - summary: Get Devices - description: Get Devices - operationId: getDevices - responses: - '200': - description: Devices - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: number - example: 151 - identifier: - type: string - example: com.plexapp.system.devices - Device: - type: array - items: - type: object - properties: - id: - type: number - example: 1 - name: - type: string - example: iPhone - platform: - type: string - example: iOS - clientIdentifier: - type: string - createdAt: - type: number - example: 1654131230 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getDevices - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->server->getDevices( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getDevices - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.server.get_devices()\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getDevices - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetDevices(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getDevices - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetDevicesBadRequest; - import dev.plexapi.plexapi.models.errors.GetDevicesUnauthorized; - import dev.plexapi.plexapi.models.operations.GetDevicesResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetDevicesBadRequest, GetDevicesUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetDevicesResponse res = sdk.server().getDevices() - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getDevices - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.server.getDevices(); - - // Handle the result - console.log(result); - } - - run(); - /companions: - get: - servers: - - url: 'https://plex.tv/api/v2' - tags: - - Plex - summary: Get Companions Data - description: Get Companions Data - operationId: getCompanionsData - responses: - '200': - description: Companions Data - content: - application/json: - schema: - type: array - items: - type: object - required: - - identifier - - baseURL - - title - - linkURL - - provides - - token - properties: - identifier: - type: string - example: tv.plex.sonos - baseURL: - type: string - example: 'https://sonos.plex.tv' - format: uri - title: - type: string - example: Sonos - linkURL: - type: string - example: 'https://sonos.plex.tv/link' - provides: - type: string - example: 'client,player' - token: - type: string - description: The plex authtoken used to identify with - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getCompanionsData - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->plex->getCompanionsData( - - ); - - if ($response->responseBodies !== null) { - // handle response - } - - lang: ruby - label: getCompanionsData - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.plex.get_companions_data()\n\nif ! res.response_bodies.nil?\n # handle response\nend" - - lang: go - label: getCompanionsData - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetCompanionsData(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseBodies != nil {\n // handle response\n }\n}" - - lang: java - label: getCompanionsData - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetCompanionsDataBadRequest; - import dev.plexapi.plexapi.models.errors.GetCompanionsDataUnauthorized; - import dev.plexapi.plexapi.models.operations.GetCompanionsDataResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetCompanionsDataBadRequest, GetCompanionsDataUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetCompanionsDataResponse res = sdk.plex().getCompanionsData() - .call(); - - if (res.responseBodies().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getCompanionsData - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.plex.getCompanionsData(); - - // Handle the result - console.log(result); - } - - run(); - /friends: - get: - servers: - - url: 'https://plex.tv/api/v2' - tags: - - Plex - summary: Get list of friends of the user logged in - description: Get friends of provided auth token. - operationId: getUserFriends - responses: - '200': - description: Friends Data - content: - application/json: - schema: - type: array - items: - title: Friend - type: object - examples: - - email: username@email.com - friendlyName: exampleUser - home: true - id: 0 - restricted: false - sharedServers: [] - sharedSources: [] - status: accepted - thumb: 'https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578' - title: username123 - username: username123 - uuid: 7d1916e0d8f6e76b - required: - - email - - friendlyName - - home - - id - - restricted - - sharedServers - - sharedSources - - status - - thumb - - title - - username - - uuid - properties: - email: - type: string - format: email - example: username@email.com - description: The account email address - friendlyName: - examples: - - exampleUser - - null - type: - - string - - 'null' - description: The account full name - home: - type: boolean - description: If the account is a Plex Home user - id: - type: integer - format: int32 - description: The Plex account ID - restricted: - type: boolean - default: false - description: If the account is a Plex Home managed user - sharedServers: - type: array - items: - type: object - sharedSources: - type: array - items: - type: object - status: - examples: - - accepted - enum: - - accepted - description: Current friend request status - thumb: - type: string - example: 'https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578' - format: uri - description: URL of the account thumbnail - title: - type: string - example: username123 - description: The title of the account (username or friendly name) - username: - type: string - example: username123 - description: The account username - uuid: - type: string - example: 7d1916e0d8f6e76b - description: The account Universally Unique Identifier (UUID) - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getUserFriends - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->plex->getUserFriends( - - ); - - if ($response->friends !== null) { - // handle response - } - - lang: ruby - label: getUserFriends - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.plex.get_user_friends()\n\nif ! res.friends.nil?\n # handle response\nend" - - lang: go - label: getUserFriends - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetUserFriends(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Friends != nil {\n // handle response\n }\n}" - - lang: java - label: getUserFriends - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetUserFriendsBadRequest; - import dev.plexapi.plexapi.models.errors.GetUserFriendsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetUserFriendsResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetUserFriendsBadRequest, GetUserFriendsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetUserFriendsResponse res = sdk.plex().getUserFriends() - .call(); - - if (res.friends().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getUserFriends - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.plex.getUserFriends(); - - // Handle the result - console.log(result); - } - - run(); - /geoip: - get: - servers: - - url: 'https://plex.tv/api/v2' - security: [] - tags: - - Plex - summary: Get Geo Data - description: Returns the geolocation and locale data of the caller - operationId: getGeoData - responses: - '200': - description: Gets the geo location data of the user - content: - application/json: - schema: - title: GeoData - type: object - description: Geo location data - examples: - - code: VI - continent_code: NA - country: United States Virgin Islands - city: Amsterdam - european_union_member: true - time_zone: America/St_Thomas - postal_code: 802 - in_privacy_restricted_country: true - in_privacy_restricted_region: true - subdivisions: Saint Thomas - coordinates: '18.3381, -64.8941' - required: - - code - - continent_code - - country - - city - - european_union_member - - time_zone - - postal_code - - in_privacy_restricted_country - - in_privacy_restricted_region - - subdivisions - - coordinates - properties: - code: - type: string - description: The ISO 3166-1 alpha-2 code of the country. - example: VI - continent_code: - type: string - description: The continent code where the country is located. - example: NA - country: - type: string - description: The official name of the country. - example: United States Virgin Islands - city: - type: string - description: The name of the city. - example: Amsterdam - european_union_member: - type: boolean - description: Indicates if the country is a member of the European Union. - example: true - default: false - time_zone: - type: string - description: The time zone of the country. - example: America/St_Thomas - postal_code: - type: string - description: The postal code of the location. - example: '802' - in_privacy_restricted_country: - type: boolean - description: Indicates if the country has privacy restrictions. - example: true - default: false - in_privacy_restricted_region: - type: boolean - description: Indicates if the region has privacy restrictions. - example: true - default: false - subdivisions: - type: string - description: The name of the primary administrative subdivision. - example: Saint Thomas - coordinates: - type: string - description: 'The geographical coordinates (latitude, longitude) of the location.' - example: '18.3381, -64.8941' - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getGeoData - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder()->build(); - - - - $response = $sdk->plex->getGeoData( - - ); - - if ($response->geoData !== null) { - // handle response - } - - lang: ruby - label: getGeoData - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\n\n \nres = s.plex.get_geo_data()\n\nif ! res.geo_data.nil?\n # handle response\nend" - - lang: go - label: getGeoData - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetGeoData(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.GeoData != nil {\n // handle response\n }\n}" - - lang: java - label: getGeoData - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetGeoDataBadRequest; - import dev.plexapi.plexapi.models.errors.GetGeoDataUnauthorized; - import dev.plexapi.plexapi.models.operations.GetGeoDataResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetGeoDataBadRequest, GetGeoDataUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .build(); - - GetGeoDataResponse res = sdk.plex().getGeoData() - .call(); - - if (res.geoData().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getGeoData + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.plex.getGeoData(); + const result = await plexAPI.butler.stopTasks(); - // Handle the result console.log(result); } run(); - /home: get: + summary: Get all Butler tasks + operationId: getTasks + description: | + Get the list of butler tasks and their scheduling tags: - - Plex - summary: Get Plex Home Data - description: 'Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.' - operationId: getHomeData + - Butler + security: + - token: + - admin responses: '200': - description: Home Data + description: Butler tasks content: application/json: schema: - type: object properties: - id: - type: number - example: 1841489 - name: - type: string - example: Blindkitty38's home - guestUserID: - type: number - example: 58815432 - guestUserUUID: - type: string - example: f3df4e01bfca0787 - guestEnabled: - type: boolean - subscription: - type: boolean - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + ButlerTasks: + properties: + ButlerTask: + items: + properties: + description: + description: A user-friendly description of the task + type: string + enabled: + description: Whether this task is enabled or not + type: boolean + interval: + description: The interval (in days) of when this task is run. A value of 1 is run every day, 7 is every week, etc. + type: integer + name: + description: The name of the task + type: string + scheduleRandomized: + description: Indicates whether the timing of the task is randomized within the butler interval + type: boolean + title: + description: A user-friendly title of the task + type: string + type: object + type: array + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - lang: php - label: getHomeData + label: PlexPHP source: |- declare(strict_types=1); @@ -3315,7 +2237,7 @@ paths: - $response = $sdk->plex->getHomeData( + $response = $sdk->butler->getButlerTasks( ); @@ -3323,31 +2245,65 @@ paths: // handle response } - lang: ruby - label: getHomeData - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.plex.get_home_data()\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.butler.get_butler_tasks() + + if ! res.object.nil? + # handle response + end - lang: go - label: getHomeData - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetHomeData(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Butler.GetTasks(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: getHomeData + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetHomeDataBadRequest; - import dev.plexapi.plexapi.models.errors.GetHomeDataUnauthorized; - import dev.plexapi.plexapi.models.operations.GetHomeDataResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetTasksResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetHomeDataBadRequest, GetHomeDataUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetHomeDataResponse res = sdk.plex().getHomeData() + GetTasksResponse res = sdk.butler().getTasks() .call(); if (res.object().isPresent()) { @@ -3356,224 +2312,316 @@ paths: } } - lang: typescript - label: getHomeData + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - const plexAPI = new PlexAPI({ - accessToken: "", - }); + const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.plex.getHomeData(); + const result = await plexAPI.butler.getTasks(); - // Handle the result console.log(result); } run(); - /hubs: - get: + post: + summary: Start all Butler tasks + operationId: startTasks + description: | + 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. tags: - - Hubs - summary: Get Global Hubs - description: Get Global Hubs filtered by the parameters provided. - operationId: getGlobalHubs - parameters: - - name: count - description: The number of items to return with each hub. - in: query - schema: - type: number - required: false - - name: onlyTransient - description: 'Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).' - in: query - schema: - type: integer - enum: - - 0 - - 1 - required: false + - Butler + security: + - token: + - admin responses: '200': - description: returns global hubs - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 8 - allowSync: - type: boolean - example: true - identifier: - type: string - example: com.plexapp.plugins.library - Hub: - type: array - items: - type: object - properties: - hubKey: - type: string - example: '/library/metadata/50768,65523,58188,57341,57302,57070' - key: - type: string - example: '/playlists/all?type=15&sort=lastViewedAt:desc&playlistType=video,audio' - title: - type: string - example: Recent Playlists - type: - type: string - example: playlist - hubIdentifier: - type: string - example: home.playlists - context: - type: string - example: hub.home.playlists - size: - type: integer - format: int32 - example: 6 - more: - type: boolean - example: true - style: - type: string - example: shelf - promoted: - type: boolean - example: true - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '57070' - key: - type: string - example: /playlists/57070/items - guid: - type: string - example: 'com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c' - type: - type: string - example: playlist - title: - type: string - example: November Movie Day - titleSort: - type: string - example: Tracks - summary: - type: string - example: '' - smart: - type: boolean - example: false - playlistType: - type: string - example: video - composite: - type: string - example: /playlists/57070/composite/1668787730 - icon: - type: string - example: 'playlist://image.smart' - viewCount: - type: integer - format: int32 - example: 2 - lastViewedAt: - type: integer - format: int32 - example: 1668787732 - duration: - type: integer - format: int32 - example: 16873000 - leafCount: - type: integer - format: int32 - example: 3 - addedAt: - type: integer - format: int32 - example: 1668779618 - updatedAt: - type: integer - format: int32 - example: 1668787730 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/200' x-codeSamples: - lang: php - label: getGlobalHubs + label: PlexPHP + source: |- + declare(strict_types=1); + + require 'vendor/autoload.php'; + + use LukeHagar\Plex_API; + + $sdk = Plex_API\PlexAPI::builder() + ->setSecurity( + '' + ) + ->build(); + + + + $response = $sdk->butler->startAllTasks( + + ); + + if ($response->statusCode === 200) { + // handle response + } + - lang: ruby + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.butler.start_all_tasks() + + if res.status_code == 200 + # handle response + end + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Butler.StartTasks(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.StartTasksResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StartTasksResponse res = sdk.butler().startTasks() + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.butler.startTasks(); + + console.log(result); + } + + run(); + /downloadQueue: + post: + summary: Create download queue + operationId: createDownloadQueue + description: | + 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. + tags: + - Download Queue + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + DownloadQueue: + items: + properties: + id: + type: integer + itemCount: + type: integer + status: + description: | + The state of this queue + - deciding: At least one item is still being decided + - waiting: At least one item is waiting for transcode and none are currently transcoding + - processing: At least one item is being transcoded + - done: All items are available (or potentially expired) + - error: At least one item has encountered an error + enum: + - deciding + - waiting + - processing + - done + - error + type: string + type: object + type: array + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.DownloadQueue.CreateDownloadQueue(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CreateDownloadQueueResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreateDownloadQueueResponse res = sdk.downloadQueue().createDownloadQueue() + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.downloadQueue.createDownloadQueue(); + + console.log(result); + } + + run(); + /hubs: + get: + summary: Get global hubs + operationId: getAllHubs + description: Get the global hubs in this PMS + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/count' + - name: onlyTransient + description: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added) + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: identifier + description: If provided, limit to only specified hubs + in: query + schema: + type: array + items: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + $ref: '#/components/schemas/Hub' + type: array + type: object + type: object + x-codeSamples: + - lang: php + label: PlexPHP source: |- declare(strict_types=1); require 'vendor/autoload.php'; use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; $sdk = Plex_API\PlexAPI::builder() ->setSecurity( @@ -3584,8 +2632,6 @@ paths: $response = $sdk->hubs->getGlobalHubs( - count: 1262.49, - onlyTransient: Operations\OnlyTransient::One ); @@ -3593,1134 +2639,72 @@ paths: // handle response } - lang: ruby - label: getGlobalHubs - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.hubs.get_global_hubs(count=1262.49, only_transient=::PlexRubySDK::Operations::OnlyTransient::ONE)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getGlobalHubs - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Hubs.GetGlobalHubs(ctx, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getGlobalHubs + label: PlexRuby source: |- - package hello.world; + require 'plex_ruby_sdk' - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetGlobalHubsBadRequest; - import dev.plexapi.plexapi.models.errors.GetGlobalHubsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetGlobalHubsResponse; - import dev.plexapi.plexapi.models.operations.OnlyTransient; - import java.lang.Exception; + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) - public class Application { + res = s.hubs.get_global_hubs(count=1262.49, only_transient=Models::Operations::OnlyTransient::ONE) - public static void main(String[] args) throws GetGlobalHubsBadRequest, GetGlobalHubsUnauthorized, Exception { + if ! res.object.nil? + # handle response + end + - lang: go + label: PlexGO + source: |- + package main - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "log" + ) - GetGlobalHubsResponse res = sdk.hubs().getGlobalHubs() - .count(1262.49d) - .onlyTransient(OnlyTransient.ONE) - .call(); + func main() { + ctx := context.Background() - if (res.object().isPresent()) { - // handle response - } + 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(""), + ) + + res, err := s.Hubs.GetAllHubs(ctx, operations.GetAllHubsRequest{ + OnlyTransient: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response } } - - lang: typescript - label: getGlobalHubs - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.hubs.getGlobalHubs(); - - // Handle the result - console.log(result); - } - - run(); - /hubs/home/recentlyAdded: - get: - tags: - - Hubs - summary: Get Recently Added - description: | - This endpoint will return the recently added content. - operationId: get-recently-added - parameters: - - name: contentDirectoryID - in: query - required: true - schema: - type: integer - description: The content directory ID. - - name: pinnedContentDirectoryID - in: query - required: false - schema: - type: string - description: Comma-separated list of pinned content directory IDs. - - name: sectionID - in: query - required: false - description: The library section ID for filtering content. - schema: - type: integer - example: 2 - - name: type - in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - - name: includeMeta - in: query - description: | - Adds the Meta object to the response - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: X-Plex-Container-Start - in: query - description: | - The index of the first item to return. If not specified, the first item will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 0 - schema: - type: integer - format: int32 - default: 0 - example: 0 - required: false - - name: X-Plex-Container-Size - in: query - description: | - The number of items to return. If not specified, all items will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 50 - schema: - type: integer - format: int32 - default: 50 - example: 50 - required: false - responses: - '200': - description: A successful response with recently added content. - content: - application/json: - schema: - type: object - properties: - MediaContainer: - allOf: - - type: object - required: - - size - properties: - size: - type: integer - example: 50 - offset: - type: integer - format: int32 - totalSize: - type: integer - format: int32 - identifier: - type: string - example: com.plexapp.plugins.library - allowSync: - type: boolean - example: false - - type: object - properties: - Meta: - type: object - description: | - The Meta object is only included in the response if the `includeMeta` parameter is set to `1`. - properties: - Type: - type: array - items: - type: object - required: - - key - - type - - title - - active - properties: - key: - type: string - example: /library/sections/2/all?type=2 - type: - type: string - example: filter - subtype: - type: string - example: clip - title: - type: string - example: TV Shows - active: - type: boolean - example: false - Filter: - type: array - items: - type: object - required: - - filter - - filterType - - key - - title - - type - properties: - filter: - type: string - example: genre - filterType: - type: string - example: string - key: - type: string - example: /library/sections/2/genre?type=2 - title: - type: string - example: Genre - type: - type: string - example: filter - advanced: - type: boolean - example: true - Sort: - type: array - items: - type: object - required: - - key - - title - - defaultDirection - properties: - default: - type: string - example: asc - active: - type: boolean - example: false - activeDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - defaultDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - descKey: - type: string - example: 'titleSort:desc' - firstCharacterKey: - type: string - example: /library/sections/2/firstCharacter - key: - type: string - example: titleSort - title: - type: string - example: Title - Field: - type: array - items: - type: object - required: - - key - - title - - type - properties: - key: - type: string - example: show.title - title: - type: string - example: Show Title - type: - type: string - example: string - subType: - type: string - example: rating - FieldType: - type: array - items: - type: object - required: - - type - - Operator - properties: - type: - type: string - example: tag - Operator: - type: array - items: - type: object - required: - - key - - title - properties: - key: - type: string - example: '=' - title: - type: string - example: is - Metadata: - type: array - items: - type: object - required: - - ratingKey - - key - - guid - - title - - type - - addedAt - - summary - properties: - ratingKey: - type: string - example: '58683' - description: | - The rating key (Media ID) of this media item. - Note: This is always an integer, but is represented as a string in the API. - key: - type: string - example: /library/metadata/58683 - guid: - type: string - example: 'plex://movie/5d7768ba96b655001fdc0408' - studio: - type: string - example: 20th Century Studios - skipChildren: - type: boolean - example: false - librarySectionID: - type: integer - examples: - - 1 - librarySectionTitle: - type: string - example: Movies - librarySectionKey: - type: string - example: /library/sections/1 - type: - type: string - enum: - - movie - - show - - season - - episode - - artist - - album - example: movie - description: | - The type of media content - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - ARTIST - - ALBUM - title: - type: string - example: 'Avatar: The Way of Water' - slug: - type: string - example: 4-for-texas - contentRating: - type: string - example: PG-13 - summary: - type: string - example: 'Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na''vi race to protect their home.' - rating: - type: number - example: 7.6 - audienceRating: - type: number - example: 9.2 - year: - type: integer - format: int32 - example: 2022 - seasonCount: - type: integer - format: int32 - example: 2022 - tagline: - type: string - example: Return to Pandora. - flattenSeasons: - type: string - description: 'Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).' - enum: - - '-1' - - '0' - - '1' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - HIDE - - SHOW - example: '1' - episodeSort: - type: string - description: 'Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).' - enum: - - '-1' - - '0' - - '1' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - OLDEST_FIRST - - NEWEST_FIRST - example: '0' - enableCreditsMarkerGeneration: - type: string - description: 'Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).' - enum: - - '-1' - - '0' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - DISABLED - example: '-1' - showOrdering: - type: string - description: | - Setting that indicates the episode ordering for the show. - None = Library default, - tmdbAiring = The Movie Database (Aired), - aired = TheTVDB (Aired), - dvd = TheTVDB (DVD), - absolute = TheTVDB (Absolute)). - enum: - - None - - tmdbAiring - - aired - - dvd - - absolute - x-speakeasy-enums: - - NONE - - TMDB_AIRING - - TVDB_AIRED - - TVDB_DVD - - TVDB_ABSOLUTE - example: absolute - thumb: - type: string - example: /library/metadata/58683/thumb/1703239236 - art: - type: string - example: /library/metadata/58683/art/1703239236 - banner: - type: string - example: /library/metadata/58683/banner/1703239236 - duration: - type: integer - format: int32 - example: 11558112 - originallyAvailableAt: - type: string - format: date - example: 2022-12-14T00:00:00.000Z - addedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - updatedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - chapterSource: - type: string - example: media - primaryExtraKey: - type: string - example: /library/metadata/58684 - ratingImage: - type: string - example: 'rottentomatoes://image.rating.ripe' - grandparentRatingKey: - type: string - example: '66' - grandparentGuid: - type: string - example: 'plex://show/5d9c081b170e24001f2a7be4' - grandparentKey: - type: string - example: /library/metadata/66 - grandparentTitle: - type: string - example: Caprica - grandparentThumb: - type: string - example: /library/metadata/66/thumb/1705716261 - parentSlug: - type: string - example: alice-in-borderland-2020 - grandparentSlug: - type: string - example: alice-in-borderland-2020 - grandparentArt: - type: string - example: /library/metadata/66/art/1705716261 - grandparentTheme: - type: string - example: /library/metadata/66/theme/1705716261 - Media: - description: | - The Media object is only included when type query is `4` or higher. - type: array - items: - type: object - required: - - id - - container - - Part - properties: - id: - type: integer - format: int32 - example: 119534 - duration: - type: integer - format: int32 - example: 11558112 - bitrate: - type: integer - format: int32 - example: 25025 - width: - type: integer - format: int32 - example: 3840 - height: - type: integer - format: int32 - example: 2072 - aspectRatio: - type: number - example: 1.85 - audioProfile: - type: string - example: dts - audioChannels: - type: integer - format: int32 - example: 6 - audioCodec: - type: string - example: eac3 - videoCodec: - type: string - example: hevc - videoResolution: - type: string - example: 4k - container: - type: string - example: mkv - videoFrameRate: - type: string - example: 24p - videoProfile: - type: string - example: main 10 - hasVoiceActivity: - type: boolean - example: false - optimizedForStreaming: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - has64bitOffsets: - type: boolean - example: false - Part: - type: array - items: - type: object - required: - - id - - key - - file - - size - - container - properties: - id: - type: integer - format: int32 - example: 119542 - key: - type: string - example: /library/parts/119542/1680457526/file.mkv - duration: - type: integer - format: int32 - example: 11558112 - file: - type: string - example: /movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv - size: - type: integer - format: int64 - example: 36158371307 - container: - type: string - description: | - The container format of the media file. - example: mkv - audioProfile: - type: string - example: dts - has64bitOffsets: - type: boolean - example: false - optimizedForStreaming: - type: boolean - example: false - videoProfile: - type: string - example: main 10 - indexes: - type: string - example: sd - hasThumbnail: - type: string - enum: - - '0' - - '1' - example: '1' - default: '0' - x-speakeasy-enums: - - false - - true - Stream: - type: array - items: - type: object - required: - - id - - streamType - - codec - - index - properties: - id: - type: integer - example: 272796 - streamType: - type: integer - description: 'Type of stream (1 = video, 2 = audio, 3 = subtitle)' - example: 1 - default: - type: boolean - description: Indicates if this is the default stream - example: true - selected: - type: boolean - description: Indicates if the stream is selected - example: true - codec: - type: string - description: Codec used by the stream - example: h264 - index: - type: integer - description: The index of the stream - example: 0 - bitrate: - type: integer - description: The bitrate of the stream in kbps - example: 6273 - colorPrimaries: - type: string - description: The color primaries of the video stream - example: bt709 - colorRange: - type: string - description: The color range of the video stream - example: tv - colorSpace: - type: string - description: The color space of the video stream - example: bt709 - colorTrc: - type: string - description: The transfer characteristics (TRC) of the video stream - example: bt709 - bitDepth: - type: integer - description: The bit depth of the video stream - example: 8 - chromaLocation: - type: string - description: The chroma location of the video stream - example: left - streamIdentifier: - type: string - description: The identifier of the video stream - example: '2' - chromaSubsampling: - type: string - description: The chroma subsampling format - example: '4:2:0' - codedHeight: - type: integer - description: The coded height of the video stream - example: 1088 - codedWidth: - type: integer - description: The coded width of the video stream - example: 1920 - frameRate: - type: number - description: The frame rate of the video stream - example: 29.97 - hasScalingMatrix: - type: boolean - description: Indicates if the stream has a scaling matrix - example: false - hearingImpaired: - type: boolean - example: false - closedCaptions: - type: boolean - example: false - embeddedInVideo: - type: string - example: '1' - height: - type: integer - description: The height of the video stream - example: 1080 - level: - type: integer - description: The level of the video codec - example: 40 - profile: - type: string - description: The profile of the video codec - example: main - refFrames: - type: integer - description: Number of reference frames - example: 4 - scanType: - type: string - description: The scan type (progressive or interlaced) - example: progressive - width: - type: integer - description: The width of the video stream - example: 1920 - displayTitle: - type: string - description: Display title of the stream - example: 1080p (H.264) - extendedDisplayTitle: - type: string - description: Extended display title of the stream - example: 1080p (H.264) - channels: - type: integer - description: Number of audio channels (for audio streams) - example: 2 - language: - type: string - description: The language of the stream (for audio/subtitle streams) - example: English - languageTag: - type: string - description: Language tag of the stream - example: en - languageCode: - type: string - description: Language code of the stream - example: eng - audioChannelLayout: - type: string - description: The audio channel layout - example: stereo - samplingRate: - type: integer - description: Sampling rate of the audio stream in Hz - example: 48000 - title: - type: string - description: Title of the subtitle track (for subtitle streams) - example: English - canAutoSync: - type: boolean - description: Indicates if the subtitle stream can auto-sync - example: false - Genre: - type: array - items: - type: object - properties: - tag: - type: string - example: Adventure - Country: - type: array - items: - type: object - properties: - tag: - type: string - example: United States of America - Director: - type: array - items: - type: object - properties: - tag: - type: string - example: James Cameron - Writer: - type: array - items: - type: object - properties: - tag: - type: string - example: James Cameron - Collection: - type: array - items: - type: object - properties: - tag: - type: string - example: Working NL Subs - Role: - type: array - items: - type: object - properties: - id: - type: integer - description: The ID of the tag or actor. - example: 294129 - filter: - type: string - description: The filter used to find the actor or tag. - example: actor=294129 - thumb: - type: string - description: The thumbnail of the actor - example: 'https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg' - tag: - type: string - description: The name of the tag or actor. - example: Mike Smith - tagKey: - type: string - description: Unique identifier for the tag. - example: 668e7e7b22bcad9064350c91 - role: - type: string - description: The role of the actor or tag in the media. - example: Self - Location: - type: array - items: - type: object - properties: - path: - type: string - example: /TV Shows/House - Guid: - x-speakeasy-name-override: MediaGuid - description: | - The Guid object is only included in the response if the `includeGuids` parameter is set to `1`. - type: array - items: - type: object - required: - - id - properties: - id: - type: string - description: | - Can be one of the following formats: - imdb://tt13015952, tmdb://2434012, tvdb://7945991 - example: 'imdb://tt13015952' - UltraBlurColors: - type: object - required: - - topLeft - - topRight - - bottomRight - - bottomLeft - properties: - topLeft: - type: string - example: 11333b - topRight: - type: string - example: 0a232d - bottomRight: - type: string - example: 073958 - bottomLeft: - type: string - example: 1f5066 - Rating: - x-speakeasy-name-override: MetaDataRating - type: array - items: - type: object - required: - - image - - value - - type - properties: - image: - type: string - description: A URI or path to the rating image. - example: 'themoviedb://image.rating' - value: - type: number - format: float - description: The value of the rating. - example: 3 - type: - type: string - description: 'The type of rating (e.g., audience, critic).' - example: audience - Image: - type: array - items: - type: object - required: - - alt - - type - - url - properties: - alt: - type: string - example: Episode 1 - type: - type: string - enum: - - coverPoster - - background - - snapshot - - clearLogo - example: background - url: - type: string - example: /library/metadata/45521/thumb/1644710589 - titleSort: - type: string - example: Whale - viewCount: - type: integer - format: int32 - example: 1 - lastViewedAt: - type: integer - format: int32 - example: 1682752242 - originalTitle: - type: string - example: 映画 ブラッククローバー 魔法帝の剣 - viewOffset: - type: integer - format: int32 - example: 5222500 - skipCount: - type: integer - format: int32 - example: 1 - index: - type: integer - format: int32 - example: 1 - theme: - type: string - example: /library/metadata/1/theme/1705636920 - leafCount: - type: integer - format: int32 - example: 14 - viewedLeafCount: - type: integer - format: int32 - example: 0 - childCount: - type: integer - format: int32 - example: 1 - hasPremiumExtras: - type: string - example: '1' - hasPremiumPrimaryExtra: - type: string - example: '1' - parentRatingKey: - type: string - description: | - The rating key of the parent item. - example: '66' - parentGuid: - type: string - example: 'plex://show/5d9c081b170e24001f2a7be4' - parentStudio: - type: string - example: UCP - parentKey: - type: string - example: /library/metadata/66 - parentTitle: - type: string - example: Caprica - parentIndex: - type: integer - format: int32 - example: 1 - parentYear: - type: integer - format: int32 - example: 2010 - parentThumb: - type: string - example: /library/metadata/66/thumb/1705716261 - parentTheme: - type: string - example: /library/metadata/66/theme/1705716261 - '400': - description: 'Bad request, invalid parameters.' - '401': - description: 'Unauthorized, invalid Plex token.' - x-codeSamples: - - lang: php - label: added - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetRecentlyAddedRequest( - contentDirectoryID: 470161, - sectionID: 2, - type: Operations\Type::TvShow, - ); - - $response = $sdk->hubs->getRecentlyAdded( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: added - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetRecentlyAddedRequest.new(\n content_directory_id: 470161,\n section_id: 2,\n type: ::PlexRubySDK::Operations::Type::TV_SHOW,\n include_meta: ::PlexRubySDK::Operations::IncludeMeta::ENABLE,\n x_plex_container_start: 0,\n x_plex_container_size: 50,\n)\n \nres = s.hubs.get_recently_added(req)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: added - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Hubs.GetRecentlyAdded(ctx, operations.GetRecentlyAddedRequest{\n ContentDirectoryID: 470161,\n SectionID: plexgo.Int64(2),\n Type: operations.TypeTvShow,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - lang: java - label: added + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.operations.GetRecentlyAddedRequest; - import dev.plexapi.plexapi.models.operations.GetRecentlyAddedResponse; - import dev.plexapi.plexapi.models.operations.Type; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAllHubsRequest; + import dev.plexapi.sdk.models.operations.GetAllHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { @@ -4728,16 +2712,25 @@ paths: public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetRecentlyAddedRequest req = GetRecentlyAddedRequest.builder() - .contentDirectoryID(470161L) - .type(Type.TvShow) - .sectionID(2L) + GetAllHubsRequest req = GetAllHubsRequest.builder() + .onlyTransient(BoolInt.ONE) .build(); - GetRecentlyAddedResponse res = sdk.hubs().getRecentlyAdded() + GetAllHubsResponse res = sdk.hubs().getAllHubs() .request(req) .call(); @@ -4747,34 +2740,516 @@ paths: } } - lang: typescript - label: added + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { Type } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.hubs.getRecentlyAdded({ - contentDirectoryID: 470161, - sectionID: 2, - type: Type.TvShow, + const result = await plexAPI.hubs.getAllHubs({ + onlyTransient: BoolInt.One, }); - // Handle the result + console.log(result); + } + + run(); + /hubs/continueWatching: + get: + summary: Get the continue watching hub + operationId: getContinueWatching + description: Get the global continue watching hub + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/count' + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + $ref: '#/components/schemas/Hub' + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.GetContinueWatching(ctx, operations.GetContinueWatchingRequest{}) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetContinueWatchingRequest; + import dev.plexapi.sdk.models.operations.GetContinueWatchingResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetContinueWatchingRequest req = GetContinueWatchingRequest.builder() + .build(); + + GetContinueWatchingResponse res = sdk.hubs().getContinueWatching() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.getContinueWatching({}); + + console.log(result); + } + + run(); + /hubs/items: + get: + summary: Get a hub's items + operationId: getHubItems + description: Get the items within a single hub specified by identifier + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/count' + - name: identifier + description: If provided, limit to only specified hubs + in: query + required: true + schema: + type: array + items: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + $ref: '#/components/schemas/MediaContainer' + type: object + '404': + description: The specified hub could not be found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.GetHubItems(ctx, operations.GetHubItemsRequest{ + Identifier: []string{ + "", + "", + "", + }, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetHubItemsRequest; + import dev.plexapi.sdk.models.operations.GetHubItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetHubItemsRequest req = GetHubItemsRequest.builder() + .identifier(List.of( + "", + "", + "")) + .build(); + + GetHubItemsResponse res = sdk.hubs().getHubItems() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.getHubItems({ + identifier: [ + "", + "", + "", + ], + }); + + console.log(result); + } + + run(); + /hubs/promoted: + get: + summary: Get the hubs which are promoted + operationId: getPromotedHubs + description: Get the global hubs which are promoted (should be displayed on the home screen) + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/count' + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + $ref: '#/components/schemas/Hub' + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.GetPromotedHubs(ctx, operations.GetPromotedHubsRequest{}) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPromotedHubsRequest; + import dev.plexapi.sdk.models.operations.GetPromotedHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPromotedHubsRequest req = GetPromotedHubsRequest.builder() + .build(); + + GetPromotedHubsResponse res = sdk.hubs().getPromotedHubs() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.getPromotedHubs({}); + console.log(result); } run(); /hubs/search: get: - tags: - - Search - summary: Perform a search - operationId: performSearch + summary: Search Hub + operationId: searchHubs description: | + 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: @@ -4787,85 +3262,70 @@ paths: - `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. + tags: + - Search parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" - name: query description: The query term in: query + required: true schema: type: string - examples: - - arnold - - dylan - required: true - name: sectionId - description: 'This gives context to the search, and can result in re-ordering of search result hubs' + description: This gives context to the search, and can result in re-ordering of search result hubs. in: query schema: - type: number - required: false + type: integer + example: 1 - name: limit - description: The number of items to return per hub + description: The number of items to return per hub. 3 if not specified in: query schema: - type: number - example: 5 - default: 3 + type: integer responses: '200': - description: The search results + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + $ref: '#/components/schemas/Hub' + type: array + type: object + type: object '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: A required parameter was not given, the wrong type, or wrong value content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + text/html: {} + '404': + description: Search restrictions result in no possible items found (such as searching no sections) content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} x-codeSamples: - lang: php - label: performSearch + label: PlexPHP source: |- declare(strict_types=1); @@ -4882,8 +3342,7 @@ paths: $response = $sdk->search->performSearch( - query: 'dylan', - sectionId: 9372.7, + query: 'arnold', limit: 5 ); @@ -4892,142 +3351,202 @@ paths: // handle response } - lang: ruby - label: performSearch - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.search.perform_search(query=\"dylan\", section_id=9372.7, limit=5.0)\n\nif res.status_code == 200\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.search.perform_search(query="dylan", section_id=9372.7, limit=5.0) + + if res.status_code == 200 + # handle response + end - lang: go - label: performSearch - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Search.PerformSearch(ctx, \"dylan\", nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Search.SearchHubs(ctx, operations.SearchHubsRequest{ + Query: "", + SectionID: plexgo.Pointer[int64](1), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: performSearch + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.PerformSearchBadRequest; - import dev.plexapi.plexapi.models.errors.PerformSearchUnauthorized; - import dev.plexapi.plexapi.models.operations.PerformSearchResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SearchHubsRequest; + import dev.plexapi.sdk.models.operations.SearchHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws PerformSearchBadRequest, PerformSearchUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - PerformSearchResponse res = sdk.search().performSearch() - .query("dylan") - .sectionId(9487.88d) - .limit(5d) + SearchHubsRequest req = SearchHubsRequest.builder() + .query("") + .sectionId(1L) + .build(); + + SearchHubsResponse res = sdk.search().searchHubs() + .request(req) .call(); - // handle response + if (res.object().isPresent()) { + // handle response + } } } - lang: typescript - label: performSearch + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.search.performSearch("dylan"); + const result = await plexAPI.search.searchHubs({ + query: "", + sectionId: 1, + }); - // Handle the result console.log(result); } run(); /hubs/search/voice: get: + summary: Voice Search Hub + operationId: voiceSearchHubs + description: | + 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. tags: - Search - summary: Perform a voice search - operationId: performVoiceSearch - description: "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. \nIt 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. \nWhenever possible, clients should limit the search to the appropriate type. \nResults, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.\n" parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" - name: query description: The query term in: query + required: true schema: type: string - examples: - - dead+poop - required: true - - name: sectionId - description: 'This gives context to the search, and can result in re-ordering of search result hubs' - in: query - schema: - type: number - required: false + - $ref: '#/components/parameters/type' - name: limit - description: The number of items to return per hub + description: The number of items to return per hub. 3 if not specified in: query schema: - type: number - example: 5 - default: 3 - required: false + type: integer responses: '200': - description: The search results + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + $ref: '#/components/schemas/Hub' + type: array + type: object + type: object '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: A required parameter was not given, the wrong type, or wrong value content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} x-codeSamples: - lang: php - label: performVoiceSearch + label: PlexPHP source: |- declare(strict_types=1); @@ -5045,7 +3564,6 @@ paths: $response = $sdk->search->performVoiceSearch( query: 'dead+poop', - sectionId: 4094.8, limit: 5 ); @@ -5054,501 +3572,98 @@ paths: // handle response } - lang: ruby - label: performVoiceSearch - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.search.perform_voice_search(query=\"dead+poop\", section_id=4094.8, limit=5.0)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: performVoiceSearch - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Search.PerformVoiceSearch(ctx, \"dead+poop\", nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: performVoiceSearch + label: PlexRuby source: |- - package hello.world; + require 'plex_ruby_sdk' - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.PerformVoiceSearchBadRequest; - import dev.plexapi.plexapi.models.errors.PerformVoiceSearchUnauthorized; - import dev.plexapi.plexapi.models.operations.PerformVoiceSearchResponse; - import java.lang.Exception; + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) - public class Application { + res = s.search.perform_voice_search(query="dead+poop", section_id=4094.8, limit=5.0) - public static void main(String[] args) throws PerformVoiceSearchBadRequest, PerformVoiceSearchUnauthorized, Exception { + if res.status_code == 200 + # handle response + end + - lang: go + label: PlexGO + source: |- + package main - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "log" + ) - PerformVoiceSearchResponse res = sdk.search().performVoiceSearch() - .query("dead+poop") - .sectionId(4094.8d) - .limit(5d) - .call(); + 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(""), + ) + + res, err := s.Search.VoiceSearchHubs(ctx, operations.VoiceSearchHubsRequest{ + Query: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { // handle response } } - - lang: typescript - label: performVoiceSearch - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.search.performVoiceSearch("dead+poop"); - - // Handle the result - console.log(result); - } - - run(); - '/hubs/sections/{sectionId}': - get: - tags: - - Hubs - summary: Get library specific hubs - description: | - This endpoint will return a list of library specific hubs - operationId: getLibraryHubs - parameters: - - name: sectionId - description: the Id of the library to query - in: path - schema: - type: number - required: true - - name: count - description: The number of items to return with each hub. - in: query - schema: - type: number - required: false - - name: onlyTransient - description: 'Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).' - in: query - schema: - type: integer - enum: - - 0 - - 1 - required: false - responses: - '200': - description: The hubs specific to the library - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 7 - allowSync: - type: boolean - example: true - identifier: - type: string - example: com.plexapp.plugins.library - librarySectionID: - type: integer - format: int32 - example: 1 - librarySectionTitle: - type: string - example: Movies - librarySectionUUID: - type: string - example: 322a231a-b7f7-49f5-920f-14c61199cd30 - Hub: - type: array - items: - type: object - properties: - key: - type: string - example: '/library/sections/1/all?sort=lastViewedAt:desc&unwatched=0&viewOffset=0' - title: - type: string - example: Recently Played Movies - type: - type: string - example: movie - hubIdentifier: - type: string - example: movie.recentlyviewed.1 - context: - type: string - example: hub.movie.recentlyviewed - size: - type: integer - format: int32 - example: 6 - more: - type: boolean - example: true - style: - type: string - example: shelf - hubKey: - type: string - example: '/library/metadata/66485,66098,57249,11449,5858,14944' - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '14944' - key: - type: string - example: /library/metadata/14944 - guid: - type: string - example: 'plex://movie/5d77686eeb5d26001f1eb339' - studio: - type: string - example: Walt Disney Animation Studios - type: - type: string - example: movie - title: - type: string - example: Tangled - librarySectionTitle: - type: string - example: Movies - librarySectionID: - type: integer - format: int32 - example: 1 - librarySectionKey: - type: string - example: /library/sections/1 - contentRating: - type: string - example: PG - summary: - type: string - example: 'The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.' - rating: - type: number - example: 8.9 - audienceRating: - type: number - example: 8.7 - viewCount: - type: integer - format: int32 - example: 1 - lastViewedAt: - type: integer - format: int32 - example: 1704936047 - year: - type: integer - format: int32 - example: 2010 - tagline: - type: string - example: They're taking adventure to new lengths. - thumb: - type: string - example: /library/metadata/14944/thumb/1705739847 - art: - type: string - example: /library/metadata/14944/art/1705739847 - duration: - type: integer - format: int32 - example: 6017237 - originallyAvailableAt: - type: string - format: date - example: 2010-11-24T00:00:00.000Z - addedAt: - type: integer - format: int32 - example: 1589412494 - updatedAt: - type: integer - format: int32 - example: 1705739847 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - primaryExtraKey: - type: string - example: /library/metadata/14952 - ratingImage: - type: string - example: 'rottentomatoes://image.rating.ripe' - Media: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 38247 - duration: - type: integer - format: int32 - example: 6017237 - bitrate: - type: integer - format: int32 - example: 2051 - width: - type: integer - format: int32 - example: 1920 - height: - type: integer - format: int32 - example: 1080 - aspectRatio: - type: number - example: 1.78 - audioChannels: - type: integer - format: int32 - example: 2 - audioCodec: - type: string - example: aac - videoCodec: - type: string - example: h264 - videoResolution: - type: string - example: '1080' - container: - type: string - example: mp4 - videoFrameRate: - type: string - example: 24p - optimizedForStreaming: - type: integer - format: int32 - example: 1 - audioProfile: - type: string - example: lc - has64bitOffsets: - type: boolean - example: false - videoProfile: - type: string - example: high - Part: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 38247 - key: - type: string - example: /library/parts/38247/1589412494/file.mp4 - duration: - type: integer - format: int32 - example: 6017237 - file: - type: string - example: /movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4 - size: - type: integer - format: int32 - example: 1545647447 - audioProfile: - type: string - example: lc - container: - type: string - example: mp4 - has64bitOffsets: - type: boolean - example: false - optimizedForStreaming: - type: boolean - example: true - videoProfile: - type: string - example: high - Genre: - type: array - items: - type: object - properties: - tag: - type: string - example: Animation - Country: - type: array - items: - type: object - properties: - tag: - type: string - example: United States of America - Director: - type: array - items: - type: object - properties: - tag: - type: string - example: Nathan Greno - Role: - type: array - items: - type: object - properties: - tag: - type: string - example: Donna Murphy - Writer: - type: array - items: - type: object - properties: - tag: - type: string - example: Wilhelm Grimm - skipCount: - type: integer - format: int32 - example: 1 - chapterSource: - type: string - example: media - promoted: - type: boolean - example: true - random: - type: boolean - example: true - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getLibraryHubs - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->hubs->getLibraryHubs( - sectionId: 6728.76, - count: 639.24, - onlyTransient: Operations\QueryParamOnlyTransient::One - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getLibraryHubs - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.hubs.get_library_hubs(section_id=6728.76, count=639.24, only_transient=::PlexRubySDK::Operations::QueryParamOnlyTransient::ONE)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getLibraryHubs - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Hubs.GetLibraryHubs(ctx, 6728.76, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - lang: java - label: getLibraryHubs + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetLibraryHubsBadRequest; - import dev.plexapi.plexapi.models.errors.GetLibraryHubsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetLibraryHubsResponse; - import dev.plexapi.plexapi.models.operations.QueryParamOnlyTransient; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.VoiceSearchHubsRequest; + import dev.plexapi.sdk.models.operations.VoiceSearchHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetLibraryHubsBadRequest, GetLibraryHubsUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetLibraryHubsResponse res = sdk.hubs().getLibraryHubs() - .sectionId(6728.76d) - .count(6728.76d) - .onlyTransient(QueryParamOnlyTransient.ZERO) + VoiceSearchHubsRequest req = VoiceSearchHubsRequest.builder() + .query("") + .build(); + + VoiceSearchHubsResponse res = sdk.search().voiceSearchHubs() + .request(req) .call(); if (res.object().isPresent()) { @@ -5557,71 +3672,68 @@ paths: } } - lang: typescript - label: getLibraryHubs + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.hubs.getLibraryHubs(6728.76); + const result = await plexAPI.search.voiceSearchHubs({ + query: "", + }); - // Handle the result console.log(result); } run(); /identity: get: + summary: Get PMS identity + operationId: getIdentity + description: Get details about this PMS's identity tags: - - Server - summary: Get Server Identity - description: This request is useful to determine if the server is online or offline - operationId: get-server-identity - security: [] + - General + security: + - {} responses: '200': - description: The Server Identity information + description: OK content: application/json: schema: - type: object properties: MediaContainer: - type: object properties: - size: - type: number - example: 0 claimed: + description: Indicates whether this server has been claimed by a user type: boolean machineIdentifier: + description: A unique identifier of the computer type: string - example: 96f2fe7a78c9dc1f16a16bedbe90f98149be16b4 + size: + type: integer version: + description: The full version string of the PMS type: string - example: 1.31.3.6868-28fc46b27 - '408': - description: Request Timeout - content: - application/json: - schema: - x-speakeasy-name-override: RequestTimeout + type: object type: object - properties: - code: - type: integer - format: int32 - example: 408 - message: - type: string - x-speakeasy-error-message: true - example: The server timed out waiting for the request. x-codeSamples: - lang: php - label: identity + label: PlexPHP source: |- declare(strict_types=1); @@ -5641,29 +3753,58 @@ paths: // handle response } - lang: ruby - label: identity - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\n\n \nres = s.server.get_server_identity()\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new + + res = s.server.get_server_identity() + + if ! res.object.nil? + # handle response + end - lang: go - label: identity - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Server.GetServerIdentity(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New() + + res, err := s.General.GetIdentity(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: identity + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetServerIdentityRequestTimeout; - import dev.plexapi.plexapi.models.operations.GetServerIdentityResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetIdentityResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetServerIdentityRequestTimeout, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() .build(); - GetServerIdentityResponse res = sdk.server().getServerIdentity() + GetIdentityResponse res = sdk.general().getIdentity() .call(); if (res.object().isPresent()) { @@ -5672,10983 +3813,3552 @@ paths: } } - lang: typescript - label: identity + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.server.getServerIdentity(); + const result = await plexAPI.general.getIdentity(); - // Handle the result console.log(result); } run(); - /library/hashes: + /library/all: get: + summary: Get all items in library + operationId: getLibraryItems + description: Request all metadata items according to a query. tags: - Library - summary: Get Hash Value - description: This resource returns hash values for local files - operationId: getFileHash parameters: - - name: url - description: 'This is the path to the local file, must be prefixed by `file://`' - in: query - schema: - type: string - example: 'file://C:\Image.png&type=13' - required: true - - name: type - description: Item type - in: query - schema: - type: number - required: false + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/mediaQuery' responses: '200': - description: The hash of the file - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/schemas/MediaContainerWithMetadata' x-codeSamples: - - lang: php - label: getFileHash - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getFileHash( - url: 'file://C:\Image.png&type=13', - type: 4462.17 - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: getFileHash - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_file_hash(url=\"file://C:\\Image.png&type=13\", type=4462.17)\n\nif res.status_code == 200\n # handle response\nend" - lang: go - label: getFileHash - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetFileHash(ctx, \"file://C:\\Image.png&type=13\", nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: getFileHash + label: PlexGO source: |- - package hello.world; + package main - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetFileHashBadRequest; - import dev.plexapi.plexapi.models.errors.GetFileHashUnauthorized; - import dev.plexapi.plexapi.models.operations.GetFileHashResponse; - import java.lang.Exception; + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "log" + ) - public class Application { + func main() { + ctx := context.Background() - public static void main(String[] args) throws GetFileHashBadRequest, GetFileHashUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetFileHashResponse res = sdk.library().getFileHash() - .url("file://C:\Image.png&type=13") - .type(4462.17d) - .call(); + 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(""), + ) + res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{}) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { // handle response } } - - lang: typescript - label: getFileHash - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getFileHash("file://C:\Image.png&type=13"); - - // Handle the result - console.log(result); - } - - run(); - /library/recentlyAdded: - get: - tags: - - Library - summary: Get Recently Added - description: | - This endpoint will return the recently added content. - operationId: get-recently-added-library - parameters: - - name: contentDirectoryID - in: query - required: false - schema: - type: integer - example: 2 - - name: pinnedContentDirectoryID - in: query - required: false - schema: - type: array - items: - type: integer - example: - - 3 - - 5 - - 7 - - 13 - - 12 - - 1 - - 6 - - 14 - - 2 - - 10 - - 16 - - 17 - - name: sectionID - in: query - required: false - description: The library section ID for filtering content. - schema: - type: integer - example: 2 - - name: type - in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - - name: includeMeta - in: query - description: | - Adds the Meta object to the response - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: X-Plex-Container-Start - in: query - description: | - The index of the first item to return. If not specified, the first item will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 0 - schema: - type: integer - format: int32 - default: 0 - example: 0 - required: false - - name: X-Plex-Container-Size - in: query - description: | - The number of items to return. If not specified, all items will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 50 - schema: - type: integer - format: int32 - default: 50 - example: 50 - required: false - responses: - '200': - description: The recently added content - content: - application/json: - schema: - type: object - properties: - MediaContainer: - allOf: - - type: object - description: | - The Meta object is only included in the response if the `includeMeta` parameter is set to `1`. - properties: - Type: - type: array - items: - type: object - required: - - key - - type - - title - - active - properties: - key: - type: string - example: /library/sections/2/all?type=2 - type: - type: string - example: filter - subtype: - type: string - example: clip - title: - type: string - example: TV Shows - active: - type: boolean - example: false - Filter: - type: array - items: - type: object - required: - - filter - - filterType - - key - - title - - type - properties: - filter: - type: string - example: genre - filterType: - type: string - example: string - key: - type: string - example: /library/sections/2/genre?type=2 - title: - type: string - example: Genre - type: - type: string - example: filter - advanced: - type: boolean - example: true - Sort: - type: array - items: - type: object - required: - - key - - title - - defaultDirection - properties: - default: - type: string - example: asc - active: - type: boolean - example: false - activeDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - defaultDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - descKey: - type: string - example: 'titleSort:desc' - firstCharacterKey: - type: string - example: /library/sections/2/firstCharacter - key: - type: string - example: titleSort - title: - type: string - example: Title - Field: - type: array - items: - type: object - required: - - key - - title - - type - properties: - key: - type: string - example: show.title - title: - type: string - example: Show Title - type: - type: string - example: string - subType: - type: string - example: rating - FieldType: - type: array - items: - type: object - required: - - type - - Operator - properties: - type: - type: string - example: tag - Operator: - type: array - items: - type: object - required: - - key - - title - properties: - key: - type: string - example: '=' - title: - type: string - example: is - - type: object - properties: - size: - type: number - example: 50 - allowSync: - type: boolean - identifier: - type: string - example: com.plexapp.plugins.library - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: number - example: 1680021154 - mixedParents: - type: boolean - Metadata: - type: array - items: - type: object - properties: - allowSync: - type: boolean - librarySectionID: - type: number - example: 1 - librarySectionTitle: - type: string - example: Movies - librarySectionUUID: - type: string - example: 322a231a-b7f7-49f5-920f-14c61199cd30 - ratingKey: - type: number - example: 59398 - key: - type: string - example: /library/metadata/59398 - guid: - type: string - example: 'plex://movie/5e161a83bea6ac004126e148' - studio: - type: string - example: Marvel Studios - type: - type: string - example: movie - title: - type: string - example: 'Ant-Man and the Wasp: Quantumania' - contentRating: - type: string - example: PG-13 - summary: - type: string - example: Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible. - rating: - type: number - example: 4.7 - audienceRating: - type: number - example: 8.3 - year: - type: number - example: 2023 - tagline: - type: string - example: Witness the beginning of a new dynasty. - thumb: - type: string - example: /library/metadata/59398/thumb/1681888010 - art: - type: string - example: /library/metadata/59398/art/1681888010 - duration: - type: number - example: 7474422 - originallyAvailableAt: - type: string - format: date-time - example: 2023-02-15T00:00:00.000Z - addedAt: - type: number - example: 1681803215 - updatedAt: - type: number - example: 1681888010 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - chapterSource: - type: string - example: media - primaryExtraKey: - type: string - example: /library/metadata/59399 - ratingImage: - type: string - example: 'rottentomatoes://image.rating.rotten' - Media: - type: array - items: - type: object - properties: - id: - type: number - example: 120345 - duration: - type: number - example: 7474422 - bitrate: - type: number - example: 3623 - width: - type: number - example: 1920 - height: - type: number - example: 804 - aspectRatio: - type: number - example: 2.35 - audioChannels: - type: number - example: 6 - audioCodec: - type: string - example: ac3 - videoCodec: - type: string - example: h264 - videoResolution: - type: number - example: 1080 - container: - type: string - example: mp4 - videoFrameRate: - type: string - example: 24p - optimizedForStreaming: - type: number - example: 0 - has64bitOffsets: - type: boolean - videoProfile: - type: string - example: high - Part: - type: array - items: - type: object - properties: - id: - type: number - example: 120353 - key: - type: string - example: /library/parts/120353/1681803203/file.mp4 - duration: - type: number - example: 7474422 - file: - type: string - example: /movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4 - size: - type: number - example: 3395307162 - container: - type: string - example: mp4 - has64bitOffsets: - type: boolean - hasThumbnail: - type: number - example: 1 - optimizedForStreaming: - type: boolean - videoProfile: - type: string - example: high - Genre: - type: array - items: - type: object - properties: - tag: - type: string - example: Comedy - Director: - type: array - items: - type: object - properties: - tag: - type: string - example: Peyton Reed - Writer: - type: array - items: - type: object - properties: - tag: - type: string - example: Jeff Loveness - Country: - type: array - items: - type: object - properties: - tag: - type: string - example: United States of America - Role: - type: array - items: - type: object - properties: - tag: - type: string - example: Paul Rudd - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: library - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetRecentlyAddedLibraryRequest( - contentDirectoryID: 2, - pinnedContentDirectoryID: [ - 3, - 5, - 7, - 13, - 12, - 1, - 6, - 14, - 2, - 10, - 16, - 17, - ], - sectionID: 2, - type: Operations\QueryParamType::TvShow, - ); - - $response = $sdk->library->getRecentlyAddedLibrary( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: library - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetRecentlyAddedLibraryRequest.new(\n content_directory_id: 2,\n pinned_content_directory_id: [\n 3,\n 5,\n 7,\n 13,\n 12,\n 1,\n 6,\n 14,\n 2,\n 10,\n 16,\n 17,\n ],\n section_id: 2,\n type: ::PlexRubySDK::Operations::QueryParamType::TV_SHOW,\n include_meta: ::PlexRubySDK::Operations::QueryParamIncludeMeta::ENABLE,\n x_plex_container_start: 0,\n x_plex_container_size: 50,\n)\n \nres = s.library.get_recently_added_library(req)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: library - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetRecentlyAddedLibrary(ctx, operations.GetRecentlyAddedLibraryRequest{\n ContentDirectoryID: plexgo.Int64(2),\n PinnedContentDirectoryID: []int64{\n 3,\n 5,\n 7,\n 13,\n 12,\n 1,\n 6,\n 14,\n 2,\n 10,\n 16,\n 17,\n },\n SectionID: plexgo.Int64(2),\n Type: operations.QueryParamTypeTvShow,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - lang: java - label: library + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetRecentlyAddedLibraryBadRequest; - import dev.plexapi.plexapi.models.errors.GetRecentlyAddedLibraryUnauthorized; - import dev.plexapi.plexapi.models.operations.GetRecentlyAddedLibraryRequest; - import dev.plexapi.plexapi.models.operations.GetRecentlyAddedLibraryResponse; - import dev.plexapi.plexapi.models.operations.QueryParamType; - import java.lang.Exception; - import java.util.List; - - public class Application { - - public static void main(String[] args) throws GetRecentlyAddedLibraryBadRequest, GetRecentlyAddedLibraryUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetRecentlyAddedLibraryRequest req = GetRecentlyAddedLibraryRequest.builder() - .type(QueryParamType.TvShow) - .contentDirectoryID(2L) - .pinnedContentDirectoryID(List.of( - 3L, - 5L, - 7L, - 13L, - 12L, - 1L, - 6L, - 14L, - 2L, - 10L, - 16L, - 17L)) - .sectionID(2L) - .build(); - - GetRecentlyAddedLibraryResponse res = sdk.library().getRecentlyAddedLibrary() - .request(req) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: library - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { QueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getRecentlyAddedLibrary({ - contentDirectoryID: 2, - pinnedContentDirectoryID: [ - 3, - 5, - 7, - 13, - 12, - 1, - 6, - 14, - 2, - 10, - 16, - 17, - ], - sectionID: 2, - type: QueryParamType.TvShow, - }); - - // Handle the result - console.log(result); - } - - run(); - /library/sections: - get: - tags: - - Library - summary: Get All Libraries - operationId: get-all-libraries - description: "A library section (commonly referred to as just a library) is a collection of media. \nLibraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. \nFor example, a music library has an artist > albums > tracks structure, whereas a movie library is flat.\n\nLibraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. \nThis allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year).\n" - responses: - '200': - description: The libraries available on the Server - content: - application/json: - schema: - type: object - required: - - MediaContainer - properties: - MediaContainer: - type: object - required: - - size - - allowSync - - title1 - - Directory - properties: - size: - type: integer - format: int32 - example: 5 - allowSync: - type: boolean - example: false - title1: - type: string - example: Plex Library - Directory: - type: array - items: - type: object - required: - - allowSync - - art - - composite - - filters - - refreshing - - thumb - - key - - type - - title - - agent - - scanner - - language - - uuid - - updatedAt - - createdAt - - scannedAt - - content - - directory - - contentChangedAt - - hidden - - Location - properties: - allowSync: - type: boolean - example: true - art: - type: string - example: '/:/resources/movie-fanart.jpg' - composite: - type: string - example: /library/sections/1/composite/1705615584 - filters: - type: boolean - example: true - refreshing: - type: boolean - example: false - thumb: - type: string - example: '/:/resources/movie.png' - key: - type: string - example: '1' - type: - type: string - example: movie - title: - type: string - example: Movies - agent: - type: string - example: tv.plex.agents.movie - scanner: - type: string - example: Plex Movie - language: - type: string - example: en-US - uuid: - type: string - example: 322a231a-b7f7-49f5-920f-14c61199cd30 - updatedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - createdAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - scannedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - content: - type: boolean - example: true - directory: - type: boolean - example: true - contentChangedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - hidden: - type: integer - format: int32 - example: 0 - Location: - type: array - items: - type: object - required: - - id - - path - properties: - id: - type: integer - format: int32 - example: 1 - path: - type: string - example: /movies - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: libraries - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getAllLibraries( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: libraries - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_all_libraries()\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: libraries - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetAllLibraries(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: libraries - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetAllLibrariesBadRequest; - import dev.plexapi.plexapi.models.errors.GetAllLibrariesUnauthorized; - import dev.plexapi.plexapi.models.operations.GetAllLibrariesResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetLibraryItemsRequest; + import dev.plexapi.sdk.models.operations.GetLibraryItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetAllLibrariesBadRequest, GetAllLibrariesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetAllLibrariesResponse res = sdk.library().getAllLibraries() - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: libraries - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getAllLibraries(); - - // Handle the result - console.log(result); - } - - run(); - '/library/sections/{sectionKey}': - get: - tags: - - Library - summary: Get Library Details - description: "## Library Details Endpoint\n\nThis endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself. \n\nThe details include:\n\n### Directories\nOrganized into three categories:\n\n- **Primary Directories**: \n - Used in some clients for quick access to media subsets (e.g., \"All\", \"On Deck\").\n - Most can be replicated via media queries.\n - Customizable by users.\n\n- **Secondary Directories**:\n - Marked with `secondary=\"1\"`.\n - Used in older clients for structured navigation.\n\n- **Special Directories**:\n - Includes a \"By Folder\" entry for filesystem-based browsing.\n - Contains an obsolete `search=\"1\"` entry for on-the-fly search dialog creation.\n\n### Types\nEach type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:\n\n- **Type Object Attributes**:\n - `key`: Endpoint for the media list of this type.\n - `type`: Metadata type (if standard Plex type).\n - `title`: Title for this content type (e.g., \"Movies\").\n\n- **Filter Objects**:\n - Subset of the media query language.\n - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.\n\n- **Sort Objects**:\n - Description of sort fields.\n - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.\n\n> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.\n" - operationId: get-library-details - parameters: - - name: includeDetails - description: "Whether or not to include details for a section (types, filters, and sorts). \nOnly exists for backwards compatibility, media providers other than the server libraries have it on always.\n" - in: query - schema: - type: integer - enum: - - 0 - - 1 - default: 0 - required: false - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - responses: - '200': - description: The details of the library - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 29 - allowSync: - type: boolean - example: false - art: - type: string - example: '/:/resources/movie-fanart.jpg' - content: - type: string - example: secondary - identifier: - type: string - example: com.plexapp.plugins.library - librarySectionID: - type: integer - format: int32 - example: 1 - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: integer - format: int32 - example: 1701731894 - thumb: - type: string - example: '/:/resources/movie.png' - title1: - type: string - example: Movies - viewGroup: - type: string - example: secondary - viewMode: - type: integer - format: int32 - example: 65592 - Directory: - type: array - items: - type: object - properties: - key: - type: string - example: search?type=1 - title: - type: string - example: Search... - secondary: - type: boolean - example: true - prompt: - type: string - example: Search Movies - search: - type: boolean - example: true - Type: - type: array - items: - type: object - properties: - key: - type: string - example: /library/sections/1/all?type=1 - type: - type: string - example: movie - title: - type: string - example: Movies - active: - type: boolean - example: false - Filter: - type: array - items: - type: object - properties: - filter: - type: string - example: label - filterType: - type: string - example: string - key: - type: string - example: /library/sections/1/label - title: - type: string - example: Labels - type: - type: string - example: filter - Sort: - type: array - items: - type: object - properties: - default: - type: string - example: asc - defaultDirection: - type: string - example: desc - descKey: - type: string - example: 'random:desc' - firstCharacterKey: - type: string - example: /library/sections/1/firstCharacter - key: - type: string - example: random - title: - type: string - example: Randomly - Field: - type: array - items: - type: object - properties: - key: - type: string - example: label - title: - type: string - example: Label - type: - type: string - example: tag - subType: - type: string - example: bitrate - FieldType: - type: array - items: - type: object - properties: - type: - type: string - example: resolution - Operator: - type: array - items: - type: object - properties: - key: - type: string - example: '=' - title: - type: string - example: is - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: details - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getLibraryDetails( - sectionKey: 9518, - includeDetails: Operations\IncludeDetails::Zero - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: details - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_library_details(section_key=9518, include_details=::PlexRubySDK::Operations::IncludeDetails::ZERO)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: details - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetLibraryDetails(ctx, 9518, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: details - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetLibraryDetailsBadRequest; - import dev.plexapi.plexapi.models.errors.GetLibraryDetailsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetLibraryDetailsResponse; - import dev.plexapi.plexapi.models.operations.IncludeDetails; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetLibraryDetailsBadRequest, GetLibraryDetailsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetLibraryDetailsResponse res = sdk.library().getLibraryDetails() - .includeDetails(IncludeDetails.ZERO) - .sectionKey(9518) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: details - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getLibraryDetails(9518); - - // Handle the result - console.log(result); - } - - run(); - delete: - tags: - - Library - summary: Delete Library Section - description: Delete a library using a specific section id - operationId: deleteLibrary - parameters: - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - responses: - '200': - description: The library is deleted - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: deleteLibrary - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->deleteLibrary( - sectionKey: 9518 - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: deleteLibrary - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.delete_library(section_key=9518)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: deleteLibrary - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.DeleteLibrary(ctx, 9518)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: deleteLibrary - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.DeleteLibraryBadRequest; - import dev.plexapi.plexapi.models.errors.DeleteLibraryUnauthorized; - import dev.plexapi.plexapi.models.operations.DeleteLibraryResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws DeleteLibraryBadRequest, DeleteLibraryUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - DeleteLibraryResponse res = sdk.library().deleteLibrary() - .sectionKey(9518) - .call(); - - // handle response - } - } - - lang: typescript - label: deleteLibrary - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.deleteLibrary(9518); - - // Handle the result - console.log(result); - } - - run(); - '/library/sections/watchlist/{filter}': - servers: - - url: 'https://metadata.provider.plex.tv' - description: The plex metadata provider server - get: - tags: - - Watchlist - summary: Get User Watchlist - description: Get User Watchlist - operationId: get-watch-list - parameters: - - name: filter - description: Filter - in: path - required: true - schema: - type: string - enum: - - all - - available - - released - - name: sort - description: | - In the format "field:dir". Available fields are "watchlistedAt" (Added At), - "titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating). - "dir" can be "asc" or "desc" - in: query - required: false - schema: - type: string - - name: libtype - description: | - The type of library to filter. Can be "movie" or "show", or all if not present. - in: query - required: false - schema: - type: string - enum: - - movie - - show - - name: maxresults - description: | - The number of items to return. If not specified, all items will be returned. - If the number of items exceeds the limit, the response will be paginated. - in: query - required: false - schema: - type: integer - format: int32 - - name: includeCollections - description: | - include collections in the results - in: query - required: false - schema: - type: integer - enum: - - 1 - - 0 - - name: includeExternalMedia - description: | - include external media in the results - in: query - required: false - schema: - type: integer - enum: - - 1 - - 0 - - name: Accept - in: header - required: false - schema: - type: string - enum: - - application/json - - application/xml - example: application/json - - name: X-Plex-Container-Start - in: query - description: | - The index of the first item to return. If not specified, the first item will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 0 - schema: - type: integer - format: int32 - default: 0 - example: 0 - required: false - - name: X-Plex-Container-Size - in: query - description: | - The number of items to return. If not specified, all items will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 50 - schema: - type: integer - format: int32 - default: 50 - example: 50 - required: false - - name: X-Plex-Token - in: header - description: 'An authentication token, obtained from plex.tv' - required: true - schema: - type: string - example: CV5xoxjTpFKUzBTShsaf - responses: - '200': - description: Watchlist Data - content: - application/json: - schema: - type: object - properties: - librarySectionID: - type: string - librarySectionTitle: - type: string - offset: - type: integer - format: int32 - totalSize: - type: integer - format: int32 - identifier: - type: string - size: - type: integer - format: int32 - Metadata: - type: array - items: - type: object - properties: - art: - type: string - guid: - type: string - key: - type: string - ratingKey: - type: string - studio: - type: string - tagline: - type: string - type: - type: string - thumb: - type: string - addedAt: - type: integer - format: int32 - duration: - type: integer - format: int32 - publicPagesURL: - type: string - slug: - type: string - userState: - type: boolean - title: - type: string - contentRating: - type: string - originallyAvailableAt: - type: string - format: date - year: - type: integer - format: int32 - Image: - type: array - items: - type: object - properties: - alt: - type: string - type: - type: string - url: - type: string - banner: - type: string - rating: - type: number - expiresAt: - type: integer - format: int32 - originalTitle: - type: string - audienceRating: - type: number - audienceRatingImage: - type: string - ratingImage: - type: string - imdbRatingCount: - type: integer - format: int32 - subtype: - type: string - theme: - type: string - leafCount: - type: integer - format: int32 - childCount: - type: integer - format: int32 - isContinuingSeries: - type: boolean - skipChildren: - type: boolean - availabilityId: - type: string - streamingMediaId: - type: string - playableKey: - type: string - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: list - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetWatchListRequest( - filter: Operations\Filter::Available, - xPlexToken: 'CV5xoxjTpFKUzBTShsaf', - ); - - $response = $sdk->watchlist->getWatchList( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: list - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetWatchListRequest.new(\n filter: ::PlexRubySDK::Operations::Filter::AVAILABLE,\n x_plex_container_start: 0,\n x_plex_container_size: 50,\n x_plex_token: \"CV5xoxjTpFKUzBTShsaf\",\n)\n \nres = s.watchlist.get_watch_list(req)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: list - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Watchlist.GetWatchList(ctx, operations.GetWatchListRequest{\n Filter: operations.FilterAvailable,\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: list - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetWatchListBadRequest; - import dev.plexapi.plexapi.models.errors.GetWatchListUnauthorized; - import dev.plexapi.plexapi.models.operations.Filter; - import dev.plexapi.plexapi.models.operations.GetWatchListRequest; - import dev.plexapi.plexapi.models.operations.GetWatchListResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetWatchListBadRequest, GetWatchListUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetWatchListRequest req = GetWatchListRequest.builder() - .filter(Filter.AVAILABLE) - .xPlexToken("CV5xoxjTpFKUzBTShsaf") - .build(); - - GetWatchListResponse res = sdk.watchlist().getWatchList() - .request(req) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: list - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { Filter } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.watchlist.getWatchList({ - filter: Filter.Available, - xPlexToken: "CV5xoxjTpFKUzBTShsaf", - }); - - // Handle the result - console.log(result); - } - - run(); - '/library/sections/{sectionKey}/{tag}': - get: - tags: - - Library - summary: Get Library Items - operationId: get-library-items - description: | - Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values: - - `all`: All items in the section. - - `unwatched`: Items that have not been played. - - `newest`: Items that are recently released. - - `recentlyAdded`: Items that are recently added to the library. - - `recentlyViewed`: Items that were recently viewed. - - `onDeck`: Items to continue watching. - - `collection`: Items categorized by collection. - - `edition`: Items categorized by edition. - - `genre`: Items categorized by genre. - - `year`: Items categorized by year of release. - - `decade`: Items categorized by decade. - - `director`: Items categorized by director. - - `actor`: Items categorized by starring actor. - - `country`: Items categorized by country of origin. - - `contentRating`: Items categorized by content rating. - - `rating`: Items categorized by rating. - - `resolution`: Items categorized by resolution. - - `firstCharacter`: Items categorized by the first letter. - - `folder`: Items categorized by folder. - - `albums`: Items categorized by album. - parameters: - - name: tag - in: path - required: true - description: A key representing a specific tag within the section. - schema: - type: string - enum: - - unwatched - - newest - - recentlyAdded - - recentlyViewed - - onDeck - - collection - - edition - - year - - decade - - director - - contentRating - - rating - - resolution - - firstCharacter - - folder - - albums - - name: includeGuids - in: query - description: | - Adds the Guids object to the response - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: type - in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - - name: includeMeta - in: query - description: | - Adds the Meta object to the response - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: X-Plex-Container-Start - in: query - description: | - The index of the first item to return. If not specified, the first item will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 0 - schema: - type: integer - format: int32 - default: 0 - example: 0 - required: false - - name: X-Plex-Container-Size - in: query - description: | - The number of items to return. If not specified, all items will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 50 - schema: - type: integer - format: int32 - default: 50 - example: 50 - required: false - - name: Accept - in: header - required: false - schema: - type: string - enum: - - application/json - - application/xml - example: application/json - responses: - '200': - description: The contents of the library by section and tag - content: - application/json: - schema: - type: object - properties: - MediaContainer: - allOf: - - type: object - description: | - The Meta object is only included in the response if the `includeMeta` parameter is set to `1`. - properties: - Type: - type: array - items: - type: object - required: - - key - - type - - title - - active - properties: - key: - type: string - example: /library/sections/2/all?type=2 - type: - type: string - example: filter - subtype: - type: string - example: clip - title: - type: string - example: TV Shows - active: - type: boolean - example: false - Filter: - type: array - items: - type: object - required: - - filter - - filterType - - key - - title - - type - properties: - filter: - type: string - example: genre - filterType: - type: string - example: string - key: - type: string - example: /library/sections/2/genre?type=2 - title: - type: string - example: Genre - type: - type: string - example: filter - advanced: - type: boolean - example: true - Sort: - type: array - items: - type: object - required: - - key - - title - - defaultDirection - properties: - default: - type: string - example: asc - active: - type: boolean - example: false - activeDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - defaultDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - descKey: - type: string - example: 'titleSort:desc' - firstCharacterKey: - type: string - example: /library/sections/2/firstCharacter - key: - type: string - example: titleSort - title: - type: string - example: Title - Field: - type: array - items: - type: object - required: - - key - - title - - type - properties: - key: - type: string - example: show.title - title: - type: string - example: Show Title - type: - type: string - example: string - subType: - type: string - example: rating - FieldType: - type: array - items: - type: object - required: - - type - - Operator - properties: - type: - type: string - example: tag - Operator: - type: array - items: - type: object - required: - - key - - title - properties: - key: - type: string - example: '=' - title: - type: string - example: is - - type: object - required: - - size - - totalSize - - offset - - content - - allowSync - - art - - content - - identifier - - librarySectionID - - librarySectionTitle - - librarySectionUUID - - mediaTagPrefix - - mediaTagVersion - - thumb - - title1 - - title2 - - viewGroup - properties: - size: - type: integer - format: int32 - example: 70 - totalSize: - type: integer - format: int32 - example: 170 - offset: - type: integer - format: int32 - example: 0 - content: - type: string - example: secondary - allowSync: - type: boolean - example: true - nocache: - type: boolean - example: true - art: - type: string - example: '/:/resources/movie-fanart.jpg' - identifier: - type: string - example: com.plexapp.plugins.library - librarySectionID: - type: integer - examples: - - 1 - librarySectionTitle: - type: string - example: Movies - librarySectionUUID: - type: string - example: 322a231a-b7f7-49f5-920f-14c61199cd30 - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: integer - format: int32 - example: 1701731894 - thumb: - type: string - example: '/:/resources/movie.png' - title1: - type: string - example: Movies - title2: - type: string - example: Recently Released - viewGroup: - type: string - example: movie - viewMode: - type: integer - format: int32 - example: 65592 - mixedParents: - type: boolean - example: true - Metadata: - type: array - items: - type: object - required: - - ratingKey - - key - - guid - - title - - type - - addedAt - - summary - properties: - ratingKey: - type: string - example: '58683' - description: | - The rating key (Media ID) of this media item. - Note: This is always an integer, but is represented as a string in the API. - key: - type: string - example: /library/metadata/58683 - guid: - type: string - example: 'plex://movie/5d7768ba96b655001fdc0408' - studio: - type: string - example: 20th Century Studios - skipChildren: - type: boolean - example: false - librarySectionID: - type: integer - examples: - - 1 - librarySectionTitle: - type: string - example: Movies - librarySectionKey: - type: string - example: /library/sections/1 - type: - type: string - enum: - - movie - - show - - season - - episode - - artist - - album - example: movie - description: | - The type of media content - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - ARTIST - - ALBUM - title: - type: string - example: 'Avatar: The Way of Water' - slug: - type: string - example: 4-for-texas - contentRating: - type: string - example: PG-13 - summary: - type: string - example: 'Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na''vi race to protect their home.' - rating: - type: number - example: 7.6 - audienceRating: - type: number - example: 9.2 - year: - type: integer - format: int32 - example: 2022 - seasonCount: - type: integer - format: int32 - example: 2022 - tagline: - type: string - example: Return to Pandora. - flattenSeasons: - type: string - description: 'Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).' - enum: - - '-1' - - '0' - - '1' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - HIDE - - SHOW - example: '1' - episodeSort: - type: string - description: 'Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).' - enum: - - '-1' - - '0' - - '1' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - OLDEST_FIRST - - NEWEST_FIRST - example: '0' - enableCreditsMarkerGeneration: - type: string - description: 'Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).' - enum: - - '-1' - - '0' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - DISABLED - example: '-1' - showOrdering: - type: string - description: | - Setting that indicates the episode ordering for the show. - None = Library default, - tmdbAiring = The Movie Database (Aired), - aired = TheTVDB (Aired), - dvd = TheTVDB (DVD), - absolute = TheTVDB (Absolute)). - enum: - - None - - tmdbAiring - - aired - - dvd - - absolute - x-speakeasy-enums: - - NONE - - TMDB_AIRING - - TVDB_AIRED - - TVDB_DVD - - TVDB_ABSOLUTE - example: absolute - thumb: - type: string - example: /library/metadata/58683/thumb/1703239236 - art: - type: string - example: /library/metadata/58683/art/1703239236 - banner: - type: string - example: /library/metadata/58683/banner/1703239236 - duration: - type: integer - format: int32 - example: 11558112 - originallyAvailableAt: - type: string - format: date - example: 2022-12-14T00:00:00.000Z - addedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - updatedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - chapterSource: - type: string - example: media - primaryExtraKey: - type: string - example: /library/metadata/58684 - ratingImage: - type: string - example: 'rottentomatoes://image.rating.ripe' - grandparentRatingKey: - type: string - example: '66' - grandparentGuid: - type: string - example: 'plex://show/5d9c081b170e24001f2a7be4' - grandparentKey: - type: string - example: /library/metadata/66 - grandparentTitle: - type: string - example: Caprica - grandparentThumb: - type: string - example: /library/metadata/66/thumb/1705716261 - parentSlug: - type: string - example: alice-in-borderland-2020 - grandparentSlug: - type: string - example: alice-in-borderland-2020 - grandparentArt: - type: string - example: /library/metadata/66/art/1705716261 - grandparentTheme: - type: string - example: /library/metadata/66/theme/1705716261 - Media: - description: | - The Media object is only included when type query is `4` or higher. - type: array - items: - type: object - required: - - id - - container - - Part - properties: - id: - type: integer - format: int32 - example: 119534 - duration: - type: integer - format: int32 - example: 11558112 - bitrate: - type: integer - format: int32 - example: 25025 - width: - type: integer - format: int32 - example: 3840 - height: - type: integer - format: int32 - example: 2072 - aspectRatio: - type: number - example: 1.85 - audioProfile: - type: string - example: dts - audioChannels: - type: integer - format: int32 - example: 6 - audioCodec: - type: string - example: eac3 - videoCodec: - type: string - example: hevc - videoResolution: - type: string - example: 4k - container: - type: string - example: mkv - videoFrameRate: - type: string - example: 24p - videoProfile: - type: string - example: main 10 - hasVoiceActivity: - type: boolean - example: false - optimizedForStreaming: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - has64bitOffsets: - type: boolean - example: false - Part: - type: array - items: - type: object - required: - - id - - key - - file - - size - - container - properties: - id: - type: integer - format: int32 - example: 119542 - key: - type: string - example: /library/parts/119542/1680457526/file.mkv - duration: - type: integer - format: int32 - example: 11558112 - file: - type: string - example: /movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv - size: - type: integer - format: int64 - example: 36158371307 - container: - type: string - description: | - The container format of the media file. - example: mkv - audioProfile: - type: string - example: dts - has64bitOffsets: - type: boolean - example: false - optimizedForStreaming: - type: boolean - example: false - videoProfile: - type: string - example: main 10 - indexes: - type: string - example: sd - hasThumbnail: - type: string - enum: - - '0' - - '1' - example: '1' - default: '0' - x-speakeasy-enums: - - false - - true - Stream: - type: array - items: - type: object - required: - - id - - streamType - - codec - - index - properties: - id: - type: integer - example: 272796 - streamType: - type: integer - description: 'Type of stream (1 = video, 2 = audio, 3 = subtitle)' - example: 1 - default: - type: boolean - description: Indicates if this is the default stream - example: true - selected: - type: boolean - description: Indicates if the stream is selected - example: true - codec: - type: string - description: Codec used by the stream - example: h264 - index: - type: integer - description: The index of the stream - example: 0 - bitrate: - type: integer - description: The bitrate of the stream in kbps - example: 6273 - colorPrimaries: - type: string - description: The color primaries of the video stream - example: bt709 - colorRange: - type: string - description: The color range of the video stream - example: tv - colorSpace: - type: string - description: The color space of the video stream - example: bt709 - colorTrc: - type: string - description: The transfer characteristics (TRC) of the video stream - example: bt709 - bitDepth: - type: integer - description: The bit depth of the video stream - example: 8 - chromaLocation: - type: string - description: The chroma location of the video stream - example: left - streamIdentifier: - type: string - description: The identifier of the video stream - example: '2' - chromaSubsampling: - type: string - description: The chroma subsampling format - example: '4:2:0' - codedHeight: - type: integer - description: The coded height of the video stream - example: 1088 - codedWidth: - type: integer - description: The coded width of the video stream - example: 1920 - frameRate: - type: number - description: The frame rate of the video stream - example: 29.97 - hasScalingMatrix: - type: boolean - description: Indicates if the stream has a scaling matrix - example: false - hearingImpaired: - type: boolean - example: false - closedCaptions: - type: boolean - example: false - embeddedInVideo: - type: string - example: '1' - height: - type: integer - description: The height of the video stream - example: 1080 - level: - type: integer - description: The level of the video codec - example: 40 - profile: - type: string - description: The profile of the video codec - example: main - refFrames: - type: integer - description: Number of reference frames - example: 4 - scanType: - type: string - description: The scan type (progressive or interlaced) - example: progressive - width: - type: integer - description: The width of the video stream - example: 1920 - displayTitle: - type: string - description: Display title of the stream - example: 1080p (H.264) - extendedDisplayTitle: - type: string - description: Extended display title of the stream - example: 1080p (H.264) - channels: - type: integer - description: Number of audio channels (for audio streams) - example: 2 - language: - type: string - description: The language of the stream (for audio/subtitle streams) - example: English - languageTag: - type: string - description: Language tag of the stream - example: en - languageCode: - type: string - description: Language code of the stream - example: eng - audioChannelLayout: - type: string - description: The audio channel layout - example: stereo - samplingRate: - type: integer - description: Sampling rate of the audio stream in Hz - example: 48000 - title: - type: string - description: Title of the subtitle track (for subtitle streams) - example: English - canAutoSync: - type: boolean - description: Indicates if the subtitle stream can auto-sync - example: false - Genre: - type: array - items: - type: object - properties: - tag: - type: string - example: Adventure - Country: - type: array - items: - type: object - properties: - tag: - type: string - example: United States of America - Director: - type: array - items: - type: object - properties: - tag: - type: string - example: James Cameron - Writer: - type: array - items: - type: object - properties: - tag: - type: string - example: James Cameron - Collection: - type: array - items: - type: object - properties: - tag: - type: string - example: Working NL Subs - Role: - type: array - items: - type: object - properties: - id: - type: integer - description: The ID of the tag or actor. - example: 294129 - filter: - type: string - description: The filter used to find the actor or tag. - example: actor=294129 - thumb: - type: string - description: The thumbnail of the actor - example: 'https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg' - tag: - type: string - description: The name of the tag or actor. - example: Mike Smith - tagKey: - type: string - description: Unique identifier for the tag. - example: 668e7e7b22bcad9064350c91 - role: - type: string - description: The role of the actor or tag in the media. - example: Self - Location: - type: array - items: - type: object - properties: - path: - type: string - example: /TV Shows/House - Guid: - x-speakeasy-name-override: MediaGuid - description: | - The Guid object is only included in the response if the `includeGuids` parameter is set to `1`. - type: array - items: - type: object - required: - - id - properties: - id: - type: string - description: | - Can be one of the following formats: - imdb://tt13015952, tmdb://2434012, tvdb://7945991 - example: 'imdb://tt13015952' - UltraBlurColors: - type: object - required: - - topLeft - - topRight - - bottomRight - - bottomLeft - properties: - topLeft: - type: string - example: 11333b - topRight: - type: string - example: 0a232d - bottomRight: - type: string - example: 073958 - bottomLeft: - type: string - example: 1f5066 - Rating: - x-speakeasy-name-override: MetaDataRating - type: array - items: - type: object - required: - - image - - value - - type - properties: - image: - type: string - description: A URI or path to the rating image. - example: 'themoviedb://image.rating' - value: - type: number - format: float - description: The value of the rating. - example: 3 - type: - type: string - description: 'The type of rating (e.g., audience, critic).' - example: audience - Image: - type: array - items: - type: object - required: - - alt - - type - - url - properties: - alt: - type: string - example: Episode 1 - type: - type: string - enum: - - coverPoster - - background - - snapshot - - clearLogo - example: background - url: - type: string - example: /library/metadata/45521/thumb/1644710589 - titleSort: - type: string - example: Whale - viewCount: - type: integer - format: int32 - example: 1 - lastViewedAt: - type: integer - format: int32 - example: 1682752242 - originalTitle: - type: string - example: 映画 ブラッククローバー 魔法帝の剣 - viewOffset: - type: integer - format: int32 - example: 5222500 - skipCount: - type: integer - format: int32 - example: 1 - index: - type: integer - format: int32 - example: 1 - theme: - type: string - example: /library/metadata/1/theme/1705636920 - leafCount: - type: integer - format: int32 - example: 14 - viewedLeafCount: - type: integer - format: int32 - example: 0 - childCount: - type: integer - format: int32 - example: 1 - hasPremiumExtras: - type: string - example: '1' - hasPremiumPrimaryExtra: - type: string - example: '1' - parentRatingKey: - type: string - description: | - The rating key of the parent item. - example: '66' - parentGuid: - type: string - example: 'plex://show/5d9c081b170e24001f2a7be4' - parentStudio: - type: string - example: UCP - parentKey: - type: string - example: /library/metadata/66 - parentTitle: - type: string - example: Caprica - parentIndex: - type: integer - format: int32 - example: 1 - parentYear: - type: integer - format: int32 - example: 2010 - parentThumb: - type: string - example: /library/metadata/66/thumb/1705716261 - parentTheme: - type: string - example: /library/metadata/66/theme/1705716261 - Meta: - description: | - The Meta object is only included in the response if the `includeMeta` parameter is set to `1`. - type: object - properties: - Type: - type: array - items: - type: object - required: - - key - - type - - title - - active - properties: - key: - type: string - example: /library/sections/2/all?type=2 - type: - type: string - example: show - title: - type: string - example: TV Shows - active: - type: boolean - example: false - Filter: - type: array - items: - type: object - required: - - filter - - filterType - - key - - title - - type - properties: - filter: - type: string - example: genre - filterType: - type: string - example: string - key: - type: string - example: /library/sections/2/genre?type=2 - title: - type: string - example: Genre - type: - type: string - example: filter - Sort: - type: array - items: - type: object - required: - - key - - title - - defaultDirection - properties: - default: - type: string - example: asc - active: - type: boolean - example: false - activeDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - defaultDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - descKey: - type: string - example: 'titleSort:desc' - firstCharacterKey: - type: string - example: /library/sections/2/firstCharacter - key: - type: string - example: titleSort - title: - type: string - example: Title - Field: - type: array - items: - type: object - required: - - key - - title - - type - properties: - key: - type: string - example: show.title - title: - type: string - example: Show Title - type: - type: string - example: string - subType: - type: string - example: rating - FieldType: - type: array - items: - type: object - required: - - type - - Operator - properties: - type: - type: string - example: tag - Operator: - type: array - items: - type: object - required: - - key - - title - properties: - key: - type: string - example: '=' - title: - type: string - example: is - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: items - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetLibraryItemsRequest( - tag: Operations\Tag::Edition, - type: Operations\GetLibraryItemsQueryParamType::TvShow, - sectionKey: 9518, - ); - - $response = $sdk->library->getLibraryItems( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: items - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetLibraryItemsRequest.new(\n tag: ::PlexRubySDK::Operations::Tag::EDITION,\n include_guids: ::PlexRubySDK::Operations::IncludeGuids::ENABLE,\n type: ::PlexRubySDK::Operations::GetLibraryItemsQueryParamType::TV_SHOW,\n section_key: 9518,\n include_meta: ::PlexRubySDK::Operations::GetLibraryItemsQueryParamIncludeMeta::ENABLE,\n x_plex_container_start: 0,\n x_plex_container_size: 50,\n)\n \nres = s.library.get_library_items(req)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: items - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{\n Tag: operations.TagEdition,\n Type: operations.GetLibraryItemsQueryParamTypeTvShow,\n SectionKey: 9518,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: items - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetLibraryItemsBadRequest; - import dev.plexapi.plexapi.models.errors.GetLibraryItemsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetLibraryItemsQueryParamType; - import dev.plexapi.plexapi.models.operations.GetLibraryItemsRequest; - import dev.plexapi.plexapi.models.operations.GetLibraryItemsResponse; - import dev.plexapi.plexapi.models.operations.Tag; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetLibraryItemsBadRequest, GetLibraryItemsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); GetLibraryItemsRequest req = GetLibraryItemsRequest.builder() - .tag(Tag.EDITION) - .type(GetLibraryItemsQueryParamType.TvShow) - .sectionKey(9518) .build(); GetLibraryItemsResponse res = sdk.library().getLibraryItems() .request(req) .call(); - if (res.object().isPresent()) { + if (res.mediaContainerWithMetadata().isPresent()) { // handle response } } } - lang: typescript - label: items + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { GetLibraryItemsQueryParamType, Tag } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.library.getLibraryItems({ - tag: Tag.Edition, - type: GetLibraryItemsQueryParamType.TvShow, - sectionKey: 9518, - }); + const result = await plexAPI.library.getLibraryItems({}); - // Handle the result console.log(result); } run(); - '/library/sections/{sectionKey}/all': - get: + /library/caches: + delete: + summary: Delete library caches + operationId: deleteCaches + description: Delete the hub caches so they are recomputed on next request tags: - Library - summary: Get all media of library - operationId: get-all-media-library - description: | - Retrieves a list of all general media data for this library. - parameters: - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - - name: type - in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - - name: includeMeta - in: query - description: | - Adds the Meta object to the response - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: includeGuids - in: query - description: | - Adds the Guid object to the response - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: includeAdvanced - in: query - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: includeCollections - in: query - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: includeExternalMedia - in: query - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: X-Plex-Container-Start - in: query - description: | - The index of the first item to return. If not specified, the first item will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 0 - schema: - type: integer - format: int32 - default: 0 - example: 0 - required: false - - name: X-Plex-Container-Size - in: query - description: | - The number of items to return. If not specified, all items will be returned. - If the number of items exceeds the limit, the response will be paginated. - By default this is 50 - schema: - type: integer - format: int32 - default: 50 - example: 50 - required: false - - name: Accept - in: header - required: false - schema: - type: string - enum: - - application/json - - application/xml - example: application/json + security: + - token: + - admin responses: '200': - description: Successful response containing media container data. - content: - application/json: - schema: - type: object - properties: - MediaContainer: - allOf: - - type: object - required: - - size - properties: - size: - description: Number of media items returned in this response. - type: integer - format: int32 - example: 50 - - type: object - required: - - totalSize - properties: - totalSize: - description: Total number of media items in the library. - type: integer - format: int32 - example: 50 - - type: object - required: - - offset - properties: - offset: - type: integer - description: Offset value for pagination. - example: 0 - - type: object - required: - - allowSync - properties: - allowSync: - type: boolean - description: Indicates whether syncing is allowed. - example: false - - type: object - required: - - art - properties: - art: - type: string - description: URL for the background artwork of the media container. - example: '/:/resources/show-fanart.jpg' - - type: object - required: - - content - properties: - content: - type: string - description: The content type or mode. - example: secondary - - type: object - required: - - identifier - properties: - identifier: - type: string - description: An plugin identifier for the media container. - example: com.plexapp.plugins.library - - type: object - required: - - librarySectionID - properties: - librarySectionID: - type: integer - description: The unique identifier for the library section. - example: 2 - - type: object - required: - - librarySectionTitle - properties: - librarySectionTitle: - type: string - description: The title of the library section. - example: TV Series - - type: object - required: - - librarySectionTitle - properties: - librarySectionUUID: - type: string - description: The universally unique identifier for the library section. - example: e69655a2-ef48-4aba-bb19-0cc34d1e7d36 - - type: object - required: - - mediaTagPrefix - properties: - mediaTagPrefix: - type: string - description: The prefix used for media tag resource paths. - example: /system/bundle/media/flags/ - - type: object - required: - - mediaTagVersion - properties: - mediaTagVersion: - type: integer - description: The version number for media tags. - example: 1734362201 - - type: object - required: - - thumb - properties: - thumb: - type: string - description: URL for the thumbnail image of the media container. - example: '/:/resources/show.png' - - type: object - required: - - nocache - properties: - nocache: - type: boolean - description: Specifies whether caching is disabled. - example: true - - type: object - required: - - title1 - properties: - title1: - type: string - description: The primary title of the media container. - example: TV Series - - type: object - required: - - title2 - properties: - title2: - type: string - description: The secondary title of the media container. - example: By Starring Actor - - type: object - required: - - viewGroup - properties: - viewGroup: - type: string - description: Identifier for the view group layout. - example: secondary - - type: object - properties: - Meta: - type: object - description: | - The Meta object is only included in the response if the `includeMeta` parameter is set to `1`. - properties: - Type: - type: array - items: - type: object - required: - - key - - type - - title - - active - properties: - key: - type: string - example: /library/sections/2/all?type=2 - type: - type: string - example: filter - subtype: - type: string - example: clip - title: - type: string - example: TV Shows - active: - type: boolean - example: false - Filter: - type: array - items: - type: object - required: - - filter - - filterType - - key - - title - - type - properties: - filter: - type: string - example: genre - filterType: - type: string - example: string - key: - type: string - example: /library/sections/2/genre?type=2 - title: - type: string - example: Genre - type: - type: string - example: filter - advanced: - type: boolean - example: true - Sort: - type: array - items: - type: object - required: - - key - - title - - defaultDirection - properties: - default: - type: string - example: asc - active: - type: boolean - example: false - activeDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - defaultDirection: - type: string - enum: - - asc - - desc - example: asc - default: asc - description: | - The direction of the sort. Can be either `asc` or `desc`. - x-speakeasy-enums: - - ASCENDING - - DESCENDING - descKey: - type: string - example: 'titleSort:desc' - firstCharacterKey: - type: string - example: /library/sections/2/firstCharacter - key: - type: string - example: titleSort - title: - type: string - example: Title - Field: - type: array - items: - type: object - required: - - key - - title - - type - properties: - key: - type: string - example: show.title - title: - type: string - example: Show Title - type: - type: string - example: string - subType: - type: string - example: rating - FieldType: - type: array - items: - type: object - required: - - type - - Operator - properties: - type: - type: string - example: tag - Operator: - type: array - items: - type: object - required: - - key - - title - properties: - key: - type: string - example: '=' - title: - type: string - example: is - Metadata: - type: array - description: An array of metadata items. - items: - required: - - type - allOf: - - type: object - required: - - ratingKey - properties: - ratingKey: - type: string - description: 'The rating key (Media ID) of this media item. Note: Although this is always an integer, it is represented as a string in the API.' - example: '58683' - - type: object - required: - - key - properties: - key: - type: string - description: The unique key for the media item. - example: /library/metadata/58683 - - type: object - required: - - guid - properties: - guid: - type: string - description: The globally unique identifier for the media item. - example: 'plex://movie/5d7768ba96b655001fdc0408' - - type: object - required: - - slug - properties: - slug: - type: string - description: A URL‐friendly version of the media title. - example: 4-for-texas - - type: object - properties: - studio: - type: string - description: The studio that produced the media item. - example: 20th Century Studios - - type: object - required: - - type - properties: - type: - allOf: - - type: string - enum: - - movie - - show - - season - - episode - - artist - - album - example: movie - description: | - The type of media content - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - ARTIST - - ALBUM - - type: object - required: - - title - properties: - title: - type: string - description: The title of the media item. - example: 'Avatar: The Way of Water' - - type: object - required: - - titleSort - properties: - titleSort: - type: string - description: The sort title used for ordering media items. - example: Whale - - type: object - properties: - contentRating: - type: string - description: The content rating for the media item. - example: PG-13 - - type: object - required: - - summary - properties: - summary: - type: string - description: A synopsis of the media item. - example: | - Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. - Once a familiar threat returns to finish what was previously started, Jake must - work with Neytiri and the army of the Na'vi race to protect their home. - - type: object - required: - - rating - properties: - rating: - type: number - format: float - description: The critic rating for the media item. - example: 7.6 - - type: object - required: - - audienceRating - properties: - audienceRating: - type: number - description: The audience rating for the media item. - example: 9.2 - - type: object - required: - - year - properties: - year: - type: integer - format: int32 - description: The release year of the media item. - example: 2022 - - type: object - required: - - tagline - properties: - tagline: - type: string - description: A brief tagline for the media item. - example: Return to Pandora. - - type: object - required: - - thumb - properties: - thumb: - type: string - description: The thumbnail image URL for the media item. - example: /library/metadata/58683/thumb/1703239236 - - type: object - required: - - art - properties: - art: - type: string - description: The art image URL for the media item. - example: /library/metadata/58683/art/1703239236 - - type: object - required: - - theme - properties: - theme: - type: string - description: The theme URL for the media item. - example: /library/metadata/1/theme/1705636920 - - type: object - required: - - index - properties: - index: - type: integer - format: int32 - description: The index position of the media item. - example: 1 - - type: object - properties: - leafCount: - type: integer - format: int32 - description: The number of leaf items (end nodes) under this media item. - example: 14 - - type: object - properties: - viewedLeafCount: - type: integer - format: int32 - description: The number of leaf items that have been viewed. - example: 0 - - type: object - required: - - childCount - properties: - childCount: - type: integer - format: int32 - description: The number of child items associated with this media item. - example: 1 - - type: object - required: - - seasonCount - properties: - seasonCount: - type: integer - format: int32 - description: The total number of seasons (for TV shows). - example: 2022 - - type: object - required: - - duration - properties: - duration: - type: integer - format: int32 - description: The duration of the media item in milliseconds. - example: 11558112 - - type: object - required: - - originallyAvailableAt - properties: - originallyAvailableAt: - type: string - format: date - description: The original release date of the media item. - example: '2022-12-14' - - type: object - required: - - addedAt - properties: - addedAt: - allOf: - - description: Unix timestamp when the item was added. - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: object - properties: - updatedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: object - properties: - audienceRatingImage: - type: string - description: The URL for the audience rating image. - example: 'rottentomatoes://image.rating.upright' - - type: object - properties: - chapterSource: - type: string - description: The source from which chapter data is derived. - example: media - - type: object - properties: - primaryExtraKey: - type: string - description: The primary extra key associated with this media item. - example: /library/metadata/58684 - - type: object - properties: - originalTitle: - type: string - description: The original title of the media item (if different). - example: 映画 ブラッククローバー 魔法帝の剣 - - type: object - properties: - parentRatingKey: - type: string - description: The rating key of the parent media item. - example: '66' - - type: object - properties: - grandparentRatingKey: - type: string - description: The rating key of the grandparent media item. - example: '66' - - type: object - properties: - parentGuid: - type: string - description: The GUID of the parent media item. - example: 'plex://show/5d9c081b170e24001f2a7be4' - - type: object - properties: - grandparentGuid: - type: string - description: The GUID of the grandparent media item. - example: 'plex://show/5d9c081b170e24001f2a7be4' - - type: object - properties: - grandparentSlug: - type: string - description: The slug for the grandparent media item. - example: alice-in-borderland-2020 - - type: object - properties: - grandparentKey: - type: string - description: The key of the grandparent media item. - example: /library/metadata/66 - - type: object - properties: - parentKey: - type: string - description: The key of the parent media item. - example: /library/metadata/66 - - type: object - properties: - grandparentTitle: - type: string - description: The title of the grandparent media item. - example: Caprica - - type: object - properties: - grandparentThumb: - type: string - description: The thumbnail URL for the grandparent media item. - example: /library/metadata/66/thumb/1705716261 - - type: object - properties: - grandparentTheme: - type: string - description: The theme URL for the grandparent media item. - example: /library/metadata/66/theme/1705716261 - - type: object - properties: - grandparentArt: - type: string - description: The art URL for the grandparent media item. - example: /library/metadata/66/art/1705716261 - - type: object - properties: - parentTitle: - type: string - description: The title of the parent media item. - example: Caprica - - type: object - properties: - parentIndex: - type: integer - format: int32 - description: The index position of the parent media item. - example: 1 - - type: object - properties: - parentThumb: - type: string - description: The thumbnail URL for the parent media item. - example: /library/metadata/66/thumb/1705716261 - - type: object - properties: - ratingImage: - type: string - description: The URL for the rating image. - example: 'rottentomatoes://image.rating.ripe' - - type: object - properties: - viewCount: - type: integer - format: int32 - description: The number of times this media item has been viewed. - example: 1 - - type: object - properties: - viewOffset: - type: integer - format: int32 - description: The current playback offset (in milliseconds). - example: 5222500 - - type: object - properties: - skipCount: - type: integer - format: int32 - description: The number of times this media item has been skipped. - example: 1 - - type: object - properties: - subtype: - type: string - description: 'A classification that further describes the type of media item. For example, ''clip'' indicates that the item is a short video clip.' - example: clip - - type: object - properties: - lastRatedAt: - type: integer - format: int64 - description: The Unix timestamp representing the last time the item was rated. - example: 1721813113 - - type: object - properties: - createdAtAccuracy: - type: string - description: 'The accuracy of the creation timestamp. This value indicates the format(s) provided (for example, ''epoch,local'' means both epoch and local time formats are available).' - example: 'epoch,local' - - type: object - properties: - createdAtTZOffset: - type: string - description: 'The time zone offset for the creation timestamp, represented as a string. This offset indicates the difference from UTC.' - example: '0' - - type: object - properties: - lastViewedAt: - type: integer - format: int32 - description: Unix timestamp for when the media item was last viewed. - example: 1682752242 - - type: object - properties: - userRating: - type: number - format: float - description: The rating provided by a user for the item. This value is expressed as a decimal number. - example: 10 - - type: object - description: | - The available images for this media item - properties: - Image: - type: array - items: - type: object - required: - - alt - - type - - url - properties: - alt: - type: string - example: Episode 1 - type: - type: string - enum: - - coverPoster - - background - - snapshot - - clearLogo - example: background - url: - type: string - example: /library/metadata/45521/thumb/1644710589 - - type: object - description: | - Unknown - properties: - UltraBlurColors: - type: object - required: - - topLeft - - topRight - - bottomRight - - bottomLeft - properties: - topLeft: - type: string - example: 11333b - topRight: - type: string - example: 0a232d - bottomRight: - type: string - example: 073958 - bottomLeft: - type: string - example: 1f5066 - - type: object - properties: - Media: - allOf: - - type: array - description: An array of media file data items. - items: - type: object - required: - - id - - hasVoiceActivity - - Part - properties: - id: - type: integer - description: Unique media identifier. - example: 387322 - duration: - type: integer - format: int32 - description: Duration of the media in milliseconds. - example: 9610350 - bitrate: - type: integer - format: int32 - description: Bitrate in bits per second. - example: 25512 - width: - type: integer - description: Video width in pixels. - example: 3840 - format: int32 - height: - type: integer - description: Video height in pixels. - example: 1602 - format: int32 - aspectRatio: - type: number - format: float - description: Aspect ratio of the video. - example: 2.35 - audioChannels: - type: integer - description: Number of audio channels. - example: 6 - format: int32 - displayOffset: - type: integer - format: int32 - example: 50 - audioCodec: - type: string - description: Audio codec used. - example: eac3 - videoCodec: - type: string - description: Video codec used. - example: hevc - videoResolution: - type: string - description: 'Video resolution (e.g., 4k).' - example: 4k - container: - type: string - description: File container type. - example: mkv - videoFrameRate: - type: string - description: | - Frame rate of the video. Values found include NTSC, PAL, 24p - example: 24p - videoProfile: - type: string - description: 'Video profile (e.g., main 10).' - example: main 10 - hasVoiceActivity: - type: boolean - description: Indicates whether voice activity is detected. - example: false - audioProfile: - type: string - description: 'The audio profile used for the media (e.g., DTS, Dolby Digital, etc.).' - example: dts - optimizedForStreaming: - description: 'Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true' - oneOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - - type: boolean - enum: - - true - - false - has64bitOffsets: - type: boolean - example: false - Part: - type: array - description: An array of parts for this media item. - items: - type: object - required: - - id - - key - - file - - size - properties: - accessible: - type: boolean - description: Indicates if the part is accessible. - example: true - exists: - type: boolean - description: Indicates if the part exists. - example: true - id: - type: integer - description: Unique part identifier. - example: 418385 - key: - type: string - description: Key to access this part. - example: /library/parts/418385/1735864239/file.mkv - indexes: - type: string - example: sd - duration: - type: integer - format: int32 - description: Duration of the part in milliseconds. - example: 9610350 - file: - type: string - description: File path for the part. - example: /mnt/Movies_1/W/Wicked (2024).mkv - size: - description: File size in bytes. - type: integer - example: 30649952104 - packetLength: - type: integer - format: int32 - example: 188 - container: - type: string - description: Container format of the part. - example: mkv - videoProfile: - type: string - description: Video profile for the part. - example: main 10 - audioProfile: - type: string - description: 'The audio profile used for the media (e.g., DTS, Dolby Digital, etc.).' - example: dts - has64bitOffsets: - type: boolean - example: false - optimizedForStreaming: - description: 'Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true' - oneOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - - type: boolean - enum: - - true - - false - hasThumbnail: - allOf: - - description: Indicates if the part has a thumbnail. - - type: string - enum: - - '0' - - '1' - example: '1' - default: '0' - x-speakeasy-enums: - - false - - true - Stream: - type: array - description: An array of streams for this part. - items: - type: object - required: - - id - - streamType - - codec - - index - - language - - languageTag - - languageCode - - displayTitle - - extendedDisplayTitle - properties: - id: - type: integer - description: Unique stream identifier. - example: 1002625 - streamType: - type: integer - format: int32 - description: 'Stream type (1=video, 2=audio, 3=subtitle).' - example: 1 - default: - type: boolean - description: Indicates if this stream is default. - example: true - codec: - type: string - description: Codec used by the stream. - example: hevc - index: - type: integer - format: int32 - description: Index of the stream. - example: 0 - bitrate: - type: integer - format: int32 - description: Bitrate of the stream. - example: 24743 - language: - type: string - description: Language of the stream. - example: English - languageTag: - type: string - description: 'Language tag (e.g., en).' - example: en - languageCode: - type: string - description: ISO language code. - example: eng - headerCompression: - type: boolean - description: Indicates whether header compression is enabled. - example: true - DOVIBLCompatID: - type: integer - format: int32 - description: Dolby Vision BL compatibility ID. - example: 1 - DOVIBLPresent: - type: boolean - description: Indicates if Dolby Vision BL is present. - example: true - DOVIELPresent: - type: boolean - description: Indicates if Dolby Vision EL is present. - example: false - DOVILevel: - type: integer - format: int32 - description: Dolby Vision level. - example: 6 - DOVIPresent: - type: boolean - description: Indicates if Dolby Vision is present. - example: true - DOVIProfile: - type: integer - format: int32 - description: Dolby Vision profile. - example: 8 - DOVIRPUPresent: - type: boolean - description: Indicates if Dolby Vision RPU is present. - example: true - DOVIVersion: - type: string - description: Dolby Vision version. - example: '1.0' - bitDepth: - type: integer - format: int32 - description: Bit depth of the video stream. - example: 10 - chromaLocation: - type: string - description: Chroma sample location. - example: topleft - chromaSubsampling: - type: string - description: Chroma subsampling format. - example: '4:2:0' - codedHeight: - type: integer - format: int32 - description: Coded video height. - example: 1608 - codedWidth: - type: integer - format: int32 - description: Coded video width. - example: 3840 - colorPrimaries: - type: string - description: Color primaries used. - example: bt2020 - colorRange: - type: string - description: 'Color range (e.g., tv).' - example: tv - colorSpace: - type: string - description: Color space. - example: bt2020nc - colorTrc: - type: string - description: Color transfer characteristics. - example: smpte2084 - frameRate: - type: number - format: float - description: Frame rate of the stream. - example: 23.976 - height: - type: integer - format: int32 - description: Height of the video stream. - example: 1602 - level: - type: integer - format: int32 - description: Video level. - example: 150 - original: - type: boolean - description: Indicates if this is the original stream. - example: true - hasScalingMatrix: - type: boolean - example: false - profile: - type: string - description: Video profile. - example: main 10 - scanType: - type: string - example: progressive - refFrames: - type: integer - format: int32 - description: Number of reference frames. - example: 1 - width: - type: integer - format: int32 - description: Width of the video stream. - example: 3840 - displayTitle: - type: string - description: Display title for the stream. - example: 4K DoVi/HDR10 (HEVC Main 10) - extendedDisplayTitle: - type: string - description: Extended display title for the stream. - example: 4K DoVi/HDR10 (HEVC Main 10) - selected: - type: boolean - description: Indicates if this stream is selected (applicable for audio streams). - example: true - forced: - type: boolean - example: true - channels: - type: integer - format: int32 - description: Number of audio channels (for audio streams). - example: 6 - audioChannelLayout: - type: string - description: Audio channel layout. - example: 5.1(side) - samplingRate: - type: integer - format: int32 - description: Sampling rate for the audio stream. - example: 48000 - canAutoSync: - type: boolean - description: Indicates if the stream can auto-sync. - example: false - hearingImpaired: - type: boolean - description: Indicates if the stream is for the hearing impaired. - example: true - dub: - type: boolean - description: Indicates if the stream is a dub. - example: true - title: - type: string - description: 'Optional title for the stream (e.g., language variant).' - example: SDH - Genre: - type: array - items: - allOf: - - type: object - required: - - tag - properties: - tag: - type: string - description: The country of origin of this media item - example: United States of America - Country: - type: array - items: - allOf: - - type: object - required: - - tag - properties: - tag: - type: string - description: The country of origin of this media item - example: United States of America - Director: - type: array - items: - allOf: - - type: object - required: - - tag - properties: - tag: - type: string - description: The role of Director - example: Danny Boyle - Writer: - type: array - items: - allOf: - - type: object - required: - - tag - properties: - tag: - type: string - description: The role of Writer - example: Danny Boyle - Role: - type: array - items: - allOf: - - type: object - required: - - tag - properties: - tag: - type: string - description: The name of the actor for this role - example: Danny Boyle - Guid: - x-speakeasy-name-override: guids - type: array - items: - type: object - properties: - id: - type: string - description: | - The unique identifier for the Guid. Can be imdb://tt0286347, tmdb://1763, tvdb://2337 - example: 'tvdb://2337' - Collection: - type: array - items: - allOf: - - type: object - required: - - tag - properties: - tag: - type: string - description: The user-made collection this media item belongs to - example: My Awesome Collection - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - '404': - description: Not Found - Returned if the resource could not be found - content: - text/html: - example: | - - - - Not Found - - -

404 Not Found

- - + $ref: '#/components/responses/200' x-codeSamples: - - lang: php - label: library - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetAllMediaLibraryRequest( - sectionKey: 9518, - type: Operations\GetAllMediaLibraryQueryParamType::TvShow, - ); - - $response = $sdk->library->getAllMediaLibrary( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: library - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetAllMediaLibraryRequest.new(\n section_key: 9518,\n type: ::PlexRubySDK::Operations::GetAllMediaLibraryQueryParamType::TV_SHOW,\n include_meta: ::PlexRubySDK::Operations::GetAllMediaLibraryQueryParamIncludeMeta::ENABLE,\n include_guids: ::PlexRubySDK::Operations::QueryParamIncludeGuids::ENABLE,\n include_advanced: ::PlexRubySDK::Operations::IncludeAdvanced::ENABLE,\n include_collections: ::PlexRubySDK::Operations::QueryParamIncludeCollections::ENABLE,\n include_external_media: ::PlexRubySDK::Operations::QueryParamIncludeExternalMedia::ENABLE,\n x_plex_container_start: 0,\n x_plex_container_size: 50,\n)\n \nres = s.library.get_all_media_library(req)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: library - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetAllMediaLibrary(ctx, operations.GetAllMediaLibraryRequest{\n SectionKey: 9518,\n Type: operations.GetAllMediaLibraryQueryParamTypeTvShow,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: library + label: PlexGO source: |- - package hello.world; + package main - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetAllMediaLibraryBadRequest; - import dev.plexapi.plexapi.models.errors.GetAllMediaLibraryUnauthorized; - import dev.plexapi.plexapi.models.operations.GetAllMediaLibraryQueryParamType; - import dev.plexapi.plexapi.models.operations.GetAllMediaLibraryRequest; - import dev.plexapi.plexapi.models.operations.GetAllMediaLibraryResponse; - import java.lang.Exception; + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) - public class Application { + func main() { + ctx := context.Background() - public static void main(String[] args) throws GetAllMediaLibraryBadRequest, GetAllMediaLibraryUnauthorized, Exception { + s := plexgo.New( + plexgo.WithSecurity(""), + ) - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetAllMediaLibraryRequest req = GetAllMediaLibraryRequest.builder() - .sectionKey(9518) - .type(GetAllMediaLibraryQueryParamType.TvShow) - .build(); - - GetAllMediaLibraryResponse res = sdk.library().getAllMediaLibrary() - .request(req) - .call(); - - if (res.object().isPresent()) { - // handle response - } + res, err := s.Library.DeleteCaches(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response } } - - lang: typescript - label: library - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { GetAllMediaLibraryQueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getAllMediaLibrary({ - sectionKey: 9518, - type: GetAllMediaLibraryQueryParamType.TvShow, - }); - - // Handle the result - console.log(result); - } - - run(); - '/library/sections/{sectionKey}/refresh': - get: - tags: - - Library - summary: Refresh Metadata Of The Library - description: | - This endpoint Refreshes all the Metadata of the library. - operationId: get-refresh-library-metadata - parameters: - - name: force - description: Force the refresh even if the library is already being refreshed. - in: query - schema: - type: integer - example: 0 - enum: - - 0 - - 1 - required: false - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - responses: - '200': - description: The library is refreshing - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: metadata - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getRefreshLibraryMetadata( - sectionKey: 9518, - force: Operations\Force::One - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: metadata - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_refresh_library_metadata(section_key=9518, force=::PlexRubySDK::Operations::Force::ONE)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: metadata - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetRefreshLibraryMetadata(ctx, 9518, operations.ForceOne.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - lang: java - label: metadata + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetRefreshLibraryMetadataBadRequest; - import dev.plexapi.plexapi.models.errors.GetRefreshLibraryMetadataUnauthorized; - import dev.plexapi.plexapi.models.operations.Force; - import dev.plexapi.plexapi.models.operations.GetRefreshLibraryMetadataResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteCachesResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetRefreshLibraryMetadataBadRequest, GetRefreshLibraryMetadataUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetRefreshLibraryMetadataResponse res = sdk.library().getRefreshLibraryMetadata() - .force(Force.ONE) - .sectionKey(9518) + DeleteCachesResponse res = sdk.library().deleteCaches() .call(); // handle response } } - lang: typescript - label: metadata + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { Force } from "@lukehagar/plexjs/sdk/models/operations"; - const plexAPI = new PlexAPI({ - accessToken: "", - }); + const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.library.getRefreshLibraryMetadata(9518, Force.One); + const result = await plexAPI.library.deleteCaches(); - // Handle the result console.log(result); } run(); - '/library/sections/{sectionKey}/search': - get: + /library/clean/bundles: + put: + summary: Clean bundles + operationId: cleanBundles + description: Clean out any now unused bundles. Bundles can become unused when media is deleted tags: - Library - summary: Search Library - operationId: get-search-library - description: "Search for content within a specific section of the library.\n\n### Types\nEach type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:\n\n- **Type Object Attributes**:\n - `type`: Metadata type (if standard Plex type). \n - `title`: Title for this content type (e.g., \"Movies\").\n\n- **Filter Objects**:\n - Subset of the media query language.\n - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.\n\n- **Sort Objects**:\n - Description of sort fields.\n - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.\n\n> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.\n" - parameters: - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - - name: Accept - in: header - required: false - schema: - type: string - enum: - - application/json - - application/xml - example: application/json - - name: type - in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true + security: + - token: + - admin responses: '200': - description: The contents of the library by section and type - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 2 - allowSync: - type: boolean - example: false - art: - type: string - example: '/:/resources/show-fanart.jpg' - identifier: - type: string - example: com.plexapp.plugins.library - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: integer - format: int32 - example: 1698860922 - nocache: - type: boolean - example: true - thumb: - type: string - example: '/:/resources/show.png' - title1: - type: string - example: TV Shows - title2: - type: string - example: Search for '' - viewGroup: - type: string - example: season - viewMode: - type: integer - format: int32 - example: 65593 - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '2' - key: - type: string - example: /library/metadata/2/children - parentRatingKey: - type: string - example: '1' - guid: - type: string - example: 'plex://season/602e67e766dfdb002c0a1b5b' - parentGuid: - type: string - example: 'plex://show/5d9c086c7d06d9001ffd27aa' - parentStudio: - type: string - example: Mutant Enemy Productions - type: - type: string - example: season - title: - type: string - example: Season 1 - parentKey: - type: string - example: /library/metadata/1 - parentTitle: - type: string - example: Firefly - summary: - type: string - example: 'Captain Malcolm ''Mal'' Reynolds is a former galactic war veteran who is the captain of the transport ship "Serenity". Mal and his crew, ensign Zoe Alleyne Washburne; Zoe''s husband, pilot Hoban ''Wash'' Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Frye; former Alliance medical officer Simon Tam; his disturbed teenage sister River (both on the run from the interplanetary government "The Alliance"); the beautiful courtesan Inara Serra; and preacher Shepherd Book do any jobs, legal or illegal, they can find as the Serenity crew travels across the outskirts of outer space.' - index: - type: integer - format: int32 - example: 1 - parentIndex: - type: integer - format: int32 - example: 1 - parentYear: - type: integer - format: int32 - example: 2002 - thumb: - type: string - example: /library/metadata/2/thumb/1705636920 - art: - type: string - example: /library/metadata/1/art/1705636920 - parentThumb: - type: string - example: /library/metadata/1/thumb/1705636920 - parentTheme: - type: string - example: /library/metadata/1/theme/1705636920 - addedAt: - type: integer - format: int32 - example: 1705636916 - updatedAt: - type: integer - format: int32 - example: 1705636920 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/200' x-codeSamples: - - lang: php - label: library - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getSearchLibrary( - sectionKey: 9518, - type: Operations\GetSearchLibraryQueryParamType::TvShow - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: library - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_search_library(section_key=9518, type=::PlexRubySDK::Operations::GetSearchLibraryQueryParamType::TV_SHOW)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: library - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetSearchLibrary(ctx, 9518, operations.GetSearchLibraryQueryParamTypeTvShow)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Library.CleanBundles(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: library + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetSearchLibraryBadRequest; - import dev.plexapi.plexapi.models.errors.GetSearchLibraryUnauthorized; - import dev.plexapi.plexapi.models.operations.GetSearchLibraryQueryParamType; - import dev.plexapi.plexapi.models.operations.GetSearchLibraryResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CleanBundlesResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetSearchLibraryBadRequest, GetSearchLibraryUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetSearchLibraryResponse res = sdk.library().getSearchLibrary() - .sectionKey(9518) - .type(GetSearchLibraryQueryParamType.TvShow) + CleanBundlesResponse res = sdk.library().cleanBundles() .call(); - if (res.object().isPresent()) { + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.library.cleanBundles(); + + console.log(result); + } + + run(); + /library/collections: + post: + summary: Create collection + operationId: createCollection + description: Create a collection in the library + tags: + - Collections + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section where this collection will be created + in: query + required: true + schema: + type: string + - $ref: '#/components/parameters/title' + - $ref: '#/components/parameters/smart' + - name: uri + description: The URI for processing the smart collection. Required for a smart collection + in: query + schema: + type: string + - $ref: '#/components/parameters/type' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '400': + description: The uri is missing for a smart collection or the section could not be found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Collections.CreateCollection(ctx, operations.CreateCollectionRequest{ + SectionID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CreateCollectionRequest; + import dev.plexapi.sdk.models.operations.CreateCollectionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreateCollectionRequest req = CreateCollectionRequest.builder() + .sectionId("") + .build(); + + CreateCollectionResponse res = sdk.collections().createCollection() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { // handle response } } } - lang: typescript - label: library + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { GetSearchLibraryQueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.library.getSearchLibrary(9518, GetSearchLibraryQueryParamType.TvShow); + const result = await plexAPI.collections.createCollection({ + sectionId: "", + }); - // Handle the result console.log(result); } run(); - '/library/sections/{sectionKey}/genre': - get: + /library/file: + post: + summary: Ingest a transient item + operationId: ingestTransientItem + description: |- + 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. tags: - Library - summary: Get Genres of library media - operationId: get-genres-library - description: | - Retrieves a list of all the genres that are found for the media in this library. parameters: - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - - name: type + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: url + description: The file of the file to ingest. in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - - name: Accept - in: header - required: false schema: type: string - enum: - - application/json - - application/xml - example: application/json + format: url + example: file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv + - name: virtualFilePath + description: A virtual path to use when the url is opaque. + in: query + schema: + type: string + example: /Avatar.mkv + - name: computeHashes + description: Whether or not to compute Plex and OpenSubtitle hashes for the file. Defaults to 0. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: ingestNonMatches + description: Whether or not non matching media should be stored. Defaults to 0. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 responses: '200': - description: Successful response containing media container data. + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - type: object - properties: - MediaContainer: - allOf: - - type: object - required: - - size - properties: - size: - description: Number of media items returned in this response. - type: integer - format: int32 - example: 50 - - type: object - required: - - allowSync - properties: - allowSync: - type: boolean - description: Indicates whether syncing is allowed. - example: false - - type: object - required: - - art - properties: - art: - type: string - description: URL for the background artwork of the media container. - example: '/:/resources/show-fanart.jpg' - - type: object - required: - - content - properties: - content: - type: string - description: The content type or mode. - example: secondary - - type: object - required: - - identifier - properties: - identifier: - type: string - description: An plugin identifier for the media container. - example: com.plexapp.plugins.library - - type: object - required: - - mediaTagPrefix - properties: - mediaTagPrefix: - type: string - description: The prefix used for media tag resource paths. - example: /system/bundle/media/flags/ - - type: object - required: - - mediaTagVersion - properties: - mediaTagVersion: - type: integer - description: The version number for media tags. - example: 1734362201 - - type: object - required: - - nocache - properties: - nocache: - type: boolean - description: Specifies whether caching is disabled. - example: true - - type: object - required: - - thumb - properties: - thumb: - type: string - description: URL for the thumbnail image of the media container. - example: '/:/resources/show.png' - - type: object - required: - - title1 - properties: - title1: - type: string - description: The primary title of the media container. - example: TV Series - - type: object - required: - - title2 - properties: - title2: - type: string - description: The secondary title of the media container. - example: By Starring Actor - - type: object - required: - - viewGroup - properties: - viewGroup: - type: string - description: Identifier for the view group layout. - example: secondary - - type: object - properties: - Directory: - type: array - items: - type: object - required: - - fastKey - - key - - title - - type - properties: - fastKey: - type: string - example: /library/sections/10/all?genre=89 - key: - type: string - example: '89' - title: - type: string - example: Action - type: - type: string - example: genre - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - '404': - description: Not Found - Returned if the resource could not be found - content: - text/html: - example: | - - - - Not Found - - -

404 Not Found

- - + $ref: '#/components/schemas/MediaContainerWithMetadata' x-codeSamples: - - lang: php - label: library - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getGenresLibrary( - sectionKey: 9518, - type: Operations\GetGenresLibraryQueryParamType::TvShow - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: library - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_genres_library(section_key=9518, type=::PlexRubySDK::Operations::GetGenresLibraryQueryParamType::TV_SHOW)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: library - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetGenresLibrary(ctx, 9518, operations.GetGenresLibraryQueryParamTypeTvShow)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.IngestTransientItem(ctx, operations.IngestTransientItemRequest{ + URL: plexgo.Pointer("file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv"), + VirtualFilePath: plexgo.Pointer("/Avatar.mkv"), + ComputeHashes: components.BoolIntOne.ToPointer(), + IngestNonMatches: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } - lang: java - label: library + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetGenresLibraryBadRequest; - import dev.plexapi.plexapi.models.errors.GetGenresLibraryUnauthorized; - import dev.plexapi.plexapi.models.operations.GetGenresLibraryQueryParamType; - import dev.plexapi.plexapi.models.operations.GetGenresLibraryResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.IngestTransientItemRequest; + import dev.plexapi.sdk.models.operations.IngestTransientItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetGenresLibraryBadRequest, GetGenresLibraryUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetGenresLibraryResponse res = sdk.library().getGenresLibrary() - .sectionKey(9518) - .type(GetGenresLibraryQueryParamType.TvShow) + IngestTransientItemRequest req = IngestTransientItemRequest.builder() + .url("file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv") + .virtualFilePath("/Avatar.mkv") + .computeHashes(BoolInt.ONE) + .ingestNonMatches(BoolInt.ONE) + .build(); + + IngestTransientItemResponse res = sdk.library().ingestTransientItem() + .request(req) .call(); - if (res.object().isPresent()) { + if (res.mediaContainerWithMetadata().isPresent()) { // handle response } } } - lang: typescript - label: library + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { GetGenresLibraryQueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.library.getGenresLibrary(9518, GetGenresLibraryQueryParamType.TvShow); + const result = await plexAPI.library.ingestTransientItem({ + url: "file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv", + virtualFilePath: "/Avatar.mkv", + computeHashes: BoolInt.One, + ingestNonMatches: BoolInt.One, + }); - // Handle the result console.log(result); } run(); - '/library/sections/{sectionKey}/country': + /library/matches: get: + summary: Get library matches + operationId: getLibraryMatches + description: |- + 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 tags: - Library - summary: Get Countries of library media - operationId: get-countries-library - description: | - Retrieves a list of all the countries that are found for the media in this library. parameters: - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - - name: type + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/type' + - name: includeFullMetadata in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - - name: Accept - in: header - required: false + description: Whether or not to include full metadata on a positive match. When set, and the best match exceeds a score threshold of 85, metadata as rich as possible is sent back. + $ref: "#/components/schemas/BoolInt" + - name: includeAncestorMetadata + in: query + schema: + description: Whether or not to include metadata for the item's ancestor (e.g. show and season data for an episode). + $ref: "#/components/schemas/BoolInt" + - name: includeAlternateMetadataSources + in: query + schema: + description: Whether or not to return all sources for each metadata field, which results in a different structure being passed back. + $ref: "#/components/schemas/BoolInt" + - name: guid + description: Used for movies, shows, artists, albums, and tracks. Allowed for various URI schemes, to be defined. + in: query + schema: + type: string + - $ref: '#/components/parameters/title' + - name: year + description: Used for movies shows, and albums. Optional. + in: query + schema: + type: integer + - name: path + description: Used for movies, episodes, and tracks. The full path to the media file, used for "cloud-scanning" an item. + in: query + schema: + type: string + - name: grandparentTitle + description: Used for episodes and tracks. The title of the show/artist. Required if `path` isn't passed. + in: query + schema: + type: string + - name: grandparentYear + description: Used for episodes. The year of the show. + in: query + schema: + type: integer + - name: parentIndex + description: Used for episodes and tracks. The season/album number. + in: query + schema: + type: integer + - name: index + description: Used for episodes and tracks. The episode/tracks number in the season/album. + in: query + schema: + type: integer + - name: originallyAvailableAt + description: Used for episodes. In the format `YYYY-MM-DD`. + in: query + schema: + type: string + - name: parentTitle + description: Used for albums and tracks. The artist name for albums or the album name for tracks. + in: query schema: type: string - enum: - - application/json - - application/xml - example: application/json responses: '200': - description: Successful response containing media container data. + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - type: object - properties: - MediaContainer: - allOf: - - type: object - required: - - size - properties: - size: - description: Number of media items returned in this response. - type: integer - format: int32 - example: 50 - - type: object - required: - - allowSync - properties: - allowSync: - type: boolean - description: Indicates whether syncing is allowed. - example: false - - type: object - required: - - art - properties: - art: - type: string - description: URL for the background artwork of the media container. - example: '/:/resources/show-fanart.jpg' - - type: object - required: - - content - properties: - content: - type: string - description: The content type or mode. - example: secondary - - type: object - required: - - identifier - properties: - identifier: - type: string - description: An plugin identifier for the media container. - example: com.plexapp.plugins.library - - type: object - required: - - mediaTagPrefix - properties: - mediaTagPrefix: - type: string - description: The prefix used for media tag resource paths. - example: /system/bundle/media/flags/ - - type: object - required: - - mediaTagVersion - properties: - mediaTagVersion: - type: integer - description: The version number for media tags. - example: 1734362201 - - type: object - required: - - nocache - properties: - nocache: - type: boolean - description: Specifies whether caching is disabled. - example: true - - type: object - required: - - thumb - properties: - thumb: - type: string - description: URL for the thumbnail image of the media container. - example: '/:/resources/show.png' - - type: object - required: - - title1 - properties: - title1: - type: string - description: The primary title of the media container. - example: TV Series - - type: object - required: - - title2 - properties: - title2: - type: string - description: The secondary title of the media container. - example: By Starring Actor - - type: object - required: - - viewGroup - properties: - viewGroup: - type: string - description: Identifier for the view group layout. - example: secondary - - type: object - properties: - Directory: - type: array - items: - type: object - required: - - fastKey - - key - - title - properties: - fastKey: - type: string - example: /library/sections/2/all?country=15491 - key: - type: string - example: '15491' - title: - type: string - example: Japan - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - '404': - description: Not Found - Returned if the resource could not be found - content: - text/html: - example: | - - - - Not Found - - -

404 Not Found

- - + $ref: '#/components/schemas/MediaContainerWithMetadata' x-codeSamples: - - lang: php - label: library - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getCountriesLibrary( - sectionKey: 9518, - type: Operations\GetCountriesLibraryQueryParamType::TvShow - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: library - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_countries_library(section_key=9518, type=::PlexRubySDK::Operations::GetCountriesLibraryQueryParamType::TV_SHOW)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: library - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetCountriesLibrary(ctx, 9518, operations.GetCountriesLibraryQueryParamTypeTvShow)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetLibraryMatches(ctx, operations.GetLibraryMatchesRequest{ + IncludeFullMetadata: components.BoolIntOne.ToPointer(), + IncludeAncestorMetadata: components.BoolIntOne.ToPointer(), + IncludeAlternateMetadataSources: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } - lang: java - label: library + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetCountriesLibraryBadRequest; - import dev.plexapi.plexapi.models.errors.GetCountriesLibraryUnauthorized; - import dev.plexapi.plexapi.models.operations.GetCountriesLibraryQueryParamType; - import dev.plexapi.plexapi.models.operations.GetCountriesLibraryResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetLibraryMatchesRequest; + import dev.plexapi.sdk.models.operations.GetLibraryMatchesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetCountriesLibraryBadRequest, GetCountriesLibraryUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetCountriesLibraryResponse res = sdk.library().getCountriesLibrary() - .sectionKey(9518) - .type(GetCountriesLibraryQueryParamType.TvShow) + GetLibraryMatchesRequest req = GetLibraryMatchesRequest.builder() + .includeFullMetadata(BoolInt.ONE) + .includeAncestorMetadata(BoolInt.ONE) + .includeAlternateMetadataSources(BoolInt.ONE) + .build(); + + GetLibraryMatchesResponse res = sdk.library().getLibraryMatches() + .request(req) .call(); - if (res.object().isPresent()) { + if (res.mediaContainerWithMetadata().isPresent()) { // handle response } } } - lang: typescript - label: library + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { GetCountriesLibraryQueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.library.getCountriesLibrary(9518, GetCountriesLibraryQueryParamType.TvShow); + const result = await plexAPI.library.getLibraryMatches({ + includeFullMetadata: BoolInt.One, + includeAncestorMetadata: BoolInt.One, + includeAlternateMetadataSources: BoolInt.One, + }); - // Handle the result console.log(result); } run(); - '/library/sections/{sectionKey}/actor': - get: + /library/optimize: + put: + summary: Optimize the Database + operationId: optimizeDatabase + description: Initiate optimize on the database. tags: - Library - summary: Get Actors of library media - operationId: get-actors-library - description: | - Retrieves a list of all the actors that are found for the media in this library. + security: + - token: + - admin parameters: - - name: sectionKey - description: "The unique key of the Plex library. \nNote: This is unique in the context of the Plex server.\n" - in: path - schema: - type: integer - format: int32 - example: 9518 - required: true - - name: type + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: async + description: If set, don't wait for completion but return an activity in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - - name: Accept - in: header - required: false - schema: - type: string - enum: - - application/json - - application/xml - example: application/json + $ref: "#/components/schemas/BoolInt" responses: '200': - description: Successful response containing media container data. - content: - application/json: - schema: - type: object - properties: - MediaContainer: - allOf: - - type: object - required: - - size - properties: - size: - description: Number of media items returned in this response. - type: integer - format: int32 - example: 50 - - type: object - required: - - allowSync - properties: - allowSync: - type: boolean - description: Indicates whether syncing is allowed. - example: false - - type: object - required: - - art - properties: - art: - type: string - description: URL for the background artwork of the media container. - example: '/:/resources/show-fanart.jpg' - - type: object - required: - - identifier - properties: - identifier: - type: string - description: An plugin identifier for the media container. - example: com.plexapp.plugins.library - - type: object - required: - - mediaTagPrefix - properties: - mediaTagPrefix: - type: string - description: The prefix used for media tag resource paths. - example: /system/bundle/media/flags/ - - type: object - required: - - mediaTagVersion - properties: - mediaTagVersion: - type: integer - description: The version number for media tags. - example: 1734362201 - - type: object - required: - - nocache - properties: - nocache: - type: boolean - description: Specifies whether caching is disabled. - example: true - - type: object - required: - - thumb - properties: - thumb: - type: string - description: URL for the thumbnail image of the media container. - example: '/:/resources/show.png' - - type: object - required: - - title1 - properties: - title1: - type: string - description: The primary title of the media container. - example: TV Series - - type: object - required: - - title2 - properties: - title2: - type: string - description: The secondary title of the media container. - example: By Starring Actor - - type: object - required: - - viewGroup - properties: - viewGroup: - type: string - description: Identifier for the view group layout. - example: secondary - - type: object - required: - - viewMode - properties: - viewMode: - type: string - description: Identifier for the view mode. - example: '131131' - - type: object - properties: - Directory: - type: array - description: An array of actor entries for media items. - items: - type: object - required: - - fastKey - - thumb - - key - - title - properties: - fastKey: - type: string - description: A fast lookup key for the actor relative url. - example: /library/sections/2/all?actor=134671 - thumb: - type: string - description: URL for the thumbnail image of the actor. - example: 'https://metadata-static.plex.tv/e/people/e2a915b537ef720252b6d408bc1f91b3.jpg' - key: - type: string - description: A unique key representing the actor. - example: '134671' - title: - type: string - description: The name of the actor. - example: Aaron Paul - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - '404': - description: Not Found - Returned if the resource could not be found - content: - text/html: - example: | - - - - Not Found - - -

404 Not Found

- - + $ref: '#/components/responses/200' x-codeSamples: - - lang: php - label: library - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getActorsLibrary( - sectionKey: 9518, - type: Operations\GetActorsLibraryQueryParamType::TvShow - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: library - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_actors_library(section_key=9518, type=::PlexRubySDK::Operations::GetActorsLibraryQueryParamType::TV_SHOW)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: library - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetActorsLibrary(ctx, 9518, operations.GetActorsLibraryQueryParamTypeTvShow)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.OptimizeDatabase(ctx, operations.OptimizeDatabaseRequest{ + Async: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: library + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetActorsLibraryBadRequest; - import dev.plexapi.plexapi.models.errors.GetActorsLibraryUnauthorized; - import dev.plexapi.plexapi.models.operations.GetActorsLibraryQueryParamType; - import dev.plexapi.plexapi.models.operations.GetActorsLibraryResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.OptimizeDatabaseRequest; + import dev.plexapi.sdk.models.operations.OptimizeDatabaseResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetActorsLibraryBadRequest, GetActorsLibraryUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetActorsLibraryResponse res = sdk.library().getActorsLibrary() - .sectionKey(9518) - .type(GetActorsLibraryQueryParamType.TvShow) + OptimizeDatabaseRequest req = OptimizeDatabaseRequest.builder() + .async(BoolInt.ONE) + .build(); + + OptimizeDatabaseResponse res = sdk.library().optimizeDatabase() + .request(req) .call(); - if (res.object().isPresent()) { - // handle response - } + // handle response } } - lang: typescript - label: library + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { GetActorsLibraryQueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.library.getActorsLibrary(9518, GetActorsLibraryQueryParamType.TvShow); + const result = await plexAPI.library.optimizeDatabase({ + async: BoolInt.One, + }); - // Handle the result console.log(result); } run(); - /library/search: + /library/randomArtwork: get: + summary: Get random artwork + operationId: getRandomArtwork + description: | + 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. tags: - Library - summary: Search All Libraries - operationId: get-search-all-libraries - description: | - Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type. parameters: - - name: query + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sections + description: The sections for which to fetch artwork. in: query - required: true - schema: - type: string - description: The search query term. - - name: X-Plex-Client-Identifier - x-speakeasy-name-override: ClientID - description: 'An opaque identifier unique to the client (UUID, serial number, or other unique device ID)' - required: true - in: header - schema: - type: string - example: 3381b62b-9ab7-4e37-827b-203e9809eb58 - - name: limit - in: query - required: false - schema: - type: integer - description: Limit the number of results returned. - - name: searchTypes - in: query - required: false + explode: false schema: type: array items: - type: string - enum: - - movies - - music - - otherVideos - - people - - tv - example: 'movies,music,otherVideos,people,tv' - style: form - explode: false - description: | - A comma-separated list of search types to include. Valid values are: movies, music, otherVideos, people, tv. - - name: includeCollections - in: query - required: false - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - description: Whether to include collections in the search results. - - name: includeExternalMedia - in: query - required: false - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - description: Whether to include external media in the search results. + type: integer + example: + - 5 + - 6 responses: '200': - description: The libraries available on the Server + description: OK content: application/json: schema: - type: object - required: - - MediaContainer - properties: - MediaContainer: - type: object - required: - - size - - SearchResult - properties: - size: - type: number - SearchResult: - type: array - items: - type: object - required: - - score - - Metadata - properties: - score: - type: number - format: float - Metadata: - type: object - required: - - ratingKey - - key - - guid - - title - - type - - addedAt - - summary - properties: - ratingKey: - type: string - example: '58683' - description: | - The rating key (Media ID) of this media item. - Note: This is always an integer, but is represented as a string in the API. - key: - type: string - example: /library/metadata/58683 - guid: - type: string - example: 'plex://movie/5d7768ba96b655001fdc0408' - studio: - type: string - example: 20th Century Studios - skipChildren: - type: boolean - example: false - librarySectionID: - type: integer - examples: - - 1 - librarySectionTitle: - type: string - example: Movies - librarySectionKey: - type: string - example: /library/sections/1 - type: - type: string - enum: - - movie - - show - - season - - episode - - artist - - album - example: movie - description: | - The type of media content - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - ARTIST - - ALBUM - title: - type: string - example: 'Avatar: The Way of Water' - slug: - type: string - example: 4-for-texas - contentRating: - type: string - example: PG-13 - summary: - type: string - example: 'Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na''vi race to protect their home.' - rating: - type: number - example: 7.6 - audienceRating: - type: number - example: 9.2 - year: - type: integer - format: int32 - example: 2022 - seasonCount: - type: integer - format: int32 - example: 2022 - tagline: - type: string - example: Return to Pandora. - flattenSeasons: - type: string - description: 'Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).' - enum: - - '-1' - - '0' - - '1' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - HIDE - - SHOW - example: '1' - episodeSort: - type: string - description: 'Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).' - enum: - - '-1' - - '0' - - '1' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - OLDEST_FIRST - - NEWEST_FIRST - example: '0' - enableCreditsMarkerGeneration: - type: string - description: 'Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).' - enum: - - '-1' - - '0' - x-speakeasy-enums: - - LIBRARY_DEFAULT - - DISABLED - example: '-1' - showOrdering: - type: string - description: | - Setting that indicates the episode ordering for the show. - None = Library default, - tmdbAiring = The Movie Database (Aired), - aired = TheTVDB (Aired), - dvd = TheTVDB (DVD), - absolute = TheTVDB (Absolute)). - enum: - - None - - tmdbAiring - - aired - - dvd - - absolute - x-speakeasy-enums: - - NONE - - TMDB_AIRING - - TVDB_AIRED - - TVDB_DVD - - TVDB_ABSOLUTE - example: absolute - thumb: - type: string - example: /library/metadata/58683/thumb/1703239236 - art: - type: string - example: /library/metadata/58683/art/1703239236 - banner: - type: string - example: /library/metadata/58683/banner/1703239236 - duration: - type: integer - format: int32 - example: 11558112 - originallyAvailableAt: - type: string - format: date - example: 2022-12-14T00:00:00.000Z - addedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - updatedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - chapterSource: - type: string - example: media - primaryExtraKey: - type: string - example: /library/metadata/58684 - ratingImage: - type: string - example: 'rottentomatoes://image.rating.ripe' - grandparentRatingKey: - type: string - example: '66' - grandparentGuid: - type: string - example: 'plex://show/5d9c081b170e24001f2a7be4' - grandparentKey: - type: string - example: /library/metadata/66 - grandparentTitle: - type: string - example: Caprica - grandparentThumb: - type: string - example: /library/metadata/66/thumb/1705716261 - parentSlug: - type: string - example: alice-in-borderland-2020 - grandparentSlug: - type: string - example: alice-in-borderland-2020 - grandparentArt: - type: string - example: /library/metadata/66/art/1705716261 - grandparentTheme: - type: string - example: /library/metadata/66/theme/1705716261 - Media: - description: | - The Media object is only included when type query is `4` or higher. - type: array - items: - type: object - required: - - id - - container - - Part - properties: - id: - type: integer - format: int32 - example: 119534 - duration: - type: integer - format: int32 - example: 11558112 - bitrate: - type: integer - format: int32 - example: 25025 - width: - type: integer - format: int32 - example: 3840 - height: - type: integer - format: int32 - example: 2072 - aspectRatio: - type: number - example: 1.85 - audioProfile: - type: string - example: dts - audioChannels: - type: integer - format: int32 - example: 6 - audioCodec: - type: string - example: eac3 - videoCodec: - type: string - example: hevc - videoResolution: - type: string - example: 4k - container: - type: string - example: mkv - videoFrameRate: - type: string - example: 24p - videoProfile: - type: string - example: main 10 - hasVoiceActivity: - type: boolean - example: false - optimizedForStreaming: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - has64bitOffsets: - type: boolean - example: false - Part: - type: array - items: - type: object - required: - - id - - key - - file - - size - - container - properties: - id: - type: integer - format: int32 - example: 119542 - key: - type: string - example: /library/parts/119542/1680457526/file.mkv - duration: - type: integer - format: int32 - example: 11558112 - file: - type: string - example: /movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv - size: - type: integer - format: int64 - example: 36158371307 - container: - type: string - description: | - The container format of the media file. - example: mkv - audioProfile: - type: string - example: dts - has64bitOffsets: - type: boolean - example: false - optimizedForStreaming: - type: boolean - example: false - videoProfile: - type: string - example: main 10 - indexes: - type: string - example: sd - hasThumbnail: - type: string - enum: - - '0' - - '1' - example: '1' - default: '0' - x-speakeasy-enums: - - false - - true - Stream: - type: array - items: - type: object - required: - - id - - streamType - - codec - - index - properties: - id: - type: integer - example: 272796 - streamType: - type: integer - description: 'Type of stream (1 = video, 2 = audio, 3 = subtitle)' - example: 1 - default: - type: boolean - description: Indicates if this is the default stream - example: true - selected: - type: boolean - description: Indicates if the stream is selected - example: true - codec: - type: string - description: Codec used by the stream - example: h264 - index: - type: integer - description: The index of the stream - example: 0 - bitrate: - type: integer - description: The bitrate of the stream in kbps - example: 6273 - colorPrimaries: - type: string - description: The color primaries of the video stream - example: bt709 - colorRange: - type: string - description: The color range of the video stream - example: tv - colorSpace: - type: string - description: The color space of the video stream - example: bt709 - colorTrc: - type: string - description: The transfer characteristics (TRC) of the video stream - example: bt709 - bitDepth: - type: integer - description: The bit depth of the video stream - example: 8 - chromaLocation: - type: string - description: The chroma location of the video stream - example: left - streamIdentifier: - type: string - description: The identifier of the video stream - example: '2' - chromaSubsampling: - type: string - description: The chroma subsampling format - example: '4:2:0' - codedHeight: - type: integer - description: The coded height of the video stream - example: 1088 - codedWidth: - type: integer - description: The coded width of the video stream - example: 1920 - frameRate: - type: number - description: The frame rate of the video stream - example: 29.97 - hasScalingMatrix: - type: boolean - description: Indicates if the stream has a scaling matrix - example: false - hearingImpaired: - type: boolean - example: false - closedCaptions: - type: boolean - example: false - embeddedInVideo: - type: string - example: '1' - height: - type: integer - description: The height of the video stream - example: 1080 - level: - type: integer - description: The level of the video codec - example: 40 - profile: - type: string - description: The profile of the video codec - example: main - refFrames: - type: integer - description: Number of reference frames - example: 4 - scanType: - type: string - description: The scan type (progressive or interlaced) - example: progressive - width: - type: integer - description: The width of the video stream - example: 1920 - displayTitle: - type: string - description: Display title of the stream - example: 1080p (H.264) - extendedDisplayTitle: - type: string - description: Extended display title of the stream - example: 1080p (H.264) - channels: - type: integer - description: Number of audio channels (for audio streams) - example: 2 - language: - type: string - description: The language of the stream (for audio/subtitle streams) - example: English - languageTag: - type: string - description: Language tag of the stream - example: en - languageCode: - type: string - description: Language code of the stream - example: eng - audioChannelLayout: - type: string - description: The audio channel layout - example: stereo - samplingRate: - type: integer - description: Sampling rate of the audio stream in Hz - example: 48000 - title: - type: string - description: Title of the subtitle track (for subtitle streams) - example: English - canAutoSync: - type: boolean - description: Indicates if the subtitle stream can auto-sync - example: false - Genre: - type: array - items: - type: object - properties: - tag: - type: string - example: Adventure - Country: - type: array - items: - type: object - properties: - tag: - type: string - example: United States of America - Director: - type: array - items: - type: object - properties: - tag: - type: string - example: James Cameron - Writer: - type: array - items: - type: object - properties: - tag: - type: string - example: James Cameron - Collection: - type: array - items: - type: object - properties: - tag: - type: string - example: Working NL Subs - Role: - type: array - items: - type: object - properties: - id: - type: integer - description: The ID of the tag or actor. - example: 294129 - filter: - type: string - description: The filter used to find the actor or tag. - example: actor=294129 - thumb: - type: string - description: The thumbnail of the actor - example: 'https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg' - tag: - type: string - description: The name of the tag or actor. - example: Mike Smith - tagKey: - type: string - description: Unique identifier for the tag. - example: 668e7e7b22bcad9064350c91 - role: - type: string - description: The role of the actor or tag in the media. - example: Self - Location: - type: array - items: - type: object - properties: - path: - type: string - example: /TV Shows/House - Guid: - x-speakeasy-name-override: MediaGuid - description: | - The Guid object is only included in the response if the `includeGuids` parameter is set to `1`. - type: array - items: - type: object - required: - - id - properties: - id: - type: string - description: | - Can be one of the following formats: - imdb://tt13015952, tmdb://2434012, tvdb://7945991 - example: 'imdb://tt13015952' - UltraBlurColors: - type: object - required: - - topLeft - - topRight - - bottomRight - - bottomLeft - properties: - topLeft: - type: string - example: 11333b - topRight: - type: string - example: 0a232d - bottomRight: - type: string - example: 073958 - bottomLeft: - type: string - example: 1f5066 - Rating: - x-speakeasy-name-override: MetaDataRating - type: array - items: - type: object - required: - - image - - value - - type - properties: - image: - type: string - description: A URI or path to the rating image. - example: 'themoviedb://image.rating' - value: - type: number - format: float - description: The value of the rating. - example: 3 - type: - type: string - description: 'The type of rating (e.g., audience, critic).' - example: audience - Image: - type: array - items: - type: object - required: - - alt - - type - - url - properties: - alt: - type: string - example: Episode 1 - type: - type: string - enum: - - coverPoster - - background - - snapshot - - clearLogo - example: background - url: - type: string - example: /library/metadata/45521/thumb/1644710589 - titleSort: - type: string - example: Whale - viewCount: - type: integer - format: int32 - example: 1 - lastViewedAt: - type: integer - format: int32 - example: 1682752242 - originalTitle: - type: string - example: 映画 ブラッククローバー 魔法帝の剣 - viewOffset: - type: integer - format: int32 - example: 5222500 - skipCount: - type: integer - format: int32 - example: 1 - index: - type: integer - format: int32 - example: 1 - theme: - type: string - example: /library/metadata/1/theme/1705636920 - leafCount: - type: integer - format: int32 - example: 14 - viewedLeafCount: - type: integer - format: int32 - example: 0 - childCount: - type: integer - format: int32 - example: 1 - hasPremiumExtras: - type: string - example: '1' - hasPremiumPrimaryExtra: - type: string - example: '1' - parentRatingKey: - type: string - description: | - The rating key of the parent item. - example: '66' - parentGuid: - type: string - example: 'plex://show/5d9c081b170e24001f2a7be4' - parentStudio: - type: string - example: UCP - parentKey: - type: string - example: /library/metadata/66 - parentTitle: - type: string - example: Caprica - parentIndex: - type: integer - format: int32 - example: 1 - parentYear: - type: integer - format: int32 - example: 2010 - parentThumb: - type: string - example: /library/metadata/66/thumb/1705716261 - parentTheme: - type: string - example: /library/metadata/66/theme/1705716261 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/schemas/MediaContainerWithArtwork' x-codeSamples: - - lang: php - label: libraries - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetSearchAllLibrariesRequest( - query: '', - clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58', - searchTypes: [ - Operations\SearchTypes::People, - ], - ); - - $response = $sdk->library->getSearchAllLibraries( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: libraries - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetSearchAllLibrariesRequest.new(\n query: \"\",\n client_id: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n search_types: [\n ::PlexRubySDK::Operations::SearchTypes::PEOPLE,\n ],\n include_collections: ::PlexRubySDK::Operations::GetSearchAllLibrariesQueryParamIncludeCollections::ENABLE,\n include_external_media: ::PlexRubySDK::Operations::GetSearchAllLibrariesQueryParamIncludeExternalMedia::ENABLE,\n)\n \nres = s.library.get_search_all_libraries(req)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: libraries - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{\n Query: \"\",\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n SearchTypes: []operations.SearchTypes{\n operations.SearchTypesPeople,\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetRandomArtwork(ctx, operations.GetRandomArtworkRequest{ + Sections: []int64{ + 5, + 6, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithArtwork != nil { + // handle response + } + } - lang: java - label: libraries + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetSearchAllLibrariesBadRequest; - import dev.plexapi.plexapi.models.errors.GetSearchAllLibrariesUnauthorized; - import dev.plexapi.plexapi.models.operations.GetSearchAllLibrariesRequest; - import dev.plexapi.plexapi.models.operations.GetSearchAllLibrariesResponse; - import dev.plexapi.plexapi.models.operations.SearchTypes; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetRandomArtworkRequest; + import dev.plexapi.sdk.models.operations.GetRandomArtworkResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; import java.util.List; public class Application { - public static void main(String[] args) throws GetSearchAllLibrariesBadRequest, GetSearchAllLibrariesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetSearchAllLibrariesRequest req = GetSearchAllLibrariesRequest.builder() - .query("") - .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") - .searchTypes(List.of( - SearchTypes.PEOPLE)) + GetRandomArtworkRequest req = GetRandomArtworkRequest.builder() + .sections(List.of( + 5L, + 6L)) .build(); - GetSearchAllLibrariesResponse res = sdk.library().getSearchAllLibraries() + GetRandomArtworkResponse res = sdk.library().getRandomArtwork() .request(req) .call(); - if (res.object().isPresent()) { + if (res.mediaContainerWithArtwork().isPresent()) { // handle response } } } - lang: typescript - label: libraries + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { SearchTypes } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.library.getSearchAllLibraries({ - query: "", - clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", - searchTypes: [ - SearchTypes.People, + const result = await plexAPI.library.getRandomArtwork({ + sections: [ + 5, + 6, ], }); - // Handle the result console.log(result); } run(); - '/library/metadata/{ratingKey}': + /library/sections/all: get: + summary: Get library sections (main Media Provider Only) + operationId: getSections + description: |- + 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). tags: - Library - summary: Get Media Metadata - description: | - This endpoint will return all the (meta)data of a library item specified with by the ratingKey. - operationId: get-media-meta-data - parameters: - - name: ratingKey - in: path - description: the id of the library item to return the children of. - schema: - type: integer - example: 9518 - required: true - - name: includeConcerts - in: query - description: Include concerts data if set to true. - required: false - schema: - type: boolean - example: true - - name: includeExtras - in: query - description: Include extra content (e.g. bonus features). - required: false - schema: - type: boolean - example: true - - name: includeOnDeck - in: query - description: Include on-deck items. - required: false - schema: - type: boolean - example: true - - name: includePopularLeaves - in: query - description: Include popular leaves (episodes/chapters). - required: false - schema: - type: boolean - example: true - - name: includePreferences - in: query - description: Include preferences information. - required: false - schema: - type: boolean - example: true - - name: includeReviews - in: query - description: Include reviews for the content. - required: false - schema: - type: boolean - example: true - - name: includeChapters - in: query - description: Include chapter details. - required: false - schema: - type: boolean - example: true - - name: includeStations - in: query - description: Include station data. - required: false - schema: - type: boolean - example: true - - name: includeExternalMedia - in: query - description: Include external media data. - required: false - schema: - type: boolean - example: true - - name: asyncAugmentMetadata - in: query - description: Trigger asynchronous metadata augmentation. - required: false - schema: - type: boolean - example: true - - name: asyncCheckFiles - in: query - description: Trigger asynchronous file checking. - required: false - schema: - type: boolean - example: true - - name: asyncRefreshAnalysis - in: query - description: Trigger asynchronous refresh of analysis. - required: false - schema: - type: boolean - example: true - - name: asyncRefreshLocalMediaAgent - in: query - description: Trigger asynchronous refresh of the local media agent. - required: false - schema: - type: boolean - example: true responses: '200': - description: The metadata of the library item. + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' content: application/json: schema: - type: object properties: MediaContainer: allOf: - - type: object - required: - - size - properties: - size: - description: Number of media items returned in this response. - type: integer - format: int32 - example: 50 - - type: object - required: - - allowSync - properties: + - $ref: '#/components/schemas/MediaContainer' + - properties: allowSync: - type: boolean - description: Indicates whether syncing is allowed. - example: false - - type: object - required: - - identifier - properties: - identifier: - type: string - description: An plugin identifier for the media container. - example: com.plexapp.plugins.library - - type: object - required: - - librarySectionID - properties: - librarySectionID: - type: integer - description: The unique identifier for the library section. - example: 2 - - type: object - required: - - librarySectionTitle - properties: - librarySectionTitle: - type: string - description: The title of the library section. - example: TV Series - - type: object - required: - - librarySectionTitle - properties: - librarySectionUUID: - type: string - description: The universally unique identifier for the library section. - example: e69655a2-ef48-4aba-bb19-0cc34d1e7d36 - - type: object - required: - - mediaTagPrefix - properties: - mediaTagPrefix: - type: string - description: The prefix used for media tag resource paths. - example: /system/bundle/media/flags/ - - type: object - required: - - mediaTagVersion - properties: - mediaTagVersion: - type: integer - description: The version number for media tags. - example: 1734362201 - - type: object - required: - - Metadata - properties: - Metadata: - type: array - description: An array of metadata items. + $ref: '#/components/schemas/AllowSync' + Directory: items: - type: object - required: - - ratingKey - - key - - guid - - type - - title - - librarySectionTitle - - librarySectionID - - librarySectionKey - - summary - - year - - thumb - - art - - duration - - addedAt - - updatedAt - - Image - - UltraBlurColors - properties: - ratingKey: - type: string - description: The rating key of the metadata item. - example: '44288' - parentRatingKey: - type: string - description: The rating key of the parent of this metadata item. - example: '48047' - grandparentRatingKey: - type: string - description: The rating key of the grandparent of this metadata item. - example: '45520' - parentGuid: - type: string - description: 'A GUID identifying the parent entity (e.g., season) for the item.' - example: 'plex://season/618b89208dde18df707ad15c' - grandparentGuid: - type: string - description: 'A GUID identifying the grandparent entity (e.g., show).' - example: 'plex://show/5e16253691c20300412003a8' - grandparentSlug: - type: string - description: A URL-friendly identifier (slug) for the grandparent entity. - example: alice-in-borderland-2020 - grandparentKey: - type: string - description: A key identifying the grandparent metadata in the library. - example: /library/metadata/45520 - parentKey: - type: string - description: A key identifying the parent metadata in the library. - example: /library/metadata/48047 - key: - type: string - description: The API key to access metadata details. - example: /library/metadata/44288/children - guid: - type: string - description: The globally unique identifier for the item. - example: 'plex://show/5d9c08254eefaa001f5d6dcb' - slug: - type: string - description: A URL-friendly identifier for the item. - example: better-call-saul - studio: - type: string - description: The studio that produced the content. - example: Sony Pictures Television - type: - type: string - description: 'The type of content (e.g., show, movie).' - example: show - title: - type: string - description: The title of the content. - example: Better Call Saul - originalTitle: - type: string - description: The original title of the content. - example: 'Wicked: Part I' - librarySectionTitle: - type: string - description: The title of the library section. - example: 'TV Series ' - librarySectionID: - type: integer - description: The ID of the library section. - example: 2 - librarySectionKey: - type: string - description: The key of the library section. - example: /library/sections/2 - contentRating: - type: string - description: 'The content rating (e.g., TV-MA).' - example: TV-MA - summary: - type: string - description: A summary of the content. - example: 'Before Saul Goodman, he was Jimmy McGill. And if you''re calling Jimmy, you''re in real trouble. The prequel to "Breaking Bad" follows small-time attorney, Jimmy McGill, as he transforms into Walter White''s morally challenged lawyer, Saul Goodman.' - index: - type: integer - description: The index or order of the item. - example: 1 - grandparentTitle: - type: string - description: The title of the grandparent entity (typically the show's title). - example: Alice in Borderland - parentTitle: - type: string - description: The title of the parent entity (typically the season's title). - example: Season 2 - audienceRating: - type: number - format: float - description: The audience rating for the content. - example: 8.7 - viewCount: - type: integer - description: The number of times the item has been viewed. - example: 4 - skipCount: - type: integer - description: The number of times the item has been skipped. - example: 1 - lastViewedAt: - type: integer - description: Unix timestamp of when the item was last viewed. - example: 1625764795 - year: - type: integer - description: The release year. - format: int32 - example: 2015 - rating: - type: number - format: float - description: The general rating - example: 6 - ratingImage: - type: string - description: 'The URL or identifier for the rating image (e.g., Rotten Tomatoes rating image).' - example: 'rottentomatoes://image.rating.ripe' - tagline: - type: string - description: The tagline of the content. - example: Make the call - chapterSource: - type: string - example: media - primaryExtraKey: - type: string - example: /library/metadata/134704 - thumb: - type: string - description: URL of the thumbnail image. - example: /library/metadata/44288/thumb/1736487993 - art: - type: string - description: URL of the art image. - example: /library/metadata/44288/art/1736487993 - theme: - type: string - description: URL of the theme image. - example: /library/metadata/44288/theme/1736487993 - duration: - type: integer - description: Duration of the content in milliseconds. - example: 2700000 - format: int32 - originallyAvailableAt: - type: string - format: date - description: The original release date. - example: '2015-02-08' - leafCount: - type: integer - description: The total number of episodes (or leaves). - example: 63 - viewedLeafCount: - type: integer - description: The number of episodes that have been viewed. - example: 4 - childCount: - type: integer - description: The number of child items. - format: int32 - example: 6 - addedAt: - allOf: - - description: Unix timestamp when the item was added. - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - updatedAt: - allOf: - - description: Unix timestamp when the item was last updated. - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - audienceRatingImage: - type: string - description: The URL for the audience rating image. - example: 'themoviedb://image.rating' - parentIndex: - type: integer - description: 'The index number of the parent entity, which could indicate its order or position.' - example: 2 - parentThumb: - type: string - description: The URL of the parent's thumbnail image. - example: /library/metadata/48047/thumb/1671800243 - grandparentThumb: - type: string - description: The URL of the grandparent's thumbnail image. - example: /library/metadata/45520/thumb/1736488003 - grandparentArt: - type: string - description: The URL of the grandparent's art image. - example: /library/metadata/45520/art/1736488003 - Media: - allOf: - - type: array - description: An array of media file data items. - items: - type: object - required: - - id - - hasVoiceActivity - - Part - properties: - id: - type: integer - description: Unique media identifier. - example: 387322 - duration: - type: integer - format: int32 - description: Duration of the media in milliseconds. - example: 9610350 - bitrate: - type: integer - format: int32 - description: Bitrate in bits per second. - example: 25512 - width: - type: integer - description: Video width in pixels. - example: 3840 - format: int32 - height: - type: integer - description: Video height in pixels. - example: 1602 - format: int32 - aspectRatio: - type: number - format: float - description: Aspect ratio of the video. - example: 2.35 - audioChannels: - type: integer - description: Number of audio channels. - example: 6 - format: int32 - displayOffset: - type: integer - format: int32 - example: 50 - audioCodec: - type: string - description: Audio codec used. - example: eac3 - videoCodec: - type: string - description: Video codec used. - example: hevc - videoResolution: - type: string - description: 'Video resolution (e.g., 4k).' - example: 4k - container: - type: string - description: File container type. - example: mkv - videoFrameRate: - type: string - description: | - Frame rate of the video. Values found include NTSC, PAL, 24p - example: 24p - videoProfile: - type: string - description: 'Video profile (e.g., main 10).' - example: main 10 - hasVoiceActivity: - type: boolean - description: Indicates whether voice activity is detected. - example: false - audioProfile: - type: string - description: 'The audio profile used for the media (e.g., DTS, Dolby Digital, etc.).' - example: dts - optimizedForStreaming: - description: 'Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true' - oneOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - - type: boolean - enum: - - true - - false - has64bitOffsets: - type: boolean - example: false - Part: - type: array - description: An array of parts for this media item. - items: - type: object - required: - - id - - key - - file - - size - properties: - accessible: - type: boolean - description: Indicates if the part is accessible. - example: true - exists: - type: boolean - description: Indicates if the part exists. - example: true - id: - type: integer - description: Unique part identifier. - example: 418385 - key: - type: string - description: Key to access this part. - example: /library/parts/418385/1735864239/file.mkv - indexes: - type: string - example: sd - duration: - type: integer - format: int32 - description: Duration of the part in milliseconds. - example: 9610350 - file: - type: string - description: File path for the part. - example: /mnt/Movies_1/W/Wicked (2024).mkv - size: - description: File size in bytes. - type: integer - example: 30649952104 - packetLength: - type: integer - format: int32 - example: 188 - container: - type: string - description: Container format of the part. - example: mkv - videoProfile: - type: string - description: Video profile for the part. - example: main 10 - audioProfile: - type: string - description: 'The audio profile used for the media (e.g., DTS, Dolby Digital, etc.).' - example: dts - has64bitOffsets: - type: boolean - example: false - optimizedForStreaming: - description: 'Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true' - oneOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - - type: boolean - enum: - - true - - false - hasThumbnail: - allOf: - - description: Indicates if the part has a thumbnail. - - type: string - enum: - - '0' - - '1' - example: '1' - default: '0' - x-speakeasy-enums: - - false - - true - Stream: - type: array - description: An array of streams for this part. - items: - type: object - required: - - id - - streamType - - codec - - index - - language - - languageTag - - languageCode - - displayTitle - - extendedDisplayTitle - properties: - id: - type: integer - description: Unique stream identifier. - example: 1002625 - streamType: - type: integer - format: int32 - description: 'Stream type (1=video, 2=audio, 3=subtitle).' - example: 1 - default: - type: boolean - description: Indicates if this stream is default. - example: true - codec: - type: string - description: Codec used by the stream. - example: hevc - index: - type: integer - format: int32 - description: Index of the stream. - example: 0 - bitrate: - type: integer - format: int32 - description: Bitrate of the stream. - example: 24743 - language: - type: string - description: Language of the stream. - example: English - languageTag: - type: string - description: 'Language tag (e.g., en).' - example: en - languageCode: - type: string - description: ISO language code. - example: eng - headerCompression: - type: boolean - description: Indicates whether header compression is enabled. - example: true - DOVIBLCompatID: - type: integer - format: int32 - description: Dolby Vision BL compatibility ID. - example: 1 - DOVIBLPresent: - type: boolean - description: Indicates if Dolby Vision BL is present. - example: true - DOVIELPresent: - type: boolean - description: Indicates if Dolby Vision EL is present. - example: false - DOVILevel: - type: integer - format: int32 - description: Dolby Vision level. - example: 6 - DOVIPresent: - type: boolean - description: Indicates if Dolby Vision is present. - example: true - DOVIProfile: - type: integer - format: int32 - description: Dolby Vision profile. - example: 8 - DOVIRPUPresent: - type: boolean - description: Indicates if Dolby Vision RPU is present. - example: true - DOVIVersion: - type: string - description: Dolby Vision version. - example: '1.0' - bitDepth: - type: integer - format: int32 - description: Bit depth of the video stream. - example: 10 - chromaLocation: - type: string - description: Chroma sample location. - example: topleft - chromaSubsampling: - type: string - description: Chroma subsampling format. - example: '4:2:0' - codedHeight: - type: integer - format: int32 - description: Coded video height. - example: 1608 - codedWidth: - type: integer - format: int32 - description: Coded video width. - example: 3840 - colorPrimaries: - type: string - description: Color primaries used. - example: bt2020 - colorRange: - type: string - description: 'Color range (e.g., tv).' - example: tv - colorSpace: - type: string - description: Color space. - example: bt2020nc - colorTrc: - type: string - description: Color transfer characteristics. - example: smpte2084 - frameRate: - type: number - format: float - description: Frame rate of the stream. - example: 23.976 - height: - type: integer - format: int32 - description: Height of the video stream. - example: 1602 - level: - type: integer - format: int32 - description: Video level. - example: 150 - original: - type: boolean - description: Indicates if this is the original stream. - example: true - hasScalingMatrix: - type: boolean - example: false - profile: - type: string - description: Video profile. - example: main 10 - scanType: - type: string - example: progressive - refFrames: - type: integer - format: int32 - description: Number of reference frames. - example: 1 - width: - type: integer - format: int32 - description: Width of the video stream. - example: 3840 - displayTitle: - type: string - description: Display title for the stream. - example: 4K DoVi/HDR10 (HEVC Main 10) - extendedDisplayTitle: - type: string - description: Extended display title for the stream. - example: 4K DoVi/HDR10 (HEVC Main 10) - selected: - type: boolean - description: Indicates if this stream is selected (applicable for audio streams). - example: true - forced: - type: boolean - example: true - channels: - type: integer - format: int32 - description: Number of audio channels (for audio streams). - example: 6 - audioChannelLayout: - type: string - description: Audio channel layout. - example: 5.1(side) - samplingRate: - type: integer - format: int32 - description: Sampling rate for the audio stream. - example: 48000 - canAutoSync: - type: boolean - description: Indicates if the stream can auto-sync. - example: false - hearingImpaired: - type: boolean - description: Indicates if the stream is for the hearing impaired. - example: true - dub: - type: boolean - description: Indicates if the stream is a dub. - example: true - title: - type: string - description: 'Optional title for the stream (e.g., language variant).' - example: SDH - Image: - type: array - description: An array of image objects. - items: - type: object - required: - - alt - - type - - url - properties: - alt: - type: string - description: Alternate text for the image. - example: Better Call Saul - type: - type: string - description: 'The type of image (e.g., coverPoster, background, clearLogo).' - example: coverPoster - url: - type: string - description: The URL of the image. - example: /library/metadata/44288/thumb/1736487993 - UltraBlurColors: - type: object - required: - - topLeft - - topRight - - bottomRight - - bottomLeft - properties: - topLeft: - type: string - description: The top-left color value. - example: 11333a - topRight: - type: string - description: The top-right color value. - example: 1d2721 - bottomRight: - type: string - description: The bottom-right color value. - example: 5c451d - bottomLeft: - type: string - description: The bottom-left color value. - example: 372c10 - Genre: - type: array - description: An array of genre tags. - items: - type: object - required: - - id - - filter - - tag - properties: - id: - type: integer - description: The unique genre identifier. - example: 1057 - filter: - type: string - description: The filter string for the genre. - example: genre=1057 - tag: - type: string - description: The genre name. - example: Crime - Country: - type: array - description: An array of country tags. - items: - type: object - required: - - id - - filter - - tag - properties: - id: - type: integer - description: The unique country identifier. - format: int32 - example: 58591 - filter: - type: string - description: The filter string for the country. - example: country=58591 - tag: - type: string - description: The country name. - example: United States of America - Guid: - x-speakeasy-name-override: Guids - type: array - description: An array of GUID objects. - items: - type: object - required: - - id - properties: - id: - type: string - description: The GUID value. - example: 'imdb://tt3032476' - Rating: - x-speakeasy-name-override: Ratings - type: array - description: An array of rating objects. - items: - type: object - required: - - image - - value - - type - properties: - image: - type: string - description: The image or reference for the rating. - example: 'imdb://image.rating' - value: - type: number - format: float - description: The rating value. - example: 9 - type: - type: string - description: 'The type of rating (e.g., audience, critic).' - example: audience - Role: - type: array - description: An array of Actor roles. - items: - type: object - required: - - id - - filter - - tag - - tagKey - properties: - id: - type: integer - description: The unique role identifier. - example: 109501 - filter: - type: string - description: The filter string for the role. - example: actor=109501 - tag: - type: string - description: The actor's name. - example: Bob Odenkirk - tagKey: - type: string - description: A key associated with the actor tag. - example: 5d77683254f42c001f8c3f69 - role: - type: string - description: The character name or role. - example: Jimmy McGill - thumb: - type: string - description: URL for the role thumbnail image. - example: 'https://metadata-static.plex.tv/f/people/f2ca7b474cc984efbdd5c503a096285a.jpg' - Director: - type: array - description: An array of Director roles. - items: - type: object - required: - - id - - filter - - tag - - tagKey - properties: - id: - type: integer - description: The unique role identifier. - example: 109501 - filter: - type: string - description: The filter string for the role. - example: actor=109501 - tag: - type: string - description: The actor's name. - example: Bob Odenkirk - tagKey: - type: string - description: A key associated with the actor tag. - example: 5d77683254f42c001f8c3f69 - role: - type: string - description: The character name or role. - example: Jimmy McGill - thumb: - type: string - description: URL for the role thumbnail image. - example: 'https://metadata-static.plex.tv/f/people/f2ca7b474cc984efbdd5c503a096285a.jpg' - Writer: - type: array - description: An array of Writer roles. - items: - type: object - required: - - id - - filter - - tag - - tagKey - properties: - id: - type: integer - description: The unique role identifier. - example: 109501 - filter: - type: string - description: The filter string for the role. - example: actor=109501 - tag: - type: string - description: The actor's name. - example: Bob Odenkirk - tagKey: - type: string - description: A key associated with the actor tag. - example: 5d77683254f42c001f8c3f69 - role: - type: string - description: The character name or role. - example: Jimmy McGill - thumb: - type: string - description: URL for the role thumbnail image. - example: 'https://metadata-static.plex.tv/f/people/f2ca7b474cc984efbdd5c503a096285a.jpg' - Producer: - type: array - description: An array of Writer roles. - items: - type: object - required: - - id - - filter - - tag - - tagKey - properties: - id: - type: integer - description: The unique role identifier. - example: 109501 - filter: - type: string - description: The filter string for the role. - example: actor=109501 - tag: - type: string - description: The actor's name. - example: Bob Odenkirk - tagKey: - type: string - description: A key associated with the actor tag. - example: 5d77683254f42c001f8c3f69 - role: - type: string - description: The character name or role. - example: Jimmy McGill - thumb: - type: string - description: URL for the role thumbnail image. - example: 'https://metadata-static.plex.tv/f/people/f2ca7b474cc984efbdd5c503a096285a.jpg' - Similar: - type: array - description: An array of similar content objects. - items: - type: object - required: - - id - - filter - - tag - properties: - id: - type: integer - description: The unique similar item identifier. - example: 26 - filter: - type: string - description: The filter string for similar items. - example: similar=26 - tag: - type: string - description: The tag or title of the similar content. - example: Breaking Bad - Location: - type: array - description: An array of location objects. - items: - type: object - required: - - path - properties: - path: - type: string - description: The file path for the location. - example: /TV Shows/Better Call Saul - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - '404': - description: Not Found - Returned if the resource could not be found - content: - text/html: - example: | - - - - Not Found - - -

404 Not Found

- - - x-codeSamples: - - lang: php - label: data - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetMediaMetaDataRequest( - ratingKey: 9518, - includeConcerts: true, - includeExtras: true, - includeOnDeck: true, - includePopularLeaves: true, - includePreferences: true, - includeReviews: true, - includeChapters: true, - includeStations: true, - includeExternalMedia: true, - asyncAugmentMetadata: true, - asyncCheckFiles: true, - asyncRefreshAnalysis: true, - asyncRefreshLocalMediaAgent: true, - ); - - $response = $sdk->library->getMediaMetaData( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: data - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetMediaMetaDataRequest.new(\n rating_key: 9518,\n include_concerts: true,\n include_extras: true,\n include_on_deck: true,\n include_popular_leaves: true,\n include_preferences: true,\n include_reviews: true,\n include_chapters: true,\n include_stations: true,\n include_external_media: true,\n async_augment_metadata: true,\n async_check_files: true,\n async_refresh_analysis: true,\n async_refresh_local_media_agent: true,\n)\n \nres = s.library.get_media_meta_data(req)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: data - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetMediaMetaData(ctx, operations.GetMediaMetaDataRequest{\n RatingKey: 9518,\n IncludeConcerts: plexgo.Bool(true),\n IncludeExtras: plexgo.Bool(true),\n IncludeOnDeck: plexgo.Bool(true),\n IncludePopularLeaves: plexgo.Bool(true),\n IncludePreferences: plexgo.Bool(true),\n IncludeReviews: plexgo.Bool(true),\n IncludeChapters: plexgo.Bool(true),\n IncludeStations: plexgo.Bool(true),\n IncludeExternalMedia: plexgo.Bool(true),\n AsyncAugmentMetadata: plexgo.Bool(true),\n AsyncCheckFiles: plexgo.Bool(true),\n AsyncRefreshAnalysis: plexgo.Bool(true),\n AsyncRefreshLocalMediaAgent: plexgo.Bool(true),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: data - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetMediaMetaDataBadRequest; - import dev.plexapi.plexapi.models.errors.GetMediaMetaDataUnauthorized; - import dev.plexapi.plexapi.models.operations.GetMediaMetaDataRequest; - import dev.plexapi.plexapi.models.operations.GetMediaMetaDataResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetMediaMetaDataBadRequest, GetMediaMetaDataUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetMediaMetaDataRequest req = GetMediaMetaDataRequest.builder() - .ratingKey(9518L) - .includeConcerts(true) - .includeExtras(true) - .includeOnDeck(true) - .includePopularLeaves(true) - .includePreferences(true) - .includeReviews(true) - .includeChapters(true) - .includeStations(true) - .includeExternalMedia(true) - .asyncAugmentMetadata(true) - .asyncCheckFiles(true) - .asyncRefreshAnalysis(true) - .asyncRefreshLocalMediaAgent(true) - .build(); - - GetMediaMetaDataResponse res = sdk.library().getMediaMetaData() - .request(req) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: data - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getMediaMetaData({ - ratingKey: 9518, - includeConcerts: true, - includeExtras: true, - includeOnDeck: true, - includePopularLeaves: true, - includePreferences: true, - includeReviews: true, - includeChapters: true, - includeStations: true, - includeExternalMedia: true, - asyncAugmentMetadata: true, - asyncCheckFiles: true, - asyncRefreshAnalysis: true, - asyncRefreshLocalMediaAgent: true, - }); - - // Handle the result - console.log(result); - } - - run(); - '/library/metadata/{ratingKey}/banner': - get: - tags: - - Media - summary: Get Banner Image - description: Gets the banner image of the media item - operationId: get-banner-image - parameters: - - name: ratingKey - in: path - description: the id of the library item to return the children of. - schema: - type: integer - example: 9518 - required: true - - name: width - in: query - required: true - schema: - type: integer - example: 396 - - name: height - in: query - required: true - schema: - type: integer - example: 396 - - name: minSize - in: query - required: true - schema: - type: integer - example: 1 - - name: upscale - in: query - required: true - schema: - type: integer - example: 1 - - name: X-Plex-Token - in: header - description: 'An authentication token, obtained from plex.tv' - required: true - schema: - type: string - example: CV5xoxjTpFKUzBTShsaf - responses: - '200': - description: Successful response returning an image - headers: - X-Plex-Protocol: - description: Version of the Plex protocol - schema: - type: string - example: '1.0' - Content-Type: - description: The MIME type of the returned content - schema: - type: string - example: image/jpeg - Connection: - description: Connection type - schema: - type: string - example: Keep-Alive - Keep-Alive: - description: Keep-Alive header with timeout value - schema: - type: string - example: timeout=20 - Content-Encoding: - description: Content encoding method - schema: - type: string - example: gzip - X-Plex-Content-Original-Length: - description: Original length of the uncompressed content - schema: - type: integer - format: int32 - example: 92476 - X-Plex-Content-Compressed-Length: - description: Length of the compressed content - schema: - type: integer - format: int32 - example: 92483 - Content-Length: - description: Length of the response content - schema: - type: integer - format: int32 - example: 92483 - Cache-Control: - description: Cache control directives - schema: - type: string - example: max-age=259200 - Date: - description: Date and time the response was generated - schema: - type: string - format: date-time - example: 'Tue, 03 Sep 2024 10:48:05 GMT' - content: - image/jpeg: - schema: - type: string - format: binary - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: image - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetBannerImageRequest( - ratingKey: 9518, - width: 396, - height: 396, - minSize: 1, - upscale: 1, - xPlexToken: 'CV5xoxjTpFKUzBTShsaf', - ); - - $response = $sdk->media->getBannerImage( - request: $request - ); - - if ($response->bytes !== null) { - // handle response - } - - lang: ruby - label: image - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetBannerImageRequest.new(\n rating_key: 9518,\n width: 396,\n height: 396,\n min_size: 1,\n upscale: 1,\n x_plex_token: \"CV5xoxjTpFKUzBTShsaf\",\n)\n \nres = s.media.get_banner_image(req)\n\nif ! res.bytes.nil?\n # handle response\nend" - - lang: go - label: image - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.GetBannerImage(ctx, operations.GetBannerImageRequest{\n RatingKey: 9518,\n Width: 396,\n Height: 396,\n MinSize: 1,\n Upscale: 1,\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseStream != nil {\n // handle response\n }\n}" - - lang: java - label: image - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetBannerImageBadRequest; - import dev.plexapi.plexapi.models.errors.GetBannerImageUnauthorized; - import dev.plexapi.plexapi.models.operations.GetBannerImageRequest; - import dev.plexapi.plexapi.models.operations.GetBannerImageResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetBannerImageBadRequest, GetBannerImageUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetBannerImageRequest req = GetBannerImageRequest.builder() - .ratingKey(9518L) - .width(396L) - .height(396L) - .minSize(1L) - .upscale(1L) - .xPlexToken("CV5xoxjTpFKUzBTShsaf") - .build(); - - GetBannerImageResponse res = sdk.media().getBannerImage() - .request(req) - .call(); - - if (res.responseStream().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: image - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.media.getBannerImage({ - ratingKey: 9518, - width: 396, - height: 396, - minSize: 1, - upscale: 1, - xPlexToken: "CV5xoxjTpFKUzBTShsaf", - }); - - // Handle the result - console.log(result); - } - - run(); - '/library/metadata/{ratingKey}/thumb': - get: - tags: - - Media - summary: Get Thumb Image - description: Gets the thumbnail image of the media item - operationId: get-thumb-image - parameters: - - name: ratingKey - in: path - description: the id of the library item to return the children of. - schema: - type: integer - example: 9518 - required: true - - name: width - in: query - required: true - schema: - type: integer - example: 396 - - name: height - in: query - required: true - schema: - type: integer - example: 396 - - name: minSize - in: query - required: true - schema: - type: integer - example: 1 - - name: upscale - in: query - required: true - schema: - type: integer - example: 1 - - name: X-Plex-Token - in: header - description: 'An authentication token, obtained from plex.tv' - required: true - schema: - type: string - example: CV5xoxjTpFKUzBTShsaf - responses: - '200': - description: Successful response returning an image - headers: - X-Plex-Protocol: - description: Version of the Plex protocol - schema: - type: string - example: '1.0' - Content-Type: - description: The MIME type of the returned content - schema: - type: string - example: image/jpeg - Connection: - description: Connection type - schema: - type: string - example: Keep-Alive - Keep-Alive: - description: Keep-Alive header with timeout value - schema: - type: string - example: timeout=20 - Content-Encoding: - description: Content encoding method - schema: - type: string - example: gzip - X-Plex-Content-Original-Length: - description: Original length of the uncompressed content - schema: - type: integer - format: int32 - example: 92476 - X-Plex-Content-Compressed-Length: - description: Length of the compressed content - schema: - type: integer - format: int32 - example: 92483 - Content-Length: - description: Length of the response content - schema: - type: integer - format: int32 - example: 92483 - Cache-Control: - description: Cache control directives - schema: - type: string - example: max-age=259200 - Date: - description: Date and time the response was generated - schema: - type: string - format: date-time - example: 'Tue, 03 Sep 2024 10:48:05 GMT' - content: - image/jpeg: - schema: - type: string - format: binary - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: image - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetThumbImageRequest( - ratingKey: 9518, - width: 396, - height: 396, - minSize: 1, - upscale: 1, - xPlexToken: 'CV5xoxjTpFKUzBTShsaf', - ); - - $response = $sdk->media->getThumbImage( - request: $request - ); - - if ($response->bytes !== null) { - // handle response - } - - lang: ruby - label: image - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetThumbImageRequest.new(\n rating_key: 9518,\n width: 396,\n height: 396,\n min_size: 1,\n upscale: 1,\n x_plex_token: \"CV5xoxjTpFKUzBTShsaf\",\n)\n \nres = s.media.get_thumb_image(req)\n\nif ! res.bytes.nil?\n # handle response\nend" - - lang: go - label: image - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.GetThumbImage(ctx, operations.GetThumbImageRequest{\n RatingKey: 9518,\n Width: 396,\n Height: 396,\n MinSize: 1,\n Upscale: 1,\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseStream != nil {\n // handle response\n }\n}" - - lang: java - label: image - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetThumbImageBadRequest; - import dev.plexapi.plexapi.models.errors.GetThumbImageUnauthorized; - import dev.plexapi.plexapi.models.operations.GetThumbImageRequest; - import dev.plexapi.plexapi.models.operations.GetThumbImageResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetThumbImageBadRequest, GetThumbImageUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetThumbImageRequest req = GetThumbImageRequest.builder() - .ratingKey(9518L) - .width(396L) - .height(396L) - .minSize(1L) - .upscale(1L) - .xPlexToken("CV5xoxjTpFKUzBTShsaf") - .build(); - - GetThumbImageResponse res = sdk.media().getThumbImage() - .request(req) - .call(); - - if (res.responseStream().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: image - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.media.getThumbImage({ - ratingKey: 9518, - width: 396, - height: 396, - minSize: 1, - upscale: 1, - xPlexToken: "CV5xoxjTpFKUzBTShsaf", - }); - - // Handle the result - console.log(result); - } - - run(); - '/library/metadata/{ratingKey}/children': - get: - tags: - - Library - summary: Get Items Children - description: | - This endpoint will return the children of of a library item specified with the ratingKey. - operationId: getMetadataChildren - parameters: - - name: ratingKey - description: the id of the library item to return the children of. - in: path - schema: - type: number - required: true - - name: includeElements - description: | - Adds additional elements to the response. Supported types are (Stream) - in: query - schema: - type: string - required: false - examples: - include-stream: - value: Stream - include-stream-otheritem: - value: 'Stream,OtherItem' - include-stream-otheritem-anotheritem: - value: 'Stream,OtherItem,AnotherItem' - responses: - '200': - description: The children of the library item. - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 3 - allowSync: - type: boolean - example: true - art: - type: string - example: /library/metadata/30072/art/1705739923 - identifier: - type: string - example: com.plexapp.plugins.library - key: - type: string - example: '30072' - librarySectionID: - type: integer - format: int32 - example: 2 - librarySectionTitle: - type: string - example: TV Shows - librarySectionUUID: - type: string - example: 4bb2521c-8ba9-459b-aaee-8ab8bc35eabd - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: integer - format: int32 - example: 1701731894 - nocache: - type: boolean - example: true - parentIndex: - type: integer - format: int32 - example: 1 - parentTitle: - type: string - example: Reacher - parentYear: - type: integer - format: int32 - example: 2022 - summary: - type: string - example: 'When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.' - theme: - type: string - example: /library/metadata/30072/theme/1705739923 - thumb: - type: string - example: /library/metadata/30072/thumb/1705739923 - title1: - type: string - example: TV Shows - title2: - type: string - example: Reacher - viewGroup: - type: string - example: season - viewMode: - type: integer - format: int32 - example: 65593 - Directory: - type: array - items: - type: object - properties: - leafCount: - type: integer - format: int32 - example: 16 - thumb: - type: string - example: /library/metadata/30072/thumb/1705739923 - viewedLeafCount: - type: integer - format: int32 - example: 16 - key: - type: string - example: /library/metadata/30072/allLeaves - title: - type: string - example: All episodes - example: - - leafCount: 16 - thumb: /library/metadata/30072/thumb/1705739923 - viewedLeafCount: 16 - key: /library/metadata/30072/allLeaves - title: All episodes - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '66488' - key: - type: string - example: /library/metadata/66488/children - parentRatingKey: - type: string - example: '30072' - guid: - type: string - example: 'plex://season/652aea6549508477c34c6000' - parentGuid: - type: string - example: 'plex://show/5d9c09190aaccd001f8f42f0' - parentStudio: - type: string - example: Amazon Studios - type: - type: string - example: season - title: - type: string - example: Season 2 - parentKey: - type: string - example: /library/metadata/30072 - parentTitle: - type: string - example: Reacher - summary: - type: string - example: 'Based on"Bad Luck and Trouble," when members of Reacher''s old military unit start turning up dead, Reacher has just one thing on his mind-revenge.' - index: - type: integer - format: int32 - example: 2 - parentIndex: - type: integer - format: int32 - example: 1 - viewCount: - type: integer - format: int32 - example: 11 - lastViewedAt: - type: integer - format: int32 - example: 1705646565 - parentYear: - type: integer - format: int32 - example: 2022 - thumb: - type: string - example: /library/metadata/66488/thumb/1703065033 - art: - type: string - example: /library/metadata/30072/art/1705739923 - parentThumb: - type: string - example: /library/metadata/30072/thumb/1705739923 - parentTheme: - type: string - example: /library/metadata/30072/theme/1705739923 - leafCount: - type: integer - format: int32 - example: 8 - viewedLeafCount: - type: integer - format: int32 - example: 8 - addedAt: - type: integer - format: int32 - example: 1702602021 - updatedAt: - type: integer - format: int32 - example: 1703065033 - userRating: - type: integer - format: int32 - example: 9 - skipCount: - type: integer - format: int32 - example: 1 - lastRatedAt: - type: integer - format: int32 - example: 1703881224 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getMetadataChildren - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getMetadataChildren( - ratingKey: 1539.14, - includeElements: '' - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getMetadataChildren - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_metadata_children(rating_key=1539.14, include_elements=\"\")\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getMetadataChildren - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetMetadataChildren(ctx, 1539.14, plexgo.String(\"Stream\"))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getMetadataChildren - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetMetadataChildrenBadRequest; - import dev.plexapi.plexapi.models.errors.GetMetadataChildrenUnauthorized; - import dev.plexapi.plexapi.models.operations.GetMetadataChildrenResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetMetadataChildrenBadRequest, GetMetadataChildrenUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetMetadataChildrenResponse res = sdk.library().getMetadataChildren() - .ratingKey(1539.14d) - .includeElements("Stream") - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getMetadataChildren - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getMetadataChildren(1539.14, "Stream"); - - // Handle the result - console.log(result); - } - - run(); - /library/all/top: - get: - tags: - - Library - summary: Get Top Watched Content - description: | - This endpoint will return the top watched content from libraries of a certain type - operationId: getTopWatchedContent - parameters: - - name: includeGuids - in: query - description: | - Adds the Guids object to the response - schema: - type: integer - required: false - example: 1 - - name: type - in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - responses: - '200': - description: The metadata of the library item. - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 1 - allowSync: - type: boolean - example: true - identifier: - type: string - example: com.plexapp.plugins.library - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: integer - format: int32 - example: 1698860922 - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '17' - key: - type: string - example: /library/metadata/17 - guid: - type: string - example: 'plex://movie/5d77683f6f4521001ea9dc53' - slug: - type: string - example: waterloo-road - studio: - type: string - example: Universal Pictures - type: - type: string - example: movie - title: - type: string - example: Serenity - librarySectionTitle: - type: string - example: Movies - librarySectionID: - type: integer - format: int32 - example: 1 - librarySectionKey: - type: string - example: /library/sections/1 - contentRating: - type: string - example: PG-13 - summary: - type: string - example: 'Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she''s not even aware - so dangerous, no one''s safe, as an Alliance operative''s sent to capture her, and all others are considered irrelevant to his job.' - index: - type: integer - example: 1 - audienceRating: - type: number - example: 9.1 - year: - type: integer - format: int32 - example: 2005 - tagline: - type: string - example: They aim to misbehave. - thumb: - type: string - example: /library/metadata/17/thumb/1705637165 - art: - type: string - example: /library/metadata/17/art/1705637165 - duration: - type: integer - format: int32 - example: 141417 - originallyAvailableAt: - type: string - format: date - example: 2005-09-29T00:00:00.000Z - leafCount: - type: integer - example: 222 - viewedLeafCount: - type: integer - example: 100 - childCount: - type: integer - example: 13 - addedAt: - type: integer - format: int32 - example: 1705637164 - updatedAt: - type: integer - format: int32 - example: 1705637165 - globalViewCount: - type: integer - example: 80 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - Genre: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 184 - filter: - type: string - example: genre=184 - tag: - type: string - example: Thriller - Country: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 116 - filter: - type: string - example: country=116 - tag: - type: string - example: United States of America - Guid: - x-speakeasy-name-override: guids - type: array - items: - type: object - properties: - id: - type: string - example: 'tvdb://2337' - Role: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 220 - filter: - type: string - example: actor=220 - tag: - type: string - example: Dennis Keiffer - tagKey: - type: string - example: 5d77683554f42c001f8c4708 - role: - type: string - example: Bar Guy (uncredited) - thumb: - type: string - example: 'https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg' - User: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 220 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getTopWatchedContent - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getTopWatchedContent( - type: Operations\GetTopWatchedContentQueryParamType::TvShow, - includeGuids: 1 - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getTopWatchedContent - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_top_watched_content(type=::PlexRubySDK::Operations::GetTopWatchedContentQueryParamType::TV_SHOW, include_guids=1)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getTopWatchedContent - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetTopWatchedContent(ctx, operations.GetTopWatchedContentQueryParamTypeTvShow, plexgo.Int64(1))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getTopWatchedContent - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetTopWatchedContentBadRequest; - import dev.plexapi.plexapi.models.errors.GetTopWatchedContentUnauthorized; - import dev.plexapi.plexapi.models.operations.GetTopWatchedContentQueryParamType; - import dev.plexapi.plexapi.models.operations.GetTopWatchedContentResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetTopWatchedContentBadRequest, GetTopWatchedContentUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetTopWatchedContentResponse res = sdk.library().getTopWatchedContent() - .includeGuids(1L) - .type(GetTopWatchedContentQueryParamType.TvShow) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getTopWatchedContent - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { GetTopWatchedContentQueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getTopWatchedContent(GetTopWatchedContentQueryParamType.TvShow, 1); - - // Handle the result - console.log(result); - } - - run(); - /library/onDeck: - get: - tags: - - Library - summary: Get On Deck - description: | - This endpoint will return the on deck content. - operationId: getOnDeck - responses: - '200': - description: The on Deck content - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: number - example: 16 - allowSync: - type: boolean - identifier: - type: string - example: com.plexapp.plugins.library - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: number - example: 1680021154 - mixedParents: - type: boolean - Metadata: - type: array - items: - type: object - properties: - allowSync: - type: boolean - librarySectionID: - type: number - example: 2 - librarySectionTitle: - type: string - example: TV Shows - librarySectionUUID: - type: string - example: 4bb2521c-8ba9-459b-aaee-8ab8bc35eabd - ratingKey: - type: number - example: 49564 - key: - type: string - example: /library/metadata/49564 - parentRatingKey: - type: number - example: 49557 - grandparentRatingKey: - type: number - example: 49556 - guid: - type: string - example: 'plex://episode/5ea7d7402e7ab10042e74d4f' - parentGuid: - type: string - example: 'plex://season/602e754d67f4c8002ce54b3d' - grandparentGuid: - type: string - example: 'plex://show/5d9c090e705e7a001e6e94d8' - type: - type: string - example: episode - title: - type: string - example: Circus - grandparentKey: - type: string - example: /library/metadata/49556 - parentKey: - type: string - example: /library/metadata/49557 - librarySectionKey: - type: string - example: /library/sections/2 - grandparentTitle: - type: string - example: Bluey (2018) - parentTitle: - type: string - example: Season 2 - contentRating: - type: string - example: TV-Y - summary: - type: string - example: Bluey is the ringmaster in a game of circus with her friends but Hercules wants to play his motorcycle game instead. Luckily Bluey has a solution to keep everyone happy. - index: - type: number - example: 33 - parentIndex: - type: number - example: 2 - lastViewedAt: - type: number - example: 1681908352 - year: - type: number - example: 2018 - thumb: - type: string - example: /library/metadata/49564/thumb/1654258204 - art: - type: string - example: /library/metadata/49556/art/1680939546 - parentThumb: - type: string - example: /library/metadata/49557/thumb/1654258204 - grandparentThumb: - type: string - example: /library/metadata/49556/thumb/1680939546 - grandparentArt: - type: string - example: /library/metadata/49556/art/1680939546 - grandparentTheme: - type: string - example: /library/metadata/49556/theme/1680939546 - duration: - type: number - example: 420080 - originallyAvailableAt: - type: string - format: date-time - example: 2020-10-31T00:00:00.000Z - addedAt: - type: number - example: 1654258196 - updatedAt: - type: number - example: 1654258204 - Media: - type: array - items: - type: object - properties: - id: - type: number - example: 80994 - duration: - type: number - example: 420080 - bitrate: - type: number - example: 1046 - width: - type: number - example: 1920 - height: - type: number - example: 1080 - aspectRatio: - type: number - example: 1.78 - audioChannels: - type: number - example: 2 - audioCodec: - type: string - example: aac - videoCodec: - type: string - example: hevc - videoResolution: - type: string - example: '1080' - container: - type: string - example: mkv - videoFrameRate: - type: string - example: PAL - audioProfile: - type: string - example: lc - videoProfile: - type: string - example: main - Part: - type: array - items: - type: object - properties: - id: - type: number - example: 80994 - key: - type: string - example: /library/parts/80994/1655007810/file.mkv - duration: - type: number - example: 420080 - file: - type: string - example: /tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv - size: - type: number - example: 55148931 - audioProfile: - type: string - example: lc - container: - type: string - example: mkv - videoProfile: - type: string - example: main - Stream: - type: array - items: - type: object - properties: - id: - type: number - example: 211234 - streamType: - type: number - example: 1 - default: - type: boolean - codec: - type: string - example: hevc - index: - type: number - example: 0 - bitrate: - type: number - example: 918 - language: - type: string - example: English - languageTag: - type: string - example: en - languageCode: - type: string - example: eng - bitDepth: - type: number - example: 8 - chromaLocation: - type: string - example: left - chromaSubsampling: - type: string - example: '4:2:0' - codedHeight: - type: number - example: 1080 - codedWidth: - type: number - example: 1920 - colorRange: - type: string - example: tv - frameRate: - type: number - example: 25 - height: - type: number - example: 1080 - level: - type: number - example: 120 - profile: - type: string - example: main - refFrames: - type: number - example: 1 - width: - type: number - example: 1920 - displayTitle: - type: string - example: 1080p (HEVC Main) - extendedDisplayTitle: - type: string - example: 1080p (HEVC Main) - Guid: - x-speakeasy-name-override: guids - type: array - items: - type: object - properties: - id: - type: string - example: 'imdb://tt13303712' - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getOnDeck - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->library->getOnDeck( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getOnDeck - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.library.get_on_deck()\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getOnDeck - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetOnDeck(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getOnDeck - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetOnDeckBadRequest; - import dev.plexapi.plexapi.models.errors.GetOnDeckUnauthorized; - import dev.plexapi.plexapi.models.operations.GetOnDeckResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetOnDeckBadRequest, GetOnDeckUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetOnDeckResponse res = sdk.library().getOnDeck() - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getOnDeck - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.library.getOnDeck(); - - // Handle the result - console.log(result); - } - - run(); - /resources: - get: - servers: - - url: 'https://plex.tv/api/v2' - tags: - - Plex - summary: Get Server Resources - description: Get Plex server access tokens and server connections - operationId: get-server-resources - parameters: - - name: includeHttps - in: query - description: Include Https entries in the results - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: includeRelay - in: query - description: "Include Relay addresses in the results \nE.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400\n" - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: includeIPv6 - in: query - description: Include IPv6 entries in the results - schema: - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - name: X-Plex-Client-Identifier - x-speakeasy-name-override: ClientID - description: 'An opaque identifier unique to the client (UUID, serial number, or other unique device ID)' - required: true - in: header - schema: - type: string - example: 3381b62b-9ab7-4e37-827b-203e9809eb58 - responses: - '200': - description: List of Plex Devices. This includes Plex hosted servers and clients - content: - application/json: - schema: - type: array - items: - title: PlexDevice - type: object - required: - - name - - product - - productVersion - - platform - - platformVersion - - device - - clientIdentifier - - createdAt - - lastSeenAt - - provides - - ownerId - - sourceTitle - - publicAddress - - accessToken - - owned - - home - - synced - - relay - - presence - - httpsRequired - - publicAddressMatches - - dnsRebindingProtection - - natLoopbackSupported - - connections - properties: - name: - type: string - product: - type: string - productVersion: - type: string - platform: - type: - - 'null' - - string - platformVersion: - type: - - 'null' - - string - device: - type: - - 'null' - - string - clientIdentifier: - type: string - createdAt: - allOf: - - type: string - format: date-time - example: '2019-06-24T11:38:02Z' - - description: The time the device was created/registered - lastSeenAt: - allOf: - - type: string - format: date-time - example: '2019-06-24T11:38:02Z' - - description: The last time the device was seen - provides: - type: string - ownerId: - description: ownerId is null when the device is owned by the token used to send the request - type: - - 'null' - - integer - sourceTitle: - type: - - 'null' - - string - publicAddress: - type: string - accessToken: - type: string - owned: - type: boolean - home: - type: boolean - synced: - type: boolean - relay: - type: boolean - presence: - type: boolean - httpsRequired: - type: boolean - publicAddressMatches: - type: boolean - dnsRebindingProtection: - type: boolean - natLoopbackSupported: - type: boolean - connections: - type: array - items: + $ref: '#/components/schemas/LibrarySection' + type: array + title1: + description: Typically just "Plex Library" + type: string type: object - required: - - protocol - - address - - port - - uri - - local - - relay - - IPv6 - properties: - protocol: - description: 'The protocol used for the connection (http, https, etc)' - example: http - type: string - enum: - - http - - https - address: - description: The (ip) address or domain name used for the connection - type: string - port: - description: The port used for the connection - type: integer - format: int32 - uri: - description: The full URI of the connection - type: string - local: - description: If the connection is local address - type: boolean - relay: - description: If the connection is relayed through plex.direct - type: boolean - IPv6: - description: If the connection is using IPv6 - type: boolean - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - - lang: php - label: resources - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->plex->getServerResources( - clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58', - includeHttps: Operations\IncludeHttps::Enable, - includeRelay: Operations\IncludeRelay::Enable, - includeIPv6: Operations\IncludeIPv6::Enable - - ); - - if ($response->plexDevices !== null) { - // handle response - } - - lang: ruby - label: resources - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.plex.get_server_resources(client_id=\"3381b62b-9ab7-4e37-827b-203e9809eb58\", include_https=::PlexRubySDK::Operations::IncludeHttps::ENABLE, include_relay=::PlexRubySDK::Operations::IncludeRelay::ENABLE, include_i_pv6=::PlexRubySDK::Operations::IncludeIPv6::ENABLE)\n\nif ! res.plex_devices.nil?\n # handle response\nend" - lang: go - label: resources - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetServerResources(ctx, \"3381b62b-9ab7-4e37-827b-203e9809eb58\", nil, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.PlexDevices != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Library.GetSections(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: resources + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetServerResourcesBadRequest; - import dev.plexapi.plexapi.models.errors.GetServerResourcesUnauthorized; - import dev.plexapi.plexapi.models.operations.GetServerResourcesResponse; - import dev.plexapi.plexapi.models.operations.IncludeHttps; - import dev.plexapi.plexapi.models.operations.IncludeIPv6; - import dev.plexapi.plexapi.models.operations.IncludeRelay; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSectionsResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetServerResourcesBadRequest, GetServerResourcesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetServerResourcesResponse res = sdk.plex().getServerResources() - .includeHttps(IncludeHttps.Enable) - .includeRelay(IncludeRelay.Enable) - .includeIPv6(IncludeIPv6.Enable) - .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") + GetSectionsResponse res = sdk.library().getSections() .call(); - if (res.plexDevices().isPresent()) { + if (res.object().isPresent()) { // handle response } } } - lang: typescript - label: resources + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - const plexAPI = new PlexAPI({ - accessToken: "", - }); + const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.plex.getServerResources("3381b62b-9ab7-4e37-827b-203e9809eb58"); + const result = await plexAPI.library.getSections(); - // Handle the result console.log(result); } run(); - /log: - get: + post: + summary: Add a library section + operationId: addSection + description: Add a new library section to the server tags: - - Log - summary: Logging a single line message. - description: | - This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log. - operationId: logLine + - Library + security: + - token: + - admin parameters: - - name: level - description: "An integer log level to write to the PMS log with. \n0: Error \n1: Warning \n2: Info \n3: Debug \n4: Verbose\n" + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: name + description: The name of the new section in: query + required: true + schema: + type: string + - name: type + description: The type of library section + in: query + required: true schema: type: integer - enum: - - 0 - - 1 - - 2 - - 3 - - 4 - required: true - - name: message - description: The text of the message to write to the log. + - name: scanner + description: The scanner this section should use in: query schema: type: string - example: Test log message + - name: agent + description: The agent this section should use for metadata + in: query required: true - - name: source - description: a string indicating the source of the message. + schema: + type: string + - name: metadataAgentProviderGroupId + description: The agent group id for this section in: query schema: type: string - example: Postman + - name: language + description: The language of this section + in: query required: true + schema: + type: string + - name: locations + description: The locations on disk to add to this section + in: query + schema: + type: array + items: + type: string + example: + - O:\fatboy\Media\Ripped\Music + - O:\fatboy\Media\My Music + - name: prefs + description: The preferences for this section + in: query + style: deepObject + schema: + type: object + example: + collectionMode: 2 + hidden: 0 + - name: relative + description: If set, paths are relative to `Media Upload` path + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: importFromiTunes + description: If set, import media from iTunes. + in: query + schema: + $ref: "#/components/schemas/BoolInt" responses: '200': - description: Log Message Posted successfully + $ref: '#/components/responses/slash-get-responses-200' '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: Section cannot be created due to bad parameters in request content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} x-codeSamples: - - lang: php - label: logLine - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->log->logLine( - level: Operations\Level::Three, - message: 'Test log message', - source: 'Postman' - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: logLine - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.log.log_line(level=::PlexRubySDK::Operations::Level::THREE, message=\"Test log message\", source=\"Postman\")\n\nif res.status_code == 200\n # handle response\nend" - lang: go - label: logLine - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Log.LogLine(ctx, operations.LevelThree, \"Test log message\", \"Postman\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.AddSection(ctx, operations.AddSectionRequest{ + Name: "", + Type: 39544, + Agent: "", + Language: "", + Locations: []string{ + "O:\fatboy\\Media\\Ripped\\Music", + "O:\fatboy\\Media\\My Music", + }, + Prefs: &operations.QueryParamPrefs{}, + Relative: components.BoolIntOne.ToPointer(), + ImportFromiTunes: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.SlashGetResponses200 != nil { + // handle response + } + } - lang: java - label: logLine + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.LogLineBadRequest; - import dev.plexapi.plexapi.models.errors.LogLineUnauthorized; - import dev.plexapi.plexapi.models.operations.Level; - import dev.plexapi.plexapi.models.operations.LogLineResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddSectionRequest req = AddSectionRequest.builder() + .name("") + .type(39544L) + .agent("") + .language("") + .locations(List.of( + "O:\fatboy\\Media\\Ripped\\Music", + "O:\fatboy\\Media\\My Music")) + .prefs(QueryParamPrefs.builder() + .build()) + .relative(BoolInt.ONE) + .importFromiTunes(BoolInt.ONE) + .build(); + + AddSectionResponse res = sdk.library().addSection() + .request(req) + .call(); + + if (res.slashGetResponses200().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.addSection({ + name: "", + type: 39544, + agent: "", + language: "", + locations: [ + "O:\fatboy\\Media\\Ripped\\Music", + "O:\fatboy\\Media\\My Music", + ], + prefs: {}, + relative: BoolInt.One, + importFromiTunes: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/sections/all/refresh: + delete: + summary: Stop refresh + operationId: stopAllRefreshes + description: Stop all refreshes across all sections + tags: + - Library + security: + - token: + - admin + responses: + '200': + $ref: '#/components/responses/LibrarySections' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Library.StopAllRefreshes(ctx) + if err != nil { + log.Fatal(err) + } + if res.LibrarySections != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.StopAllRefreshesResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws LogLineBadRequest, LogLineUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - LogLineResponse res = sdk.log().logLine() - .level(Level.THREE) - .message("Test log message") - .source("Postman") + StopAllRefreshesResponse res = sdk.library().stopAllRefreshes() + .call(); + + if (res.librarySections().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.library.stopAllRefreshes(); + + console.log(result); + } + + run(); + /library/sections/prefs: + get: + summary: Get section prefs + operationId: getSectionsPrefs + description: Get a section's preferences for a metadata type + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: type + description: The metadata type + in: query + required: true + schema: + type: integer + - name: agent + description: The metadata agent in use + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/LibrarySections' + '400': + description: type not provided or not an integer + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetSectionsPrefs(ctx, operations.GetSectionsPrefsRequest{ + Type: 460221, + }) + if err != nil { + log.Fatal(err) + } + if res.LibrarySections != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSectionsPrefsRequest; + import dev.plexapi.sdk.models.operations.GetSectionsPrefsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSectionsPrefsRequest req = GetSectionsPrefsRequest.builder() + .type(460221L) + .build(); + + GetSectionsPrefsResponse res = sdk.library().getSectionsPrefs() + .request(req) + .call(); + + if (res.librarySections().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getSectionsPrefs({ + type: 460221, + }); + + console.log(result); + } + + run(); + /library/sections/refresh: + post: + summary: Refresh all sections + operationId: refreshSectionsMetadata + description: Tell PMS to refresh all section metadata + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: force + description: Force refresh of metadata + in: query + schema: + type: boolean + responses: + '200': + $ref: '#/components/responses/200' + '503': + description: Server cannot refresh a music library when not signed in + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.RefreshSectionsMetadata(ctx, operations.RefreshSectionsMetadataRequest{}) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RefreshSectionsMetadataRequest; + import dev.plexapi.sdk.models.operations.RefreshSectionsMetadataResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RefreshSectionsMetadataRequest req = RefreshSectionsMetadataRequest.builder() + .build(); + + RefreshSectionsMetadataResponse res = sdk.library().refreshSectionsMetadata() + .request(req) .call(); // handle response } } - lang: typescript - label: logLine + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { Level } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.log.logLine(Level.Three, "Test log message", "Postman"); + const result = await plexAPI.library.refreshSectionsMetadata({}); + + console.log(result); + } + + run(); + /library/tags: + get: + summary: Get all library tags of a type + operationId: getTags + description: Get all library tags of a type + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/type' + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Directory: + items: + properties: + filter: + description: The filter string to view metadata wit this tag + type: string + id: + type: integer + tag: + description: The name of the tag + type: string + tagKey: + description: The key of this tag. This is a universal key across all PMS instances and plex.tv services + type: string + tagType: + description: The type of the tag + type: integer + thumb: + description: The URL to a thumbnail for this tag + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetTags(ctx, operations.GetTagsRequest{}) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetTagsRequest; + import dev.plexapi.sdk.models.operations.GetTagsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetTagsRequest req = GetTagsRequest.builder() + .build(); + + GetTagsResponse res = sdk.library().getTags() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getTags({}); + + console.log(result); + } + + run(); + /livetv/dvrs: + get: + summary: Get DVRs + operationId: listDVRs + description: Get the list of all available DVRs + tags: + - DVRs + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.DVRs.ListDVRs(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListDVRsResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListDVRsResponse res = sdk.dvRs().listDVRs() + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.dvRs.listDVRs(); - // Handle the result console.log(result); } run(); post: + summary: Create a DVR + operationId: createDVR + description: Creation of a DVR, after creation of a devcie and a lineup is selected tags: - - Log - summary: Logging a multi-line message - description: "This endpoint allows for the batch addition of log entries to the main Plex Media Server log. \nIt accepts a text/plain request body, where each line represents a distinct log entry. \nEach log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'. \n\nLog entries are separated by a newline character (`\\n`). \nEach entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters. \nThis method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests. \n\nThe 'level' parameter specifies the log entry's severity or importance, with the following integer values:\n- `0`: Error - Critical issues that require immediate attention.\n- `1`: Warning - Important events that are not critical but may indicate potential issues.\n- `2`: Info - General informational messages about system operation.\n- `3`: Debug - Detailed information useful for debugging purposes.\n- `4`: Verbose - Highly detailed diagnostic information for in-depth analysis.\n\nThe 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).\n\nExample of a single log entry format:\n`level=4&message=Sample%20log%20entry&source=applicationName`\n\nEnsure each parameter is properly URL-encoded to avoid interpretation issues.\n" - operationId: logMultiLine - requestBody: - required: true - content: - text/plain: - schema: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: lineup + description: The EPG lineup. + in: query + schema: + type: string + example: lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT + - name: device + description: The device. + in: query + schema: + type: array + items: type: string - example: |- - level=4&message=Test%20message%201&source=postman - level=3&message=Test%20message%202&source=postman - level=1&message=Test%20message%203&source=postman + example: device[]=device://tv.plex.grabbers.hdhomerun/1053C0CA + - name: language + description: The language. + in: query + schema: + type: string + example: eng responses: '200': - description: Multi-Line Log Message Posted successfully + $ref: '#/components/responses/dvrRequestHandler_slash-get-responses-200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.CreateDVR(ctx, operations.CreateDVRRequest{ + Lineup: plexgo.Pointer("lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT"), + DeviceQueryParameter: []string{ + "d", + "e", + "v", + "i", + "c", + "e", + "[", + "]", + "=", + "d", + "e", + "v", + "i", + "c", + "e", + ":", + "/", + "/", + "t", + "v", + ".", + "p", + "l", + "e", + "x", + ".", + "g", + "r", + "a", + "b", + "b", + "e", + "r", + "s", + ".", + "h", + "d", + "h", + "o", + "m", + "e", + "r", + "u", + "n", + "/", + "1", + "0", + "5", + "3", + "C", + "0", + "C", + "A", + }, + Language: plexgo.Pointer("eng"), + }) + if err != nil { + log.Fatal(err) + } + if res.DvrRequestHandlerSlashGetResponses200 != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CreateDVRRequest; + import dev.plexapi.sdk.models.operations.CreateDVRResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreateDVRRequest req = CreateDVRRequest.builder() + .lineup("lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT") + .deviceQueryParameter(List.of( + "d", + "e", + "v", + "i", + "c", + "e", + "[", + "]", + "=", + "d", + "e", + "v", + "i", + "c", + "e", + ":", + "/", + "/", + "t", + "v", + ".", + "p", + "l", + "e", + "x", + ".", + "g", + "r", + "a", + "b", + "b", + "e", + "r", + "s", + ".", + "h", + "d", + "h", + "o", + "m", + "e", + "r", + "u", + "n", + "/", + "1", + "0", + "5", + "3", + "C", + "0", + "C", + "A")) + .language("eng") + .build(); + + CreateDVRResponse res = sdk.dvRs().createDVR() + .request(req) + .call(); + + if (res.dvrRequestHandlerSlashGetResponses200().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.createDVR({ + lineup: "lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT", + deviceQueryParameter: [ + "d", + "e", + "v", + "i", + "c", + "e", + "[", + "]", + "=", + "d", + "e", + "v", + "i", + "c", + "e", + ":", + "/", + "/", + "t", + "v", + ".", + "p", + "l", + "e", + "x", + ".", + "g", + "r", + "a", + "b", + "b", + "e", + "r", + "s", + ".", + "h", + "d", + "h", + "o", + "m", + "e", + "r", + "u", + "n", + "/", + "1", + "0", + "5", + "3", + "C", + "0", + "C", + "A", + ], + language: "eng", + }); + + console.log(result); + } + + run(); + /livetv/epg/channelmap: + get: + summary: Compute the best channel map + operationId: computeChannelMap + description: Compute the best channel map, given device and lineup + tags: + - EPG + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: device + description: The URI describing the device + in: query + required: true + schema: + type: string + - name: lineup + description: The URI describing the lineup + in: query + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + ChannelMapping: + items: + properties: + channelKey: + type: string + deviceIdentifier: + description: The channel description on the device + type: string + favorite: + type: boolean + lineupIdentifier: + description: The channel identifier in the lineup + type: string + type: object + type: array + type: object + type: object + '404': + description: No device or provider with the identifier was found + content: + text/html: {} + '500': + description: Failed to compute channel map + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Epg.ComputeChannelMap(ctx, operations.ComputeChannelMapRequest{ + DeviceQueryParameter: "", + Lineup: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ComputeChannelMapRequest; + import dev.plexapi.sdk.models.operations.ComputeChannelMapResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ComputeChannelMapRequest req = ComputeChannelMapRequest.builder() + .deviceQueryParameter("") + .lineup("") + .build(); + + ComputeChannelMapResponse res = sdk.epg().computeChannelMap() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.epg.computeChannelMap({ + deviceQueryParameter: "", + lineup: "", + }); + + console.log(result); + } + + run(); + /livetv/epg/channels: + get: + summary: Get channels for a lineup + operationId: getChannels + description: Get channels for a lineup within an EPG provider + tags: + - EPG + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: lineup + description: The URI describing the lineup + in: query + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Channel: + items: + $ref: '#/components/schemas/Channel' + type: array + type: object + type: object + '404': + description: No provider with the identifier was found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Epg.GetChannels(ctx, operations.GetChannelsRequest{ + Lineup: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetChannelsRequest; + import dev.plexapi.sdk.models.operations.GetChannelsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetChannelsRequest req = GetChannelsRequest.builder() + .lineup("") + .build(); + + GetChannelsResponse res = sdk.epg().getChannels() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.epg.getChannels({ + lineup: "", + }); + + console.log(result); + } + + run(); + /livetv/epg/countries: + get: + summary: Get all countries + operationId: getCountries + description: This endpoint returns a list of countries which EPG data is available for. There are three flavors, as specfied by the `flavor` attribute + tags: + - EPG + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Country: + items: + properties: + code: + description: Three letter code + type: string + example: + type: string + flavor: + description: | + - `0`: The country is divided into regions, and following the key will lead to a list of regions. + - `1`: The county is divided by postal codes, and an example code is returned in `example`. + - `2`: The country has a single postal code, returned in `example`. + enum: + - 0 + - 1 + - 2 + type: integer + key: + type: string + language: + description: Three letter language code + type: string + languageTitle: + description: The title of the language + type: string + title: + type: string + type: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Epg.GetCountries(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCountriesResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCountriesResponse res = sdk.epg().getCountries() + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.epg.getCountries(); + + console.log(result); + } + + run(); + /livetv/epg/languages: + get: + summary: Get all languages + operationId: getAllLanguages + description: Returns a list of all possible languages for EPG data. + tags: + - EPG + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Language: + items: + properties: + code: + description: 3 letter language code + type: string + title: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Epg.GetAllLanguages(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAllLanguagesResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetAllLanguagesResponse res = sdk.epg().getAllLanguages() + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.epg.getAllLanguages(); + + console.log(result); + } + + run(); + /livetv/epg/lineup: + get: + summary: Compute the best lineup + operationId: getLineup + description: Compute the best lineup, given lineup group and device + tags: + - EPG + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: device + description: The URI describing the device + in: query + required: true + schema: + type: string + - name: lineupGroup + description: The URI describing the lineupGroup + in: query + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Activity: + description: The activity of the reload process + schema: + type: string + '404': + description: No device or provider with the identifier was found + content: + text/html: {} + '500': + description: Could not get device's channels + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Epg.GetLineup(ctx, operations.GetLineupRequest{ + DeviceQueryParameter: "", + LineupGroup: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetLineupRequest; + import dev.plexapi.sdk.models.operations.GetLineupResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetLineupRequest req = GetLineupRequest.builder() + .deviceQueryParameter("") + .lineupGroup("") + .build(); + + GetLineupResponse res = sdk.epg().getLineup() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.epg.getLineup({ + deviceQueryParameter: "", + lineupGroup: "", + }); + + console.log(result); + } + + run(); + /livetv/epg/lineupchannels: + get: + summary: Get the channels for mulitple lineups + operationId: getLineupChannels + description: Get the channels across multiple lineups + tags: + - EPG + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: lineup + description: The URIs describing the lineups + in: query + required: true + schema: + type: array + items: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Lineup: + items: + allOf: + - $ref: '#/components/schemas/Lineup' + - properties: + Channel: + items: + $ref: '#/components/schemas/Channel' + type: array + type: object + type: array + type: object + type: object + '404': + description: No provider with the identifier was found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Epg.GetLineupChannels(ctx, operations.GetLineupChannelsRequest{ + Lineup: []string{ + "", + "", + }, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetLineupChannelsRequest; + import dev.plexapi.sdk.models.operations.GetLineupChannelsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetLineupChannelsRequest req = GetLineupChannelsRequest.builder() + .lineup(List.of( + "", + "")) + .build(); + + GetLineupChannelsResponse res = sdk.epg().getLineupChannels() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.epg.getLineupChannels({ + lineup: [ + "", + "", + ], + }); + + console.log(result); + } + + run(); + /livetv/sessions: + get: + summary: Get all sessions + operationId: getSessions + description: Get all livetv sessions and metadata + tags: + - Live TV + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.LiveTV.GetSessions(ctx) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSessionsResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSessionsResponse res = sdk.liveTV().getSessions() + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.liveTV.getSessions(); + + console.log(result); + } + + run(); + /log: + post: + summary: Logging a multi-line message to the Plex Media Server log + operationId: writeLog + description: | + 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. + tags: + - Log + security: + - token: + - admin + requestBody: + required: true + description: Line separated list of log items + content: + text/plain: {} + responses: + '200': + $ref: '#/components/responses/200' '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/400' x-codeSamples: - lang: php - label: logMultiLine + label: PlexPHP source: |- declare(strict_types=1); @@ -16674,34 +7384,227 @@ paths: // handle response } - lang: ruby - label: logMultiLine - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = \"level=4&message=Test%20message%201&source=postman\\n\" +\n\"level=3&message=Test%20message%202&source=postman\\n\" +\n\"level=1&message=Test%20message%203&source=postman\"\n \nres = s.log.log_multi_line(req)\n\nif res.status_code == 200\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + req = "level=4&message=Test%20message%201&source=postman\n" + + "level=3&message=Test%20message%202&source=postman\n" + + "level=1&message=Test%20message%203&source=postman" + + res = s.log.log_multi_line(req) + + if res.status_code == 200 + # handle response + end - lang: go - label: logMultiLine - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Log.LogMultiLine(ctx, \"level=4&message=Test%20message%201&source=postman\\n\" +\n \"level=3&message=Test%20message%202&source=postman\\n\" +\n \"level=1&message=Test%20message%203&source=postman\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "os" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + example, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + + res, err := s.Log.WriteLog(ctx, example) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: logMultiLine + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.LogMultiLineBadRequest; - import dev.plexapi.plexapi.models.errors.LogMultiLineUnauthorized; - import dev.plexapi.plexapi.models.operations.LogMultiLineResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.WriteLogResponse; + import dev.plexapi.sdk.utils.Utils; + import java.io.FileInputStream; import java.lang.Exception; - import java.lang.String; public class Application { - public static void main(String[] args) throws LogMultiLineBadRequest, LogMultiLineUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - String req = "level=4&message=Test%20message%201&source=postman\nlevel=3&message=Test%20message%202&source=postman\nlevel=1&message=Test%20message%203&source=postman"; + byte[] req = Utils.readBytesAndClose(new FileInputStream("example.file")); - LogMultiLineResponse res = sdk.log().logMultiLine() + WriteLogResponse res = sdk.log().writeLog() + .request(req) + .call(); + + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { openAsBlob } from "node:fs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.log.writeLog(await openAsBlob("example.file")); + + console.log(result); + } + + run(); + put: + summary: Logging a single-line message to the Plex Media Server log + operationId: writeMessage + description: | + 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 + tags: + - Log + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: level + description: | + An integer log level to write to the PMS log with. + - 0: Error + - 1: Warning + - 2: Info + - 3: Debug + - 4: Verbose + in: query + schema: + type: integer + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + - name: message + description: The text of the message to write to the log. + in: query + schema: + type: string + - name: source + description: A string indicating the source of the message. + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Log.WriteMessage(ctx, operations.WriteMessageRequest{}) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.WriteMessageRequest; + import dev.plexapi.sdk.models.operations.WriteMessageResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + WriteMessageRequest req = WriteMessageRequest.builder() + .build(); + + WriteMessageResponse res = sdk.log().writeMessage() .request(req) .call(); @@ -16709,313 +7612,312 @@ paths: } } - lang: typescript - label: logMultiLine + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.log.logMultiLine("level=4&message=Test%20message%201&source=postman\n" + - "level=3&message=Test%20message%202&source=postman\n" + - "level=1&message=Test%20message%203&source=postman"); + const result = await plexAPI.log.writeMessage({}); - // Handle the result console.log(result); } run(); /log/networked: - get: + post: + summary: Enabling Papertrail + operationId: enablePapertrail + description: | + 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 tags: - Log - summary: Enabling Papertrail - description: | - This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time. - operationId: enablePaperTrail + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: minutes + description: The number of minutes logging should be sent to Papertrail + in: query + schema: + type: integer responses: '200': - description: Papertrail enabled successfully - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/200' '403': - description: the user was not signed in + description: User doesn't have permission + content: + text/html: {} x-codeSamples: - - lang: php - label: enablePaperTrail - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->log->enablePaperTrail( - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: enablePaperTrail - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.log.enable_paper_trail()\n\nif res.status_code == 200\n # handle response\nend" - lang: go - label: enablePaperTrail - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Log.EnablePaperTrail(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Log.EnablePapertrail(ctx, operations.EnablePapertrailRequest{}) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: enablePaperTrail + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.EnablePaperTrailBadRequest; - import dev.plexapi.plexapi.models.errors.EnablePaperTrailUnauthorized; - import dev.plexapi.plexapi.models.operations.EnablePaperTrailResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.EnablePapertrailRequest; + import dev.plexapi.sdk.models.operations.EnablePapertrailResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws EnablePaperTrailBadRequest, EnablePaperTrailUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - EnablePaperTrailResponse res = sdk.log().enablePaperTrail() + EnablePapertrailRequest req = EnablePapertrailRequest.builder() + .build(); + + EnablePapertrailResponse res = sdk.log().enablePapertrail() + .request(req) .call(); // handle response } } - lang: typescript - label: enablePaperTrail + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.log.enablePaperTrail(); + const result = await plexAPI.log.enablePapertrail({}); - // Handle the result console.log(result); } run(); - /myplex/account: + /media/grabbers: get: + summary: Get available grabbers + operationId: getAvailableGrabbers + description: Get available grabbers visible to the server tags: - - Server - summary: Get MyPlex Account - description: Returns MyPlex Account Information - operationId: getMyPlexAccount + - Devices + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: protocol + description: Only return grabbers providing this protocol. + in: query + schema: + type: string + example: livetv responses: '200': - description: MyPlex Account + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - type: object properties: - MyPlex: - type: object - properties: - authToken: - type: string - example: Z5v-PrNASDFpsaCi3CPK7 - username: - type: string - example: example.email@mail.com - mappingState: - type: string - example: mapped - mappingError: - type: string - signInState: - type: string - example: ok - publicAddress: - type: string - example: 140.20.68.140 - publicPort: - type: number - example: 32400 - privateAddress: - type: string - example: 10.10.10.47 - privatePort: - type: number - example: 32400 - subscriptionFeatures: - type: string - example: 'federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks' - subscriptionActive: - type: boolean - subscriptionState: - type: string - example: Active - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + MediaGrabber: + items: + properties: + identifier: + type: string + protocol: + type: string + title: + type: string + type: object + type: array + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - - lang: php - label: getMyPlexAccount - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->server->getMyPlexAccount( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getMyPlexAccount - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.server.get_my_plex_account()\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: getMyPlexAccount - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetMyPlexAccount(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.GetAvailableGrabbers(ctx, operations.GetAvailableGrabbersRequest{ + Protocol: plexgo.Pointer("livetv"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: getMyPlexAccount + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetMyPlexAccountBadRequest; - import dev.plexapi.plexapi.models.errors.GetMyPlexAccountUnauthorized; - import dev.plexapi.plexapi.models.operations.GetMyPlexAccountResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAvailableGrabbersRequest; + import dev.plexapi.sdk.models.operations.GetAvailableGrabbersResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetMyPlexAccountBadRequest, GetMyPlexAccountUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetMyPlexAccountResponse res = sdk.server().getMyPlexAccount() + GetAvailableGrabbersRequest req = GetAvailableGrabbersRequest.builder() + .protocol("livetv") + .build(); + + GetAvailableGrabbersResponse res = sdk.devices().getAvailableGrabbers() + .request(req) .call(); if (res.object().isPresent()) { @@ -17024,3250 +7926,409 @@ paths: } } - lang: typescript - label: getMyPlexAccount + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.server.getMyPlexAccount(); + const result = await plexAPI.devices.getAvailableGrabbers({ + protocol: "livetv", + }); - // Handle the result console.log(result); } run(); - '/photo/:/transcode': + /media/grabbers/devices: get: + summary: Get all devices + operationId: listDevices + description: Get the list of all devices present tags: - - Server - summary: Get a Resized Photo - description: | - Plex's Photo transcoder is used throughout the service to serve images at specified sizes. - operationId: getResizedPhoto - parameters: - - name: width - description: The width for the resized photo - in: query - schema: - type: number - example: 110 - required: true - - name: height - description: The height for the resized photo - in: query - schema: - type: number - example: 165 - required: true - - name: opacity - description: The opacity for the resized photo - in: query - schema: - type: integer - minimum: 1 - maximum: 100 - default: 100 - required: true - - name: blur - description: The width for the resized photo - in: query - schema: - type: number - examples: - - 0 - - 20 - - 4000 - required: true - - name: minSize - description: images are always scaled proportionally. A value of '1' in minSize will make the smaller native dimension the dimension resized against. - in: query - schema: - type: integer - enum: - - 0 - - 1 - required: true - - name: upscale - description: allow images to be resized beyond native dimensions. - in: query - schema: - type: integer - enum: - - 0 - - 1 - required: true - - name: url - description: path to image within Plex - in: query - schema: - type: string - example: /library/metadata/49564/thumb/1654258204 - required: true + - Devices + security: + - token: + - admin responses: '200': - description: Resized Image - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/schemas/MediaContainerWithDevice' x-codeSamples: - - lang: php - label: getResizedPhoto - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\GetResizedPhotoRequest( - width: 110, - height: 165, - opacity: 100, - blur: 20, - minSize: Operations\MinSize::Zero, - upscale: Operations\Upscale::One, - url: '/library/metadata/49564/thumb/1654258204', - ); - - $response = $sdk->server->getResizedPhoto( - request: $request - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: getResizedPhoto - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::GetResizedPhotoRequest.new(\n width: 110.0,\n height: 165.0,\n opacity: 643869,\n blur: 0.0,\n min_size: ::PlexRubySDK::Operations::MinSize::ONE,\n upscale: ::PlexRubySDK::Operations::Upscale::ONE,\n url: \"/library/metadata/49564/thumb/1654258204\",\n)\n \nres = s.server.get_resized_photo(req)\n\nif res.status_code == 200\n # handle response\nend" - lang: go - label: getResizedPhoto - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetResizedPhoto(ctx, operations.GetResizedPhotoRequest{\n Width: 110,\n Height: 165,\n Opacity: 100,\n Blur: 0,\n MinSize: operations.MinSizeOne,\n Upscale: operations.UpscaleOne,\n URL: \"/library/metadata/49564/thumb/1654258204\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: getResizedPhoto + label: PlexGO source: |- - package hello.world; + package main - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetResizedPhotoBadRequest; - import dev.plexapi.plexapi.models.errors.GetResizedPhotoUnauthorized; - import dev.plexapi.plexapi.models.operations.GetResizedPhotoRequest; - import dev.plexapi.plexapi.models.operations.GetResizedPhotoResponse; - import dev.plexapi.plexapi.models.operations.MinSize; - import dev.plexapi.plexapi.models.operations.Upscale; - import java.lang.Exception; + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) - public class Application { + func main() { + ctx := context.Background() - public static void main(String[] args) throws GetResizedPhotoBadRequest, GetResizedPhotoUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetResizedPhotoRequest req = GetResizedPhotoRequest.builder() - .width(110d) - .height(165d) - .opacity(100L) - .blur(0d) - .minSize(MinSize.ONE) - .upscale(Upscale.ONE) - .url("/library/metadata/49564/thumb/1654258204") - .build(); - - GetResizedPhotoResponse res = sdk.server().getResizedPhoto() - .request(req) - .call(); + s := plexgo.New( + plexgo.WithSecurity(""), + ) + res, err := s.Devices.ListDevices(ctx) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDevice != nil { // handle response } } - - lang: typescript - label: getResizedPhoto - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { MinSize, Upscale } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.server.getResizedPhoto({ - width: 110, - height: 165, - opacity: 100, - blur: 0, - minSize: MinSize.One, - upscale: Upscale.One, - url: "/library/metadata/49564/thumb/1654258204", - }); - - // Handle the result - console.log(result); - } - - run(); - /pins: - post: - servers: - - url: 'https://plex.tv/api/v2' - tags: - - Plex - summary: Get a Pin - operationId: getPin - description: Retrieve a Pin ID from Plex.tv to use for authentication flows - security: [] - parameters: - - name: strong - description: | - Determines the kind of code returned by the API call - Strong codes are used for Pin authentication flows - Non-Strong codes are used for `Plex.tv/link` - in: query - schema: - type: boolean - default: false - required: false - - name: X-Plex-Client-Identifier - x-speakeasy-name-override: ClientID - description: 'An opaque identifier unique to the client (UUID, serial number, or other unique device ID)' - required: true - in: header - schema: - type: string - example: 3381b62b-9ab7-4e37-827b-203e9809eb58 - - name: X-Plex-Product - x-speakeasy-name-override: ClientName - description: 'The name of the client application. (Plex Web, Plex Media Server, etc.)' - in: header - required: false - schema: - type: string - example: Plex for Roku - - name: X-Plex-Device - x-speakeasy-name-override: DeviceNickname - description: A relatively friendly name for the client device - in: header - required: false - schema: - type: string - example: Roku 3 - - name: X-Plex-Version - x-speakeasy-name-override: ClientVersion - description: The version of the client application. - in: header - required: false - schema: - type: string - example: 2.4.1 - - name: X-Plex-Platform - x-speakeasy-name-override: Platform - description: The platform of the client application. - in: header - required: false - schema: - type: string - example: Roku - responses: - '201': - description: Requests a new pin id used in the authentication flow - content: - application/json: - schema: - type: object - x-examples: - Example 1: - id: 373040866 - code: 7RQZ - product: '0' - trusted: false - qr: 'https://plex.tv/api/v2/pins/qr/7RQZ' - clientIdentifier: 9klpwueublnfbvlx95w83ah9 - location: - code: NL - european_union_member: true - continent_code: EU - country: The Netherlands - city: Breda - time_zone: Europe/Amsterdam - postal_code: '4814' - in_privacy_restricted_country: true - in_privacy_restricted_region: true - subdivisions: North Brabant - coordinates: '51.5869, 4.7471' - expiresIn: 876 - createdAt: '2024-07-16T17:03:05Z' - expiresAt: '2024-07-16T17:18:05Z' - authToken: null - newRegistration: null - title: AuthPinContainer - examples: - - id: 308667304 - code: 7RQZ - product: '0' - trusted: false - qr: 'https://plex.tv/api/v2/pins/qr/7RQZ' - clientIdentifier: string - location: - code: VI - continent_code: NA - country: United States Virgin Islands - city: Amsterdam - european_union_member: true - time_zone: America/St_Thomas - postal_code: 802 - in_privacy_restricted_country: true - in_privacy_restricted_region: true - subdivisions: Saint Thomas - coordinates: '18.3381, -64.8941' - expiresIn: 876 - createdAt: '2024-07-16T17:03:05Z' - expiresAt: '2024-07-16T17:18:05Z' - authToken: null - newRegistration: null - required: - - id - - code - - product - - trusted - - qr - - clientIdentifier - - location - - expiresIn - - createdAt - - expiresAt - properties: - id: - type: integer - example: 308667304 - code: - type: string - example: 7RQZ - product: - type: string - example: Tautulli - trusted: - type: boolean - default: false - qr: - type: string - example: 'https://plex.tv/api/v2/pins/qr/7RQZ' - clientIdentifier: - type: string - description: The X-Client-Identifier used in the request - example: Tautulli - location: - title: GeoData - type: object - description: Geo location data - examples: - - code: VI - continent_code: NA - country: United States Virgin Islands - city: Amsterdam - european_union_member: true - time_zone: America/St_Thomas - postal_code: 802 - in_privacy_restricted_country: true - in_privacy_restricted_region: true - subdivisions: Saint Thomas - coordinates: '18.3381, -64.8941' - required: - - code - - continent_code - - country - - city - - european_union_member - - time_zone - - postal_code - - in_privacy_restricted_country - - in_privacy_restricted_region - - subdivisions - - coordinates - properties: - code: - type: string - description: The ISO 3166-1 alpha-2 code of the country. - example: VI - continent_code: - type: string - description: The continent code where the country is located. - example: NA - country: - type: string - description: The official name of the country. - example: United States Virgin Islands - city: - type: string - description: The name of the city. - example: Amsterdam - european_union_member: - type: boolean - description: Indicates if the country is a member of the European Union. - example: true - default: false - time_zone: - type: string - description: The time zone of the country. - example: America/St_Thomas - postal_code: - type: string - description: The postal code of the location. - example: '802' - in_privacy_restricted_country: - type: boolean - description: Indicates if the country has privacy restrictions. - example: true - default: false - in_privacy_restricted_region: - type: boolean - description: Indicates if the region has privacy restrictions. - example: true - default: false - subdivisions: - type: string - description: The name of the primary administrative subdivision. - example: Saint Thomas - coordinates: - type: string - description: 'The geographical coordinates (latitude, longitude) of the location.' - example: '18.3381, -64.8941' - expiresIn: - type: integer - example: 876 - description: 'The number of seconds this pin expires, by default 900 seconds' - default: 900 - createdAt: - type: string - example: '2024-07-16T17:03:05Z' - format: date-time - expiresAt: - type: string - format: date-time - example: '2024-07-16T17:18:05Z' - authToken: - type: - - string - - 'null' - example: gcgzw5rz2xovp84b4vha3a40 - newRegistration: - type: 'null' - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - x-codeSamples: - - lang: php - label: getPin - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder()->build(); - - $request = new Operations\GetPinRequest( - clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58', - clientName: 'Plex for Roku', - deviceNickname: 'Roku 3', - clientVersion: '2.4.1', - platform: 'Roku', - ); - - $response = $sdk->plex->getPin( - request: $request - ); - - if ($response->authPinContainer !== null) { - // handle response - } - - lang: ruby - label: getPin - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\n\n\nreq = ::PlexRubySDK::Operations::GetPinRequest.new(\n client_id: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n client_name: \"Plex for Roku\",\n device_nickname: \"Roku 3\",\n client_version: \"2.4.1\",\n platform: \"Roku\",\n)\n \nres = s.plex.get_pin(req)\n\nif ! res.auth_pin_container.nil?\n # handle response\nend" - - lang: go - label: getPin - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.AuthPinContainer != nil {\n // handle response\n }\n}" - lang: java - label: getPin + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetPinBadRequest; - import dev.plexapi.plexapi.models.operations.GetPinRequest; - import dev.plexapi.plexapi.models.operations.GetPinResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListDevicesResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetPinBadRequest, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetPinRequest req = GetPinRequest.builder() - .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") - .clientName("Plex for Roku") - .deviceNickname("Roku 3") - .clientVersion("2.4.1") - .platform("Roku") - .build(); - - GetPinResponse res = sdk.plex().getPin() - .request(req) + ListDevicesResponse res = sdk.devices().listDevices() .call(); - if (res.authPinContainer().isPresent()) { + if (res.mediaContainerWithDevice().isPresent()) { // handle response } } } - lang: typescript - label: getPin + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.plex.getPin({ - clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", - clientName: "Plex for Roku", - deviceNickname: "Roku 3", - clientVersion: "2.4.1", - platform: "Roku", - }); + const result = await plexAPI.devices.listDevices(); - // Handle the result console.log(result); } run(); - '/pins/{pinID}': - get: - servers: - - url: 'https://plex.tv/api/v2' - security: [] + post: + summary: Add a device + operationId: addDevice + description: This endpoint adds a device to an existing grabber. The device is identified, and added to the correct grabber. tags: - - Plex - summary: Get Access Token by PinId - description: Retrieve an Access Token from Plex.tv after the Pin has been authenticated - operationId: getTokenByPinId + - Devices + security: + - token: + - admin parameters: - - name: pinID - description: The PinID to retrieve an access token for - in: path - required: true - schema: - type: integer - - name: X-Plex-Client-Identifier - x-speakeasy-name-override: ClientID - description: 'An opaque identifier unique to the client (UUID, serial number, or other unique device ID)' - required: true - in: header + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: uri + description: The URI of the device. + in: query schema: type: string - example: 3381b62b-9ab7-4e37-827b-203e9809eb58 - - name: X-Plex-Product - x-speakeasy-name-override: ClientName - description: 'The name of the client application. (Plex Web, Plex Media Server, etc.)' - in: header - required: false - schema: - type: string - example: Plex for Roku - - name: X-Plex-Device - x-speakeasy-name-override: DeviceNickname - description: A relatively friendly name for the client device - in: header - required: false - schema: - type: string - example: Roku 3 - - name: X-Plex-Version - x-speakeasy-name-override: ClientVersion - description: The version of the client application. - in: header - required: false - schema: - type: string - example: 2.4.1 - - name: X-Plex-Platform - x-speakeasy-name-override: Platform - description: The platform of the client application. - in: header - required: false - schema: - type: string - example: Roku + example: http://10.0.0.5 responses: '200': - description: The Pin with a non-null authToken when it has been verified by the user + description: OK content: application/json: schema: - type: object - x-examples: - Example 1: - id: 373040866 - code: 7RQZ - product: '0' - trusted: false - qr: 'https://plex.tv/api/v2/pins/qr/7RQZ' - clientIdentifier: 9klpwueublnfbvlx95w83ah9 - location: - code: NL - european_union_member: true - continent_code: EU - country: The Netherlands - city: Breda - time_zone: Europe/Amsterdam - postal_code: '4814' - in_privacy_restricted_country: true - in_privacy_restricted_region: true - subdivisions: North Brabant - coordinates: '51.5869, 4.7471' - expiresIn: 876 - createdAt: '2024-07-16T17:03:05Z' - expiresAt: '2024-07-16T17:18:05Z' - authToken: null - newRegistration: null - title: AuthPinContainer - examples: - - id: 308667304 - code: 7RQZ - product: '0' - trusted: false - qr: 'https://plex.tv/api/v2/pins/qr/7RQZ' - clientIdentifier: string - location: - code: VI - continent_code: NA - country: United States Virgin Islands - city: Amsterdam - european_union_member: true - time_zone: America/St_Thomas - postal_code: 802 - in_privacy_restricted_country: true - in_privacy_restricted_region: true - subdivisions: Saint Thomas - coordinates: '18.3381, -64.8941' - expiresIn: 876 - createdAt: '2024-07-16T17:03:05Z' - expiresAt: '2024-07-16T17:18:05Z' - authToken: null - newRegistration: null - required: - - id - - code - - product - - trusted - - qr - - clientIdentifier - - location - - expiresIn - - createdAt - - expiresAt - properties: - id: - type: integer - example: 308667304 - code: - type: string - example: 7RQZ - product: - type: string - example: Tautulli - trusted: - type: boolean - default: false - qr: - type: string - example: 'https://plex.tv/api/v2/pins/qr/7RQZ' - clientIdentifier: - type: string - description: The X-Client-Identifier used in the request - example: Tautulli - location: - title: GeoData - type: object - description: Geo location data - examples: - - code: VI - continent_code: NA - country: United States Virgin Islands - city: Amsterdam - european_union_member: true - time_zone: America/St_Thomas - postal_code: 802 - in_privacy_restricted_country: true - in_privacy_restricted_region: true - subdivisions: Saint Thomas - coordinates: '18.3381, -64.8941' - required: - - code - - continent_code - - country - - city - - european_union_member - - time_zone - - postal_code - - in_privacy_restricted_country - - in_privacy_restricted_region - - subdivisions - - coordinates - properties: - code: - type: string - description: The ISO 3166-1 alpha-2 code of the country. - example: VI - continent_code: - type: string - description: The continent code where the country is located. - example: NA - country: - type: string - description: The official name of the country. - example: United States Virgin Islands - city: - type: string - description: The name of the city. - example: Amsterdam - european_union_member: - type: boolean - description: Indicates if the country is a member of the European Union. - example: true - default: false - time_zone: - type: string - description: The time zone of the country. - example: America/St_Thomas - postal_code: - type: string - description: The postal code of the location. - example: '802' - in_privacy_restricted_country: - type: boolean - description: Indicates if the country has privacy restrictions. - example: true - default: false - in_privacy_restricted_region: - type: boolean - description: Indicates if the region has privacy restrictions. - example: true - default: false - subdivisions: - type: string - description: The name of the primary administrative subdivision. - example: Saint Thomas - coordinates: - type: string - description: 'The geographical coordinates (latitude, longitude) of the location.' - example: '18.3381, -64.8941' - expiresIn: - type: integer - example: 876 - description: 'The number of seconds this pin expires, by default 900 seconds' - default: 900 - createdAt: - type: string - example: '2024-07-16T17:03:05Z' - format: date-time - expiresAt: - type: string - format: date-time - example: '2024-07-16T17:18:05Z' - authToken: - type: - - string - - 'null' - example: gcgzw5rz2xovp84b4vha3a40 - newRegistration: - type: 'null' + $ref: '#/components/schemas/MediaContainerWithDevice' '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '404': - description: Not Found or Expired - content: - application/json: - schema: - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - example: 1020 - message: - type: string - example: Code not found or expired - example: - errors: - - code: 1020 - message: Code not found or expired + $ref: '#/components/responses/400' x-codeSamples: - - lang: php - label: getTokenByPinId - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder()->build(); - - $request = new Operations\GetTokenByPinIdRequest( - pinID: 408895, - clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58', - clientName: 'Plex for Roku', - deviceNickname: 'Roku 3', - clientVersion: '2.4.1', - platform: 'Roku', - ); - - $response = $sdk->plex->getTokenByPinId( - request: $request - ); - - if ($response->authPinContainer !== null) { - // handle response - } - - lang: ruby - label: getTokenByPinId - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\n\n\nreq = ::PlexRubySDK::Operations::GetTokenByPinIdRequest.new(\n pin_id: 408895,\n client_id: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n client_name: \"Plex for Roku\",\n device_nickname: \"Roku 3\",\n client_version: \"2.4.1\",\n platform: \"Roku\",\n)\n \nres = s.plex.get_token_by_pin_id(req)\n\nif ! res.auth_pin_container.nil?\n # handle response\nend" - lang: go - label: getTokenByPinId - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetTokenByPinID(ctx, operations.GetTokenByPinIDRequest{\n PinID: 408895,\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.AuthPinContainer != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.AddDevice(ctx, operations.AddDeviceRequest{ + URI: plexgo.Pointer("http://10.0.0.5"), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDevice != nil { + // handle response + } + } - lang: java - label: getTokenByPinId + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetTokenByPinIdBadRequest; - import dev.plexapi.plexapi.models.errors.GetTokenByPinIdResponseBody; - import dev.plexapi.plexapi.models.operations.GetTokenByPinIdRequest; - import dev.plexapi.plexapi.models.operations.GetTokenByPinIdResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddDeviceRequest; + import dev.plexapi.sdk.models.operations.AddDeviceResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetTokenByPinIdBadRequest, GetTokenByPinIdResponseBody, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetTokenByPinIdRequest req = GetTokenByPinIdRequest.builder() - .pinID(408895L) - .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") - .clientName("Plex for Roku") - .deviceNickname("Roku 3") - .clientVersion("2.4.1") - .platform("Roku") + AddDeviceRequest req = AddDeviceRequest.builder() + .uri("http://10.0.0.5") .build(); - GetTokenByPinIdResponse res = sdk.plex().getTokenByPinId() + AddDeviceResponse res = sdk.devices().addDevice() .request(req) .call(); - if (res.authPinContainer().isPresent()) { + if (res.mediaContainerWithDevice().isPresent()) { // handle response } } } - lang: typescript - label: getTokenByPinId + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.addDevice({ + uri: "http://10.0.0.5", + }); + + console.log(result); + } + + run(); + /media/grabbers/devices/discover: + post: + summary: Tell grabbers to discover devices + operationId: discoverDevices + description: Tell grabbers to discover devices + tags: + - Devices + security: + - token: + - admin + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithDevice' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Devices.DiscoverDevices(ctx) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDevice != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DiscoverDevicesResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DiscoverDevicesResponse res = sdk.devices().discoverDevices() + .call(); + + if (res.mediaContainerWithDevice().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.plex.getTokenByPinId({ - pinID: 408895, - clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", - clientName: "Plex for Roku", - deviceNickname: "Roku 3", - clientVersion: "2.4.1", - platform: "Roku", - }); + const result = await plexAPI.devices.discoverDevices(); - // Handle the result - console.log(result); - } - - run(); - /playlists: - post: - tags: - - Playlists - summary: Create a Playlist - description: | - Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass: - - `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`). - - `playQueueID` - To create a playlist from an existing play queue. - operationId: createPlaylist - parameters: - - name: title - description: name of the playlist - in: query - schema: - type: string - required: true - - name: type - description: type of playlist to create - in: query - schema: - type: string - enum: - - audio - - video - - photo - required: true - - name: smart - description: whether the playlist is smart or not - in: query - schema: - type: integer - enum: - - 0 - - 1 - required: true - - name: uri - description: the content URI for the playlist - in: query - schema: - type: string - required: true - - name: playQueueID - description: the play queue to copy to a playlist - in: query - schema: - type: number - required: false - responses: - '200': - description: returns all playlists - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 7 - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '96' - key: - type: string - example: /playlists/96/items - guid: - type: string - example: 'com.plexapp.agents.none://a2f92937-1408-40e2-b022-63a8a9377e55' - type: - type: string - example: playlist - title: - type: string - example: A Great Playlist - summary: - type: string - example: What a great playlist - smart: - type: boolean - example: false - playlistType: - type: string - example: video - icon: - type: string - example: 'playlist://image.smart' - viewCount: - type: integer - format: int32 - example: 1 - lastViewedAt: - type: integer - format: int32 - example: 1705719589 - leafCount: - type: integer - format: int32 - example: 1 - addedAt: - type: integer - format: int32 - example: 1705719589 - updatedAt: - type: integer - format: int32 - example: 1705724593 - composite: - type: string - example: /playlists/96/composite/1705724593 - duration: - type: integer - format: int32 - example: 141000 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: createPlaylist - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - $request = new Operations\CreatePlaylistRequest( - title: '', - type: Operations\CreatePlaylistQueryParamType::Photo, - smart: Operations\Smart::One, - uri: 'https://hoarse-testing.info/', - ); - - $response = $sdk->playlists->createPlaylist( - request: $request - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: createPlaylist - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::CreatePlaylistRequest.new(\n title: \"\",\n type: ::PlexRubySDK::Operations::CreatePlaylistQueryParamType::PHOTO,\n smart: ::PlexRubySDK::Operations::Smart::ONE,\n uri: \"https://hoarse-testing.info/\",\n)\n \nres = s.playlists.create_playlist(req)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: createPlaylist - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{\n Title: \"\",\n Type: operations.CreatePlaylistQueryParamTypePhoto,\n Smart: operations.SmartOne,\n URI: \"https://hoarse-testing.info/\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: createPlaylist - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.CreatePlaylistBadRequest; - import dev.plexapi.plexapi.models.errors.CreatePlaylistUnauthorized; - import dev.plexapi.plexapi.models.operations.CreatePlaylistQueryParamType; - import dev.plexapi.plexapi.models.operations.CreatePlaylistRequest; - import dev.plexapi.plexapi.models.operations.CreatePlaylistResponse; - import dev.plexapi.plexapi.models.operations.Smart; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws CreatePlaylistBadRequest, CreatePlaylistUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - CreatePlaylistRequest req = CreatePlaylistRequest.builder() - .title("") - .type(CreatePlaylistQueryParamType.PHOTO) - .smart(Smart.ONE) - .uri("https://hoarse-testing.info/") - .build(); - - CreatePlaylistResponse res = sdk.playlists().createPlaylist() - .request(req) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: createPlaylist - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { CreatePlaylistQueryParamType, Smart } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.createPlaylist({ - title: "", - type: CreatePlaylistQueryParamType.Photo, - smart: Smart.One, - uri: "https://hoarse-testing.info/", - }); - - // Handle the result - console.log(result); - } - - run(); - get: - tags: - - Playlists - summary: Get All Playlists - description: Get All Playlists given the specified filters. - operationId: getPlaylists - parameters: - - name: playlistType - description: limit to a type of playlist. - in: query - schema: - type: string - enum: - - audio - - video - - photo - required: false - - name: smart - description: type of playlists to return (default is all). - in: query - schema: - type: integer - enum: - - 0 - - 1 - required: false - responses: - '200': - description: returns all playlists - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 4 - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '92' - key: - type: string - example: /playlists/92/items - guid: - type: string - example: 'com.plexapp.agents.none://7ca5aaef-58e8-4828-9e21-c009c97f2903' - type: - type: string - example: playlist - title: - type: string - example: Static Playlist - summary: - type: string - example: A Great Playlist - smart: - type: boolean - example: false - playlistType: - type: string - example: video - composite: - type: string - example: /playlists/92/composite/1705716440 - icon: - type: string - example: 'playlist://image.smart' - viewCount: - type: integer - format: int32 - example: 1 - lastViewedAt: - type: integer - format: int32 - example: 1705716298 - duration: - type: integer - format: int32 - example: 7328000 - leafCount: - type: integer - format: int32 - example: 32 - addedAt: - type: integer - format: int32 - example: 1705716298 - updatedAt: - type: integer - format: int32 - example: 1705716440 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getPlaylists - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->getPlaylists( - playlistType: Operations\PlaylistType::Audio, - smart: Operations\QueryParamSmart::Zero - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getPlaylists - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.get_playlists(playlist_type=::PlexRubySDK::Operations::PlaylistType::AUDIO, smart=::PlexRubySDK::Operations::QueryParamSmart::ZERO)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getPlaylists - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.GetPlaylists(ctx, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getPlaylists - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetPlaylistsBadRequest; - import dev.plexapi.plexapi.models.errors.GetPlaylistsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetPlaylistsResponse; - import dev.plexapi.plexapi.models.operations.PlaylistType; - import dev.plexapi.plexapi.models.operations.QueryParamSmart; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetPlaylistsBadRequest, GetPlaylistsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetPlaylistsResponse res = sdk.playlists().getPlaylists() - .playlistType(PlaylistType.AUDIO) - .smart(QueryParamSmart.ZERO) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getPlaylists - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.getPlaylists(); - - // Handle the result - console.log(result); - } - - run(); - '/playlists/{playlistID}': - get: - tags: - - Playlists - summary: Retrieve Playlist - description: | - 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. - operationId: getPlaylist - parameters: - - name: playlistID - description: the ID of the playlist - in: path - schema: - type: number - required: true - responses: - '200': - description: The playlist - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 1 - Metadata: - type: array - items: - type: object - properties: - content: - type: string - example: 'library://x/directory/%2Flibrary%2Fsections%2F1%2Fall%3Ftype%3D1%26push%3D1%26title%3D2%26or%3D1%26title%3DSerenity%26pop%3D1' - ratingKey: - type: string - example: '95' - key: - type: string - example: /playlists/95/items - guid: - type: string - example: 'com.plexapp.agents.none://87425529-380f-44b8-a689-9a0537e7ec91' - type: - type: string - example: playlist - title: - type: string - example: Smart Movie Playlist - summary: - type: string - example: '' - smart: - type: boolean - example: true - playlistType: - type: string - example: video - composite: - type: string - example: /playlists/95/composite/1705717387 - icon: - type: string - example: 'playlist://image.smart' - duration: - type: integer - format: int32 - example: 282000 - leafCount: - type: integer - format: int32 - example: 2 - addedAt: - type: integer - format: int32 - example: 1705716493 - updatedAt: - type: integer - format: int32 - example: 1705717387 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getPlaylist - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->getPlaylist( - playlistID: 4109.48 - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getPlaylist - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.get_playlist(playlist_id=4109.48)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getPlaylist - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.GetPlaylist(ctx, 4109.48)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getPlaylist - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetPlaylistBadRequest; - import dev.plexapi.plexapi.models.errors.GetPlaylistUnauthorized; - import dev.plexapi.plexapi.models.operations.GetPlaylistResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetPlaylistBadRequest, GetPlaylistUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetPlaylistResponse res = sdk.playlists().getPlaylist() - .playlistID(4109.48d) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getPlaylist - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.getPlaylist(4109.48); - - // Handle the result - console.log(result); - } - - run(); - delete: - tags: - - Playlists - summary: Deletes a Playlist - description: | - This endpoint will delete a playlist - operationId: deletePlaylist - parameters: - - name: playlistID - description: the ID of the playlist - in: path - schema: - type: number - required: true - responses: - '204': - description: The playlist is deleted - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: deletePlaylist - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->deletePlaylist( - playlistID: 216.22 - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: deletePlaylist - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.delete_playlist(playlist_id=216.22)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: deletePlaylist - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.DeletePlaylist(ctx, 216.22)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: deletePlaylist - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.DeletePlaylistBadRequest; - import dev.plexapi.plexapi.models.errors.DeletePlaylistUnauthorized; - import dev.plexapi.plexapi.models.operations.DeletePlaylistResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws DeletePlaylistBadRequest, DeletePlaylistUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - DeletePlaylistResponse res = sdk.playlists().deletePlaylist() - .playlistID(216.22d) - .call(); - - // handle response - } - } - - lang: typescript - label: deletePlaylist - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.deletePlaylist(216.22); - - // Handle the result - console.log(result); - } - - run(); - put: - tags: - - Playlists - summary: Update a Playlist - description: | - From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}` - operationId: updatePlaylist - parameters: - - name: playlistID - description: the ID of the playlist - in: path - schema: - type: number - required: true - - name: title - description: name of the playlist - in: query - schema: - type: string - required: false - - name: summary - description: summary description of the playlist - in: query - schema: - type: string - required: false - responses: - '200': - description: The playlist is deleted - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: updatePlaylist - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->updatePlaylist( - playlistID: 3915, - title: '', - summary: '' - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: updatePlaylist - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.update_playlist(playlist_id=3915.0, title=\"\", summary=\"\")\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: updatePlaylist - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.UpdatePlaylist(ctx, 3915, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: updatePlaylist - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.UpdatePlaylistBadRequest; - import dev.plexapi.plexapi.models.errors.UpdatePlaylistUnauthorized; - import dev.plexapi.plexapi.models.operations.UpdatePlaylistResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws UpdatePlaylistBadRequest, UpdatePlaylistUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - UpdatePlaylistResponse res = sdk.playlists().updatePlaylist() - .playlistID(3915d) - .title("") - .summary("") - .call(); - - // handle response - } - } - - lang: typescript - label: updatePlaylist - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.updatePlaylist(3915); - - // Handle the result - console.log(result); - } - - run(); - '/playlists/{playlistID}/items': - get: - tags: - - Playlists - summary: Retrieve Playlist Contents - description: "Gets the contents of a playlist. Should be paged by clients via standard mechanisms. \nBy default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter. \nFor example, you could use this to display a list of recently added albums vis a smart playlist. \nNote that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.\n" - operationId: getPlaylistContents - parameters: - - name: playlistID - description: the ID of the playlist - in: path - schema: - type: number - required: true - - name: type - in: query - description: | - The type of media to retrieve or filter by. - 1 = movie - 2 = show - 3 = season - 4 = episode - E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries - schema: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 8 - - 9 - - 10 - example: 2 - x-speakeasy-enums: - - MOVIE - - TV_SHOW - - SEASON - - EPISODE - - AUDIO - - ALBUM - - TRACK - required: true - responses: - '200': - description: The playlist contents - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 2 - composite: - type: string - example: /playlists/95/composite/1705717521 - duration: - type: integer - format: int32 - example: 282 - leafCount: - type: integer - format: int32 - example: 2 - playlistType: - type: string - example: video - ratingKey: - type: string - example: '95' - smart: - type: boolean - example: true - title: - type: string - example: Smart Movie Playlist - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '17' - key: - type: string - example: /library/metadata/17 - guid: - type: string - example: 'plex://movie/5d77683f6f4521001ea9dc53' - studio: - type: string - example: Universal Pictures - type: - type: string - example: movie - title: - type: string - example: Serenity - titleSort: - type: string - example: Amazing Spider-Man 2 - librarySectionTitle: - type: string - example: Movies - librarySectionID: - type: integer - format: int32 - example: 1 - librarySectionKey: - type: string - example: /library/sections/1 - contentRating: - type: string - example: PG-13 - summary: - type: string - example: 'Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she''s not even aware - so dangerous, no one''s safe, as an Alliance operative''s sent to capture her, and all others are considered irrelevant to his job.' - rating: - type: number - example: 8.2 - audienceRating: - type: number - example: 9.1 - year: - type: integer - format: int32 - example: 2005 - tagline: - type: string - example: They aim to misbehave. - thumb: - type: string - example: /library/metadata/17/thumb/1705637165 - art: - type: string - example: /library/metadata/17/art/1705637165 - duration: - type: integer - format: int32 - example: 141416 - originallyAvailableAt: - type: string - format: date - example: 2005-09-29T00:00:00.000Z - addedAt: - type: integer - format: int32 - example: 1705637164 - updatedAt: - type: integer - format: int32 - example: 1705637165 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - hasPremiumExtras: - type: string - example: '1' - hasPremiumPrimaryExtra: - type: string - example: '1' - ratingImage: - type: string - example: 'rottentomatoes://image.rating.ripe' - Media: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 15 - duration: - type: integer - format: int32 - example: 141416 - bitrate: - type: integer - format: int32 - example: 2273 - width: - type: integer - format: int32 - example: 1920 - height: - type: integer - format: int32 - example: 814 - aspectRatio: - type: number - example: 2.35 - audioChannels: - type: integer - format: int32 - example: 2 - audioCodec: - type: string - example: aac - videoCodec: - type: string - example: h264 - videoResolution: - type: string - example: '1080' - container: - type: string - example: mp4 - videoFrameRate: - type: string - example: 24p - optimizedForStreaming: - type: integer - format: int32 - example: 0 - audioProfile: - type: string - example: lc - has64bitOffsets: - type: boolean - example: false - videoProfile: - type: string - example: high - Part: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 15 - key: - type: string - example: /library/parts/15/1705637151/file.mp4 - duration: - type: integer - format: int32 - example: 141416 - file: - type: string - example: /movies/Serenity (2005)/Serenity (2005).mp4 - size: - type: integer - format: int32 - example: 40271948 - audioProfile: - type: string - example: lc - container: - type: string - example: mp4 - has64bitOffsets: - type: boolean - example: false - optimizedForStreaming: - type: boolean - example: false - videoProfile: - type: string - example: high - Genre: - type: array - items: - type: object - properties: - tag: - type: string - example: Action - Country: - type: array - items: - type: object - properties: - tag: - type: string - example: United States of America - Director: - type: array - items: - type: object - properties: - tag: - type: string - example: Joss Whedon - Writer: - type: array - items: - type: object - properties: - tag: - type: string - example: Joss Whedon - Role: - type: array - items: - type: object - properties: - tag: - type: string - example: Gina Torres - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getPlaylistContents - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->getPlaylistContents( - playlistID: 5004.46, - type: Operations\GetPlaylistContentsQueryParamType::TvShow - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getPlaylistContents - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.get_playlist_contents(playlist_id=5004.46, type=::PlexRubySDK::Operations::GetPlaylistContentsQueryParamType::TV_SHOW)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getPlaylistContents - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.GetPlaylistContents(ctx, 5004.46, operations.GetPlaylistContentsQueryParamTypeTvShow)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getPlaylistContents - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetPlaylistContentsBadRequest; - import dev.plexapi.plexapi.models.errors.GetPlaylistContentsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetPlaylistContentsQueryParamType; - import dev.plexapi.plexapi.models.operations.GetPlaylistContentsResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetPlaylistContentsBadRequest, GetPlaylistContentsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetPlaylistContentsResponse res = sdk.playlists().getPlaylistContents() - .playlistID(5004.46d) - .type(GetPlaylistContentsQueryParamType.TvShow) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getPlaylistContents - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { GetPlaylistContentsQueryParamType } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.getPlaylistContents(5004.46, GetPlaylistContentsQueryParamType.TvShow); - - // Handle the result - console.log(result); - } - - run(); - delete: - tags: - - Playlists - summary: Delete Playlist Contents - description: | - Clears a playlist, only works with dumb playlists. Returns the playlist. - operationId: clearPlaylistContents - parameters: - - name: playlistID - description: the ID of the playlist - in: path - schema: - type: number - required: true - responses: - '200': - description: The playlist contents are cleared - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: clearPlaylistContents - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->clearPlaylistContents( - playlistID: 1893.18 - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: clearPlaylistContents - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.clear_playlist_contents(playlist_id=1893.18)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: clearPlaylistContents - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.ClearPlaylistContents(ctx, 1893.18)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: clearPlaylistContents - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.ClearPlaylistContentsBadRequest; - import dev.plexapi.plexapi.models.errors.ClearPlaylistContentsUnauthorized; - import dev.plexapi.plexapi.models.operations.ClearPlaylistContentsResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws ClearPlaylistContentsBadRequest, ClearPlaylistContentsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - ClearPlaylistContentsResponse res = sdk.playlists().clearPlaylistContents() - .playlistID(1893.18d) - .call(); - - // handle response - } - } - - lang: typescript - label: clearPlaylistContents - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.clearPlaylistContents(1893.18); - - // Handle the result - console.log(result); - } - - run(); - put: - tags: - - Playlists - summary: Adding to a Playlist - description: | - Adds a generator to a playlist, same parameters as the POST to create. 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. - operationId: addPlaylistContents - parameters: - - name: playlistID - description: the ID of the playlist - in: path - schema: - type: number - required: true - - name: uri - description: the content URI for the playlist - in: query - schema: - type: string - example: 'server://12345/com.plexapp.plugins.library/library/metadata/1' - required: true - - name: playQueueID - description: the play queue to add to a playlist - in: query - schema: - type: number - example: 123 - required: false - responses: - '200': - description: Playlist Updated - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 1 - leafCountAdded: - type: integer - format: int32 - example: 1 - leafCountRequested: - type: integer - format: int32 - example: 1 - Metadata: - type: array - items: - type: object - properties: - ratingKey: - type: string - example: '94' - key: - type: string - example: /playlists/94/items - guid: - type: string - example: 'com.plexapp.agents.none://972e3047-83d6-4848-a000-261f0af26ba2' - type: - type: string - example: playlist - title: - type: string - example: A great playlist - summary: - type: string - example: One of my great playlists - smart: - type: boolean - example: false - playlistType: - type: string - example: video - composite: - type: string - example: /playlists/94/composite/1705800070 - duration: - type: integer - format: int32 - example: 423000 - leafCount: - type: integer - format: int32 - example: 3 - addedAt: - type: integer - format: int32 - example: 1705716458 - updatedAt: - type: integer - format: int32 - example: 1705800070 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: addPlaylistContents - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->addPlaylistContents( - playlistID: 8502.01, - uri: 'server://12345/com.plexapp.plugins.library/library/metadata/1', - playQueueID: 123 - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: addPlaylistContents - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.add_playlist_contents(playlist_id=8502.01, uri=\"server://12345/com.plexapp.plugins.library/library/metadata/1\", play_queue_id=123.0)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: addPlaylistContents - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.AddPlaylistContents(ctx, 8502.01, \"server://12345/com.plexapp.plugins.library/library/metadata/1\", plexgo.Float64(123))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: addPlaylistContents - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.AddPlaylistContentsBadRequest; - import dev.plexapi.plexapi.models.errors.AddPlaylistContentsUnauthorized; - import dev.plexapi.plexapi.models.operations.AddPlaylistContentsResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws AddPlaylistContentsBadRequest, AddPlaylistContentsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - AddPlaylistContentsResponse res = sdk.playlists().addPlaylistContents() - .playlistID(8502.01d) - .uri("server://12345/com.plexapp.plugins.library/library/metadata/1") - .playQueueID(123d) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: addPlaylistContents - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.addPlaylistContents(8502.01, "server://12345/com.plexapp.plugins.library/library/metadata/1", 123); - - // Handle the result - console.log(result); - } - - run(); - /playlists/upload: - post: - tags: - - Playlists - summary: Upload Playlist - description: | - 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. - operationId: uploadPlaylist - parameters: - - name: path - description: "absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server. \nIf the `path` argument is a directory, that path will be scanned for playlist files to be processed. \nEach file in that directory creates a separate playlist, with a name based on the filename of the file that created it. \nThe GUID of each playlist is based on the filename. \nIf the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it. \nThe GUID of each playlist is based on the filename.\n" - in: query - schema: - type: string - example: /home/barkley/playlist.m3u - required: true - - name: force - description: "Force overwriting of duplicate playlists. \nBy default, a playlist file uploaded with the same path will overwrite the existing playlist. \nThe `force` argument is used to disable overwriting. \nIf the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.\n" - in: query - schema: - type: integer - enum: - - 0 - - 1 - required: true - - name: sectionID - description: 'Possibly the section ID to upload the playlist to, we are not certain.' - in: query - schema: - type: integer - example: 1 - default: 1 - required: true - responses: - '200': - description: The playlist is uploaded - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: uploadPlaylist - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->playlists->uploadPlaylist( - path: '/home/barkley/playlist.m3u', - force: Operations\QueryParamForce::Zero, - sectionID: 1 - - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: uploadPlaylist - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.playlists.upload_playlist(path=\"/home/barkley/playlist.m3u\", force=::PlexRubySDK::Operations::QueryParamForce::ZERO, section_id=1)\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: uploadPlaylist - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.UploadPlaylist(ctx, \"/home/barkley/playlist.m3u\", operations.QueryParamForceZero, 1)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: uploadPlaylist - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.UploadPlaylistBadRequest; - import dev.plexapi.plexapi.models.errors.UploadPlaylistUnauthorized; - import dev.plexapi.plexapi.models.operations.QueryParamForce; - import dev.plexapi.plexapi.models.operations.UploadPlaylistResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws UploadPlaylistBadRequest, UploadPlaylistUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - UploadPlaylistResponse res = sdk.playlists().uploadPlaylist() - .path("/home/barkley/playlist.m3u") - .force(QueryParamForce.ZERO) - .sectionID(1L) - .call(); - - // handle response - } - } - - lang: typescript - label: uploadPlaylist - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - import { QueryParamForce } from "@lukehagar/plexjs/sdk/models/operations"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.playlists.uploadPlaylist("/home/barkley/playlist.m3u", QueryParamForce.Zero, 1); - - // Handle the result console.log(result); } run(); /media/providers: get: + summary: Get the list of available media providers + operationId: listProviders + description: 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. tags: - - Server - summary: Get Media Providers - description: Retrieves media providers and their features from the Plex server. - operationId: get-media-providers - parameters: - - name: Accept - in: header - required: false - schema: - type: string - enum: - - application/json - - application/xml - example: application/json - - name: X-Plex-Token - in: header - description: 'An authentication token, obtained from plex.tv' - required: true - schema: - type: string - example: CV5xoxjTpFKUzBTShsaf + - Provider responses: '200': - description: Media providers and their features + description: OK content: application/json: schema: - type: object properties: MediaContainer: - type: object - properties: - size: - type: integer - allowCameraUpload: - type: boolean - allowChannelAccess: - type: boolean - allowSharing: - type: boolean - allowSync: - type: boolean - allowTuners: - type: boolean - backgroundProcessing: - type: boolean - certificate: - type: boolean - companionProxy: - type: boolean - countryCode: - type: string - diagnostics: - type: string - eventStream: - type: boolean - friendlyName: - type: string - livetv: - type: integer - machineIdentifier: - type: string - musicAnalysis: - type: integer - myPlex: - type: boolean - myPlexMappingState: - type: string - myPlexSigninState: - type: string - myPlexSubscription: - type: boolean - myPlexUsername: - type: string - offlineTranscode: - type: integer - ownerFeatures: - type: string - platform: - type: string - platformVersion: - type: string - pluginHost: - type: boolean - pushNotifications: - type: boolean - readOnlyLibraries: - type: boolean - streamingBrainABRVersion: - type: integer - streamingBrainVersion: - type: integer - sync: - type: boolean - transcoderActiveVideoSessions: - type: integer - transcoderAudio: - type: boolean - transcoderLyrics: - type: boolean - transcoderSubtitles: - type: boolean - transcoderVideo: - type: boolean - transcoderVideoBitrates: - type: string - transcoderVideoQualities: - type: string - transcoderVideoResolutions: - type: string - updatedAt: - type: integer - updater: - type: boolean - version: - type: string - voiceSearch: - type: boolean - MediaProvider: - type: array - items: - type: object - properties: - identifier: - type: string - title: - type: string - types: - type: string - protocols: - type: string - Feature: - type: array - items: - type: object - required: - - type - properties: - key: - type: string - type: - type: string - flavor: - type: string - example: global - scrobbleKey: - type: string - example: '/:/scrobble/new' - unscrobbleKey: - type: string - example: '/:/unscrobble/new' - Directory: - type: array - items: - type: object - properties: - hubKey: - type: string - title: - type: string - agent: - type: string - language: - type: string - refreshing: - type: boolean - scanner: - type: string - uuid: - type: string - id: - type: string - key: - type: string - type: - type: string - subtype: - type: string - updatedAt: - type: integer - scannedAt: - type: integer - Pivot: - type: array - items: - type: object - properties: - id: - type: string - key: - type: string - type: - type: string - title: - type: string - context: - type: string - symbol: - type: string - Action: - type: array - items: - type: object - required: - - id - - key - properties: - id: - type: string - example: addToContinueWatching - key: - type: string - example: /actions/addToContinueWatching - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + allOf: + - $ref: '#/components/schemas/ServerConfiguration' + - properties: + Feature: + items: + properties: + Directory: + items: + $ref: '#/components/schemas/Directory' + type: array + key: + type: string + type: + type: string + type: object + type: array + identifier: + description: A unique identifier for the provider, e.g. `com.plexapp.plugins.library`. + type: string + protocols: + description: |- + A comma-separated list of default protocols for the provider, which can be: + - `stream`: The provider allows streaming media directly from the provider (e.g. for Vimeo). - `download`: The provider allows downloading media for offline storage, sync, etc. (e.g. Podcasts). - `livetv`: The provider provides live content which is only available on a schedule basis. + type: string + title: + description: The title of the provider. + type: string + types: + description: This attribute contains a comma-separated list of the media types exposed by the provider (e.g. `video, audio`). + type: string + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - lang: php - label: providers + label: PlexPHP source: |- declare(strict_types=1); @@ -20291,32 +8352,65 @@ paths: // handle response } - lang: ruby - label: providers - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.server.get_media_providers(x_plex_token=\"CV5xoxjTpFKUzBTShsaf\")\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.server.get_media_providers(x_plex_token="CV5xoxjTpFKUzBTShsaf") + + if ! res.object.nil? + # handle response + end - lang: go - label: providers - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetMediaProviders(ctx, \"CV5xoxjTpFKUzBTShsaf\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Provider.ListProviders(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: providers + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetMediaProvidersBadRequest; - import dev.plexapi.plexapi.models.errors.GetMediaProvidersUnauthorized; - import dev.plexapi.plexapi.models.operations.GetMediaProvidersResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListProvidersResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetMediaProvidersBadRequest, GetMediaProvidersUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetMediaProvidersResponse res = sdk.server().getMediaProviders() - .xPlexToken("CV5xoxjTpFKUzBTShsaf") + ListProvidersResponse res = sdk.provider().listProviders() .call(); if (res.object().isPresent()) { @@ -20325,331 +8419,1400 @@ paths: } } - lang: typescript - label: providers + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - const plexAPI = new PlexAPI({ - accessToken: "", - }); + const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.server.getMediaProviders("CV5xoxjTpFKUzBTShsaf"); + const result = await plexAPI.provider.listProviders(); - // Handle the result console.log(result); } run(); - /search: - get: + post: + summary: Add a media provider + operationId: addProvider + description: 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. tags: - - Search - summary: Get Search Results - description: This will search the database for the string provided. - operationId: getSearchResults + - Provider parameters: - - name: query - description: The search query string to use + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: url + description: The URL of the media provider to add. + in: query + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '400': + $ref: '#/components/responses/400' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Provider.AddProvider(ctx, operations.AddProviderRequest{ + URL: "https://steep-obedience.name/", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddProviderRequest; + import dev.plexapi.sdk.models.operations.AddProviderResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddProviderRequest req = AddProviderRequest.builder() + .url("https://steep-obedience.name/") + .build(); + + AddProviderResponse res = sdk.provider().addProvider() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.provider.addProvider({ + url: "https://steep-obedience.name/", + }); + + console.log(result); + } + + run(); + /media/providers/refresh: + post: + summary: Refresh media providers + operationId: refreshProviders + description: Refresh all known media providers. This is useful in case a provider has updated features. + tags: + - Provider + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Provider.RefreshProviders(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RefreshProvidersResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RefreshProvidersResponse res = sdk.provider().refreshProviders() + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.provider.refreshProviders(); + + console.log(result); + } + + run(); + /media/subscriptions: + get: + summary: Get all subscriptions + operationId: getAllSubscriptions + description: Get all subscriptions and potentially the grabs too + tags: + - Subscriptions + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: includeGrabs + description: Indicates whether the active grabs should be included as well + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: includeStorage + description: Compute the storage of recorded items desired by this subscription + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithSubscription' + '403': + description: User cannot access DVR on this server + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.GetAllSubscriptions(ctx, operations.GetAllSubscriptionsRequest{ + IncludeGrabs: components.BoolIntOne.ToPointer(), + IncludeStorage: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithSubscription != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAllSubscriptionsRequest; + import dev.plexapi.sdk.models.operations.GetAllSubscriptionsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetAllSubscriptionsRequest req = GetAllSubscriptionsRequest.builder() + .includeGrabs(BoolInt.ONE) + .includeStorage(BoolInt.ONE) + .build(); + + GetAllSubscriptionsResponse res = sdk.subscriptions().getAllSubscriptions() + .request(req) + .call(); + + if (res.mediaContainerWithSubscription().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.getAllSubscriptions({ + includeGrabs: BoolInt.One, + includeStorage: BoolInt.One, + }); + + console.log(result); + } + + run(); + post: + summary: Create a subscription + operationId: createSubscription + description: Create a subscription. The query parameters should be mostly derived from the [template](#tag/Subscriptions/operation/mediaSubscriptionsGetTemplate) + tags: + - Subscriptions + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: targetLibrarySectionID + description: The library section into which we'll grab the media. Not actually required when the subscription is to a playlist. + in: query + schema: + type: integer + example: 1 + - name: targetSectionLocationID + description: The section location into which to grab. + in: query + schema: + type: integer + example: 3 + - name: type + description: The type of the thing we're subscribing too (e.g. show, season). + in: query + schema: + type: integer + example: 2 + - name: hints + description: 'Hints describing what we''re looking for. Note: The hint `ratingKey` is required for downloading from a PMS remote.' + in: query + style: deepObject + schema: + type: object + example: + title: Family Guy + - name: prefs + description: Subscription preferences. + in: query + style: deepObject + schema: + type: object + example: + minVideoQuality: 720 + - name: params + description: | + Subscription parameters. + - `mediaProviderID`: Required for downloads to indicate which MP the subscription will download into + - `source`: Required for downloads to indicate the source of the downloaded content. + in: query + style: deepObject + schema: + type: object + example: + mediaProviderID: 1 + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + MediaSubscription: + items: + $ref: '#/components/schemas/MediaSubscription' + type: array + type: object + type: object + '400': + $ref: '#/components/responses/400' + '403': + description: User cannot access DVR on this server + content: + text/html: {} + '409': + description: An subscription with the same parameters already exists + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.CreateSubscription(ctx, operations.CreateSubscriptionRequest{ + TargetLibrarySectionID: plexgo.Pointer[int64](1), + TargetSectionLocationID: plexgo.Pointer[int64](3), + Type: plexgo.Pointer[int64](2), + Hints: &operations.Hints{}, + Prefs: &operations.CreateSubscriptionQueryParamPrefs{}, + Params: &operations.Params{}, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreateSubscriptionRequest req = CreateSubscriptionRequest.builder() + .targetLibrarySectionID(1L) + .targetSectionLocationID(3L) + .type(2L) + .hints(Hints.builder() + .build()) + .prefs(CreateSubscriptionQueryParamPrefs.builder() + .build()) + .params(Params.builder() + .build()) + .build(); + + CreateSubscriptionResponse res = sdk.subscriptions().createSubscription() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.createSubscription({ + targetLibrarySectionID: 1, + targetSectionLocationID: 3, + type: 2, + hints: {}, + prefs: {}, + params: {}, + }); + + console.log(result); + } + + run(); + /media/subscriptions/process: + post: + summary: Process all subscriptions + operationId: processSubscriptions + description: Process all subscriptions asynchronously + tags: + - Subscriptions + responses: + '200': + description: OK + headers: + X-Plex-Activity: + description: The activity of the process + schema: + type: string + content: + text/html: {} + '403': + description: User cannot access DVR on this server + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Subscriptions.ProcessSubscriptions(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ProcessSubscriptionsResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ProcessSubscriptionsResponse res = sdk.subscriptions().processSubscriptions() + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.subscriptions.processSubscriptions(); + + console.log(result); + } + + run(); + /media/subscriptions/scheduled: + get: + summary: Get all scheduled recordings + operationId: getScheduledRecordings + description: Get all scheduled recordings across all subscriptions + tags: + - Subscriptions + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + MediaGrabOperation: + items: + $ref: '#/components/schemas/MediaGrabOperation' + type: array + type: object + type: object + '403': + description: User cannot access DVR on this server + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Subscriptions.GetScheduledRecordings(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetScheduledRecordingsResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetScheduledRecordingsResponse res = sdk.subscriptions().getScheduledRecordings() + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.subscriptions.getScheduledRecordings(); + + console.log(result); + } + + run(); + /media/subscriptions/template: + get: + summary: Get the subscription template + operationId: getTemplate + description: Get the templates for a piece of media which could include fetching one airing, season, the whole show, etc. + tags: + - Subscriptions + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: guid + description: The guid of the item for which to get the template in: query schema: type: string - example: '110' - required: true + example: plex://episode/5fc70265c40548002d539d23 responses: '200': - description: Search Results + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - type: object properties: MediaContainer: - type: object - properties: - size: - type: number - example: 26 - identifier: - type: string - example: com.plexapp.plugins.library - mediaTagPrefix: - type: string - example: /system/bundle/media/flags/ - mediaTagVersion: - type: number - example: 1680021154 - Metadata: - type: array - items: - type: object - properties: - allowSync: - type: boolean - librarySectionID: - type: number - example: 1 - librarySectionTitle: - type: string - example: Movies - librarySectionUUID: - type: string - example: 322a231a-b7f7-49f5-920f-14c61199cd30 - personal: - type: boolean - sourceTitle: - type: string - example: Hera - ratingKey: - type: number - example: 10398 - key: - type: string - example: /library/metadata/10398 - guid: - type: string - example: 'plex://movie/5d7768284de0ee001fcc8f52' - studio: - type: string - example: Paramount - type: - type: string - example: movie - title: - type: string - example: 'Mission: Impossible' - contentRating: - type: string - example: PG-13 - summary: - type: string - example: When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score. - rating: - type: number - example: 6.6 - audienceRating: - type: number - example: 7.1 - year: - type: number - example: 1996 - tagline: - type: string - example: Expect the impossible. - thumb: - type: string - example: /library/metadata/10398/thumb/1679505055 - art: - type: string - example: /library/metadata/10398/art/1679505055 - duration: - type: number - example: 6612628 - originallyAvailableAt: - type: string - format: date-time - example: 1996-05-22T00:00:00.000Z - addedAt: - type: number - example: 1589234571 - updatedAt: - type: number - example: 1679505055 - audienceRatingImage: - type: string - example: 'rottentomatoes://image.rating.upright' - chapterSource: - type: string - example: media - primaryExtraKey: - type: string - example: /library/metadata/10501 - ratingImage: - type: string - example: 'rottentomatoes://image.rating.ripe' - Media: - type: array - items: - type: object - properties: - id: - type: number - example: 26610 - duration: - type: number - example: 6612628 - bitrate: - type: number - example: 4751 - width: - type: number - example: 1916 - height: - type: number - example: 796 - aspectRatio: - type: number - example: 2.35 - audioChannels: - type: number - example: 6 - audioCodec: - type: string - example: aac - videoCodec: - type: string - example: hevc - videoResolution: - type: number - example: 1080 - container: - type: string - example: mkv - videoFrameRate: - type: string - example: 24p - audioProfile: - type: string - example: lc - videoProfile: - type: string - example: main 10 - Part: - type: array - items: - type: object - properties: - id: - type: number - example: 26610 - key: - type: string - example: /library/parts/26610/1589234571/file.mkv - duration: - type: number - example: 6612628 - file: - type: string - example: /movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv - size: - type: number - example: 3926903851 - audioProfile: - type: string - example: lc - container: - type: string - example: mkv - videoProfile: - type: string - example: main 10 - Genre: - type: array - items: - type: object - properties: - tag: - type: string - example: Action - Director: - type: array - items: - type: object - properties: - tag: - type: string - example: Brian De Palma - Writer: - type: array - items: - type: object - properties: - tag: - type: string - example: David Koepp - Country: - type: array - items: - type: object - properties: - tag: - type: string - example: United States of America - Role: - type: array - items: - type: object - properties: - tag: - type: string - example: Tom Cruise - Provider: - type: array - items: - type: object - properties: - key: - type: string - example: /system/search - title: - type: string - example: Local Network - type: - type: string - example: mixed + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + SubscriptionTemplate: + items: + properties: + MediaSubscription: + items: + allOf: + - $ref: '#/components/schemas/MediaSubscription' + - properties: + airingsType: + type: string + librarySectionTitle: + type: string + locationPath: + type: string + parameters: + description: Parameter string for creating this subscription + type: string + selected: + type: boolean + targetLibrarySectionID: + description: Where this subscription will record to + type: integer + title: + description: The title of this subscription type + example: This Episode + type: string + type: + description: Metadata type number + type: integer + type: object + type: array + type: object + type: array + type: object + type: object + '403': + description: User cannot access DVR on this server + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.GetTemplate(ctx, operations.GetTemplateRequest{ + GUID: plexgo.Pointer("plex://episode/5fc70265c40548002d539d23"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetTemplateRequest; + import dev.plexapi.sdk.models.operations.GetTemplateResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetTemplateRequest req = GetTemplateRequest.builder() + .guid("plex://episode/5fc70265c40548002d539d23") + .build(); + + GetTemplateResponse res = sdk.subscriptions().getTemplate() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.getTemplate({ + guid: "plex://episode/5fc70265c40548002d539d23", + }); + + console.log(result); + } + + run(); + /photo/:/transcode: + get: + summary: Transcode an image + operationId: transcodeImage + description: Transcode an image, possibly changing format or size + tags: + - Transcoder + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: url + description: The source URL for the image to transcode. Note, if this URL requires a token such as `X-Plex-Token`, it should be given as a query parameter to this url. + in: query + schema: + type: string + example: /library/metadata/265/thumb/1715112705 + - name: format + description: The output format for the image; defaults to jpg + in: query + required: false + schema: + type: string + enum: + - jpg + - jpeg + - png + - ppm + - name: width + description: The desired width of the output image + in: query + schema: + type: integer + - name: height + description: The desired height of the output image + in: query + schema: + type: integer + - name: quality + description: The desired quality of the output. -1 means the highest quality. Defaults to -1 + in: query + required: false + schema: + maximum: 127 + minimum: -1 + type: integer + - name: background + description: The background color to apply before painting the image. Only really applicable if image has transparency. Defaults to none + in: query + required: false + schema: + type: string + example: '#ff5522' + - name: upscale + description: Indicates if image should be upscaled to the desired width/height. Defaults to false + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + - name: minSize + description: Indicates if image should be scaled to fit the smaller dimension. By default (false) the image is scaled to fit within the width/height specified but if this parameter is true, it will allow overflowing one dimension to fit the other. Essentially it is making the width/height minimum sizes of the image or sizing the image to fill the entire width/height even if it overflows one dimension. + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + - name: rotate + description: Obey the rotation values specified in EXIF data. Defaults to true. + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + - name: blur + description: Apply a blur to the image, Defaults to 0 (none) + in: query + required: false + schema: + type: integer + - name: saturation + description: Scale the image saturation by the specified percentage. Defaults to 100 + in: query + required: false + schema: + maximum: 100 + minimum: 0 + type: integer + - name: opacity + description: Render the image at the specified opacity percentage. Defaults to 100 + in: query + required: false + schema: + maximum: 100 + minimum: 0 + type: integer + - name: chromaSubsampling + description: |- + Use the specified chroma subsambling. + - 0: 411 + - 1: 420 + - 2: 422 + - 3: 444 + Defaults to 3 (444) + in: query + required: false + schema: + type: integer + enum: + - 0 + - 1 + - 2 + - 3 + - name: blendColor + description: The color to blend with the image. Defaults to none + in: query + required: false + schema: + type: string + example: '#ff5522' + responses: + '200': + description: The resulting image + content: + image/jpeg: + schema: + format: binary + type: string + image/png: + schema: + format: binary + type: string + image/x-portable-pixmap: + schema: + format: binary + type: string '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/400' + '403': + $ref: '#/components/responses/403' + '404': + $ref: '#/components/responses/404' x-codeSamples: - lang: php - label: getSearchResults + label: PlexPHP + source: |- + declare(strict_types=1); + + require 'vendor/autoload.php'; + + use LukeHagar\Plex_API; + use LukeHagar\Plex_API\Models\Operations; + + $sdk = Plex_API\PlexAPI::builder() + ->setSecurity( + '' + ) + ->build(); + + $request = new Operations\GetResizedPhotoRequest( + width: 110, + height: 165, + blur: 0, + minSize: Operations\MinSize::Zero, + upscale: Operations\Upscale::Zero, + url: '/library/metadata/49564/thumb/1654258204', + ); + + $response = $sdk->server->getResizedPhoto( + request: $request + ); + + if ($response->statusCode === 200) { + // handle response + } + - lang: ruby + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + req = Models::Operations::GetResizedPhotoRequest.new( + width: 110.0, + height: 165.0, + opacity: 643_869, + blur: 0.0, + min_size: Models::Operations::MinSize::ONE, + upscale: Models::Operations::Upscale::ONE, + url: "/library/metadata/49564/thumb/1654258204", + ) + + res = s.server.get_resized_photo(req) + + if res.status_code == 200 + # handle response + end + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Transcoder.TranscodeImage(ctx, operations.TranscodeImageRequest{ + URL: plexgo.Pointer("/library/metadata/265/thumb/1715112705"), + Background: plexgo.Pointer("#ff5522"), + Upscale: components.BoolIntOne.ToPointer(), + MinSize: components.BoolIntOne.ToPointer(), + Rotate: components.BoolIntOne.ToPointer(), + BlendColor: plexgo.Pointer("#ff5522"), + }) + if err != nil { + log.Fatal(err) + } + if res.TwoHundredImageJpegResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.TranscodeImageRequest; + import dev.plexapi.sdk.models.operations.TranscodeImageResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + TranscodeImageRequest req = TranscodeImageRequest.builder() + .url("/library/metadata/265/thumb/1715112705") + .background("#ff5522") + .upscale(BoolInt.ONE) + .minSize(BoolInt.ONE) + .rotate(BoolInt.ONE) + .blendColor("#ff5522") + .build(); + + TranscodeImageResponse res = sdk.transcoder().transcodeImage() + .request(req) + .call(); + + if (res.twoHundredImageJpegResponseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.transcoder.transcodeImage({ + url: "/library/metadata/265/thumb/1715112705", + background: "#ff5522", + upscale: BoolInt.One, + minSize: BoolInt.One, + rotate: BoolInt.One, + blendColor: "#ff5522", + }); + + console.log(result); + } + + run(); + /playlists: + get: + summary: List playlists + operationId: listPlaylists + description: 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. + tags: + - Playlist + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistType + description: Limit to a type of playlist + in: query + schema: + type: string + enum: + - audio + - video + - photo + - $ref: '#/components/parameters/smart' + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithPlaylistMetadata' + x-codeSamples: + - lang: php + label: PlexPHP source: |- declare(strict_types=1); @@ -20665,145 +9828,381 @@ paths: - $response = $sdk->search->getSearchResults( - query: '110' + $response = $sdk->playlists->getPlaylists( + ); if ($response->object !== null) { // handle response } - lang: ruby - label: getSearchResults - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.search.get_search_results(query=\"110\")\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.playlists.get_playlists(playlist_type=Models::Operations::PlaylistType::AUDIO, smart=Models::Operations::QueryParamSmart::ZERO) + + if ! res.object.nil? + # handle response + end - lang: go - label: getSearchResults - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Search.GetSearchResults(ctx, \"110\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Playlist.ListPlaylists(ctx, operations.ListPlaylistsRequest{}) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } - lang: java - label: getSearchResults + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetSearchResultsBadRequest; - import dev.plexapi.plexapi.models.errors.GetSearchResultsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetSearchResultsResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListPlaylistsRequest; + import dev.plexapi.sdk.models.operations.ListPlaylistsResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetSearchResultsBadRequest, GetSearchResultsUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetSearchResultsResponse res = sdk.search().getSearchResults() - .query("110") + ListPlaylistsRequest req = ListPlaylistsRequest.builder() + .build(); + + ListPlaylistsResponse res = sdk.playlist().listPlaylists() + .request(req) .call(); - if (res.object().isPresent()) { + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { // handle response } } } - lang: typescript - label: getSearchResults + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.search.getSearchResults("110"); + const result = await plexAPI.playlist.listPlaylists({}); - // Handle the result console.log(result); } run(); - /security/token: - get: + post: + summary: Create a Playlist + operationId: createPlaylist + description: Create a new playlist. By default the playlist is blank. tags: - - Authentication - summary: Get a Transient Token - description: | - 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. - operationId: getTransientToken + - Library Playlists parameters: - - name: type - description: '`delegation` - This is the only supported `type` parameter.' + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: uri + description: The content URI for what we're playing (e.g. `library://...`). in: query schema: type: string - enum: - - delegation - required: true - - name: scope - description: '`all` - This is the only supported `scope` parameter.' + - name: playQueueID + description: To create a playlist from an existing play queue. in: query schema: - type: string - enum: - - all - required: true + type: integer responses: '200': - description: A Transient Token + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithPlaylistMetadata' '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/400' x-codeSamples: - lang: php - label: getTransientToken + label: PlexPHP + source: |- + declare(strict_types=1); + + require 'vendor/autoload.php'; + + use LukeHagar\Plex_API; + use LukeHagar\Plex_API\Models\Operations; + + $sdk = Plex_API\PlexAPI::builder() + ->setSecurity( + '' + ) + ->build(); + + $request = new Operations\CreatePlaylistRequest( + title: '', + type: Operations\CreatePlaylistQueryParamType::Audio, + smart: Operations\Smart::One, + uri: 'https://short-term-disconnection.name/', + ); + + $response = $sdk->playlists->createPlaylist( + request: $request + ); + + if ($response->object !== null) { + // handle response + } + - lang: ruby + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + req = Models::Operations::CreatePlaylistRequest.new( + title: "", + type: Models::Operations::CreatePlaylistQueryParamType::PHOTO, + smart: Models::Operations::Smart::ONE, + uri: "https://hoarse-testing.info/", + ) + + res = s.playlists.create_playlist(req) + + if ! res.object.nil? + # handle response + end + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{}) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CreatePlaylistRequest; + import dev.plexapi.sdk.models.operations.CreatePlaylistResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreatePlaylistRequest req = CreatePlaylistRequest.builder() + .build(); + + CreatePlaylistResponse res = sdk.libraryPlaylists().createPlaylist() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.createPlaylist({}); + + console.log(result); + } + + run(); + /playlists/upload: + post: + summary: Upload + operationId: uploadPlaylist + description: 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. + tags: + - Library Playlists + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: path + description: Absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server. If the `path` argument is a directory, that path will be scanned for playlist files to be processed. Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it. The GUID of each playlist is based on the filename. If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it. The GUID of each playlist is based on the filename. + in: query + schema: + type: string + example: /home/barkley/playlist.m3u + - name: force + description: Force overwriting of duplicate playlists. By default, a playlist file uploaded with the same path will overwrite the existing playlist. The `force` argument is used to disable overwriting. If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + '403': + $ref: '#/components/responses/200' + '500': + description: The playlist could not be imported + content: + text/html: {} + x-codeSamples: + - lang: php + label: PlexPHP source: |- declare(strict_types=1); @@ -20820,9 +10219,10 @@ paths: - $response = $sdk->authentication->getTransientToken( - type: Operations\GetTransientTokenQueryParamType::Delegation, - scope: Operations\Scope::All + $response = $sdk->playlists->uploadPlaylist( + path: '/home/barkley/playlist.m3u', + force: Operations\QueryParamForce::One, + sectionID: 1 ); @@ -20830,133 +10230,475 @@ paths: // handle response } - lang: ruby - label: getTransientToken - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.authentication.get_transient_token(type=::PlexRubySDK::Operations::GetTransientTokenQueryParamType::DELEGATION, scope=::PlexRubySDK::Operations::Scope::ALL)\n\nif res.status_code == 200\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.playlists.upload_playlist(path="/home/barkley/playlist.m3u", force=Models::Operations::QueryParamForce::ZERO, section_id=1) + + if res.status_code == 200 + # handle response + end - lang: go - label: getTransientToken - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Authentication.GetTransientToken(ctx, operations.GetTransientTokenQueryParamTypeDelegation, operations.ScopeAll)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.UploadPlaylist(ctx, operations.UploadPlaylistRequest{ + Path: plexgo.Pointer("/home/barkley/playlist.m3u"), + Force: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: getTransientToken + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetTransientTokenBadRequest; - import dev.plexapi.plexapi.models.errors.GetTransientTokenUnauthorized; - import dev.plexapi.plexapi.models.operations.GetTransientTokenQueryParamType; - import dev.plexapi.plexapi.models.operations.GetTransientTokenResponse; - import dev.plexapi.plexapi.models.operations.Scope; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.UploadPlaylistRequest; + import dev.plexapi.sdk.models.operations.UploadPlaylistResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetTransientTokenBadRequest, GetTransientTokenUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetTransientTokenResponse res = sdk.authentication().getTransientToken() - .type(GetTransientTokenQueryParamType.DELEGATION) - .scope(Scope.ALL) + UploadPlaylistRequest req = UploadPlaylistRequest.builder() + .path("/home/barkley/playlist.m3u") + .force(BoolInt.ONE) + .build(); + + UploadPlaylistResponse res = sdk.libraryPlaylists().uploadPlaylist() + .request(req) .call(); // handle response } } - lang: typescript - label: getTransientToken + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { GetTransientTokenQueryParamType, Scope } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.authentication.getTransientToken(GetTransientTokenQueryParamType.Delegation, Scope.All); + const result = await plexAPI.libraryPlaylists.uploadPlaylist({ + path: "/home/barkley/playlist.m3u", + force: BoolInt.One, + }); + + console.log(result); + } + + run(); + /playQueues: + post: + summary: Create a play queue + operationId: createPlayQueue + description: |- + 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 + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: uri + description: The content URI for what we're playing. + in: query + schema: + type: string + - name: playlistID + description: the ID of the playlist we're playing. + in: query + schema: + type: integer + - name: type + description: The type of play queue to create + in: query + required: true + schema: + type: string + enum: + - audio + - video + - photo + - name: key + description: The key of the first item to play, defaults to the first in the play queue. + in: query + schema: + type: string + - name: shuffle + description: Whether to shuffle the playlist, defaults to 0. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: repeat + description: If the PQ is bigger than the window, fill any empty space with wraparound items, defaults to 0. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: continuous + description: Whether to create a continuous play queue (e.g. from an episode), defaults to 0. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: extrasPrefixCount + description: Number of trailers to prepend a movie with not including the pre-roll. If omitted the pre-roll will not be returned in the play queue. When resuming a movie `extrasPrefixCount` should be omitted as a parameter instead of passing 0. + in: query + schema: + type: integer + - name: recursive + description: Only applies to queues of type photo, whether to retrieve all descendent photos from an album or section, defaults to 1. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: onDeck + description: Only applies to queues of type show or seasons, whether to return a queue that is started on the On Deck episode if one exists. Otherwise begins the play queue on the beginning of the show or season. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + playQueueID: + description: The ID of the play queue, which is used in subsequent requests. + type: integer + playQueueLastAddedItemID: + description: Defines where the "Up Next" region starts + type: string + playQueueSelectedItemID: + description: The queue item ID of the currently selected item. + type: integer + playQueueSelectedItemOffset: + description: The offset of the selected item in the play queue, from the beginning of the queue. + type: integer + playQueueSelectedMetadataItemID: + description: The metadata item ID of the currently selected item (matches `ratingKey` attribute in metadata item if the media provider is a library). + type: integer + playQueueShuffled: + description: Whether or not the queue is shuffled. + type: boolean + playQueueSourceURI: + description: The original URI used to create the play queue. + type: string + playQueueTotalCount: + description: The total number of items in the play queue. + type: integer + playQueueVersion: + description: The version of the play queue. It increments every time a change is made to the play queue to assist clients in knowing when to refresh. + type: integer + type: object + type: object + '400': + $ref: '#/components/responses/400' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.CreatePlayQueue(ctx, operations.CreatePlayQueueRequest{ + Type: operations.TypeAudio, + Shuffle: components.BoolIntOne.ToPointer(), + Repeat: components.BoolIntOne.ToPointer(), + Continuous: components.BoolIntOne.ToPointer(), + Recursive: components.BoolIntOne.ToPointer(), + OnDeck: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreatePlayQueueRequest req = CreatePlayQueueRequest.builder() + .type(Type.AUDIO) + .shuffle(BoolInt.ONE) + .repeat(BoolInt.ONE) + .continuous(BoolInt.ONE) + .recursive(BoolInt.ONE) + .onDeck(BoolInt.ONE) + .build(); + + CreatePlayQueueResponse res = sdk.playQueue().createPlayQueue() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { CreatePlayQueueType } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.createPlayQueue({ + type: CreatePlayQueueType.Audio, + shuffle: BoolInt.One, + repeat: BoolInt.One, + continuous: BoolInt.One, + recursive: BoolInt.One, + onDeck: BoolInt.One, + }); - // Handle the result console.log(result); } run(); /security/resources: get: - tags: - - Authentication summary: Get Source Connection Information - description: | - 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. - Note: requires Plex Media Server >= 1.15.4. operationId: getSourceConnectionInformation + description: 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. + tags: + - General parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" - name: source description: The source identifier with an included prefix. in: query + required: true schema: type: string - examples: - - 'server://client-identifier' - - 'provider://provider-identifier' - required: true + - name: refresh + description: Force refresh + in: query + schema: + $ref: "#/components/schemas/BoolInt" responses: '200': - description: Source Connection Information + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Device: + properties: + accessToken: + type: string + clientIdentifier: + type: string + Connection: + items: + properties: + address: + type: string + local: + description: Indicates if the connection is the server's LAN address + type: boolean + port: + type: integer + protocol: + type: string + relay: + description: Indicates the connection is over a relayed connection + type: boolean + uri: + type: string + type: object + type: array + name: + type: string + type: object + type: object + type: object '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: A query param is missing or the wrong value content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + text/html: {} + '403': + description: Invalid or no token provided or a transient token could not be created content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} x-codeSamples: - lang: php - label: getSourceConnectionInformation + label: PlexPHP source: |- declare(strict_types=1); @@ -20980,199 +10722,101 @@ paths: // handle response } - lang: ruby - label: getSourceConnectionInformation - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.authentication.get_source_connection_information(source=\"server://client-identifier\")\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: getSourceConnectionInformation - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Authentication.GetSourceConnectionInformation(ctx, \"provider://provider-identifier\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: getSourceConnectionInformation + label: PlexRuby source: |- - package hello.world; + require 'plex_ruby_sdk' - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetSourceConnectionInformationBadRequest; - import dev.plexapi.plexapi.models.errors.GetSourceConnectionInformationUnauthorized; - import dev.plexapi.plexapi.models.operations.GetSourceConnectionInformationResponse; - import java.lang.Exception; + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) - public class Application { + res = s.authentication.get_source_connection_information(source="server://client-identifier") - public static void main(String[] args) throws GetSourceConnectionInformationBadRequest, GetSourceConnectionInformationUnauthorized, Exception { + if res.status_code == 200 + # handle response + end + - lang: go + label: PlexGO + source: |- + package main - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" + "log" + ) - GetSourceConnectionInformationResponse res = sdk.authentication().getSourceConnectionInformation() - .source("provider://provider-identifier") - .call(); + 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(""), + ) + + res, err := s.General.GetSourceConnectionInformation(ctx, operations.GetSourceConnectionInformationRequest{ + Source: "", + Refresh: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { // handle response } } - - lang: typescript - label: getSourceConnectionInformation - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.authentication.getSourceConnectionInformation("provider://provider-identifier"); - - // Handle the result - console.log(result); - } - - run(); - /servers: - get: - tags: - - Server - summary: Get Server List - description: Get Server List - operationId: getServerList - responses: - '200': - description: List of Servers - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: number - example: 1 - Server: - type: array - items: - type: object - properties: - name: - type: string - example: Hera - host: - type: string - example: 10.10.10.47 - address: - type: string - example: 10.10.10.47 - port: - type: number - example: 32400 - machineIdentifier: - type: string - example: 96f2fe7a78c9dc1f16a16bedbe90f98149be16b4 - version: - type: string - example: 1.31.3.6868-28fc46b27 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getServerList - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->server->getServerList( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getServerList - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.server.get_server_list()\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getServerList - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetServerList(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - lang: java - label: getServerList + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetServerListBadRequest; - import dev.plexapi.plexapi.models.errors.GetServerListUnauthorized; - import dev.plexapi.plexapi.models.operations.GetServerListResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationRequest; + import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetServerListBadRequest, GetServerListUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetServerListResponse res = sdk.server().getServerList() + GetSourceConnectionInformationRequest req = GetSourceConnectionInformationRequest.builder() + .source("") + .refresh(BoolInt.ONE) + .build(); + + GetSourceConnectionInformationResponse res = sdk.general().getSourceConnectionInformation() + .request(req) .call(); if (res.object().isPresent()) { @@ -21181,242 +10825,354 @@ paths: } } - lang: typescript - label: getServerList + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.server.getServerList(); + const result = await plexAPI.general.getSourceConnectionInformation({ + source: "", + refresh: BoolInt.One, + }); - // Handle the result console.log(result); } run(); - /statistics/media: - get: + /security/token: + post: + summary: Get Transient Tokens + operationId: getTransientToken + description: |- + 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 tags: - - Statistics - summary: Get Media Statistics - description: This will return the media statistics for the server - operationId: getStatistics + - General parameters: - - name: timespan - description: | - The timespan to retrieve statistics for - the exact meaning of this parameter is not known + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: type + description: The value `delegation` is the only supported `type` parameter. + in: query + required: true + schema: + type: string + enum: + - delegation + - name: scope + description: The value `all` is the only supported `scope` parameter. + in: query + required: true + schema: + type: string + enum: + - all + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + token: + description: The transient token + type: string + type: object + type: object + '400': + description: A query param is missing or the wrong value + content: + text/html: {} + '403': + description: Invalid or no token provided or a transient token could not be created + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.General.GetTransientToken(ctx, operations.GetTransientTokenRequest{ + Type: operations.QueryParamTypeDelegation, + Scope: operations.ScopeAll, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetTransientTokenRequest req = GetTransientTokenRequest.builder() + .type(QueryParamType.DELEGATION) + .scope(Scope.ALL) + .build(); + + GetTransientTokenResponse res = sdk.general().getTransientToken() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { GetTransientTokenScope, GetTransientTokenType } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.general.getTransientToken({ + type: GetTransientTokenType.Delegation, + scope: GetTransientTokenScope.All, + }); + + console.log(result); + } + + run(); + /services/ultrablur/colors: + get: + summary: Get UltraBlur Colors + operationId: getColors + description: Retrieves the four colors extracted from an image for clients to use to generate an ultrablur image. + tags: + - UltraBlur + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: url + description: Url for image which requires color extraction. Can be relative PMS library path or absolute url. in: query schema: - type: integer - required: false - example: 4 + type: string + example: /library/metadata/217745/art/1718931408 responses: '200': - description: Media Statistics + description: OK content: application/json: schema: - type: object properties: MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 5497 - Device: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 208 - name: - type: string - example: Roku Express - platform: - type: string - example: Roku - clientIdentifier: - type: string - example: 793095d235660625108ef785cc7646e9 - createdAt: - type: integer - format: int32 - example: 1706470556 - Account: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 238960586 - key: - type: string - example: /accounts/238960586 - name: - type: string - example: Diane - defaultAudioLanguage: - type: string - example: en - autoSelectAudio: - type: boolean - example: true - defaultSubtitleLanguage: - type: string - example: en - subtitleMode: - type: integer - format: int32 - example: 1 - thumb: - type: string - example: 'https://plex.tv/users/50d83634246da1de/avatar?c=1707110967' - StatisticsMedia: - type: array - items: - type: object - properties: - accountID: - type: integer - format: int32 - example: 1 - deviceID: - type: integer - format: int32 - example: 13 - timespan: - type: integer - format: int32 - example: 4 - at: - type: integer - format: int32 - example: 1707141600 - metadataType: - type: integer - format: int32 - example: 4 - count: - type: integer - format: int32 - example: 1 - duration: - type: integer - format: int32 - example: 1555 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + UltraBlurColors: + items: + properties: + bottomLeft: + description: The color (hex) for the bottom left quadrant. + type: string + bottomRight: + description: The color (hex) for the bottom right quadrant. + type: string + topLeft: + description: The color (hex) for the top left quadrant. + type: string + topRight: + description: The color (hex) for the top right quadrant. + type: string + type: object + type: array + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + '404': + description: The image url could not be found. content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} + '500': + description: The server was unable to successfully extract the UltraBlur colors. + content: + text/html: {} x-codeSamples: - - lang: php - label: getStatistics - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->statistics->getStatistics( - timespan: 4 - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getStatistics - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.statistics.get_statistics(timespan=4)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: getStatistics - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Statistics.GetStatistics(ctx, plexgo.Int64(4))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.UltraBlur.GetColors(ctx, operations.GetColorsRequest{ + URL: plexgo.Pointer("/library/metadata/217745/art/1718931408"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: getStatistics + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetStatisticsBadRequest; - import dev.plexapi.plexapi.models.errors.GetStatisticsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetStatisticsResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetColorsRequest; + import dev.plexapi.sdk.models.operations.GetColorsResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetStatisticsBadRequest, GetStatisticsUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetStatisticsResponse res = sdk.statistics().getStatistics() - .timespan(4L) + GetColorsRequest req = GetColorsRequest.builder() + .url("/library/metadata/217745/art/1718931408") + .build(); + + GetColorsResponse res = sdk.ultraBlur().getColors() + .request(req) .call(); if (res.object().isPresent()) { @@ -21425,843 +11181,292 @@ paths: } } - lang: typescript - label: getStatistics + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.statistics.getStatistics(4); + const result = await plexAPI.ultraBlur.getColors({ + url: "/library/metadata/217745/art/1718931408", + }); - // Handle the result console.log(result); } run(); - /statistics/resources: + /services/ultrablur/image: get: + summary: Get UltraBlur Image + operationId: getImage + description: Retrieves a server-side generated UltraBlur image based on the provided color inputs. Clients should always call this via the photo transcoder endpoint. tags: - - Statistics - summary: Get Resources Statistics - description: This will return the resources for the server - operationId: getResourcesStatistics + - UltraBlur parameters: - - name: timespan - description: | - The timespan to retrieve statistics for - the exact meaning of this parameter is not known + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: topLeft + description: The base color (hex) for the top left quadrant. in: query schema: + type: string + example: 3f280a + - name: topRight + description: The base color (hex) for the top right quadrant. + in: query + schema: + type: string + example: 6b4713 + - name: bottomRight + description: The base color (hex) for the bottom right quadrant. + in: query + schema: + type: string + example: 0f2a43 + - name: bottomLeft + description: The base color (hex) for the bottom left quadrant. + in: query + schema: + type: string + example: 1c425d + - name: width + description: Width in pixels for the image. + in: query + schema: + maximum: 3840 + minimum: 320 type: integer - required: false - example: 4 + example: 1920 + - name: height + description: Height in pixels for the image. + in: query + schema: + maximum: 2160 + minimum: 240 + type: integer + example: 1080 + - name: noise + description: Whether to add noise to the ouput image. Noise can reduce color banding with the gradients. Image sizes with noise will be larger. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 responses: '200': - description: Resource Statistics + description: OK content: - application/json: + image/png: schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 5497 - StatisticsResources: - type: array - items: - type: object - properties: - timespan: - type: integer - example: 6 - at: - type: integer - example: 1718384427 - hostCpuUtilization: - type: number - format: float - example: 1.276 - processCpuUtilization: - type: number - format: float - example: 0.025 - hostMemoryUtilization: - type: number - format: float - example: 17.026 - processMemoryUtilization: - type: number - format: float - example: 0.493 + format: binary + type: string '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: Requested width and height parameters are out of bounds (maximum 3840 x 2160) content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} x-codeSamples: - - lang: php - label: getResourcesStatistics - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->statistics->getResourcesStatistics( - timespan: 4 - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getResourcesStatistics - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.statistics.get_resources_statistics(timespan=4)\n\nif ! res.object.nil?\n # handle response\nend" - lang: go - label: getResourcesStatistics - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Statistics.GetResourcesStatistics(ctx, plexgo.Int64(4))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.UltraBlur.GetImage(ctx, operations.GetImageRequest{ + TopLeft: plexgo.Pointer("3f280a"), + TopRight: plexgo.Pointer("6b4713"), + BottomRight: plexgo.Pointer("0f2a43"), + BottomLeft: plexgo.Pointer("1c425d"), + Width: plexgo.Pointer[int64](1920), + Height: plexgo.Pointer[int64](1080), + Noise: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } + } - lang: java - label: getResourcesStatistics + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetResourcesStatisticsBadRequest; - import dev.plexapi.plexapi.models.errors.GetResourcesStatisticsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetResourcesStatisticsResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetImageRequest; + import dev.plexapi.sdk.models.operations.GetImageResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetResourcesStatisticsBadRequest, GetResourcesStatisticsUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetResourcesStatisticsResponse res = sdk.statistics().getResourcesStatistics() - .timespan(4L) + GetImageRequest req = GetImageRequest.builder() + .topLeft("3f280a") + .topRight("6b4713") + .bottomRight("0f2a43") + .bottomLeft("1c425d") + .width(1920L) + .height(1080L) + .noise(BoolInt.ONE) + .build(); + + GetImageResponse res = sdk.ultraBlur().getImage() + .request(req) .call(); - if (res.object().isPresent()) { + if (res.responseStream().isPresent()) { // handle response } } } - lang: typescript - label: getResourcesStatistics + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.statistics.getResourcesStatistics(4); + const result = await plexAPI.ultraBlur.getImage({ + topLeft: "3f280a", + topRight: "6b4713", + bottomRight: "0f2a43", + bottomLeft: "1c425d", + width: 1920, + height: 1080, + noise: BoolInt.One, + }); - // Handle the result - console.log(result); - } - - run(); - /statistics/bandwidth: - get: - tags: - - Statistics - summary: Get Bandwidth Statistics - description: This will return the bandwidth statistics for the server - operationId: getBandwidthStatistics - parameters: - - name: timespan - description: | - The timespan to retrieve statistics for - the exact meaning of this parameter is not known - in: query - schema: - type: integer - required: false - example: 4 - responses: - '200': - description: Bandwidth Statistics - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 5497 - Device: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 208 - name: - type: string - example: Roku Express - platform: - type: string - example: Roku - clientIdentifier: - type: string - example: 793095d235660625108ef785cc7646e9 - createdAt: - type: integer - format: int32 - example: 1706470556 - Account: - type: array - items: - type: object - properties: - id: - type: integer - format: int32 - example: 238960586 - key: - type: string - example: /accounts/238960586 - name: - type: string - example: Diane - defaultAudioLanguage: - type: string - example: en - autoSelectAudio: - type: boolean - example: true - defaultSubtitleLanguage: - type: string - example: en - subtitleMode: - type: integer - format: int32 - example: 1 - thumb: - type: string - example: 'https://plex.tv/users/50d83634246da1de/avatar?c=1707110967' - StatisticsBandwidth: - type: array - items: - type: object - properties: - accountID: - type: integer - format: int32 - example: 238960586 - deviceID: - type: integer - format: int32 - example: 208 - timespan: - type: integer - example: 6 - at: - type: integer - format: int32 - example: 1718387650 - lan: - type: boolean - example: true - bytes: - type: integer - example: 22 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getBandwidthStatistics - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->statistics->getBandwidthStatistics( - timespan: 4 - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getBandwidthStatistics - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.statistics.get_bandwidth_statistics(timespan=4)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getBandwidthStatistics - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Statistics.GetBandwidthStatistics(ctx, plexgo.Int64(4))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getBandwidthStatistics - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetBandwidthStatisticsBadRequest; - import dev.plexapi.plexapi.models.errors.GetBandwidthStatisticsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetBandwidthStatisticsResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetBandwidthStatisticsBadRequest, GetBandwidthStatisticsUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetBandwidthStatisticsResponse res = sdk.statistics().getBandwidthStatistics() - .timespan(4L) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getBandwidthStatistics - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.statistics.getBandwidthStatistics(4); - - // Handle the result console.log(result); } run(); /status/sessions: get: + summary: List Sessions + operationId: listSessions + description: List all current playbacks on this server tags: - - Sessions - summary: Get Active Sessions - description: This will retrieve the "Now Playing" Information of the PMS. - operationId: getSessions + - Status + security: + - token: + - admin responses: '200': - description: List of Active Plex Sessions + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - type: object properties: MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 1 - Metadata: - type: array - items: - type: object - properties: - addedAt: - type: integer - format: int32 - example: 1705543312 - art: - type: string - example: /library/metadata/39904/art/1705310687 - duration: - type: integer - format: int32 - example: 186240 - grandparentArt: - type: string - example: /library/metadata/39904/art/1705310687 - grandparentGuid: - type: string - example: 'plex://artist/5d07bbfd403c6402904a6480' - grandparentKey: - type: string - example: /library/metadata/39904 - grandparentRatingKey: - type: string - example: '39904' - grandparentThumb: - type: string - example: /library/metadata/39904/thumb/1705310687 - grandparentTitle: - type: string - example: Green Day - guid: - type: string - example: 'plex://track/6535834f71f22f36f71a8e8f' - index: - type: integer - format: int32 - example: 1 - key: - type: string - example: /library/metadata/67085 - librarySectionID: - type: string - example: '3' - librarySectionKey: - type: string - example: /library/sections/3 - librarySectionTitle: - type: string - example: Music - musicAnalysisVersion: - type: string - example: '1' - originalTitle: - type: string - description: 'The original untranslated name of the media item when non-english, or the track artist if an audio Item has an album artist' - example: The American Dream Is Killing Me - parentGuid: - type: string - example: 'plex://album/65394d6d472b8ab03ef47f12' - parentIndex: - type: integer - format: int32 - example: 1 - parentKey: - type: string - example: /library/metadata/67084 - parentRatingKey: - type: string - example: '67084' - parentStudio: - type: string - example: Reprise Records - parentThumb: - type: string - example: /library/metadata/67084/thumb/1705543314 - parentTitle: - type: string - example: Saviors - parentYear: - type: integer - format: int32 - example: 2024 - ratingCount: - type: integer - format: int32 - example: 45885 - ratingKey: - type: string - example: '67085' - sessionKey: - type: string - example: '203' - thumb: - type: string - example: /library/metadata/67084/thumb/1705543314 - title: - type: string - example: The American Dream Is Killing Me - titleSort: - type: string - example: American Dream Is Killing Me - type: - type: string - example: track - updatedAt: - type: integer - format: int32 - example: 1705543314 - viewOffset: - type: integer - format: int32 - example: 1000 - Media: - type: array - items: - type: object - properties: - audioChannels: - type: integer - format: int32 - example: 2 - audioCodec: - type: string - example: flac - bitrate: - type: integer - format: int32 - example: 1014 - container: - type: string - example: flac - duration: - type: integer - format: int32 - example: 186240 - id: - type: string - example: '130355' - selected: - type: boolean - example: true - Part: - type: array - items: - type: object - properties: - container: - type: string - example: flac - duration: - type: integer - format: int32 - example: 186240 - file: - type: string - example: /music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac - hasThumbnail: - type: string - example: '1' - id: - type: string - example: '130625' - key: - type: string - example: /library/parts/130625/1705543268/file.flac - size: - type: integer - format: int32 - example: 23644000 - decision: - type: string - example: directplay - selected: - type: boolean - example: true - Stream: - type: array - items: - type: object - properties: - albumGain: - type: string - example: '-12.94' - albumPeak: - type: string - example: '1.000000' - albumRange: - type: string - example: '4.751014' - audioChannelLayout: - type: string - example: stereo - bitDepth: - type: integer - format: int32 - example: 16 - bitrate: - type: integer - format: int32 - example: 1014 - channels: - type: integer - format: int32 - example: 2 - codec: - type: string - example: flac - displayTitle: - type: string - example: FLAC (Stereo) - extendedDisplayTitle: - type: string - example: FLAC (Stereo) - gain: - type: string - example: '-12.94' - id: - type: string - example: '352487' - index: - type: integer - format: int32 - example: 0 - loudness: - type: string - example: '-5.94' - lra: - type: string - example: '1.74' - peak: - type: string - example: '1.000000' - samplingRate: - type: integer - format: int32 - example: 44100 - selected: - type: boolean - example: true - streamType: - type: integer - format: int32 - example: 2 - location: - type: string - example: direct - User: - type: object - properties: - id: - type: string - example: '1' - thumb: - type: string - example: 'https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661' - title: - type: string - example: Blindkitty38 - Player: - type: object - properties: - address: - type: string - example: 10.10.10.171 - machineIdentifier: - type: string - example: 3tsdzir85m2onc3qyr255aq1 - model: - type: string - example: standalone - platform: - type: string - example: windows - platformVersion: - type: string - example: 10.0.22621 - product: - type: string - example: Plex for Windows - profile: - type: string - example: Plex Desktop - remotePublicAddress: - type: string - example: 68.248.140.20 - state: - type: string - example: playing - title: - type: string - example: DESKTOP-BL80MTD - version: - type: string - example: 1.85.0.4071-21128b56 - local: - type: boolean - example: true - relayed: - type: boolean - example: false - secure: - type: boolean - example: true - userID: - type: integer - format: int32 - example: 1 - Session: - type: object - properties: - id: - type: string - example: 93h7e00ncblxncqw9lkfaoxi - bandwidth: - type: integer - format: int32 - example: 1050 - location: - type: string - example: lan - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Metadata: + items: + allOf: + - properties: + Player: + $ref: '#/components/schemas/Player' + Session: + $ref: '#/components/schemas/Session' + User: + $ref: '#/components/schemas/User' + type: object + - $ref: '#/components/schemas/Metadata' + type: array + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - lang: php - label: getSessions + label: PlexPHP source: |- declare(strict_types=1); @@ -22285,31 +11490,65 @@ paths: // handle response } - lang: ruby - label: getSessions - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.sessions.get_sessions()\n\nif ! res.object.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.sessions.get_sessions() + + if ! res.object.nil? + # handle response + end - lang: go - label: getSessions - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.GetSessions(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Status.ListSessions(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: getSessions + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetSessionsBadRequest; - import dev.plexapi.plexapi.models.errors.GetSessionsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetSessionsResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListSessionsResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetSessionsBadRequest, GetSessionsUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetSessionsResponse res = sdk.sessions().getSessions() + ListSessionsResponse res = sdk.status().listSessions() .call(); if (res.object().isPresent()) { @@ -22318,217 +11557,255 @@ paths: } } - lang: typescript - label: getSessions + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - const plexAPI = new PlexAPI({ - accessToken: "", - }); + const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.sessions.getSessions(); + const result = await plexAPI.status.listSessions(); + + console.log(result); + } + + run(); + /status/sessions/background: + get: + summary: Get background tasks + operationId: getBackgroundTasks + description: Get the list of all background tasks + tags: + - Status + security: + - token: + - admin + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + TranscodeJob: + items: + properties: + generatorID: + type: integer + key: + type: string + progress: + maximum: 100 + minimum: 0 + type: number + ratingKey: + type: string + remaining: + description: The number of seconds remaining in this job + type: integer + size: + description: The size of the result so far + type: integer + speed: + description: The speed of the transcode; 1.0 means real-time + type: number + targetTagID: + description: The tag associated with the job. This could be the tag containing the optimizer settings. + type: integer + thumb: + type: string + title: + type: string + type: + enum: + - transcode + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Status.GetBackgroundTasks(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetBackgroundTasksResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetBackgroundTasksResponse res = sdk.status().getBackgroundTasks() + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + + const plexAPI = new PlexAPI(); + + async function run() { + const result = await plexAPI.status.getBackgroundTasks(); - // Handle the result console.log(result); } run(); /status/sessions/history/all: get: + summary: List Playback History + operationId: listPlaybackHistory + description: |- + 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. tags: - - Sessions - summary: Get Session History - description: This will Retrieve a listing of all history views. - operationId: getSessionHistory + - Status parameters: - - name: sort - description: | - Sorts the results by the specified field followed by the direction (asc, desc) - in: query - schema: - type: string - required: false - examples: - viewed-at-descending: - value: 'viewedAt:desc' - viewed-at-ascending: - value: 'viewedAt:asc' - rating-descending: - value: 'rating:desc' - rating-ascending: - value: 'rating:asc' - - name: accountId - description: | - Filter results by those that are related to a specific users id + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: accountID + description: The account id to restrict view history in: query schema: type: integer - required: false - example: 1 - - name: filter - description: | - Filters content by field and direction/equality - (Unknown if viewedAt is the only supported column) + - name: viewedAt + description: The time period to restrict history (typically of the form `viewedAt>=12456789`) in: query schema: - type: object - pattern: '^[A-Za-z][A-Za-z0-9]*[>=<]{0,2}$' - example: - viewed-at-greater-than: - value: viewedAt> - viewed-at-greater-than-or-equal-to: - value: viewedAt>=> - viewed-at-less-than: - value: viewedAt< - required: false - examples: - ViewedAt: - value: viewedAt>=1704862818 + type: integer - name: librarySectionID - description: | - Filters the results based on the id of a valid library section + description: The library section id to restrict view history in: query schema: type: integer - required: false - example: 12 + - name: metadataItemID + description: The metadata item to restrict view history (can provide the id for a show to see all of that show's view history). Note this is translated to `metadata_items.id`, `parents.id`, or `grandparents.id` internally depending on the metadata type. + in: query + schema: + type: integer + - name: sort + description: The field on which to sort. Multiple orderings can be specified separated by `,` and the direction specified following a `:` (`desc` or `asc`; `asc` is assumed if not provided). Note `metadataItemID` may not be used here. + in: query + schema: + type: array + items: + type: string + example: viewedAt:desc,accountID responses: '200': - description: List of Plex Sessions + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - type: object properties: MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 10855 - Metadata: - type: array - items: - type: object - properties: - historyKey: - type: string - example: /status/sessions/history/1 - key: - type: string - example: /library/metadata/32171 - ratingKey: - type: string - example: '32171' - librarySectionID: - type: string - example: '2' - parentKey: - type: string - example: /library/metadata/32170 - grandparentKey: - type: string - example: /library/metadata/32132 - title: - type: string - example: The Noise That Blue Makes - grandparentTitle: - type: string - example: Taskmaster - type: - type: string - example: episode - thumb: - type: string - example: /library/metadata/32171/thumb/-1 - parentThumb: - type: string - example: /library/metadata/32170/thumb/1654134301 - grandparentThumb: - type: string - example: /library/metadata/32132/thumb/1703933346 - grandparentArt: - type: string - example: /library/metadata/32132/art/1703933346 - index: - type: integer - format: int32 - example: 1 - parentIndex: - type: integer - format: int32 - example: 13 - originallyAvailableAt: - type: string - format: date - example: 2022-04-14T00:00:00.000Z - viewedAt: - type: integer - format: int32 - example: 1654139223 - accountID: - type: integer - format: int32 - example: 1 - deviceID: - type: integer - format: int32 - example: 5 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Metadata: + items: + properties: + accountID: + description: The account id of this playback + type: integer + deviceID: + description: The device id which played the item + type: integer + historyKey: + description: The key for this individual history item + type: string + key: + description: The metadata key for the item played + type: string + librarySectionID: + description: The library section id containing the item played + type: string + originallyAvailableAt: + description: The originally available at of the item played + type: string + ratingKey: + description: The rating key for the item played + type: string + thumb: + description: The thumb of the item played + type: string + title: + description: The title of the item played + type: string + type: + description: The metadata type of the item played + type: string + viewedAt: + description: The time when the item was played + type: integer + type: object + type: array + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - lang: php - label: getSessionHistory + label: PlexPHP source: |- declare(strict_types=1); @@ -22546,7 +11823,7 @@ paths: $filter = new Operations\QueryParamFilter(); $response = $sdk->sessions->getSessionHistory( - sort: '', + sort: 'viewedAt:desc', accountId: 1, filter: $filter, librarySectionID: 12 @@ -22557,290 +11834,146 @@ paths: // handle response } - lang: ruby - label: getSessionHistory - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.sessions.get_session_history(sort=\"\", account_id=1, filter=::PlexRubySDK::Operations::QueryParamFilter.new(), library_section_id=12)\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getSessionHistory - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.GetSessionHistory(ctx, plexgo.String(\"viewedAt:desc\"), plexgo.Int64(1), &operations.QueryParamFilter{}, plexgo.Int64(12))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getSessionHistory + label: PlexRuby source: |- - package hello.world; + require 'plex_ruby_sdk' - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetSessionHistoryBadRequest; - import dev.plexapi.plexapi.models.errors.GetSessionHistoryUnauthorized; - import dev.plexapi.plexapi.models.operations.GetSessionHistoryResponse; - import dev.plexapi.plexapi.models.operations.QueryParamFilter; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetSessionHistoryBadRequest, GetSessionHistoryUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetSessionHistoryResponse res = sdk.sessions().getSessionHistory() - .sort("viewedAt:desc") - .accountId(1L) - .filter(QueryParamFilter.builder() - .build()) - .librarySectionID(12L) - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getSessionHistory - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.sessions.getSessionHistory("viewedAt:desc", 1, {}, 12); - - // Handle the result - console.log(result); - } - - run(); - /transcode/sessions: - get: - tags: - - Sessions - summary: Get Transcode Sessions - description: Get Transcode Sessions - operationId: getTranscodeSessions - responses: - '200': - description: The Transcode Sessions - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 1 - TranscodeSession: - type: array - items: - type: object - properties: - key: - type: string - example: vv3i2q2lax92qlzul1hbd4bx - throttled: - type: boolean - example: false - complete: - type: boolean - example: false - progress: - type: number - example: 1.7999999523162842 - size: - type: integer - format: int32 - example: -22 - speed: - type: number - example: 25.100000381469727 - error: - type: boolean - example: false - duration: - type: integer - format: int32 - example: 1445695 - remaining: - type: integer - format: int32 - example: 53 - context: - type: string - example: streaming - sourceVideoCodec: - type: string - example: h264 - sourceAudioCodec: - type: string - example: aac - videoDecision: - type: string - example: transcode - audioDecision: - type: string - example: transcode - subtitleDecision: - type: string - example: burn - protocol: - type: string - example: http - container: - type: string - example: mkv - videoCodec: - type: string - example: h264 - audioCodec: - type: string - example: opus - audioChannels: - type: integer - format: int32 - example: 1 - transcodeHwRequested: - type: boolean - example: true - timeStamp: - type: number - example: 1705895805.4919229 - maxOffsetAvailable: - type: number - example: 29.53 - minOffsetAvailable: - type: number - example: 3.003000020980835 - example: - - key: vv3i2q2lax92qlzul1hbd4bx - throttled: false - complete: false - progress: 1.7999999523162842 - size: -22 - speed: 25.100000381469727 - error: false - duration: 1445695 - remaining: 53 - context: streaming - sourceVideoCodec: h264 - sourceAudioCodec: aac - videoDecision: transcode - audioDecision: transcode - subtitleDecision: burn - protocol: http - container: mkv - videoCodec: h264 - audioCodec: opus - audioChannels: 1 - transcodeHwRequested: true - timeStamp: 1705895805.4919229 - maxOffsetAvailable: 29.53 - minOffsetAvailable: 3.003000020980835 - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getTranscodeSessions - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), ) - ->build(); + res = s.sessions.get_session_history(sort="", account_id=1, filter=Models::Operations::QueryParamFilter.new(), library_section_id=12) - - $response = $sdk->sessions->getTranscodeSessions( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getTranscodeSessions - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.sessions.get_transcode_sessions()\n\nif ! res.object.nil?\n # handle response\nend" + if ! res.object.nil? + # handle response + end - lang: go - label: getTranscodeSessions - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.GetTranscodeSessions(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Status.ListPlaybackHistory(ctx, operations.ListPlaybackHistoryRequest{ + Sort: []string{ + "v", + "i", + "e", + "w", + "e", + "d", + "A", + "t", + ":", + "d", + "e", + "s", + "c", + ",", + "a", + "c", + "c", + "o", + "u", + "n", + "t", + "I", + "D", + }, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: getTranscodeSessions + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetTranscodeSessionsBadRequest; - import dev.plexapi.plexapi.models.errors.GetTranscodeSessionsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetTranscodeSessionsResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListPlaybackHistoryRequest; + import dev.plexapi.sdk.models.operations.ListPlaybackHistoryResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; + import java.util.List; public class Application { - public static void main(String[] args) throws GetTranscodeSessionsBadRequest, GetTranscodeSessionsUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetTranscodeSessionsResponse res = sdk.sessions().getTranscodeSessions() + ListPlaybackHistoryRequest req = ListPlaybackHistoryRequest.builder() + .sort(List.of( + "v", + "i", + "e", + "w", + "e", + "d", + "A", + "t", + ":", + "d", + "e", + "s", + "c", + ",", + "a", + "c", + "c", + "o", + "u", + "n", + "t", + "I", + "D")) + .build(); + + ListPlaybackHistoryResponse res = sdk.status().listPlaybackHistory() + .request(req) .call(); if (res.object().isPresent()) { @@ -22849,624 +11982,271 @@ paths: } } - lang: typescript - label: getTranscodeSessions + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.sessions.getTranscodeSessions(); + const result = await plexAPI.status.listPlaybackHistory({ + sort: [ + "v", + "i", + "e", + "w", + "e", + "d", + "A", + "t", + ":", + "d", + "e", + "s", + "c", + ",", + "a", + "c", + "c", + "o", + "u", + "n", + "t", + "I", + "D", + ], + }); - // Handle the result console.log(result); } run(); - '/transcode/sessions/{sessionKey}': - delete: + /status/sessions/terminate: + post: + summary: Terminate a session + operationId: terminateSession + description: Terminate a playback session kicking off the user tags: - - Sessions - summary: Stop a Transcode Session - operationId: stopTranscodeSession - description: Stop a Transcode Session + - Status + security: + - token: + - admin parameters: - - name: sessionKey - description: the Key of the transcode session to stop - in: path + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sessionId + description: The session id (found in the `Session` element in [/status/sessions](#tag/Status/operation/statusGetSlash)) + in: query + required: true schema: type: string - example: zz7llzqlx8w9vnrsbnwhbmep - required: true - responses: - '204': - description: The Transcode Session ended - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: stopTranscodeSession - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->sessions->stopTranscodeSession( - sessionKey: 'zz7llzqlx8w9vnrsbnwhbmep' - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: stopTranscodeSession - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.sessions.stop_transcode_session(session_key=\"zz7llzqlx8w9vnrsbnwhbmep\")\n\nif res.status_code == 200\n # handle response\nend" - - lang: go - label: stopTranscodeSession - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.StopTranscodeSession(ctx, \"zz7llzqlx8w9vnrsbnwhbmep\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - - lang: java - label: stopTranscodeSession - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.StopTranscodeSessionBadRequest; - import dev.plexapi.plexapi.models.errors.StopTranscodeSessionUnauthorized; - import dev.plexapi.plexapi.models.operations.StopTranscodeSessionResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws StopTranscodeSessionBadRequest, StopTranscodeSessionUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - StopTranscodeSessionResponse res = sdk.sessions().stopTranscodeSession() - .sessionKey("zz7llzqlx8w9vnrsbnwhbmep") - .call(); - - // handle response - } - } - - lang: typescript - label: stopTranscodeSession - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.sessions.stopTranscodeSession("zz7llzqlx8w9vnrsbnwhbmep"); - - // Handle the result - console.log(result); - } - - run(); - /updater/status: - get: - tags: - - Updater - summary: Querying status of updates - description: Querying status of updates - operationId: getUpdateStatus - responses: - '200': - description: The Server Updates - content: - application/json: - schema: - type: object - properties: - MediaContainer: - type: object - properties: - size: - type: integer - format: int32 - example: 1 - canInstall: - type: boolean - example: false - checkedAt: - type: integer - format: int32 - example: 1705801232 - downloadURL: - type: string - example: 'https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx' - status: - type: integer - format: int32 - example: 0 - Release: - type: array - items: - type: object - properties: - key: - type: string - example: 'https://plex.tv/updater/releases/5136' - version: - type: string - example: 1.40.0.7775-456fbaf97 - added: - type: string - example: |- - (PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish. - (Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793) - (Music) Store track genres and add filtering options (#14653) - (Music) Support ID3v2.4 null-separated tags for genres and release type (#14653) - (View History) No longer create a view history entry for items marked as played (#10888) - (Web) Updated to 4.118.0 - fixed: - type: string - example: |- - (Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483) - (Agents) It is possible that agents are not initialised during startup on rare occasions (#14654) - (Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667) - (Collection) Server could become unresponsive when collection membership changes (#14612) - (DVR) Previously watched recordings could be deleted without being watched again (#13779) - (Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501) - (Library) The Content Rating not equal to None filter does not work (#14620) - (Search) Album search results could contain all the album's tracks too (#14486) - (Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674) - (Transcoder) HW encoding would fail on devices with no rate control (#14222) - (Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605) - downloadURL: - type: string - example: 'https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx' - state: - type: string - example: notify - example: - - key: 'https://plex.tv/updater/releases/5136' - version: 1.40.0.7775-456fbaf97 - added: |- - (PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish. - (Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793) - (Music) Store track genres and add filtering options (#14653) - (Music) Support ID3v2.4 null-separated tags for genres and release type (#14653) - (View History) No longer create a view history entry for items marked as played (#10888) - (Web) Updated to 4.118.0 - fixed: |- - (Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483) - (Agents) It is possible that agents are not initialised during startup on rare occasions (#14654) - (Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667) - (Collection) Server could become unresponsive when collection membership changes (#14612) - (DVR) Previously watched recordings could be deleted without being watched again (#13779) - (Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501) - (Library) The Content Rating not equal to None filter does not work (#14620) - (Search) Album search results could contain all the album's tracks too (#14486) - (Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674) - (Transcoder) HW encoding would fail on devices with no rate control (#14222) - (Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605) - downloadURL: 'https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx' - state: notify - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: getUpdateStatus - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->updater->getUpdateStatus( - - ); - - if ($response->object !== null) { - // handle response - } - - lang: ruby - label: getUpdateStatus - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.updater.get_update_status()\n\nif ! res.object.nil?\n # handle response\nend" - - lang: go - label: getUpdateStatus - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Updater.GetUpdateStatus(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - - lang: java - label: getUpdateStatus - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetUpdateStatusBadRequest; - import dev.plexapi.plexapi.models.errors.GetUpdateStatusUnauthorized; - import dev.plexapi.plexapi.models.operations.GetUpdateStatusResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws GetUpdateStatusBadRequest, GetUpdateStatusUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .accessToken("") - .build(); - - GetUpdateStatusResponse res = sdk.updater().getUpdateStatus() - .call(); - - if (res.object().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: getUpdateStatus - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.updater.getUpdateStatus(); - - // Handle the result - console.log(result); - } - - run(); - /updater/check: - put: - tags: - - Updater - summary: Checking for updates - description: Checking for updates - operationId: checkForUpdates - parameters: - - name: download - description: Indicate that you want to start download any updates found. - required: false + example: cdefghijklmnopqrstuvwxyz + - name: reason + description: The reason to give to the user (typically displayed in the client) in: query schema: - type: integer - enum: - - 0 - - 1 - example: 1 + type: string + example: Stop Playing responses: '200': - description: 'The update check is started, if download is set to 1 and the system is able to update automatically, the update download will start.' - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 + $ref: '#/components/responses/200' '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + description: Server does not have the feature enabled content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} + '403': + description: sessionId is empty + content: + text/html: {} + '404': + description: Session not found + content: + text/html: {} x-codeSamples: - - lang: php - label: checkForUpdates - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder() - ->setSecurity( - '' - ) - ->build(); - - - - $response = $sdk->updater->checkForUpdates( - download: Operations\Download::One - ); - - if ($response->statusCode === 200) { - // handle response - } - - lang: ruby - label: checkForUpdates - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.updater.check_for_updates(download=::PlexRubySDK::Operations::Download::ONE)\n\nif res.status_code == 200\n # handle response\nend" - lang: go - label: checkForUpdates - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Updater.CheckForUpdates(ctx, operations.DownloadOne.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Status.TerminateSession(ctx, operations.TerminateSessionRequest{ + SessionID: "cdefghijklmnopqrstuvwxyz", + Reason: plexgo.Pointer("Stop Playing"), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: checkForUpdates + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.CheckForUpdatesBadRequest; - import dev.plexapi.plexapi.models.errors.CheckForUpdatesUnauthorized; - import dev.plexapi.plexapi.models.operations.CheckForUpdatesResponse; - import dev.plexapi.plexapi.models.operations.Download; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.TerminateSessionRequest; + import dev.plexapi.sdk.models.operations.TerminateSessionResponse; + import dev.plexapi.sdk.models.shared.Accepts; import java.lang.Exception; public class Application { - public static void main(String[] args) throws CheckForUpdatesBadRequest, CheckForUpdatesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - CheckForUpdatesResponse res = sdk.updater().checkForUpdates() - .download(Download.ONE) + TerminateSessionRequest req = TerminateSessionRequest.builder() + .sessionId("cdefghijklmnopqrstuvwxyz") + .reason("Stop Playing") + .build(); + + TerminateSessionResponse res = sdk.status().terminateSession() + .request(req) .call(); // handle response } } - lang: typescript - label: checkForUpdates + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { Download } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.updater.checkForUpdates(Download.One); + const result = await plexAPI.status.terminateSession({ + sessionId: "cdefghijklmnopqrstuvwxyz", + reason: "Stop Playing", + }); - // Handle the result console.log(result); } run(); /updater/apply: put: + summary: Applying updates + operationId: applyUpdates + description: 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. tags: - Updater - summary: Apply Updates - description: | - Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed - operationId: applyUpdates + security: + - token: + - admin parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" - name: tonight - description: Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install - required: false + description: Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install immediately. in: query schema: - type: integer - enum: - - 0 - - 1 - example: 1 + $ref: "#/components/schemas/BoolInt" - name: skip - description: 'Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`.' - required: false + description: Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. in: query schema: - type: integer - enum: - - 0 - - 1 - example: 1 + $ref: "#/components/schemas/BoolInt" responses: '200': - description: If the update process started correctly + description: The update process started correctly + content: + text/html: {} '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: This system cannot install updates content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} '500': - description: If the update process failed to start + description: The update process failed to start + content: + text/html: {} x-codeSamples: - lang: php - label: applyUpdates + label: PlexPHP source: |- declare(strict_types=1); @@ -23493,234 +12273,169 @@ paths: // handle response } - lang: ruby - label: applyUpdates - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.updater.apply_updates(tonight=::PlexRubySDK::Operations::Tonight::ONE, skip=::PlexRubySDK::Operations::Skip::ONE)\n\nif res.status_code == 200\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.updater.apply_updates(tonight=Models::Operations::Tonight::ONE, skip=Models::Operations::Skip::ONE) + + if res.status_code == 200 + # handle response + end - lang: go - label: applyUpdates - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Updater.ApplyUpdates(ctx, operations.TonightOne.ToPointer(), operations.SkipOne.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Updater.ApplyUpdates(ctx, operations.ApplyUpdatesRequest{ + Tonight: components.BoolIntOne.ToPointer(), + Skip: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: applyUpdates + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.ApplyUpdatesBadRequest; - import dev.plexapi.plexapi.models.errors.ApplyUpdatesUnauthorized; - import dev.plexapi.plexapi.models.operations.ApplyUpdatesResponse; - import dev.plexapi.plexapi.models.operations.Skip; - import dev.plexapi.plexapi.models.operations.Tonight; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ApplyUpdatesRequest; + import dev.plexapi.sdk.models.operations.ApplyUpdatesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws ApplyUpdatesBadRequest, ApplyUpdatesUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); + ApplyUpdatesRequest req = ApplyUpdatesRequest.builder() + .tonight(BoolInt.ONE) + .skip(BoolInt.ONE) + .build(); + ApplyUpdatesResponse res = sdk.updater().applyUpdates() - .tonight(Tonight.ONE) - .skip(Skip.ONE) + .request(req) .call(); // handle response } } - lang: typescript - label: applyUpdates + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; - import { Skip, Tonight } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.updater.applyUpdates(Tonight.One, Skip.One); + const result = await plexAPI.updater.applyUpdates({ + tonight: BoolInt.One, + skip: BoolInt.One, + }); - // Handle the result console.log(result); } run(); - '/video/:/transcode/universal/start.mpd': - get: + /updater/check: + put: + summary: Checking for updates + operationId: checkUpdates + description: Perform an update check and potentially download tags: - - Video - summary: Start Universal Transcode - description: Begin a Universal Transcode Session - operationId: startUniversalTranscode + - Updater + security: + - token: + - admin parameters: - - name: hasMDE - description: Whether the media item has MDE - required: true + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: download + description: Indicate that you want to start download any updates found. in: query schema: - type: number - example: 1 - - name: path - description: The path to the media item to transcode - required: true - in: query - schema: - type: string - example: /library/metadata/23409 - - name: mediaIndex - description: The index of the media item to transcode - required: true - in: query - schema: - type: number - example: 0 - - name: partIndex - description: The index of the part to transcode - required: true - in: query - schema: - type: number - example: 0 - - name: protocol - description: The protocol to use for the transcode session - required: true - in: query - schema: - type: string - example: hls - - name: fastSeek - description: Whether to use fast seek or not - required: false - in: query - schema: - type: number - example: 0 - - name: directPlay - description: Whether to use direct play or not - required: false - in: query - schema: - type: number - example: 0 - - name: directStream - description: Whether to use direct stream or not - required: false - in: query - schema: - type: number - example: 0 - - name: subtitleSize - description: The size of the subtitles - required: false - in: query - schema: - type: number - example: 100 - - name: subtites - description: The subtitles - required: false - in: query - schema: - type: string - example: burn - - name: audioBoost - description: The audio boost - required: false - in: query - schema: - type: number - example: 100 - - name: location - description: The location of the transcode session - required: false - in: query - schema: - type: string - example: lan - - name: mediaBufferSize - description: The size of the media buffer - required: false - in: query - schema: - type: number - example: 102400 - - name: session - description: The session ID - required: false - in: query - schema: - type: string - example: zvcage8b7rkioqcm8f4uns4c - - name: addDebugOverlay - description: Whether to add a debug overlay or not - required: false - in: query - schema: - type: number - example: 0 - - name: autoAdjustQuality - description: Whether to auto adjust quality or not - required: false - in: query - schema: - type: number - example: 0 + $ref: "#/components/schemas/BoolInt" responses: '200': - description: The transcode session has started - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + $ref: '#/components/responses/200' x-codeSamples: - lang: php - label: startUniversalTranscode + label: PlexPHP source: |- declare(strict_types=1); @@ -23735,78 +12450,108 @@ paths: ) ->build(); - $request = new Operations\StartUniversalTranscodeRequest( - hasMDE: 1, - path: '/library/metadata/23409', - mediaIndex: 0, - partIndex: 0, - protocol: 'hls', - fastSeek: 0, - directPlay: 0, - directStream: 0, - subtitleSize: 100, - subtites: 'burn', - audioBoost: 100, - location: 'lan', - mediaBufferSize: 102400, - session: 'zvcage8b7rkioqcm8f4uns4c', - addDebugOverlay: 0, - autoAdjustQuality: 0, - ); - $response = $sdk->video->startUniversalTranscode( - request: $request + + $response = $sdk->updater->checkForUpdates( + download: Operations\Download::One ); if ($response->statusCode === 200) { // handle response } - lang: ruby - label: startUniversalTranscode - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n\nreq = ::PlexRubySDK::Operations::StartUniversalTranscodeRequest.new(\n has_mde: 1.0,\n path: \"/library/metadata/23409\",\n media_index: 0.0,\n part_index: 0.0,\n protocol: \"hls\",\n fast_seek: 0.0,\n direct_play: 0.0,\n direct_stream: 0.0,\n subtitle_size: 100.0,\n subtites: \"burn\",\n audio_boost: 100.0,\n location: \"lan\",\n media_buffer_size: 102400.0,\n session: \"zvcage8b7rkioqcm8f4uns4c\",\n add_debug_overlay: 0.0,\n auto_adjust_quality: 0.0,\n)\n \nres = s.video.start_universal_transcode(req)\n\nif res.status_code == 200\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.updater.check_for_updates(download=Models::Operations::Download::ONE) + + if res.status_code == 200 + # handle response + end - lang: go - label: startUniversalTranscode - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Video.StartUniversalTranscode(ctx, operations.StartUniversalTranscodeRequest{\n HasMDE: 1,\n Path: \"/library/metadata/23409\",\n MediaIndex: 0,\n PartIndex: 0,\n Protocol: \"hls\",\n FastSeek: plexgo.Float64(0),\n DirectPlay: plexgo.Float64(0),\n DirectStream: plexgo.Float64(0),\n SubtitleSize: plexgo.Float64(100),\n Subtites: plexgo.String(\"burn\"),\n AudioBoost: plexgo.Float64(100),\n Location: plexgo.String(\"lan\"),\n MediaBufferSize: plexgo.Float64(102400),\n Session: plexgo.String(\"zvcage8b7rkioqcm8f4uns4c\"),\n AddDebugOverlay: plexgo.Float64(0),\n AutoAdjustQuality: plexgo.Float64(0),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Updater.CheckUpdates(ctx, operations.CheckUpdatesRequest{ + Download: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - lang: java - label: startUniversalTranscode + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.StartUniversalTranscodeBadRequest; - import dev.plexapi.plexapi.models.errors.StartUniversalTranscodeUnauthorized; - import dev.plexapi.plexapi.models.operations.StartUniversalTranscodeRequest; - import dev.plexapi.plexapi.models.operations.StartUniversalTranscodeResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CheckUpdatesRequest; + import dev.plexapi.sdk.models.operations.CheckUpdatesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws StartUniversalTranscodeBadRequest, StartUniversalTranscodeUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - StartUniversalTranscodeRequest req = StartUniversalTranscodeRequest.builder() - .hasMDE(1d) - .path("/library/metadata/23409") - .mediaIndex(0d) - .partIndex(0d) - .protocol("hls") - .fastSeek(0d) - .directPlay(0d) - .directStream(0d) - .subtitleSize(100d) - .subtites("burn") - .audioBoost(100d) - .location("lan") - .mediaBufferSize(102400d) - .session("zvcage8b7rkioqcm8f4uns4c") - .addDebugOverlay(0d) - .autoAdjustQuality(0d) + CheckUpdatesRequest req = CheckUpdatesRequest.builder() + .download(BoolInt.ONE) .build(); - StartUniversalTranscodeResponse res = sdk.video().startUniversalTranscode() + CheckUpdatesResponse res = sdk.updater().checkUpdates() .request(req) .call(); @@ -23814,738 +12559,118 @@ paths: } } - lang: typescript - label: startUniversalTranscode + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ - accessToken: "", + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", }); async function run() { - const result = await plexAPI.video.startUniversalTranscode({ - hasMDE: 1, - path: "/library/metadata/23409", - mediaIndex: 0, - partIndex: 0, - protocol: "hls", - fastSeek: 0, - directPlay: 0, - directStream: 0, - subtitleSize: 100, - subtites: "burn", - audioBoost: 100, - location: "lan", - mediaBufferSize: 102400, - session: "zvcage8b7rkioqcm8f4uns4c", - addDebugOverlay: 0, - autoAdjustQuality: 0, + const result = await plexAPI.updater.checkUpdates({ + download: BoolInt.One, }); - // Handle the result console.log(result); } run(); - /user: + /updater/status: get: - servers: - - url: 'https://plex.tv/api/v2' + summary: Querying status of updates + operationId: getUpdatesStatus + description: Get the status of updating the server tags: - - Authentication - summary: Get Token Details - description: Get the User data from the provided X-Plex-Token - operationId: getTokenDetails + - Updater + security: + - token: + - admin responses: '200': - description: Logged in user details + description: OK content: application/json: schema: - title: UserPlexAccount - type: object - required: - - adsConsent - - adsConsentReminderAt - - adsConsentSetAt - - anonymous - - authToken - - backupCodesCreated - - confirmed - - country - - email - - emailOnlyAuth - - experimentalFeatures - - friendlyName - - entitlements - - guest - - hasPassword - - home - - homeAdmin - - homeSize - - id - - joinedAt - - locale - - mailingListActive - - mailingListStatus - - maxHomeSize - - profile - - protected - - rememberExpiresAt - - restricted - - scrobbleTypes - - services - - subscription - - subscriptionDescription - - subscriptions - - thumb - - title - - twoFactorEnabled - - username - - uuid - - attributionPartner properties: - adsConsent: - type: - - boolean - - 'null' - description: Unknown - adsConsentReminderAt: - oneOf: - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: 'null' - adsConsentSetAt: - oneOf: - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: 'null' - anonymous: - type: - - boolean - - 'null' - description: Unknown - default: false - authToken: - type: string - description: The account token - example: CxoUzBTSV5hsxjTpFKaf - backupCodesCreated: - type: boolean - description: If the two-factor authentication backup codes have been created - default: false - confirmed: - type: boolean - description: If the account has been confirmed - default: false - country: - type: string - description: The account country - example: US - maxLength: 2 - minLength: 2 - email: - type: string - description: The account email address - format: email - example: username@email.com - emailOnlyAuth: - type: boolean - description: If login with email only is enabled - default: false - experimentalFeatures: - type: boolean - description: If experimental features are enabled - default: false - friendlyName: - type: string - description: Your account full name - example: friendlyUsername - entitlements: - type: array - description: List of devices your allowed to use with this account - items: - type: string - example: '[]' - guest: - type: boolean - description: If the account is a Plex Home guest user - default: false - hasPassword: - type: boolean - description: If the account has a password - default: true - home: - type: boolean - description: If the account is a Plex Home user - default: false - homeAdmin: - type: boolean - description: If the account is the Plex Home admin - default: false - homeSize: - type: integer - description: The number of accounts in the Plex Home - example: 1 - format: int32 - id: - type: integer - description: The Plex account ID - example: 13692262 - format: int32 - joinedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - locale: - type: - - string - - 'null' - description: The account locale - mailingListActive: - type: boolean - description: If you are subscribed to the Plex newsletter - default: false - mailingListStatus: - description: Your current mailing list status (active or unsubscribed) - type: string - example: active - enum: - - active - - unsubscribed - maxHomeSize: - type: integer - description: The maximum number of accounts allowed in the Plex Home - example: 15 - format: int32 - pin: - type: string - description: '[Might be removed] The hashed Plex Home PIN ' - deprecated: true - profile: - title: UserProfile - type: object - required: - - autoSelectAudio - - defaultAudioLanguage - - defaultSubtitleLanguage - - autoSelectSubtitle - - defaultSubtitleAccessibility - - defaultSubtitleForced - - watchedIndicator - - mediaReviewsVisibility - properties: - autoSelectAudio: - description: If the account has automatically select audio and subtitle tracks enabled - type: boolean - example: true - default: true - defaultAudioLanguage: - description: The preferred audio language for the account - type: - - string - - 'null' - example: ja - defaultSubtitleLanguage: - description: The preferred subtitle language for the account - type: - - string - - 'null' - example: en - autoSelectSubtitle: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: 'The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled)' - defaultSubtitleAccessibility: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: 'The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only show non-SDH subtitles)' - defaultSubtitleForced: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: 'The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles)' - watchedIndicator: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: Whether or not media watched indicators are enabled (little orange dot on media) - mediaReviewsVisibility: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: Whether or not the account has media reviews visibility enabled - protected: - type: boolean - description: If the account has a Plex Home PIN enabled - default: false - rememberExpiresAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - restricted: - type: boolean - description: If the account is a Plex Home managed user - default: false - roles: - type: array - description: '[Might be removed] List of account roles. Plexpass membership listed here' - items: - type: string - scrobbleTypes: - type: string - description: Unknown - services: - type: array - items: - type: object - required: - - identifier - - endpoint - - token - - secret - - status - properties: - identifier: - type: string - example: metadata-dev - endpoint: - type: string - example: 'https://epg.provider.plex.tv' - format: uri - token: - type: - - string - - 'null' - example: DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv - secret: - type: - - string - - 'null' - status: - example: online - enum: - - online - - offline - subscription: - description: If the account’s Plex Pass subscription is active - title: Subscription - type: object - properties: - features: - description: List of features allowed on your Plex Pass subscription - type: array - items: - type: string - description: | - - Android - Dolby Vision - - Android - PiP - - CU Sunset - - HRK_enable_EUR - - TREBLE-show-features - - ad-countdown-timer - - adaptive_bitrate - - album-types - - allow_dvr - - amazon-loop-debug - - avod-ad-analysis - - avod-new-media - - blacklist_get_signin - - boost-voices - - camera_upload - - client-radio-stations - - cloudflare-turnstile-required - - cloudsync - - collections - - comments_and_replies_push_notifications - - community_access_plex_tv - - companions_sonos - - content_filter - - custom-home-removal - - disable_home_user_friendships - - disable_sharing_friendships - - downloads-gating - - drm_support - - dvr - - dvr-block-unsupported-countries - - epg-recent-channels - - exclude restrictions - - federated-auth - - friend_request_push_notifications - - grandfather-sync - - guided-upgrade - - hardware_transcoding - - home - - hwtranscode - - imagga-v2 - - increase-password-complexity - - ios14-privacy-banner - - iterable-notification-tokens - - item_clusters - - keep-payment-method - - kevin-bacon - - korea-consent - - le_isrg_root_x1 - - lets_encrypt - - lightning-dvr-pivot - - live-tv-support-incomplete-segments - - livetv - - lyrics - - metadata_search - - music-analysis - - music_videos - - new_plex_pass_prices - - news-provider-sunset-modal - - nominatim - - pass - - photos-favorites - - photos-metadata-edition - - photosV6-edit - - photosV6-tv-albums - - pms_health - - premium-dashboard - - premium_music_metadata - - radio - - rate-limit-client-token - - scrobbling-service-plex-tv - - session_bandwidth_restrictions - - session_kick - - shared_server_notification - - shared_source_notification - - signin_notification - - signin_with_apple - - silence-removal - - sleep-timer - - spring_serve_ad_provider - - sync - - sweet-fades - - transcoder_cache - - trailers - - tuner-sharing - - two-factor-authentication - - unsupportedtuners - - upgrade-3ds2 - - visualizers - - vod-schema - - vod_cloudflare - - volume-leveling - - watch-together-invite - - watchlist-rss - - web_server_dashboard - - webhooks - - blacklist-subnets - - chromecast-music-mp - - Sync v3 - - livetv-platform-specific - - nonAnonymousAccount - - parental-controls - - Subtitles on Demand - - ultrablur - - web-desktop-gracenote-banner - active: - description: If the account's Plex Pass subscription is active - type: boolean - example: true - subscribedAt: - description: Date the account subscribed to Plex Pass - type: - - string - - 'null' - example: '2021-04-12T18:21:12Z' - status: - description: String representation of subscriptionActive - example: Inactive - enum: - - Inactive - - Active - paymentService: - description: Payment service used for your Plex Pass subscription - type: - - string - - 'null' - plan: - description: Name of Plex Pass subscription plan - type: - - string - - 'null' - subscriptionDescription: - type: - - string - - 'null' - description: Description of the Plex Pass subscription - subscriptions: - type: array - items: - title: Subscription - type: object - properties: - features: - description: List of features allowed on your Plex Pass subscription - type: array - items: + MediaContainer: + allOf: + - properties: + autoUpdateVersion: + description: The version of the updater (currently `1`) + type: integer + canInstall: + description: Indicates whether this install can be updated through these endpoints (typically only on MacOS and Windows) + type: boolean + checkedAt: + description: The last time a check for updates was performed + type: integer + downloadURL: + description: The URL where the update is available type: string - description: | - - Android - Dolby Vision - - Android - PiP - - CU Sunset - - HRK_enable_EUR - - TREBLE-show-features - - ad-countdown-timer - - adaptive_bitrate - - album-types - - allow_dvr - - amazon-loop-debug - - avod-ad-analysis - - avod-new-media - - blacklist_get_signin - - boost-voices - - camera_upload - - client-radio-stations - - cloudflare-turnstile-required - - cloudsync - - collections - - comments_and_replies_push_notifications - - community_access_plex_tv - - companions_sonos - - content_filter - - custom-home-removal - - disable_home_user_friendships - - disable_sharing_friendships - - downloads-gating - - drm_support - - dvr - - dvr-block-unsupported-countries - - epg-recent-channels - - exclude restrictions - - federated-auth - - friend_request_push_notifications - - grandfather-sync - - guided-upgrade - - hardware_transcoding - - home - - hwtranscode - - imagga-v2 - - increase-password-complexity - - ios14-privacy-banner - - iterable-notification-tokens - - item_clusters - - keep-payment-method - - kevin-bacon - - korea-consent - - le_isrg_root_x1 - - lets_encrypt - - lightning-dvr-pivot - - live-tv-support-incomplete-segments - - livetv - - lyrics - - metadata_search - - music-analysis - - music_videos - - new_plex_pass_prices - - news-provider-sunset-modal - - nominatim - - pass - - photos-favorites - - photos-metadata-edition - - photosV6-edit - - photosV6-tv-albums - - pms_health - - premium-dashboard - - premium_music_metadata - - radio - - rate-limit-client-token - - scrobbling-service-plex-tv - - session_bandwidth_restrictions - - session_kick - - shared_server_notification - - shared_source_notification - - signin_notification - - signin_with_apple - - silence-removal - - sleep-timer - - spring_serve_ad_provider - - sync - - sweet-fades - - transcoder_cache - - trailers - - tuner-sharing - - two-factor-authentication - - unsupportedtuners - - upgrade-3ds2 - - visualizers - - vod-schema - - vod_cloudflare - - volume-leveling - - watch-together-invite - - watchlist-rss - - web_server_dashboard - - webhooks - - blacklist-subnets - - chromecast-music-mp - - Sync v3 - - livetv-platform-specific - - nonAnonymousAccount - - parental-controls - - Subtitles on Demand - - ultrablur - - web-desktop-gracenote-banner - active: - description: If the account's Plex Pass subscription is active - type: boolean - example: true - subscribedAt: - description: Date the account subscribed to Plex Pass - type: - - string - - 'null' - example: '2021-04-12T18:21:12Z' - status: - description: String representation of subscriptionActive - example: Inactive - enum: - - Inactive - - Active - paymentService: - description: Payment service used for your Plex Pass subscription - type: - - string - - 'null' - plan: - description: Name of Plex Pass subscription plan - type: - - string - - 'null' - thumb: - type: string - description: URL of the account thumbnail - format: uri - example: 'https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101' - title: - type: string - description: The title of the account (username or friendly name) - example: UsernameTitle - twoFactorEnabled: - type: boolean - description: If two-factor authentication is enabled - default: false - username: - type: string - description: The account username - example: Username - uuid: - type: string - description: The account UUID - example: dae343c1f45beb4f - attributionPartner: - type: - - string - - 'null' - example: null - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest + Release: + items: + properties: + added: + description: A list of what has been added in this version + type: string + downloadURL: + description: The URL of where this update is available + type: string + fixed: + description: A list of what has been fixed in this version + type: string + key: + description: The URL key of the update + type: string + state: + description: | + The status of this update. + + - available - This release is available + - downloading - This release is downloading + - downloaded - This release has been downloaded + - installing - This release is installing + - tonight - This release will be installed tonight + - skipped - This release has been skipped + - error - This release has an error + - notify - This release is only notifying it is available (typically because it cannot be installed on this setup) + - done - This release is complete + enum: + - available + - downloading + - downloaded + - installing + - tonight + - skipped + - error + - notify + - done + type: string + version: + description: The version available + type: string + type: object + type: array + status: + description: The current error code (`0` means no error) + type: integer + type: object type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 x-codeSamples: - lang: php - label: getTokenDetails + label: PlexPHP source: |- declare(strict_types=1); @@ -24561,1671 +12686,30124 @@ paths: - $response = $sdk->authentication->getTokenDetails( + $response = $sdk->updater->getUpdateStatus( ); - if ($response->userPlexAccount !== null) { + if ($response->object !== null) { // handle response } - lang: ruby - label: getTokenDetails - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\ns.config_security(\n ::PlexRubySDK::Shared::Security.new(\n access_token: \"\",\n )\n)\n\n \nres = s.authentication.get_token_details()\n\nif ! res.user_plex_account.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.updater.get_update_status() + + if ! res.object.nil? + # handle response + end - lang: go - label: getTokenDetails - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Authentication.GetTokenDetails(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.UserPlexAccount != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo" + "log" + ) + + func main() { + ctx := context.Background() + + s := plexgo.New( + plexgo.WithSecurity(""), + ) + + res, err := s.Updater.GetUpdatesStatus(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: getTokenDetails + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetTokenDetailsBadRequest; - import dev.plexapi.plexapi.models.errors.GetTokenDetailsUnauthorized; - import dev.plexapi.plexapi.models.operations.GetTokenDetailsResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetUpdatesStatusResponse; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetTokenDetailsBadRequest, GetTokenDetailsUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() - .accessToken("") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetTokenDetailsResponse res = sdk.authentication().getTokenDetails() + GetUpdatesStatusResponse res = sdk.updater().getUpdatesStatus() .call(); - if (res.userPlexAccount().isPresent()) { + if (res.object().isPresent()) { // handle response } } } - lang: typescript - label: getTokenDetails - source: |- - import { PlexAPI } from "@lukehagar/plexjs"; - - const plexAPI = new PlexAPI({ - accessToken: "", - }); - - async function run() { - const result = await plexAPI.authentication.getTokenDetails(); - - // Handle the result - console.log(result); - } - - run(); - /users/signin: - post: - servers: - - url: 'https://plex.tv/api/v2' - security: [] - tags: - - Authentication - summary: Get User Sign In Data - description: Sign in user with username and password and return user data with Plex authentication token - operationId: post-users-sign-in-data - parameters: - - name: X-Plex-Client-Identifier - x-speakeasy-name-override: ClientID - description: 'An opaque identifier unique to the client (UUID, serial number, or other unique device ID)' - required: true - in: header - schema: - type: string - example: 3381b62b-9ab7-4e37-827b-203e9809eb58 - - name: X-Plex-Product - x-speakeasy-name-override: ClientName - description: 'The name of the client application. (Plex Web, Plex Media Server, etc.)' - in: header - required: false - schema: - type: string - example: Plex for Roku - - name: X-Plex-Device - x-speakeasy-name-override: DeviceNickname - description: A relatively friendly name for the client device - in: header - required: false - schema: - type: string - example: Roku 3 - - name: X-Plex-Version - x-speakeasy-name-override: ClientVersion - description: The version of the client application. - in: header - required: false - schema: - type: string - example: 2.4.1 - - name: X-Plex-Platform - x-speakeasy-name-override: Platform - description: The platform of the client application. - in: header - required: false - schema: - type: string - example: Roku - requestBody: - content: - application/x-www-form-urlencoded: - schema: - type: object - required: - - login - - password - properties: - login: - type: string - format: email - example: username@email.com - password: - type: string - format: password - example: password123 - rememberMe: - type: boolean - default: false - verificationCode: - type: string - example: 123456 - description: Login credentials - responses: - '201': - description: Returns the user account data with a valid auth token - content: - application/json: - schema: - allOf: - - title: UserPlexAccount - type: object - required: - - adsConsent - - adsConsentReminderAt - - adsConsentSetAt - - anonymous - - authToken - - backupCodesCreated - - confirmed - - country - - email - - emailOnlyAuth - - experimentalFeatures - - friendlyName - - entitlements - - guest - - hasPassword - - home - - homeAdmin - - homeSize - - id - - joinedAt - - locale - - mailingListActive - - mailingListStatus - - maxHomeSize - - profile - - protected - - rememberExpiresAt - - restricted - - scrobbleTypes - - services - - subscription - - subscriptionDescription - - subscriptions - - thumb - - title - - twoFactorEnabled - - username - - uuid - - attributionPartner - properties: - adsConsent: - type: - - boolean - - 'null' - description: Unknown - adsConsentReminderAt: - oneOf: - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: 'null' - adsConsentSetAt: - oneOf: - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: 'null' - anonymous: - type: - - boolean - - 'null' - description: Unknown - default: false - authToken: - type: string - description: The account token - example: CxoUzBTSV5hsxjTpFKaf - backupCodesCreated: - type: boolean - description: If the two-factor authentication backup codes have been created - default: false - confirmed: - type: boolean - description: If the account has been confirmed - default: false - country: - type: string - description: The account country - example: US - maxLength: 2 - minLength: 2 - email: - type: string - description: The account email address - format: email - example: username@email.com - emailOnlyAuth: - type: boolean - description: If login with email only is enabled - default: false - experimentalFeatures: - type: boolean - description: If experimental features are enabled - default: false - friendlyName: - type: string - description: Your account full name - example: friendlyUsername - entitlements: - type: array - description: List of devices your allowed to use with this account - items: - type: string - example: '[]' - guest: - type: boolean - description: If the account is a Plex Home guest user - default: false - hasPassword: - type: boolean - description: If the account has a password - default: true - home: - type: boolean - description: If the account is a Plex Home user - default: false - homeAdmin: - type: boolean - description: If the account is the Plex Home admin - default: false - homeSize: - type: integer - description: The number of accounts in the Plex Home - example: 1 - format: int32 - id: - type: integer - description: The Plex account ID - example: 13692262 - format: int32 - joinedAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - locale: - type: - - string - - 'null' - description: The account locale - mailingListActive: - type: boolean - description: If you are subscribed to the Plex newsletter - default: false - mailingListStatus: - description: Your current mailing list status (active or unsubscribed) - type: string - example: active - enum: - - active - - unsubscribed - maxHomeSize: - type: integer - description: The maximum number of accounts allowed in the Plex Home - example: 15 - format: int32 - pin: - type: string - description: '[Might be removed] The hashed Plex Home PIN ' - deprecated: true - profile: - title: UserProfile - type: object - required: - - autoSelectAudio - - defaultAudioLanguage - - defaultSubtitleLanguage - - autoSelectSubtitle - - defaultSubtitleAccessibility - - defaultSubtitleForced - - watchedIndicator - - mediaReviewsVisibility - properties: - autoSelectAudio: - description: If the account has automatically select audio and subtitle tracks enabled - type: boolean - example: true - default: true - defaultAudioLanguage: - description: The preferred audio language for the account - type: - - string - - 'null' - example: ja - defaultSubtitleLanguage: - description: The preferred subtitle language for the account - type: - - string - - 'null' - example: en - autoSelectSubtitle: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: 'The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled)' - defaultSubtitleAccessibility: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: 'The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only show non-SDH subtitles)' - defaultSubtitleForced: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: 'The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles)' - watchedIndicator: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: Whether or not media watched indicators are enabled (little orange dot on media) - mediaReviewsVisibility: - allOf: - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - - description: Whether or not the account has media reviews visibility enabled - protected: - type: boolean - description: If the account has a Plex Home PIN enabled - default: false - rememberExpiresAt: - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - restricted: - type: boolean - description: If the account is a Plex Home managed user - default: false - roles: - type: array - description: '[Might be removed] List of account roles. Plexpass membership listed here' - items: - type: string - scrobbleTypes: - type: string - description: Unknown - services: - type: array - items: - type: object - required: - - identifier - - endpoint - - token - - secret - - status - properties: - identifier: - type: string - example: metadata-dev - endpoint: - type: string - example: 'https://epg.provider.plex.tv' - format: uri - token: - type: - - string - - 'null' - example: DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv - secret: - type: - - string - - 'null' - status: - example: online - enum: - - online - - offline - subscription: - description: If the account’s Plex Pass subscription is active - title: Subscription - type: object - properties: - features: - description: List of features allowed on your Plex Pass subscription - type: array - items: - type: string - description: | - - Android - Dolby Vision - - Android - PiP - - CU Sunset - - HRK_enable_EUR - - TREBLE-show-features - - ad-countdown-timer - - adaptive_bitrate - - album-types - - allow_dvr - - amazon-loop-debug - - avod-ad-analysis - - avod-new-media - - blacklist_get_signin - - boost-voices - - camera_upload - - client-radio-stations - - cloudflare-turnstile-required - - cloudsync - - collections - - comments_and_replies_push_notifications - - community_access_plex_tv - - companions_sonos - - content_filter - - custom-home-removal - - disable_home_user_friendships - - disable_sharing_friendships - - downloads-gating - - drm_support - - dvr - - dvr-block-unsupported-countries - - epg-recent-channels - - exclude restrictions - - federated-auth - - friend_request_push_notifications - - grandfather-sync - - guided-upgrade - - hardware_transcoding - - home - - hwtranscode - - imagga-v2 - - increase-password-complexity - - ios14-privacy-banner - - iterable-notification-tokens - - item_clusters - - keep-payment-method - - kevin-bacon - - korea-consent - - le_isrg_root_x1 - - lets_encrypt - - lightning-dvr-pivot - - live-tv-support-incomplete-segments - - livetv - - lyrics - - metadata_search - - music-analysis - - music_videos - - new_plex_pass_prices - - news-provider-sunset-modal - - nominatim - - pass - - photos-favorites - - photos-metadata-edition - - photosV6-edit - - photosV6-tv-albums - - pms_health - - premium-dashboard - - premium_music_metadata - - radio - - rate-limit-client-token - - scrobbling-service-plex-tv - - session_bandwidth_restrictions - - session_kick - - shared_server_notification - - shared_source_notification - - signin_notification - - signin_with_apple - - silence-removal - - sleep-timer - - spring_serve_ad_provider - - sync - - sweet-fades - - transcoder_cache - - trailers - - tuner-sharing - - two-factor-authentication - - unsupportedtuners - - upgrade-3ds2 - - visualizers - - vod-schema - - vod_cloudflare - - volume-leveling - - watch-together-invite - - watchlist-rss - - web_server_dashboard - - webhooks - - blacklist-subnets - - chromecast-music-mp - - Sync v3 - - livetv-platform-specific - - nonAnonymousAccount - - parental-controls - - Subtitles on Demand - - ultrablur - - web-desktop-gracenote-banner - active: - description: If the account's Plex Pass subscription is active - type: boolean - example: true - subscribedAt: - description: Date the account subscribed to Plex Pass - type: - - string - - 'null' - example: '2021-04-12T18:21:12Z' - status: - description: String representation of subscriptionActive - example: Inactive - enum: - - Inactive - - Active - paymentService: - description: Payment service used for your Plex Pass subscription - type: - - string - - 'null' - plan: - description: Name of Plex Pass subscription plan - type: - - string - - 'null' - subscriptionDescription: - type: - - string - - 'null' - description: Description of the Plex Pass subscription - subscriptions: - type: array - items: - title: Subscription - type: object - properties: - features: - description: List of features allowed on your Plex Pass subscription - type: array - items: - type: string - description: | - - Android - Dolby Vision - - Android - PiP - - CU Sunset - - HRK_enable_EUR - - TREBLE-show-features - - ad-countdown-timer - - adaptive_bitrate - - album-types - - allow_dvr - - amazon-loop-debug - - avod-ad-analysis - - avod-new-media - - blacklist_get_signin - - boost-voices - - camera_upload - - client-radio-stations - - cloudflare-turnstile-required - - cloudsync - - collections - - comments_and_replies_push_notifications - - community_access_plex_tv - - companions_sonos - - content_filter - - custom-home-removal - - disable_home_user_friendships - - disable_sharing_friendships - - downloads-gating - - drm_support - - dvr - - dvr-block-unsupported-countries - - epg-recent-channels - - exclude restrictions - - federated-auth - - friend_request_push_notifications - - grandfather-sync - - guided-upgrade - - hardware_transcoding - - home - - hwtranscode - - imagga-v2 - - increase-password-complexity - - ios14-privacy-banner - - iterable-notification-tokens - - item_clusters - - keep-payment-method - - kevin-bacon - - korea-consent - - le_isrg_root_x1 - - lets_encrypt - - lightning-dvr-pivot - - live-tv-support-incomplete-segments - - livetv - - lyrics - - metadata_search - - music-analysis - - music_videos - - new_plex_pass_prices - - news-provider-sunset-modal - - nominatim - - pass - - photos-favorites - - photos-metadata-edition - - photosV6-edit - - photosV6-tv-albums - - pms_health - - premium-dashboard - - premium_music_metadata - - radio - - rate-limit-client-token - - scrobbling-service-plex-tv - - session_bandwidth_restrictions - - session_kick - - shared_server_notification - - shared_source_notification - - signin_notification - - signin_with_apple - - silence-removal - - sleep-timer - - spring_serve_ad_provider - - sync - - sweet-fades - - transcoder_cache - - trailers - - tuner-sharing - - two-factor-authentication - - unsupportedtuners - - upgrade-3ds2 - - visualizers - - vod-schema - - vod_cloudflare - - volume-leveling - - watch-together-invite - - watchlist-rss - - web_server_dashboard - - webhooks - - blacklist-subnets - - chromecast-music-mp - - Sync v3 - - livetv-platform-specific - - nonAnonymousAccount - - parental-controls - - Subtitles on Demand - - ultrablur - - web-desktop-gracenote-banner - active: - description: If the account's Plex Pass subscription is active - type: boolean - example: true - subscribedAt: - description: Date the account subscribed to Plex Pass - type: - - string - - 'null' - example: '2021-04-12T18:21:12Z' - status: - description: String representation of subscriptionActive - example: Inactive - enum: - - Inactive - - Active - paymentService: - description: Payment service used for your Plex Pass subscription - type: - - string - - 'null' - plan: - description: Name of Plex Pass subscription plan - type: - - string - - 'null' - thumb: - type: string - description: URL of the account thumbnail - format: uri - example: 'https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101' - title: - type: string - description: The title of the account (username or friendly name) - example: UsernameTitle - twoFactorEnabled: - type: boolean - description: If two-factor authentication is enabled - default: false - username: - type: string - description: The account username - example: Username - uuid: - type: string - description: The account UUID - example: dae343c1f45beb4f - attributionPartner: - type: - - string - - 'null' - example: null - - type: object - required: - - pastSubscriptions - - trials - properties: - pastSubscriptions: - type: array - items: - title: PastSubscription - type: object - required: - - id - - mode - - renewsAt - - endsAt - - canceled - - gracePeriod - - onHold - - canReactivate - - canUpgrade - - canDowngrade - - canConvert - - type - - transfer - - state - - billing - properties: - id: - type: - - string - - 'null' - mode: - type: - - string - - 'null' - renewsAt: - oneOf: - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: 'null' - endsAt: - oneOf: - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - - type: 'null' - canceled: - type: boolean - example: false - default: false - gracePeriod: - type: boolean - example: false - default: false - onHold: - type: boolean - example: false - default: false - canReactivate: - type: boolean - example: false - default: false - canUpgrade: - type: boolean - example: false - default: false - canDowngrade: - type: boolean - example: false - default: false - canConvert: - type: boolean - example: false - default: false - type: - type: string - example: plexpass - transfer: - type: - - string - - 'null' - state: - example: ended - enum: - - ended - billing: - type: object - required: - - internalPaymentMethod - - paymentMethodId - properties: - internalPaymentMethod: - type: object - paymentMethodId: - type: - - integer - - 'null' - trials: - type: array - items: - type: object - '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' - content: - application/json: - schema: - x-speakeasy-name-override: BadRequest - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 - x-codeSamples: - - lang: php - label: data - source: |- - declare(strict_types=1); - - require 'vendor/autoload.php'; - - use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - - $sdk = Plex_API\PlexAPI::builder()->build(); - - $request = new Operations\PostUsersSignInDataRequest( - clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58', - clientName: 'Plex for Roku', - deviceNickname: 'Roku 3', - clientVersion: '2.4.1', - platform: 'Roku', - requestBody: new Operations\PostUsersSignInDataRequestBody( - login: 'username@email.com', - password: 'password123', - verificationCode: '123456', - ), - ); - - $response = $sdk->authentication->postUsersSignInData( - request: $request - ); - - if ($response->userPlexAccount !== null) { - // handle response - } - - lang: ruby - label: data - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\n\n\nreq = ::PlexRubySDK::Operations::PostUsersSignInDataRequest.new(\n client_id: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n client_name: \"Plex for Roku\",\n device_nickname: \"Roku 3\",\n client_version: \"2.4.1\",\n platform: \"Roku\",\n request_body: ::PlexRubySDK::Operations::PostUsersSignInDataRequestBody.new(\n login: \"username@email.com\",\n password: \"password123\",\n verification_code: \"123456\",\n ),\n)\n \nres = s.authentication.post_users_sign_in_data(req)\n\nif ! res.user_plex_account.nil?\n # handle response\nend" - - lang: go - label: data - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Authentication.PostUsersSignInData(ctx, operations.PostUsersSignInDataRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n RequestBody: &operations.PostUsersSignInDataRequestBody{\n Login: \"username@email.com\",\n Password: \"password123\",\n VerificationCode: plexgo.String(\"123456\"),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.UserPlexAccount != nil {\n // handle response\n }\n}" - - lang: java - label: data - source: |- - package hello.world; - - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.PostUsersSignInDataBadRequest; - import dev.plexapi.plexapi.models.errors.PostUsersSignInDataUnauthorized; - import dev.plexapi.plexapi.models.operations.PostUsersSignInDataRequest; - import dev.plexapi.plexapi.models.operations.PostUsersSignInDataRequestBody; - import dev.plexapi.plexapi.models.operations.PostUsersSignInDataResponse; - import java.lang.Exception; - - public class Application { - - public static void main(String[] args) throws PostUsersSignInDataBadRequest, PostUsersSignInDataUnauthorized, Exception { - - PlexAPI sdk = PlexAPI.builder() - .build(); - - PostUsersSignInDataRequest req = PostUsersSignInDataRequest.builder() - .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") - .clientName("Plex for Roku") - .deviceNickname("Roku 3") - .clientVersion("2.4.1") - .platform("Roku") - .requestBody(PostUsersSignInDataRequestBody.builder() - .login("username@email.com") - .password("password123") - .verificationCode("123456") - .build()) - .build(); - - PostUsersSignInDataResponse res = sdk.authentication().postUsersSignInData() - .request(req) - .call(); - - if (res.userPlexAccount().isPresent()) { - // handle response - } - } - } - - lang: typescript - label: data + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { - const result = await plexAPI.authentication.postUsersSignInData({ - clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", - clientName: "Plex for Roku", - deviceNickname: "Roku 3", - clientVersion: "2.4.1", - platform: "Roku", - requestBody: { - login: "username@email.com", - password: "password123", - verificationCode: "123456", - }, - }); + const result = await plexAPI.updater.getUpdatesStatus(); - // Handle the result console.log(result); } run(); - /users: + /{transcodeType}/:/transcode/universal/decision: get: - servers: - - url: 'https://plex.tv/api' - security: [] + summary: Make a decision on media playback + operationId: makeDecision + description: Make a decision on media playback based on client profile, and requested settings such as bandwidth and resolution. tags: - - Users - summary: Get list of all connected users - description: Get list of all users that are friends and have library access with the provided Plex authentication token - operationId: get-users + - Transcoder parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/transcodeType' + - $ref: '#/components/parameters/transcodeSessionId' + - $ref: '#/components/parameters/advancedSubtitles' + - name: audioBoost + description: Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc) + in: query + schema: + minimum: 1 + type: integer + example: 50 + - name: audioChannelCount + description: Target video number of audio channels. + in: query + schema: + maximum: 8 + minimum: 1 + type: integer + example: 5 + - name: autoAdjustQuality + description: Indicates the client supports ABR. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: autoAdjustSubtitle + description: Indicates if the server should adjust subtitles based on Voice Activity Data. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directPlay + description: Indicates the client supports direct playing the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directStream + description: Indicates the client supports direct streaming the video of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directStreamAudio + description: Indicates the client supports direct streaming the audio of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: disableResolutionRotation + description: Indicates if resolution should be adjusted for orientation. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: hasMDE + description: Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1 + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: location + description: Network type of the client, can be used to help determine target bitrate. + in: query + schema: + type: string + enum: + - lan + - wan + - cellular + example: wan + - name: mediaBufferSize + description: Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks. + in: query + schema: + type: integer + example: 102400 + - name: mediaIndex + description: Index of the media to transcode. -1 or not specified indicates let the server choose. + in: query + schema: + type: integer + example: 0 + - name: musicBitrate + description: Target bitrate for audio only files (in kbps, used to transcode). + in: query + schema: + minimum: 0 + type: integer + example: 5000 + - name: offset + description: Offset from the start of the media (in seconds). + in: query + schema: + type: number + example: 90.5 + - name: partIndex + description: Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode + in: query + schema: + type: integer + example: 0 + - name: path + description: Internal PMS path of the media to transcode. + in: query + schema: + type: string + example: /library/metadata/151671 + - name: peakBitrate + description: Maximum bitrate (in kbps) to use in ABR. + in: query + schema: + minimum: 0 + type: integer + example: 12000 + - name: photoResolution + description: Target photo resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 + - name: protocol + description: | + Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022) + in: query + schema: + type: string + enum: + - http + - hls + - dash + example: dash + - name: secondsPerSegment + description: Number of seconds to include in each transcoded segment + in: query + schema: + type: integer + example: 5 + - name: subtitleSize + description: Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect) + in: query + schema: + minimum: 1 + type: integer + example: 50 + - name: subtitles + description: | + Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream + in: query + schema: + type: string + enum: + - auto + - burn + - none + - sidecar + - embedded + - segmented + - unknown + example: Burn + - name: videoBitrate + description: Target video bitrate (in kbps). + in: query + schema: + minimum: 0 + type: integer + example: 12000 + - name: videoQuality + description: Target photo quality. + in: query + schema: + maximum: 99 + minimum: 0 + type: integer + example: 50 + - name: videoResolution + description: Target maximum video resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 - name: X-Plex-Client-Identifier - x-speakeasy-name-override: ClientID - description: 'An opaque identifier unique to the client (UUID, serial number, or other unique device ID)' + description: Unique per client. + in: header required: true + schema: + type: string + - name: X-Plex-Client-Profile-Extra + description: See [Profile Augmentations](#section/API-Info/Profile-Augmentations) . in: header schema: type: string - example: 3381b62b-9ab7-4e37-827b-203e9809eb58 - - name: X-Plex-Product - x-speakeasy-name-override: ClientName - description: 'The name of the client application. (Plex Web, Plex Media Server, etc.)' + example: 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) + - name: X-Plex-Client-Profile-Name + description: Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile. in: header - required: false schema: type: string - example: Plex for Roku + example: generic - name: X-Plex-Device - x-speakeasy-name-override: DeviceNickname - description: A relatively friendly name for the client device + description: Device the client is running on in: header - required: false schema: type: string - example: Roku 3 - - name: X-Plex-Device-Name - x-speakeasy-name-override: DeviceName - description: 'The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.)' + example: Windows + - name: X-Plex-Model + description: Model of the device the client is running on + in: header + schema: + type: string + example: standalone + - name: X-Plex-Platform + description: Client Platform in: header - required: false schema: type: string example: Chrome - - name: X-Plex-Device-Screen-Resolution - x-speakeasy-name-override: DeviceScreenResolution - description: 'The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440)' - in: header - required: false - schema: - type: string - example: '1487x1165,2560x1440' - - name: X-Plex-Version - x-speakeasy-name-override: ClientVersion - description: The version of the client application. - in: header - required: false - schema: - type: string - example: 2.4.1 - - name: X-Plex-Platform - x-speakeasy-name-override: Platform - description: The platform of the client application. - in: header - required: false - schema: - type: string - example: Roku - - name: X-Plex-Features - x-speakeasy-name-override: ClientFeatures - description: 'The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list)' - in: header - required: false - schema: - type: string - example: 'external-media,indirect-media,hub-style-list' - - name: X-Plex-Model - x-speakeasy-name-override: Model - description: A potentially less friendly identifier for the device model - in: header - required: false - schema: - type: string - example: 4200X - - name: X-Plex-Session-Id - description: The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) - in: header - required: false - schema: - type: string - example: 97e136ef-4ddd-4ff3-89a7-a5820c96c2ca - - name: X-Plex-Language - description: The language of the client application. - in: header - required: false - schema: - type: string - example: en - name: X-Plex-Platform-Version - x-speakeasy-name-override: PlatformVersion - description: The version of the platform + description: Client Platform Version in: header - required: false schema: type: string - example: 4.3 build 1057 - - name: X-Plex-Token + example: 135 + - name: X-Plex-Session-Identifier + description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs) + in: header + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithDecision' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Transcoder.MakeDecision(ctx, operations.MakeDecisionRequest{ + TranscodeType: components.TranscodeTypeMusic, + AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(), + AudioBoost: plexgo.Pointer[int64](50), + AudioChannelCount: plexgo.Pointer[int64](5), + AutoAdjustQuality: components.BoolIntOne.ToPointer(), + AutoAdjustSubtitle: components.BoolIntOne.ToPointer(), + DirectPlay: components.BoolIntOne.ToPointer(), + DirectStream: components.BoolIntOne.ToPointer(), + DirectStreamAudio: components.BoolIntOne.ToPointer(), + DisableResolutionRotation: components.BoolIntOne.ToPointer(), + HasMDE: components.BoolIntOne.ToPointer(), + Location: operations.LocationWan.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.ProtocolDash.ToPointer(), + SecondsPerSegment: plexgo.Pointer[int64](5), + SubtitleSize: plexgo.Pointer[int64](50), + VideoBitrate: plexgo.Pointer[int64](12000), + VideoQuality: plexgo.Pointer[int64](50), + VideoResolution: plexgo.Pointer("1080x1080"), + 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.MediaContainerWithDecision != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.*; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MakeDecisionRequest req = MakeDecisionRequest.builder() + .transcodeType(TranscodeType.MUSIC) + .advancedSubtitles(AdvancedSubtitles.BURN) + .audioBoost(50L) + .audioChannelCount(5L) + .autoAdjustQuality(BoolInt.ONE) + .autoAdjustSubtitle(BoolInt.ONE) + .directPlay(BoolInt.ONE) + .directStream(BoolInt.ONE) + .directStreamAudio(BoolInt.ONE) + .disableResolutionRotation(BoolInt.ONE) + .hasMDE(BoolInt.ONE) + .location(Location.WAN) + .mediaBufferSize(102400L) + .mediaIndex(0L) + .musicBitrate(5000L) + .offset(90.5) + .partIndex(0L) + .path("/library/metadata/151671") + .peakBitrate(12000L) + .photoResolution("1080x1080") + .protocol(Protocol.DASH) + .secondsPerSegment(5L) + .subtitleSize(50L) + .videoBitrate(12000L) + .videoQuality(50L) + .videoResolution("1080x1080") + .xPlexClientProfileExtra("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("generic") + .build(); + + MakeDecisionResponse res = sdk.transcoder().makeDecision() + .request(req) + .call(); + + if (res.mediaContainerWithDecision().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { MakeDecisionLocation, MakeDecisionProtocol } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, AdvancedSubtitles, BoolInt, TranscodeType } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.transcoder.makeDecision({ + transcodeType: TranscodeType.Music, + advancedSubtitles: AdvancedSubtitles.Burn, + audioBoost: 50, + audioChannelCount: 5, + autoAdjustQuality: BoolInt.One, + autoAdjustSubtitle: BoolInt.One, + directPlay: BoolInt.One, + directStream: BoolInt.One, + directStreamAudio: BoolInt.One, + disableResolutionRotation: BoolInt.One, + hasMDE: BoolInt.One, + location: MakeDecisionLocation.Wan, + mediaBufferSize: 102400, + mediaIndex: 0, + musicBitrate: 5000, + offset: 90.5, + partIndex: 0, + path: "/library/metadata/151671", + peakBitrate: 12000, + photoResolution: "1080x1080", + protocol: MakeDecisionProtocol.Dash, + secondsPerSegment: 5, + subtitleSize: 50, + videoBitrate: 12000, + videoQuality: 50, + videoResolution: "1080x1080", + xPlexClientProfileExtra: "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: "generic", + }); + + console.log(result); + } + + run(); + /{transcodeType}/:/transcode/universal/fallback: + post: + summary: Manually trigger a transcoder fallback + operationId: triggerFallback + description: 'Manually trigger a transcoder fallback ex: HEVC to h.264 or hw to sw' + tags: + - Transcoder + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/transcodeType' + - $ref: '#/components/parameters/transcodeSessionId' + responses: + '200': + $ref: '#/components/responses/200' + '404': + description: Session ID does not exist + content: + text/html: {} + '412': + description: Transcode could not fallback + content: + text/html: {} + '500': + description: Transcode failed to fallback + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Transcoder.TriggerFallback(ctx, operations.TriggerFallbackRequest{ + TranscodeType: components.TranscodeTypeAudio, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.TriggerFallbackRequest; + import dev.plexapi.sdk.models.operations.TriggerFallbackResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.TranscodeType; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + TriggerFallbackRequest req = TriggerFallbackRequest.builder() + .transcodeType(TranscodeType.AUDIO) + .build(); + + TriggerFallbackResponse res = sdk.transcoder().triggerFallback() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, TranscodeType } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.transcoder.triggerFallback({ + transcodeType: TranscodeType.Audio, + }); + + console.log(result); + } + + run(); + /{transcodeType}/:/transcode/universal/subtitles: + get: + summary: Transcode subtitles + operationId: transcodeSubtitles + description: Only transcode subtitle streams. + tags: + - Transcoder + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/transcodeType' + - $ref: '#/components/parameters/transcodeSessionId' + - $ref: '#/components/parameters/advancedSubtitles' + - name: audioBoost + description: Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc) + in: query + schema: + minimum: 1 + type: integer + example: 50 + - name: audioChannelCount + description: Target video number of audio channels. + in: query + schema: + maximum: 8 + minimum: 1 + type: integer + example: 5 + - name: autoAdjustQuality + description: Indicates the client supports ABR. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: autoAdjustSubtitle + description: Indicates if the server should adjust subtitles based on Voice Activity Data. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directPlay + description: Indicates the client supports direct playing the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directStream + description: Indicates the client supports direct streaming the video of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directStreamAudio + description: Indicates the client supports direct streaming the audio of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: disableResolutionRotation + description: Indicates if resolution should be adjusted for orientation. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: hasMDE + description: Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1 + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: location + description: Network type of the client, can be used to help determine target bitrate. + in: query + schema: + type: string + enum: + - lan + - wan + - cellular + example: wan + - name: mediaBufferSize + description: Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks. + in: query + schema: + type: integer + example: 102400 + - name: mediaIndex + description: Index of the media to transcode. -1 or not specified indicates let the server choose. + in: query + schema: + type: integer + example: 0 + - name: musicBitrate + description: Target bitrate for audio only files (in kbps, used to transcode). + in: query + schema: + minimum: 0 + type: integer + example: 5000 + - name: offset + description: Offset from the start of the media (in seconds). + in: query + schema: + type: number + example: 90.5 + - name: partIndex + description: Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode + in: query + schema: + type: integer + example: 0 + - name: path + description: Internal PMS path of the media to transcode. + in: query + schema: + type: string + example: /library/metadata/151671 + - name: peakBitrate + description: Maximum bitrate (in kbps) to use in ABR. + in: query + schema: + minimum: 0 + type: integer + example: 12000 + - name: photoResolution + description: Target photo resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 + - name: protocol + description: | + Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022) + in: query + schema: + type: string + enum: + - http + - hls + - dash + example: dash + - name: secondsPerSegment + description: Number of seconds to include in each transcoded segment + in: query + schema: + type: integer + example: 5 + - name: subtitleSize + description: Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect) + in: query + schema: + minimum: 1 + type: integer + example: 50 + - name: subtitles + description: | + Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream + in: query + schema: + type: string + enum: + - auto + - burn + - none + - sidecar + - embedded + - segmented + - unknown + example: Burn + - name: videoBitrate + description: Target video bitrate (in kbps). + in: query + schema: + minimum: 0 + type: integer + example: 12000 + - name: videoQuality + description: Target photo quality. + in: query + schema: + maximum: 99 + minimum: 0 + type: integer + example: 50 + - name: videoResolution + description: Target maximum video resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 + - name: X-Plex-Client-Identifier + description: Unique per client. in: header - description: 'An authentication token, obtained from plex.tv' required: true schema: type: string - example: CV5xoxjTpFKUzBTShsaf + - name: X-Plex-Client-Profile-Extra + description: See [Profile Augmentations](#section/API-Info/Profile-Augmentations) . + in: header + schema: + type: string + example: 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) + - name: X-Plex-Client-Profile-Name + description: Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile. + in: header + schema: + type: string + example: generic + - name: X-Plex-Device + description: Device the client is running on + in: header + schema: + type: string + example: Windows + - name: X-Plex-Model + description: Model of the device the client is running on + in: header + schema: + type: string + example: standalone + - name: X-Plex-Platform + description: Client Platform + in: header + schema: + type: string + example: Chrome + - name: X-Plex-Platform-Version + description: Client Platform Version + in: header + schema: + type: string + example: 135 + - name: X-Plex-Session-Identifier + description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs) + in: header + schema: + type: string responses: '200': - description: Successful response with media container data in XML + description: Transcoded subtitle file content: - application/xml: + text/srt: + example: "1\n00:00:02,499 --> 00:00:06,416\n[SERENE MUSIC]\n\n2\n00:00:11,791 --> 00:00:13,958\n[BROOK BABBLES] \n[FLY BUZZES]\n\n3\n00:00:16,166 --> 00:00:17,666\n[BIRD TWEETS]\n\n4\n00:00:17,666 --> 00:00:18,708\n[WINGS FLAP]\n\n5\n00:00:19,833 --> 00:00:20,374\n[BIRD TWEETS] \n[WINGS FLAP]\n\n6\n00:00:20,374 --> 00:00:21,041\n[THUD]\n\n7\n00:00:21,374 --> 00:00:22,249\n[THUD]\n\n8\n00:00:22,249 --> 00:00:23,083\n[SQUIRREL LAUGHS]\n\n9\n00:00:26,249 --> 00:00:27,541\n[SNORES]\n\n10\n00:00:29,416 --> 00:00:30,708\n[SNORES]\n\n11\n00:00:32,749 --> 00:00:34,041\n[BUNNY SNORES]\n\n12\n00:00:35,916 --> 00:00:37,249\n[BUNNY SNORES]\n" + '400': + $ref: '#/components/responses/400' + '403': + $ref: '#/components/responses/403' + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Transcoder.TranscodeSubtitles(ctx, operations.TranscodeSubtitlesRequest{ + TranscodeType: components.TranscodeTypeAudio, + AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(), + AudioBoost: plexgo.Pointer[int64](50), + AudioChannelCount: plexgo.Pointer[int64](5), + AutoAdjustQuality: components.BoolIntOne.ToPointer(), + AutoAdjustSubtitle: components.BoolIntOne.ToPointer(), + DirectPlay: components.BoolIntOne.ToPointer(), + DirectStream: components.BoolIntOne.ToPointer(), + DirectStreamAudio: components.BoolIntOne.ToPointer(), + DisableResolutionRotation: components.BoolIntOne.ToPointer(), + HasMDE: components.BoolIntOne.ToPointer(), + Location: operations.QueryParamLocationWan.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.QueryParamProtocolDash.ToPointer(), + SecondsPerSegment: plexgo.Pointer[int64](5), + SubtitleSize: plexgo.Pointer[int64](50), + VideoBitrate: plexgo.Pointer[int64](12000), + VideoQuality: plexgo.Pointer[int64](50), + VideoResolution: plexgo.Pointer("1080x1080"), + 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 != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.*; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + TranscodeSubtitlesRequest req = TranscodeSubtitlesRequest.builder() + .transcodeType(TranscodeType.AUDIO) + .advancedSubtitles(AdvancedSubtitles.BURN) + .audioBoost(50L) + .audioChannelCount(5L) + .autoAdjustQuality(BoolInt.ONE) + .autoAdjustSubtitle(BoolInt.ONE) + .directPlay(BoolInt.ONE) + .directStream(BoolInt.ONE) + .directStreamAudio(BoolInt.ONE) + .disableResolutionRotation(BoolInt.ONE) + .hasMDE(BoolInt.ONE) + .location(QueryParamLocation.WAN) + .mediaBufferSize(102400L) + .mediaIndex(0L) + .musicBitrate(5000L) + .offset(90.5) + .partIndex(0L) + .path("/library/metadata/151671") + .peakBitrate(12000L) + .photoResolution("1080x1080") + .protocol(QueryParamProtocol.DASH) + .secondsPerSegment(5L) + .subtitleSize(50L) + .videoBitrate(12000L) + .videoQuality(50L) + .videoResolution("1080x1080") + .xPlexClientProfileExtra("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("generic") + .build(); + + TranscodeSubtitlesResponse res = sdk.transcoder().transcodeSubtitles() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { TranscodeSubtitlesLocation, TranscodeSubtitlesProtocol } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, AdvancedSubtitles, BoolInt, TranscodeType } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.transcoder.transcodeSubtitles({ + transcodeType: TranscodeType.Audio, + advancedSubtitles: AdvancedSubtitles.Burn, + audioBoost: 50, + audioChannelCount: 5, + autoAdjustQuality: BoolInt.One, + autoAdjustSubtitle: BoolInt.One, + directPlay: BoolInt.One, + directStream: BoolInt.One, + directStreamAudio: BoolInt.One, + disableResolutionRotation: BoolInt.One, + hasMDE: BoolInt.One, + location: TranscodeSubtitlesLocation.Wan, + mediaBufferSize: 102400, + mediaIndex: 0, + musicBitrate: 5000, + offset: 90.5, + partIndex: 0, + path: "/library/metadata/151671", + peakBitrate: 12000, + photoResolution: "1080x1080", + protocol: TranscodeSubtitlesProtocol.Dash, + secondsPerSegment: 5, + subtitleSize: 50, + videoBitrate: 12000, + videoQuality: 50, + videoResolution: "1080x1080", + xPlexClientProfileExtra: "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: "generic", + }); + + console.log(result); + } + + run(); + /activities/{activityId}: + delete: + summary: Cancel a running activity + operationId: cancelActivity + description: Cancel a running activity. Admins can cancel all activities but other users can only cancel their own + tags: + - Activities + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: activityId + description: The UUID of the activity to cancel. + in: path + required: true + schema: + type: string + example: d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Activity is not cancellable + content: + text/html: {} + '404': + description: No activity with the provided id is found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Activities.CancelActivity(ctx, operations.CancelActivityRequest{ + ActivityID: "d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CancelActivityRequest; + import dev.plexapi.sdk.models.operations.CancelActivityResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CancelActivityRequest req = CancelActivityRequest.builder() + .activityId("d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e") + .build(); + + CancelActivityResponse res = sdk.activities().cancelActivity() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.activities.cancelActivity({ + activityId: "d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e", + }); + + console.log(result); + } + + run(); + /butler/{task}: + delete: + summary: Stop a single Butler task + operationId: stopTask + description: | + This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists + tags: + - Butler + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: task + description: The task name + in: path + required: true + schema: + type: string + enum: + - AutomaticUpdates + - BackupDatabase + - ButlerTaskGenerateAdMarkers + - ButlerTaskGenerateCreditsMarkers + - ButlerTaskGenerateIntroMarkers + - ButlerTaskGenerateVoiceActivity + - CleanOldBundles + - CleanOldCacheFiles + - DeepMediaAnalysis + - GarbageCollectBlobs + - GarbageCollectLibraryMedia + - GenerateBlurHashes + - GenerateChapterThumbs + - GenerateMediaIndexFiles + - LoudnessAnalysis + - MusicAnalysis + - OptimizeDatabase + - RefreshEpgGuides + - RefreshLibraries + - RefreshLocalMedia + - RefreshPeriodicMetadata + - UpgradeMediaAnalysis + responses: + '200': + $ref: '#/components/responses/200' + '404': + description: No task with this name was found or no task with this name was running + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Butler.StopTask(ctx, operations.StopTaskRequest{ + Task: operations.TaskCleanOldBundles, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StopTaskRequest req = StopTaskRequest.builder() + .task(Task.CLEAN_OLD_BUNDLES) + .build(); + + StopTaskResponse res = sdk.butler().stopTask() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { StopTaskTask } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.butler.stopTask({ + task: StopTaskTask.CleanOldBundles, + }); + + console.log(result); + } + + run(); + post: + summary: Start a single Butler task + operationId: startTask + description: | + This endpoint will attempt to start a specific Butler task by name. + tags: + - Butler + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: task + description: The task name + in: path + required: true + schema: + type: string + enum: + - AutomaticUpdates + - BackupDatabase + - ButlerTaskGenerateAdMarkers + - ButlerTaskGenerateCreditsMarkers + - ButlerTaskGenerateIntroMarkers + - ButlerTaskGenerateVoiceActivity + - CleanOldBundles + - CleanOldCacheFiles + - DeepMediaAnalysis + - GarbageCollectBlobs + - GarbageCollectLibraryMedia + - GenerateBlurHashes + - GenerateChapterThumbs + - GenerateMediaIndexFiles + - LoudnessAnalysis + - MusicAnalysis + - OptimizeDatabase + - RefreshEpgGuides + - RefreshLibraries + - RefreshLocalMedia + - RefreshPeriodicMetadata + - UpgradeMediaAnalysis + responses: + '200': + description: Task started + content: + text/html: {} + '202': + description: Task is already running + content: + text/html: {} + '404': + description: No task with this name was found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Butler.StartTask(ctx, operations.StartTaskRequest{ + Task: operations.PathParamTaskRefreshLocalMedia, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StartTaskRequest req = StartTaskRequest.builder() + .task(PathParamTask.REFRESH_LOCAL_MEDIA) + .build(); + + StartTaskResponse res = sdk.butler().startTask() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { StartTaskTask } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.butler.startTask({ + task: StartTaskTask.RefreshLocalMedia, + }); + + console.log(result); + } + + run(); + /downloadQueue/{queueId}: + get: + summary: Get a download queue + operationId: getDownloadQueue + description: | + Available: 0.2.0 + + Get a download queue by its id + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: schema: - type: object properties: MediaContainer: - type: object - description: Container holding user and server details. - required: - - friendlyName - - identifier - - machineIdentifier - - totalSize - - size - - User - properties: - friendlyName: - type: string - description: The friendly name of the Plex instance. - example: myPlex - identifier: - type: string - example: com.plexapp.plugins.myplex - machineIdentifier: - type: string - description: Unique Machine identifier of the Plex server. - example: 3dff4c4da3b1229a649aa574a9e2b419a684a20e - totalSize: - type: integer - description: Total number of users. - example: 30 - size: - type: integer - description: Number of users in the current response. - example: 30 - User: - type: array - description: List of users with access to the Plex server. - items: - type: object - required: - - id - - title - - username - - email - - thumb - - protected - - home - - allowTuners - - allowSync - - allowCameraUpload - - allowChannels - - allowSubtitleAdmin - - restricted - - Server - properties: - id: - type: integer - description: User's unique ID. - example: 22526914 - title: - type: string - description: User's display name. - example: Plex User - username: - type: string - description: User's username. - example: zgfuc7krcqfimrmb9lsl5j - email: - type: string - description: User's email address. - example: zgfuc7krcqfimrmb9lsl5j@protonmail.com - recommendationsPlaylistId: - description: ID of the user's recommendation playlist. - type: - - 'null' - - string - example: '' - thumb: - type: string - description: URL to the user's avatar image. - example: 'https://plex.tv/users/3346028014e93acd/avatar?c=1731605021' - protected: - allOf: - - description: Indicates whether the account is protected. - - type: integer - format: int32 + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + DownloadQueue: + items: + properties: + id: + type: integer + itemCount: + type: integer + status: + description: | + The state of this queue + - deciding: At least one item is still being decided + - waiting: At least one item is waiting for transcode and none are currently transcoding + - processing: At least one item is being transcoded + - done: All items are available (or potentially expired) + - error: At least one item has encountered an error enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - home: - allOf: - - description: Indicates if the user is part of a home group. - - type: integer - format: int32 + - deciding + - waiting + - processing + - done + - error + type: string + type: object + type: array + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.GetDownloadQueue(ctx, operations.GetDownloadQueueRequest{ + QueueID: 922802, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetDownloadQueueRequest; + import dev.plexapi.sdk.models.operations.GetDownloadQueueResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetDownloadQueueRequest req = GetDownloadQueueRequest.builder() + .queueId(922802L) + .build(); + + GetDownloadQueueResponse res = sdk.downloadQueue().getDownloadQueue() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.getDownloadQueue({ + queueId: 922802, + }); + + console.log(result); + } + + run(); + /downloadQueue/{queueId}/add: + post: + summary: Add to download queue + operationId: addDownloadQueueItems + description: | + Available: 0.2.0 + + Add items to the download queue + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + - name: keys + description: Keys to add + in: query + required: true + explode: false + schema: + type: array + items: + type: string + example: + - /library/metadata/3 + - /library/metadata/6 + - $ref: '#/components/parameters/advancedSubtitles' + - $ref: '#/components/parameters/audioBoost' + - $ref: '#/components/parameters/audioChannelCount' + - $ref: '#/components/parameters/autoAdjustQuality' + - $ref: '#/components/parameters/autoAdjustSubtitle' + - $ref: '#/components/parameters/directPlay' + - $ref: '#/components/parameters/directStream' + - $ref: '#/components/parameters/directStreamAudio' + - $ref: '#/components/parameters/disableResolutionRotation' + - $ref: '#/components/parameters/hasMDE' + - $ref: '#/components/parameters/location' + - $ref: '#/components/parameters/mediaBufferSize' + - $ref: '#/components/parameters/mediaIndex' + - $ref: '#/components/parameters/musicBitrate' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/partIndex' + - $ref: '#/components/parameters/path' + - $ref: '#/components/parameters/peakBitrate' + - $ref: '#/components/parameters/photoResolution' + - $ref: '#/components/parameters/protocol' + - $ref: '#/components/parameters/secondsPerSegment' + - $ref: '#/components/parameters/subtitleSize' + - $ref: '#/components/parameters/subtitles' + - $ref: '#/components/parameters/videoBitrate' + - $ref: '#/components/parameters/videoQuality' + - $ref: '#/components/parameters/videoResolution' + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + AddedQueueItems: + items: + properties: + id: + description: The queue item id that was added or the existing one if an item already exists in this queue with the same parameters + type: integer + key: + description: The key added to the queue + type: string + type: object + type: array + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.AddDownloadQueueItems(ctx, operations.AddDownloadQueueItemsRequest{ + QueueID: 984925, + Keys: []string{ + "/library/metadata/3", + "/library/metadata/6", + }, + AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(), + AudioBoost: plexgo.Pointer[int64](50), + AudioChannelCount: plexgo.Pointer[int64](5), + AutoAdjustQuality: components.BoolIntOne.ToPointer(), + AutoAdjustSubtitle: components.BoolIntOne.ToPointer(), + DirectPlay: components.BoolIntOne.ToPointer(), + DirectStream: components.BoolIntOne.ToPointer(), + DirectStreamAudio: components.BoolIntOne.ToPointer(), + DisableResolutionRotation: components.BoolIntOne.ToPointer(), + HasMDE: components.BoolIntOne.ToPointer(), + Location: components.LocationWan.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: components.ProtocolDash.ToPointer(), + SecondsPerSegment: plexgo.Pointer[int64](5), + SubtitleSize: plexgo.Pointer[int64](50), + VideoBitrate: plexgo.Pointer[int64](12000), + VideoQuality: plexgo.Pointer[int64](50), + VideoResolution: plexgo.Pointer("1080x1080"), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddDownloadQueueItemsRequest; + import dev.plexapi.sdk.models.operations.AddDownloadQueueItemsResponse; + import dev.plexapi.sdk.models.shared.*; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddDownloadQueueItemsRequest req = AddDownloadQueueItemsRequest.builder() + .queueId(984925L) + .keys(List.of( + "/library/metadata/3", + "/library/metadata/6")) + .advancedSubtitles(AdvancedSubtitles.BURN) + .audioBoost(50L) + .audioChannelCount(5L) + .autoAdjustQuality(BoolInt.ONE) + .autoAdjustSubtitle(BoolInt.ONE) + .directPlay(BoolInt.ONE) + .directStream(BoolInt.ONE) + .directStreamAudio(BoolInt.ONE) + .disableResolutionRotation(BoolInt.ONE) + .hasMDE(BoolInt.ONE) + .location(Location.WAN) + .mediaBufferSize(102400L) + .mediaIndex(0L) + .musicBitrate(5000L) + .offset(90.5) + .partIndex(0L) + .path("/library/metadata/151671") + .peakBitrate(12000L) + .photoResolution("1080x1080") + .protocol(Protocol.DASH) + .secondsPerSegment(5L) + .subtitleSize(50L) + .videoBitrate(12000L) + .videoQuality(50L) + .videoResolution("1080x1080") + .build(); + + AddDownloadQueueItemsResponse res = sdk.downloadQueue().addDownloadQueueItems() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, AdvancedSubtitles, BoolInt, LocationParameter, Protocol } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.addDownloadQueueItems({ + queueId: 984925, + keys: [ + "/library/metadata/3", + "/library/metadata/6", + ], + advancedSubtitles: AdvancedSubtitles.Burn, + audioBoost: 50, + audioChannelCount: 5, + autoAdjustQuality: BoolInt.One, + autoAdjustSubtitle: BoolInt.One, + directPlay: BoolInt.One, + directStream: BoolInt.One, + directStreamAudio: BoolInt.One, + disableResolutionRotation: BoolInt.One, + hasMDE: BoolInt.One, + location: LocationParameter.Wan, + mediaBufferSize: 102400, + mediaIndex: 0, + musicBitrate: 5000, + offset: 90.5, + partIndex: 0, + path: "/library/metadata/151671", + peakBitrate: 12000, + photoResolution: "1080x1080", + protocol: Protocol.Dash, + secondsPerSegment: 5, + subtitleSize: 50, + videoBitrate: 12000, + videoQuality: 50, + videoResolution: "1080x1080", + }); + + console.log(result); + } + + run(); + /downloadQueue/{queueId}/items: + get: + summary: Get download queue items + operationId: listDownloadQueueItems + description: | + Available: 0.2.0 + + Get items from a download queue + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + DownloadQueueItem: + items: + properties: + DecisionResult: + properties: + availableBandwidth: + description: The maximum bitrate set when item was added + type: integer + directPlayDecisionCode: + type: integer + directPlayDecisionText: + type: string + generalDecisionCode: + type: integer + generalDecisionText: + type: string + mdeDecisionCode: + description: The code indicating the status of evaluation of playback when client indicates `hasMDE=1` + type: integer + mdeDecisionText: + description: Descriptive text for the above code + type: string + transcodeDecisionCode: + type: integer + transcodeDecisionText: + type: string + type: object + error: + description: The error encountered in transcoding or decision + type: string + id: + type: integer + key: + type: string + queueId: + type: integer + status: + description: | + The state of the item: + - deciding: The item decision is pending + - waiting: The item is waiting for transcode + - processing: The item is being transcoded + - available: The item is available for download + - error: The item encountered an error in the decision or transcode + - expired: The transcoded item has timed out and is no longer available enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - allowTuners: - allOf: - - description: Indicates if the user is allowed to use tuners. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - allowSync: - allOf: - - description: Indicates if the user is allowed to sync media. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - allowCameraUpload: - allOf: - - description: Indicates if the user is allowed to upload from a camera. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - allowChannels: - allOf: - - description: Indicates if the user has access to channels. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - allowSubtitleAdmin: - allOf: - - description: Indicates if the user can manage subtitles. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - filterAll: - type: - - 'null' - - string - description: Filters applied for all content. - example: '' - filterMovies: - type: - - 'null' - - string - description: Filters applied for movies. - example: '' - filterMusic: - type: - - 'null' - - string - description: Filters applied for music. - example: '' - filterPhotos: - type: - - 'null' - - string - description: Filters applied for photos. - example: '' - filterTelevision: - type: string - description: Filters applied for television. - example: '' - restricted: - allOf: - - description: Indicates if the user has restricted access. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - Server: - type: array - description: List of servers owned by the user. - items: - type: object - required: - - id - - serverId - - machineIdentifier - - name - - lastSeenAt - - numLibraries - - allLibraries - - owned - - pending - properties: - id: - type: integer - description: Unique ID of the server of the connected user - example: 907759180 - serverId: - type: integer - description: ID of the actual Plex server. - example: 9999999 - machineIdentifier: - type: string - description: Machine identifier of the Plex server. - example: fbb8aa6be6e0c997c6268bc2b4431c8807f70a3 - name: - type: string - description: Name of the Plex server of the connected user. - example: ConnectedUserFlix - lastSeenAt: - allOf: - - description: Timestamp of the last time the server was seen. - - type: - - integer - example: 1556281940 - description: Unix epoch datetime in seconds - format: int64 - numLibraries: - type: integer - description: Number of libraries in the server this user has access to. - example: 16 - allLibraries: - allOf: - - description: Indicates if the user has access to all libraries. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - owned: - allOf: - - description: Indicates if the user owns the server. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE - pending: - allOf: - - description: Indicates if the server is pending approval. - - type: integer - format: int32 - enum: - - 0 - - 1 - example: 1 - default: 0 - x-speakeasy-enums: - - DISABLE - - ENABLE + - deciding + - waiting + - processing + - available + - error + - expired + type: string + transcode: + description: The transcode session object which is not yet documented otherwise it'd be a $ref here. + type: object + TranscodeSession: + $ref: '#/components/schemas/TranscodeSession' + type: object + type: array + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.ListDownloadQueueItems(ctx, operations.ListDownloadQueueItemsRequest{ + QueueID: 524138, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListDownloadQueueItemsRequest; + import dev.plexapi.sdk.models.operations.ListDownloadQueueItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListDownloadQueueItemsRequest req = ListDownloadQueueItemsRequest.builder() + .queueId(524138L) + .build(); + + ListDownloadQueueItemsResponse res = sdk.downloadQueue().listDownloadQueueItems() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.listDownloadQueueItems({ + queueId: 524138, + }); + + console.log(result); + } + + run(); + /hubs/metadata/{metadataId}: + get: + summary: Get hubs for section by metadata item + operationId: getMetadataHubs + description: Get the hubs for a section by metadata item. Currently only for music sections + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: metadataId + description: The metadata ID for the hubs to fetch + in: path + required: true + schema: + type: integer + - $ref: '#/components/parameters/count' + - name: onlyTransient + description: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added) + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/responses-200' '400': - description: 'Bad Request - A parameter was not specified, or was specified incorrectly.' + description: No metadata with that id or permission is denied + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.GetMetadataHubs(ctx, operations.GetMetadataHubsRequest{ + MetadataID: 605482, + OnlyTransient: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithHubs != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetMetadataHubsRequest; + import dev.plexapi.sdk.models.operations.GetMetadataHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetMetadataHubsRequest req = GetMetadataHubsRequest.builder() + .metadataId(605482L) + .onlyTransient(BoolInt.ONE) + .build(); + + GetMetadataHubsResponse res = sdk.hubs().getMetadataHubs() + .request(req) + .call(); + + if (res.mediaContainerWithHubs().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.getMetadataHubs({ + metadataId: 605482, + onlyTransient: BoolInt.One, + }); + + console.log(result); + } + + run(); + /hubs/metadata/{metadataId}/postplay: + get: + summary: Get postplay hubs + operationId: getPostplayHubs + description: Get the hubs for a metadata to be displayed in post play + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: metadataId + description: The metadata ID for the hubs to fetch + in: path + required: true + schema: + type: integer + - $ref: '#/components/parameters/count' + - name: onlyTransient + description: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added) + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/responses-200' + '400': + description: No metadata with that id or permission is denied + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.GetPostplayHubs(ctx, operations.GetPostplayHubsRequest{ + MetadataID: 441419, + OnlyTransient: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithHubs != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPostplayHubsRequest; + import dev.plexapi.sdk.models.operations.GetPostplayHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPostplayHubsRequest req = GetPostplayHubsRequest.builder() + .metadataId(441419L) + .onlyTransient(BoolInt.ONE) + .build(); + + GetPostplayHubsResponse res = sdk.hubs().getPostplayHubs() + .request(req) + .call(); + + if (res.mediaContainerWithHubs().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.getPostplayHubs({ + metadataId: 441419, + onlyTransient: BoolInt.One, + }); + + console.log(result); + } + + run(); + /hubs/metadata/{metadataId}/related: + get: + summary: Get related hubs + operationId: getRelatedHubs + description: Get the hubs for a metadata related to the provided metadata item + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: metadataId + description: The metadata ID for the hubs to fetch + in: path + required: true + schema: + type: integer + - $ref: '#/components/parameters/count' + - name: onlyTransient + description: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added) + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/responses-200' + '400': + description: No metadata with that id or permission is denied + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.GetRelatedHubs(ctx, operations.GetRelatedHubsRequest{ + MetadataID: 8858, + OnlyTransient: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithHubs != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetRelatedHubsRequest; + import dev.plexapi.sdk.models.operations.GetRelatedHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetRelatedHubsRequest req = GetRelatedHubsRequest.builder() + .metadataId(8858L) + .onlyTransient(BoolInt.ONE) + .build(); + + GetRelatedHubsResponse res = sdk.hubs().getRelatedHubs() + .request(req) + .call(); + + if (res.mediaContainerWithHubs().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.getRelatedHubs({ + metadataId: 8858, + onlyTransient: BoolInt.One, + }); + + console.log(result); + } + + run(); + /hubs/sections/{sectionId}: + get: + summary: Get section hubs + operationId: getSectionHubs + description: Get the hubs for a single section + tags: + - Hubs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section ID for the hubs to fetch + in: path + required: true + schema: + type: integer + - $ref: '#/components/parameters/count' + - name: onlyTransient + description: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added) + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer content: application/json: schema: - x-speakeasy-name-override: BadRequest - type: object properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1000 - message: - type: string - x-speakeasy-error-message: true - example: X-Plex-Client-Identifier is missing - status: - type: integer - format: int32 - example: 400 - '401': - description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + $ref: '#/components/schemas/Hub' + type: array + type: object + type: object + '400': + description: No section with that id or permission is denied content: - application/json: - schema: - x-speakeasy-name-override: Unauthorized - type: object - properties: - errors: - type: array - items: - type: object - properties: - code: - type: integer - format: int32 - example: 1001 - message: - type: string - x-speakeasy-error-message: true - example: User could not be authenticated - status: - type: integer - format: int32 - example: 401 + text/html: {} x-codeSamples: - lang: php - label: users + label: PlexPHP source: |- declare(strict_types=1); require 'vendor/autoload.php'; use LukeHagar\Plex_API; - use LukeHagar\Plex_API\Models\Operations; - $sdk = Plex_API\PlexAPI::builder()->build(); + $sdk = Plex_API\PlexAPI::builder() + ->setSecurity( + '' + ) + ->build(); - $request = new Operations\GetUsersRequest( - clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58', - clientName: 'Plex for Roku', - deviceNickname: 'Roku 3', - deviceName: 'Chrome', - deviceScreenResolution: '1487x1165,2560x1440', - clientVersion: '2.4.1', - platform: 'Roku', - clientFeatures: 'external-media,indirect-media,hub-style-list', - model: '4200X', - xPlexSessionId: '97e136ef-4ddd-4ff3-89a7-a5820c96c2ca', - xPlexLanguage: 'en', - platformVersion: '4.3 build 1057', - xPlexToken: 'CV5xoxjTpFKUzBTShsaf', + + + $response = $sdk->hubs->getLibraryHubs( + sectionId: 492.74 ); - $response = $sdk->users->getUsers( - request: $request - ); - - if ($response->body !== null) { + if ($response->object !== null) { // handle response } - lang: ruby - label: users - source: "require 'plex_ruby_sdk'\n\n\ns = ::PlexRubySDK::PlexAPI.new\n\n\nreq = ::PlexRubySDK::Operations::GetUsersRequest.new(\n client_id: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n client_name: \"Plex for Roku\",\n device_nickname: \"Roku 3\",\n device_name: \"Chrome\",\n device_screen_resolution: \"1487x1165,2560x1440\",\n client_version: \"2.4.1\",\n platform: \"Roku\",\n client_features: \"external-media,indirect-media,hub-style-list\",\n model: \"4200X\",\n x_plex_session_id: \"97e136ef-4ddd-4ff3-89a7-a5820c96c2ca\",\n x_plex_language: \"en\",\n platform_version: \"4.3 build 1057\",\n x_plex_token: \"CV5xoxjTpFKUzBTShsaf\",\n)\n \nres = s.users.get_users(req)\n\nif ! res.body.nil?\n # handle response\nend" + label: PlexRuby + source: |- + require 'plex_ruby_sdk' + + s = ::PlexRubySDK::PlexAPI.new( + security: Models::Shared::Security.new( + access_token: "", + ), + ) + + res = s.hubs.get_library_hubs(section_id=6728.76, count=639.24, only_transient=Models::Operations::QueryParamOnlyTransient::ONE) + + if ! res.object.nil? + # handle response + end - lang: go - label: users - source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Users.GetUsers(ctx, operations.GetUsersRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n DeviceName: plexgo.String(\"Chrome\"),\n DeviceScreenResolution: plexgo.String(\"1487x1165,2560x1440\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n ClientFeatures: plexgo.String(\"external-media,indirect-media,hub-style-list\"),\n Model: plexgo.String(\"4200X\"),\n XPlexSessionID: plexgo.String(\"97e136ef-4ddd-4ff3-89a7-a5820c96c2ca\"),\n XPlexLanguage: plexgo.String(\"en\"),\n PlatformVersion: plexgo.String(\"4.3 build 1057\"),\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Body != nil {\n // handle response\n }\n}" + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.GetSectionHubs(ctx, operations.GetSectionHubsRequest{ + SectionID: 336924, + OnlyTransient: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - lang: java - label: users + label: PlexJava source: |- package hello.world; - import dev.plexapi.plexapi.PlexAPI; - import dev.plexapi.plexapi.models.errors.GetUsersBadRequest; - import dev.plexapi.plexapi.models.errors.GetUsersUnauthorized; - import dev.plexapi.plexapi.models.operations.GetUsersRequest; - import dev.plexapi.plexapi.models.operations.GetUsersResponse; + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSectionHubsRequest; + import dev.plexapi.sdk.models.operations.GetSectionHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; import java.lang.Exception; public class Application { - public static void main(String[] args) throws GetUsersBadRequest, GetUsersUnauthorized, Exception { + public static void main(String[] args) throws Exception { PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) .build(); - GetUsersRequest req = GetUsersRequest.builder() - .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") - .xPlexToken("CV5xoxjTpFKUzBTShsaf") - .clientName("Plex for Roku") - .deviceNickname("Roku 3") - .deviceName("Chrome") - .deviceScreenResolution("1487x1165,2560x1440") - .clientVersion("2.4.1") - .platform("Roku") - .clientFeatures("external-media,indirect-media,hub-style-list") - .model("4200X") - .xPlexSessionId("97e136ef-4ddd-4ff3-89a7-a5820c96c2ca") - .xPlexLanguage("en") - .platformVersion("4.3 build 1057") + GetSectionHubsRequest req = GetSectionHubsRequest.builder() + .sectionId(336924L) + .onlyTransient(BoolInt.ONE) .build(); - GetUsersResponse res = sdk.users().getUsers() + GetSectionHubsResponse res = sdk.hubs().getSectionHubs() .request(req) .call(); - if (res.body().isPresent()) { + if (res.object().isPresent()) { // handle response } } } - lang: typescript - label: users + label: PlexJS source: |- import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; - const plexAPI = new PlexAPI(); + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); async function run() { - const result = await plexAPI.users.getUsers({ - clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", - clientName: "Plex for Roku", - deviceNickname: "Roku 3", - deviceName: "Chrome", - deviceScreenResolution: "1487x1165,2560x1440", - clientVersion: "2.4.1", - platform: "Roku", - clientFeatures: "external-media,indirect-media,hub-style-list", - model: "4200X", - xPlexSessionId: "97e136ef-4ddd-4ff3-89a7-a5820c96c2ca", - xPlexLanguage: "en", - platformVersion: "4.3 build 1057", - xPlexToken: "CV5xoxjTpFKUzBTShsaf", + const result = await plexAPI.hubs.getSectionHubs({ + sectionId: 336924, + onlyTransient: BoolInt.One, }); - // Handle the result console.log(result); } run(); -tags: - - name: Activities - description: | - Activities are awesome. They 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. Other details: - - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity. - - They must contain an `type` which is used by clients to distinguish the specific activity. - - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.) - - The may contain a `Response` object which attributes which represent the result of the asynchronous operation. - - name: Authentication - description: | - API Calls regarding authentication for Plex Media Server - - name: Butler - description: | - Butler is the task manager of the Plex Media Server Ecosystem. - - name: Server - description: | - Operations against the Plex Media Server System. - - name: Updater - description: | - 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. - - name: Log - description: | - Submit logs to the Log Handler for Plex Media Server - - name: Library - description: | - API Calls interacting with Plex Media Server Libraries - - name: Media - description: | - API Calls interacting with Plex Media Server Media - - name: Hubs - description: | - Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows. - - name: Playlists - description: "Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as \"all albums from 2017\"). \nThey can be organized in (optionally nesting) folders.\nRetrieving a playlist, or its items, will trigger a refresh of its metadata. \nThis may cause the duration and number of items to change.\n" - - name: Search - description: | - API Calls that perform search operations with Plex Media Server - - name: Sessions - description: | - API Calls that perform search operations with Plex Media Server Sessions - - name: User - description: | - API Calls that perform operations with Plex Media Server Users - - name: Video - description: | - API Calls that perform operations with Plex Media Server Videos - - name: Plex - description: | - API Calls that perform operations directly against https://Plex.tv - - name: Statistics - description: | - API Calls that perform operations with Plex Media Server Statistics - - name: Watchlist - description: | - API Calls that perform operations with Plex Media Server Watchlists + /hubs/sections/{sectionId}/manage: + delete: + summary: Reset hubs to defaults + operationId: resetSectionDefaults + description: Reset hubs for this section to defaults and delete custom hubs + tags: + - Hubs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section ID for the hubs to reorder + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + '403': + $ref: '#/components/responses/403' + '404': + description: Section id was not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.ResetSectionDefaults(ctx, operations.ResetSectionDefaultsRequest{ + SectionID: 383022, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ResetSectionDefaultsRequest; + import dev.plexapi.sdk.models.operations.ResetSectionDefaultsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ResetSectionDefaultsRequest req = ResetSectionDefaultsRequest.builder() + .sectionId(383022L) + .build(); + + ResetSectionDefaultsResponse res = sdk.hubs().resetSectionDefaults() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.resetSectionDefaults({ + sectionId: 383022, + }); + + console.log(result); + } + + run(); + get: + summary: Get hubs + operationId: listHubs + description: Get the list of hubs including both built-in and custom + tags: + - Hubs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section ID for the hubs to reorder + in: path + required: true + schema: + type: integer + - name: metadataItemId + description: Restrict hubs to ones relevant to the provided metadata item + in: query + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + properties: + homeVisibility: + description: | + Whether this hub is visible on the home screen + - all: Visible to all users + - none: Visible to no users + - admin: Visible to only admin users + - shared: Visible to shared users + enum: + - all + - none + - admin + - shared + type: string + identifier: + description: The identifier for this hub + type: string + promotedToOwnHome: + description: Whether this hub is visible to admin user home + type: boolean + promotedToRecommended: + description: Whether this hub is promoted to all for recommendations + type: boolean + promotedToSharedHome: + description: Whether this hub is visible to shared user's home + type: boolean + recommendationsVisibility: + description: | + The visibility of this hub in recommendations: + - all: Visible to all users + - none: Visible to no users + - admin: Visible to only admin users + - shared: Visible to shared users + enum: + - all + - none + - admin + - shared + type: string + title: + description: The title of this hub + type: string + type: object + type: array + type: object + type: object + '403': + $ref: '#/components/responses/403' + '404': + description: Section id was not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.ListHubs(ctx, operations.ListHubsRequest{ + SectionID: 442546, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListHubsRequest; + import dev.plexapi.sdk.models.operations.ListHubsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListHubsRequest req = ListHubsRequest.builder() + .sectionId(442546L) + .build(); + + ListHubsResponse res = sdk.hubs().listHubs() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.listHubs({ + sectionId: 442546, + }); + + console.log(result); + } + + run(); + post: + summary: Create a custom hub + operationId: createCustomHub + description: Create a custom hub based on a metadata item + tags: + - Hubs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section ID for the hubs to reorder + in: path + required: true + schema: + type: integer + - name: metadataItemId + description: The metadata item on which to base this hub. This must currently be a collection + in: query + required: true + schema: + type: integer + - name: promotedToRecommended + description: Whether this hub should be displayed in recommended + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: promotedToOwnHome + description: Whether this hub should be displayed in admin's home + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: promotedToSharedHome + description: Whether this hub should be displayed in shared user's home + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: A hub could not be created with this metadata item + content: + text/html: {} + '403': + $ref: '#/components/responses/403' + '404': + description: Section id or metadata item was not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.CreateCustomHub(ctx, operations.CreateCustomHubRequest{ + SectionID: 869922, + MetadataItemID: 703843, + PromotedToRecommended: components.BoolIntOne.ToPointer(), + PromotedToOwnHome: components.BoolIntOne.ToPointer(), + PromotedToSharedHome: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CreateCustomHubRequest; + import dev.plexapi.sdk.models.operations.CreateCustomHubResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreateCustomHubRequest req = CreateCustomHubRequest.builder() + .sectionId(869922L) + .metadataItemId(703843L) + .promotedToRecommended(BoolInt.ONE) + .promotedToOwnHome(BoolInt.ONE) + .promotedToSharedHome(BoolInt.ONE) + .build(); + + CreateCustomHubResponse res = sdk.hubs().createCustomHub() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.createCustomHub({ + sectionId: 869922, + metadataItemId: 703843, + promotedToRecommended: BoolInt.One, + promotedToOwnHome: BoolInt.One, + promotedToSharedHome: BoolInt.One, + }); + + console.log(result); + } + + run(); + /hubs/sections/{sectionId}/manage/move: + put: + summary: Move Hub + operationId: moveHub + description: Changed the ordering of a hub among others hubs + tags: + - Hubs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section ID for the hubs to reorder + in: path + required: true + schema: + type: integer + - name: identifier + description: The identifier of the hub to move + in: query + required: true + schema: + type: string + - name: after + description: The identifier of the hub to order this hub after (or empty/missing to put this hub first) + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/get-responses-200' + '403': + $ref: '#/components/responses/403' + '404': + description: Section id was not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.MoveHub(ctx, operations.MoveHubRequest{ + SectionID: 755710, + Identifier: "", + }) + if err != nil { + log.Fatal(err) + } + if res.GetResponses200 != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.MoveHubRequest; + import dev.plexapi.sdk.models.operations.MoveHubResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MoveHubRequest req = MoveHubRequest.builder() + .sectionId(755710L) + .identifier("") + .build(); + + MoveHubResponse res = sdk.hubs().moveHub() + .request(req) + .call(); + + if (res.getResponses200().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.moveHub({ + sectionId: 755710, + identifier: "", + }); + + console.log(result); + } + + run(); + /library/collections/{collectionId}/items: + get: + summary: Get items in a collection + operationId: getCollectionItems + description: Get items in a collection. Note if this collection contains more than 100 items, paging must be used. + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: collectionId + description: The collection id + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '404': + description: Collection not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetCollectionItems(ctx, operations.GetCollectionItemsRequest{ + CollectionID: 314585, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCollectionItemsRequest; + import dev.plexapi.sdk.models.operations.GetCollectionItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCollectionItemsRequest req = GetCollectionItemsRequest.builder() + .collectionId(314585L) + .build(); + + GetCollectionItemsResponse res = sdk.content().getCollectionItems() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getCollectionItems({ + collectionId: 314585, + }); + + console.log(result); + } + + run(); + put: + summary: Add items to a collection + operationId: addCollectionItems + description: Add items to a collection by uri + tags: + - Library Collections + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: collectionId + description: The collection id + in: path + required: true + schema: + type: integer + - name: uri + description: The URI describing the items to add to this collection + in: query + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '404': + description: Collection not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryCollections.AddCollectionItems(ctx, operations.AddCollectionItemsRequest{ + CollectionID: 338144, + URI: "https://expensive-bakeware.com", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddCollectionItemsRequest; + import dev.plexapi.sdk.models.operations.AddCollectionItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddCollectionItemsRequest req = AddCollectionItemsRequest.builder() + .collectionId(338144L) + .uri("https://expensive-bakeware.com") + .build(); + + AddCollectionItemsResponse res = sdk.libraryCollections().addCollectionItems() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryCollections.addCollectionItems({ + collectionId: 338144, + uri: "https://expensive-bakeware.com", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}: + delete: + summary: Delete a metadata item + operationId: deleteMetadataItem + description: Delete a single metadata item from the library, deleting media as well + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: proxy + description: Whether proxy items, such as media optimized versions, should also be deleted. Defaults to false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Media items could not be deleted + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteMetadataItem(ctx, operations.DeleteMetadataItemRequest{ + Ids: "", + Proxy: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteMetadataItemRequest; + import dev.plexapi.sdk.models.operations.DeleteMetadataItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteMetadataItemRequest req = DeleteMetadataItemRequest.builder() + .ids("") + .proxy(BoolInt.ONE) + .build(); + + DeleteMetadataItemResponse res = sdk.library().deleteMetadataItem() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteMetadataItem({ + ids: "", + proxy: BoolInt.One, + }); + + console.log(result); + } + + run(); + get: + summary: Get a metadata item + operationId: getMetadataItem + description: Get one or more metadata items. + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: array + items: + type: string + - name: asyncCheckFiles + description: Determines if file check should be performed asynchronously. An activity is created to indicate progress. Default is false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: asyncRefreshLocalMediaAgent + description: Determines if local media agent refresh should be performed asynchronously. An activity is created to indicate progress. Default is false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: asyncRefreshAnalysis + description: Determines if analysis refresh should be performed asynchronously. An activity is created to indicate progress. Default is false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: checkFiles + description: Determines if file check should be performed synchronously. Specifying `asyncCheckFiles` will cause this option to be ignored. Default is false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: skipRefresh + description: Determines if synchronous local media agent and analysis refresh should be skipped. Specifying async versions will cause synchronous versions to be skipped. Default is false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: checkFileAvailability + description: Determines if file existence check should be performed synchronously. Specifying `checkFiles` will imply this option. Default is false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: asyncAugmentMetadata + description: Add metadata augmentations. An activity is created to indicate progress. Option will be ignored if specified by non-admin or if multiple metadata items are requested. Default is false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: augmentCount + description: Number of augmentations to add. Requires `asyncAugmentMetadata` to be specified. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetMetadataItem(ctx, operations.GetMetadataItemRequest{ + Ids: []string{}, + AsyncCheckFiles: components.BoolIntOne.ToPointer(), + AsyncRefreshLocalMediaAgent: components.BoolIntOne.ToPointer(), + AsyncRefreshAnalysis: components.BoolIntOne.ToPointer(), + CheckFiles: components.BoolIntOne.ToPointer(), + SkipRefresh: components.BoolIntOne.ToPointer(), + CheckFileAvailability: components.BoolIntOne.ToPointer(), + AsyncAugmentMetadata: components.BoolIntOne.ToPointer(), + AugmentCount: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetMetadataItemRequest; + import dev.plexapi.sdk.models.operations.GetMetadataItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetMetadataItemRequest req = GetMetadataItemRequest.builder() + .ids(List.of()) + .asyncCheckFiles(BoolInt.ONE) + .asyncRefreshLocalMediaAgent(BoolInt.ONE) + .asyncRefreshAnalysis(BoolInt.ONE) + .checkFiles(BoolInt.ONE) + .skipRefresh(BoolInt.ONE) + .checkFileAvailability(BoolInt.ONE) + .asyncAugmentMetadata(BoolInt.ONE) + .augmentCount(BoolInt.ONE) + .build(); + + GetMetadataItemResponse res = sdk.content().getMetadataItem() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getMetadataItem({ + ids: [], + asyncCheckFiles: BoolInt.One, + asyncRefreshLocalMediaAgent: BoolInt.One, + asyncRefreshAnalysis: BoolInt.One, + checkFiles: BoolInt.One, + skipRefresh: BoolInt.One, + checkFileAvailability: BoolInt.One, + asyncAugmentMetadata: BoolInt.One, + augmentCount: BoolInt.One, + }); + + console.log(result); + } + + run(); + put: + summary: Edit a metadata item + operationId: editMetadataItem + description: Edit metadata items setting fields + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: array + items: + type: string + - name: args + description: The new values for the metadata item + in: query + schema: + type: object + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Media items could not be deleted + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.EditMetadataItem(ctx, operations.EditMetadataItemRequest{ + Ids: []string{ + "", + "", + }, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.EditMetadataItemRequest; + import dev.plexapi.sdk.models.operations.EditMetadataItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + EditMetadataItemRequest req = EditMetadataItemRequest.builder() + .ids(List.of( + "", + "")) + .build(); + + EditMetadataItemResponse res = sdk.library().editMetadataItem() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.editMetadataItem({ + ids: [ + "", + "", + ], + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/addetect: + put: + summary: Ad-detect an item + operationId: detectAds + description: Start the detection of ads in a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DetectAds(ctx, operations.DetectAdsRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DetectAdsRequest; + import dev.plexapi.sdk.models.operations.DetectAdsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DetectAdsRequest req = DetectAdsRequest.builder() + .ids("") + .build(); + + DetectAdsResponse res = sdk.library().detectAds() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.detectAds({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/allLeaves: + get: + summary: Get the leaves of an item + operationId: getAllItemLeaves + description: Get the leaves for a metadata item such as the episodes in a show + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetAllItemLeaves(ctx, operations.GetAllItemLeavesRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAllItemLeavesRequest; + import dev.plexapi.sdk.models.operations.GetAllItemLeavesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetAllItemLeavesRequest req = GetAllItemLeavesRequest.builder() + .ids("") + .build(); + + GetAllItemLeavesResponse res = sdk.library().getAllItemLeaves() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getAllItemLeaves({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/analyze: + put: + summary: Analyze an item + operationId: analyzeMetadata + description: Start the analysis of a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: thumbOffset + description: Set the offset to be used for thumbnails + in: query + required: false + schema: + type: number + - name: artOffset + description: Set the offset to be used for artwork + in: query + required: false + schema: + type: number + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.AnalyzeMetadata(ctx, operations.AnalyzeMetadataRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AnalyzeMetadataRequest; + import dev.plexapi.sdk.models.operations.AnalyzeMetadataResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AnalyzeMetadataRequest req = AnalyzeMetadataRequest.builder() + .ids("") + .build(); + + AnalyzeMetadataResponse res = sdk.library().analyzeMetadata() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.analyzeMetadata({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/chapterThumbs: + put: + summary: Generate thumbs of chapters for an item + operationId: generateThumbs + description: Start the chapter thumb generation for an item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: force + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GenerateThumbs(ctx, operations.GenerateThumbsRequest{ + Ids: "", + Force: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GenerateThumbsRequest; + import dev.plexapi.sdk.models.operations.GenerateThumbsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GenerateThumbsRequest req = GenerateThumbsRequest.builder() + .ids("") + .force(BoolInt.ONE) + .build(); + + GenerateThumbsResponse res = sdk.library().generateThumbs() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.generateThumbs({ + ids: "", + force: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/credits: + put: + summary: Credit detect a metadata item + operationId: detectCredits + description: Start credit detection on a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: force + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + - name: manual + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DetectCredits(ctx, operations.DetectCreditsRequest{ + Ids: "", + Force: components.BoolIntOne.ToPointer(), + Manual: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DetectCreditsRequest; + import dev.plexapi.sdk.models.operations.DetectCreditsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DetectCreditsRequest req = DetectCreditsRequest.builder() + .ids("") + .force(BoolInt.ONE) + .manual(BoolInt.ONE) + .build(); + + DetectCreditsResponse res = sdk.library().detectCredits() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.detectCredits({ + ids: "", + force: BoolInt.One, + manual: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/extras: + get: + summary: Get an item's extras + operationId: getExtras + description: Get the extras for a metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetExtras(ctx, operations.GetExtrasRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetExtrasRequest; + import dev.plexapi.sdk.models.operations.GetExtrasResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetExtrasRequest req = GetExtrasRequest.builder() + .ids("") + .build(); + + GetExtrasResponse res = sdk.library().getExtras() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getExtras({ + ids: "", + }); + + console.log(result); + } + + run(); + post: + summary: Add to an item's extras + operationId: addExtras + description: Add an extra to a metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: extraType + description: The metadata type of the extra + in: query + schema: + type: integer + - name: url + description: The URL of the extra + in: query + required: true + schema: + type: string + - $ref: '#/components/parameters/title' + responses: + '200': + $ref: '#/components/responses/200' + '404': + description: Either the metadata item is not present or the extra could not be added + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.AddExtras(ctx, operations.AddExtrasRequest{ + Ids: "", + URL: "https://super-mortise.biz/", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddExtrasRequest; + import dev.plexapi.sdk.models.operations.AddExtrasResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddExtrasRequest req = AddExtrasRequest.builder() + .ids("") + .url("https://super-mortise.biz/") + .build(); + + AddExtrasResponse res = sdk.library().addExtras() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.addExtras({ + ids: "", + url: "https://super-mortise.biz/", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/file: + get: + summary: Get a file from a metadata or media bundle + operationId: getFile + description: Get a bundle file for a metadata or media item. This is either an image or a mp3 (for a show's theme) + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: url + description: The bundle url, typically starting with `metadata://` or `media://` + in: query + schema: + type: string + responses: + '200': + description: OK + content: + audio/mpeg3: + schema: + format: binary + type: string + image/jpeg: + schema: + format: binary + type: string + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetFile(ctx, operations.GetFileRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.TwoHundredAudioMpeg3ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetFileRequest; + import dev.plexapi.sdk.models.operations.GetFileResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetFileRequest req = GetFileRequest.builder() + .ids("") + .build(); + + GetFileResponse res = sdk.library().getFile() + .request(req) + .call(); + + if (res.twoHundredAudioMpeg3ResponseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getFile({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/index: + put: + summary: Start BIF generation of an item + operationId: startBifGeneration + description: Start the indexing (BIF generation) of an item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: force + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.StartBifGeneration(ctx, operations.StartBifGenerationRequest{ + Ids: "", + Force: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.StartBifGenerationRequest; + import dev.plexapi.sdk.models.operations.StartBifGenerationResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StartBifGenerationRequest req = StartBifGenerationRequest.builder() + .ids("") + .force(BoolInt.ONE) + .build(); + + StartBifGenerationResponse res = sdk.library().startBifGeneration() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.startBifGeneration({ + ids: "", + force: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/intro: + put: + summary: Intro detect an item + operationId: detectIntros + description: Start the detection of intros in a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: force + description: Indicate whether detection should be re-run + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + - name: threshold + description: The threshold for determining if content is an intro or not + in: query + required: false + schema: + type: number + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DetectIntros(ctx, operations.DetectIntrosRequest{ + Ids: "", + Force: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DetectIntrosRequest; + import dev.plexapi.sdk.models.operations.DetectIntrosResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DetectIntrosRequest req = DetectIntrosRequest.builder() + .ids("") + .force(BoolInt.ONE) + .build(); + + DetectIntrosResponse res = sdk.library().detectIntros() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.detectIntros({ + ids: "", + force: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/marker: + post: + summary: Create a marker + operationId: createMarker + description: Create a marker for this user on the metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: type + description: The type of marker to edit/create + in: query + required: true + schema: + type: integer + - name: startTimeOffset + description: The start time of the marker + in: query + required: true + schema: + type: integer + - name: endTimeOffset + description: The end time of the marker + in: query + schema: + type: integer + - name: attributes + description: The attributes to assign to this marker + in: query + style: deepObject + schema: + type: object + example: + title: My favorite spot + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - additionalProperties: true + properties: + color: + type: string + endTimeOffset: + type: integer + id: + type: integer + startTimeOffset: + type: integer + title: + type: string + type: + enum: + - intro + - commercial + - bookmark + - resume + - credit + type: string + type: object + type: object + '400': + description: Request parameters are bad, such as an `endTimeOffset` prior to the `startTimeOffset` + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.CreateMarker(ctx, operations.CreateMarkerRequest{ + Ids: "", + Type: 248391, + StartTimeOffset: 535191, + Attributes: &operations.Attributes{}, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CreateMarkerRequest req = CreateMarkerRequest.builder() + .ids("") + .type(248391L) + .startTimeOffset(535191L) + .attributes(Attributes.builder() + .build()) + .build(); + + CreateMarkerResponse res = sdk.library().createMarker() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.createMarker({ + ids: "", + type: 248391, + startTimeOffset: 535191, + attributes: {}, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/match: + put: + summary: Match a metadata item + operationId: matchItem + description: Match a metadata item to a guid + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: guid + in: query + schema: + type: string + - name: name + in: query + required: false + schema: + type: string + - name: year + in: query + required: false + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.MatchItem(ctx, operations.MatchItemRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.MatchItemRequest; + import dev.plexapi.sdk.models.operations.MatchItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MatchItemRequest req = MatchItemRequest.builder() + .ids("") + .build(); + + MatchItemResponse res = sdk.library().matchItem() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.matchItem({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/matches: + put: + summary: Get metadata matches for an item + operationId: listMatches + description: Get the list of metadata matches for a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: title + in: query + schema: + type: string + - name: parentTitle + in: query + required: false + schema: + type: string + - name: agent + in: query + required: false + schema: + type: string + - name: language + in: query + required: false + schema: + type: string + - name: year + in: query + required: false + schema: + type: integer + - name: manual + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.ListMatches(ctx, operations.ListMatchesRequest{ + Ids: "", + Manual: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListMatchesRequest; + import dev.plexapi.sdk.models.operations.ListMatchesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListMatchesRequest req = ListMatchesRequest.builder() + .ids("") + .manual(BoolInt.ONE) + .build(); + + ListMatchesResponse res = sdk.library().listMatches() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.listMatches({ + ids: "", + manual: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/merge: + put: + summary: Merge a metadata item + operationId: mergeItems + description: Merge a metadata item with other items + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: ids + in: query + explode: false + schema: + type: array + items: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.MergeItems(ctx, operations.MergeItemsRequest{ + IdsPathParameter: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.MergeItemsRequest; + import dev.plexapi.sdk.models.operations.MergeItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MergeItemsRequest req = MergeItemsRequest.builder() + .idsPathParameter("") + .idsQueryParameter(List.of( + "<", + "v", + "a", + "l", + "u", + "e", + ">")) + .build(); + + MergeItemsResponse res = sdk.library().mergeItems() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.mergeItems({ + idsPathParameter: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/nearest: + get: + summary: Get nearest tracks to metadata item + operationId: listSonicallySimilar + description: Get the nearest tracks, sonically, to the provided track + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: excludeParentID + in: query + required: false + schema: + type: integer + - name: excludeGrandparentID + in: query + required: false + schema: + type: integer + - name: limit + in: query + required: false + schema: + type: integer + - name: maxDistance + in: query + required: false + schema: + type: number + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.ListSonicallySimilar(ctx, operations.ListSonicallySimilarRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListSonicallySimilarRequest; + import dev.plexapi.sdk.models.operations.ListSonicallySimilarResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListSonicallySimilarRequest req = ListSonicallySimilarRequest.builder() + .ids("") + .build(); + + ListSonicallySimilarResponse res = sdk.library().listSonicallySimilar() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.listSonicallySimilar({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/prefs: + put: + summary: Set metadata preferences + operationId: setItemPreferences + description: Set the preferences on a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: args + in: query + schema: + type: object + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.SetItemPreferences(ctx, operations.SetItemPreferencesRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SetItemPreferencesRequest; + import dev.plexapi.sdk.models.operations.SetItemPreferencesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetItemPreferencesRequest req = SetItemPreferencesRequest.builder() + .ids("") + .build(); + + SetItemPreferencesResponse res = sdk.library().setItemPreferences() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.setItemPreferences({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/refresh: + put: + summary: Refresh a metadata item + operationId: refreshItemsMetadata + description: Refresh a metadata item from the agent + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: agent + in: query + required: false + schema: + type: string + - name: markUpdated + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.RefreshItemsMetadata(ctx, operations.RefreshItemsMetadataRequest{ + Ids: "", + MarkUpdated: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RefreshItemsMetadataRequest; + import dev.plexapi.sdk.models.operations.RefreshItemsMetadataResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RefreshItemsMetadataRequest req = RefreshItemsMetadataRequest.builder() + .ids("") + .markUpdated(BoolInt.ONE) + .build(); + + RefreshItemsMetadataResponse res = sdk.library().refreshItemsMetadata() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.refreshItemsMetadata({ + ids: "", + markUpdated: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/related: + get: + summary: Get related items + operationId: getRelatedItems + description: Get a hub of related items to a metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + $ref: '#/components/schemas/Hub' + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetRelatedItems(ctx, operations.GetRelatedItemsRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetRelatedItemsRequest; + import dev.plexapi.sdk.models.operations.GetRelatedItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetRelatedItemsRequest req = GetRelatedItemsRequest.builder() + .ids("") + .build(); + + GetRelatedItemsResponse res = sdk.library().getRelatedItems() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getRelatedItems({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/similar: + get: + summary: Get similar items + operationId: listSimilar + description: Get a list of similar items to a metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/count' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.ListSimilar(ctx, operations.ListSimilarRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListSimilarRequest; + import dev.plexapi.sdk.models.operations.ListSimilarResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListSimilarRequest req = ListSimilarRequest.builder() + .ids("") + .build(); + + ListSimilarResponse res = sdk.library().listSimilar() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.listSimilar({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/split: + put: + summary: Split a metadata item + operationId: splitItem + description: Split a metadata item into multiple items + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.SplitItem(ctx, operations.SplitItemRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SplitItemRequest; + import dev.plexapi.sdk.models.operations.SplitItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SplitItemRequest req = SplitItemRequest.builder() + .ids("") + .build(); + + SplitItemResponse res = sdk.library().splitItem() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.splitItem({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/subtitles: + get: + summary: Add subtitles + operationId: addSubtitles + description: Add a subtitle to a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: title + in: query + required: false + schema: + type: string + - name: language + in: query + required: false + schema: + type: string + - name: mediaItemID + in: query + required: false + schema: + type: integer + - name: url + description: The URL of the subtitle. If not provided, the contents of the subtitle must be in the post body + in: query + required: false + schema: + type: string + - name: format + in: query + required: false + schema: + type: string + - name: forced + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + - name: hearingImpaired + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.AddSubtitles(ctx, operations.AddSubtitlesRequest{ + Ids: "", + Forced: components.BoolIntOne.ToPointer(), + HearingImpaired: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddSubtitlesRequest; + import dev.plexapi.sdk.models.operations.AddSubtitlesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddSubtitlesRequest req = AddSubtitlesRequest.builder() + .ids("") + .forced(BoolInt.ONE) + .hearingImpaired(BoolInt.ONE) + .build(); + + AddSubtitlesResponse res = sdk.library().addSubtitles() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.addSubtitles({ + ids: "", + forced: BoolInt.One, + hearingImpaired: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/tree: + get: + summary: Get metadata items as a tree + operationId: getItemTree + description: Get a tree of metadata items, such as the seasons/episodes of a show + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithNestedMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetItemTree(ctx, operations.GetItemTreeRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithNestedMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetItemTreeRequest; + import dev.plexapi.sdk.models.operations.GetItemTreeResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetItemTreeRequest req = GetItemTreeRequest.builder() + .ids("") + .build(); + + GetItemTreeResponse res = sdk.library().getItemTree() + .request(req) + .call(); + + if (res.mediaContainerWithNestedMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getItemTree({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/unmatch: + put: + summary: Unmatch a metadata item + operationId: unmatch + description: Unmatch a metadata item to info fetched from the agent + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.Unmatch(ctx, operations.UnmatchRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.UnmatchRequest; + import dev.plexapi.sdk.models.operations.UnmatchResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + UnmatchRequest req = UnmatchRequest.builder() + .ids("") + .build(); + + UnmatchResponse res = sdk.library().unmatch() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.unmatch({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/users/top: + get: + summary: Get metadata top users + operationId: listTopUsers + description: Get the list of users which have played this item starting with the most + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Account: + items: + properties: + globalViewCount: + type: integer + id: + type: integer + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.ListTopUsers(ctx, operations.ListTopUsersRequest{ + Ids: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListTopUsersRequest; + import dev.plexapi.sdk.models.operations.ListTopUsersResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListTopUsersRequest req = ListTopUsersRequest.builder() + .ids("") + .build(); + + ListTopUsersResponse res = sdk.library().listTopUsers() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.listTopUsers({ + ids: "", + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/voiceActivity: + put: + summary: Detect voice activity + operationId: detectVoiceActivity + description: Start the detection of voice in a metadata item + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: force + description: Indicate whether detection should be re-run + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + - name: manual + description: Indicate whether detection is manually run + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DetectVoiceActivity(ctx, operations.DetectVoiceActivityRequest{ + Ids: "", + Force: components.BoolIntOne.ToPointer(), + Manual: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DetectVoiceActivityRequest; + import dev.plexapi.sdk.models.operations.DetectVoiceActivityResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DetectVoiceActivityRequest req = DetectVoiceActivityRequest.builder() + .ids("") + .force(BoolInt.ONE) + .manual(BoolInt.ONE) + .build(); + + DetectVoiceActivityResponse res = sdk.library().detectVoiceActivity() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.detectVoiceActivity({ + ids: "", + force: BoolInt.One, + manual: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/metadata/augmentations/{augmentationId}: + get: + summary: Get augmentation status + operationId: getAugmentationStatus + description: Get augmentation status and potentially wait for completion + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: augmentationId + description: The id of the augmentation + in: path + required: true + schema: + type: string + - name: wait + description: Wait for augmentation completion before returning + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '204': + $ref: '#/components/responses/204' + '401': + description: This augmentation is not owned by the requesting user + content: + text/html: {} + '404': + description: No augmentation found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetAugmentationStatus(ctx, operations.GetAugmentationStatusRequest{ + AugmentationID: "", + Wait: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAugmentationStatusRequest; + import dev.plexapi.sdk.models.operations.GetAugmentationStatusResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetAugmentationStatusRequest req = GetAugmentationStatusRequest.builder() + .augmentationId("") + .wait_(BoolInt.ONE) + .build(); + + GetAugmentationStatusResponse res = sdk.library().getAugmentationStatus() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getAugmentationStatus({ + augmentationId: "", + wait: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/parts/{partId}: + put: + summary: Set stream selection + operationId: setStreamSelection + description: Set which streams (audio/subtitle) are selected by this user + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: partId + description: The id of the part to select streams on + in: path + required: true + schema: + type: integer + - name: audioStreamID + description: The id of the audio stream to select in this part + in: query + schema: + type: integer + - name: subtitleStreamID + description: The id of the subtitle stream to select in this part. Specify 0 to select no subtitle + in: query + schema: + type: integer + - name: allParts + description: Perform the same for all parts of this media selecting similar streams in each + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: One of the audio or subtitle streams does not belong to this part + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.SetStreamSelection(ctx, operations.SetStreamSelectionRequest{ + PartID: 360489, + AllParts: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SetStreamSelectionRequest; + import dev.plexapi.sdk.models.operations.SetStreamSelectionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetStreamSelectionRequest req = SetStreamSelectionRequest.builder() + .partId(360489L) + .allParts(BoolInt.ONE) + .build(); + + SetStreamSelectionResponse res = sdk.library().setStreamSelection() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.setStreamSelection({ + partId: 360489, + allParts: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/people/{personId}: + get: + summary: Get person details + operationId: getPerson + description: Get details for a single actor. + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: personId + description: Either the PMS tag `id` of the person or `tagKey` of the actor. Note the `tagKey` is the hex portion of the plex guid for the actor + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Directory: + items: + $ref: '#/components/schemas/Tag' + type: array + type: object + type: object + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetPerson(ctx, operations.GetPersonRequest{ + PersonID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPersonRequest; + import dev.plexapi.sdk.models.operations.GetPersonResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPersonRequest req = GetPersonRequest.builder() + .personId("") + .build(); + + GetPersonResponse res = sdk.library().getPerson() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getPerson({ + personId: "", + }); + + console.log(result); + } + + run(); + /library/people/{personId}/media: + get: + summary: Get media for a person + operationId: listPersonMedia + description: Get all the media for a single actor. + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: personId + description: Either the PMS tag `id` of the person or `tagKey` of the actor. Note the `tagKey` is the hex portion of the plex guid for the actor + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.ListPersonMedia(ctx, operations.ListPersonMediaRequest{ + PersonID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListPersonMediaRequest; + import dev.plexapi.sdk.models.operations.ListPersonMediaResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListPersonMediaRequest req = ListPersonMediaRequest.builder() + .personId("") + .build(); + + ListPersonMediaResponse res = sdk.library().listPersonMedia() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.listPersonMedia({ + personId: "", + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}: + delete: + summary: Delete a library section + operationId: deleteLibrarySection + description: Delete a library section by id + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section identifier + in: path + required: true + schema: + type: string + - name: async + description: If set, response will return an activity with the actual deletion process. Otherwise request will return when deletion is complete + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteLibrarySection(ctx, operations.DeleteLibrarySectionRequest{ + SectionID: "", + Async: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteLibrarySectionRequest; + import dev.plexapi.sdk.models.operations.DeleteLibrarySectionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteLibrarySectionRequest req = DeleteLibrarySectionRequest.builder() + .sectionId("") + .async(BoolInt.ONE) + .build(); + + DeleteLibrarySectionResponse res = sdk.library().deleteLibrarySection() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteLibrarySection({ + sectionId: "", + async: BoolInt.One, + }); + + console.log(result); + } + + run(); + get: + summary: Get a library section by id + operationId: getLibraryDetails + description: '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.' + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section identifier + in: path + required: true + schema: + type: string + - name: includeDetails + description: Whether or not to include details for a section (types, filters, and sorts). Only exists for backwards compatibility, media providers other than the server libraries have it on always. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + properties: + content: + description: |- + The flavors of directory found here: + - Primary: (e.g. all, On Deck) These are still used in some clients to provide "shortcuts" to subsets of media. However, with the exception of On Deck, all of them can be created by media queries, and the desire is to allow these to be customized by users. + - Secondary: These are marked with `"secondary": true` and were used by old clients to provide nested menus allowing for primative (but structured) navigation. + - Special: There is a By Folder entry which allows browsing the media by the underlying filesystem structure, and there's a completely obsolete entry marked `"search": true` which used to be used to allow clients to build search dialogs on the fly. + type: string + allowSync: + type: boolean + art: + type: string + Directory: + items: + $ref: '#/components/schemas/Metadata' + type: array + identifier: + type: string + librarySectionID: + type: integer + mediaTagPrefix: + type: string + mediaTagVersion: + type: integer + size: + type: integer + sortAsc: + type: boolean + thumb: + type: string + title1: + type: string + viewGroup: + type: string + viewMode: + type: integer + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetLibraryDetails(ctx, operations.GetLibraryDetailsRequest{ + SectionID: "", + IncludeDetails: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetLibraryDetailsRequest; + import dev.plexapi.sdk.models.operations.GetLibraryDetailsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetLibraryDetailsRequest req = GetLibraryDetailsRequest.builder() + .sectionId("") + .includeDetails(BoolInt.ONE) + .build(); + + GetLibraryDetailsResponse res = sdk.library().getLibraryDetails() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getLibraryDetails({ + sectionId: "", + includeDetails: BoolInt.One, + }); + + console.log(result); + } + + run(); + put: + summary: Edit a library section + operationId: editSection + description: Edit a library section by id setting parameters + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section identifier + in: path + required: true + schema: + type: string + - name: name + description: The name of the new section + in: query + schema: + type: string + - name: scanner + description: The scanner this section should use + in: query + schema: + type: string + - name: agent + description: The agent this section should use for metadata + in: query + required: true + schema: + type: string + - name: metadataAgentProviderGroupId + description: The agent group id for this section + in: query + schema: + type: string + - name: language + description: The language of this section + in: query + schema: + type: string + - name: locations + description: The locations on disk to add to this section + in: query + schema: + type: array + items: + type: string + example: + - O:\fatboy\Media\Ripped\Music + - O:\fatboy\Media\My Music + - name: prefs + description: The preferences for this section + in: query + style: deepObject + schema: + type: object + example: + collectionMode: 2 + hidden: 0 + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Section cannot be created due to bad parameters in request + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.EditSection(ctx, operations.EditSectionRequest{ + SectionID: "", + Agent: "", + Locations: []string{ + "O:\fatboy\\Media\\Ripped\\Music", + "O:\fatboy\\Media\\My Music", + }, + Prefs: &operations.EditSectionQueryParamPrefs{}, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + EditSectionRequest req = EditSectionRequest.builder() + .sectionId("") + .agent("") + .locations(List.of( + "O:\fatboy\\Media\\Ripped\\Music", + "O:\fatboy\\Media\\My Music")) + .prefs(EditSectionQueryParamPrefs.builder() + .build()) + .build(); + + EditSectionResponse res = sdk.library().editSection() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.editSection({ + sectionId: "", + agent: "", + locations: [ + "O:\fatboy\\Media\\Ripped\\Music", + "O:\fatboy\\Media\\My Music", + ], + prefs: {}, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/albums: + get: + summary: Set section albums + operationId: getAlbums + description: Get all albums in a music section + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + example: + MediaContainer: + content: secondary + allowSync: false + art: /:/resources/artist-fanart.jpg + identifier: com.plexapp.plugins.library + mediaTagPrefix: /system/bundle/media/flags/ + mediaTagVersion: 1680272530 + Metadata: + - addedAt: 1681152176 + allowSync: true + art: /library/metadata/251/art/1716801576 + deletedAt: 1682628386 + Genre: + - tag: Comedy/Spoken + guid: plex://album/5d07c894403c640290c0e196 + index: 1 + key: /library/metadata/265/children + leafCount: 12 + librarySectionID: 3 + librarySectionTitle: Music + librarySectionUUID: d7fd8c81-a345-4e68-8113-92f23cb47e70 + loudnessAnalysisVersion: '2' + originallyAvailableAt: '2014-07-15' + parentGuid: plex://artist/5d07bbfc403c6402904a60e7 + parentKey: /library/metadata/251 + parentRatingKey: '251' + parentThumb: /library/metadata/251/thumb/1716801576 + parentTitle: “Weird Al” Yankovic + rating: 8 + ratingKey: '265' + studio: RCA + summary: Already accepted as a bona fide talent in the world of parody -- his musicianship, comedic timing, his pop-culture reference awareness, and his great wordplay are all well-documented -- the only thing that matters when it comes to "Weird Al" Yankovic albums is how inspired the king of novelty songs sounds on any given LP. On his 14th studio album, Mandatory Fun, the inspiration meter goes well into the red, something heard instantly as Iggy Azalea's electro-rap "Fancy" does a complete 180 thematically on the opening "Handy," the song now heading toward the local home improvement store where the craftsmen vogue in their orange vests and blow sweet come-ons like "I'll bring you up to code" and "My socket wrenches are second to none." Pharrell's "Happy" becomes "Tacky" and Al's amazing ability to follow an everyday poke ("Wear my Ed Hardy shirt with fluorescent orange pants") with something brainy and reserved ("Got my new résumé, it's printed in Comic Sans") surprises once more, but for end-to-end "wows," it's his brilliant redo of Robin Thicke's "Blurred Lines," now the smug and twerking "Word Crimes," which gives copy editors, English professors, and grammar nerds a reason to hit the dancefloor ("And listen up when I tell you this/I hope you never use quotation marks for emphasis!"). Hardcore and hilarious musical moments start to happen when Imagine Dragons' "Radioactive" becomes "Inactive," a singalong anthem for the sluggish and the slovenly ("Near comatose, no exercise/Don't tag my toe, I'm still alive") with a dubstep-rock bassline that sounds like Galactus burping. Better still is the every-Al-album pop-polka medley, this time called "Now That's What I Call Polka!" which polkas-up Daft Punk ("Get Lucky"), PSY ("Gangnam Style"), and Miley Cyrus ("Wrecking Ball"), and with more Spike Jones-styled sound effects than usual. As for the originals this time out, the "you suck!"-minded "Sports Song" will be unavoidable under Friday night lights once a teen gets hold of it, while the ranting and wonderfully weird "First World Problems" sounds more like the Pixies than anything the Pixies did in 2014. Wonders never cease on Mandatory Fun, and neither do the laughs. ~ David Jeffries + thumb: /library/metadata/265/thumb/1715112705 + title: Mandatory Fun + type: album + updatedAt: 1715112705 + year: 2014 + mixedParents: true + nocache: true + size: 12 + thumb: /:/resources/artist.png + title1: Music + title2: By Album + viewGroup: album + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetAlbums(ctx, operations.GetAlbumsRequest{ + SectionID: 817133, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAlbumsRequest; + import dev.plexapi.sdk.models.operations.GetAlbumsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetAlbumsRequest req = GetAlbumsRequest.builder() + .sectionId(817133L) + .build(); + + GetAlbumsResponse res = sdk.content().getAlbums() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getAlbums({ + sectionId: 817133, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/all: + get: + summary: Get items in the section + operationId: listContent + description: Get the items in a section, potentially filtering them + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/mediaQuery' + - name: sectionId + description: The id of the section + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.ListContent(ctx, operations.ListContentRequest{ + SectionID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListContentRequest; + import dev.plexapi.sdk.models.operations.ListContentResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListContentRequest req = ListContentRequest.builder() + .sectionId("") + .build(); + + ListContentResponse res = sdk.content().listContent() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.listContent({ + sectionId: "", + }); + + console.log(result); + } + + run(); + put: + summary: Set the fields of the filtered items + operationId: updateItems + description: |- + 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 + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The id of the section + in: path + required: true + schema: + type: string + - name: type + in: query + schema: + type: string + - name: filters + description: The filters to apply to determine which items should be modified + in: query + schema: + type: string + - name: field.value + description: Set the specified field to a new value + in: query + schema: + type: string + - name: field.locked + description: Set the specified field to locked (or unlocked if set to 0) + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: title.value + description: This field is treated specially by albums or artists and may be used for implicit reparenting. + in: query + schema: + type: string + - name: artist.title.value + description: Reparents set of Tracks or Albums - used with album.title.* in the case of tracks + in: query + schema: + type: string + - name: artist.title.id + description: Reparents set of Tracks or Albums - used with album.title.* in the case of tracks + in: query + schema: + type: string + - name: album.title.value + description: Reparents set of Tracks - Must be used in conjunction with artist.title.value or id + in: query + schema: + type: string + - name: album.title.id + description: Reparents set of Tracks - Must be used in conjunction with artist.title.value or id + in: query + schema: + type: string + - name: tagtype[idx].tag.tag + description: Creates tag and associates it with each item in the set. - [idx] links this and the next parameters together + in: query + schema: + type: string + - name: tagtype[idx].tagging.object + description: Here `object` may be text/thumb/art/theme - Optionally used in conjunction with tag.tag, to update association info across the set. + in: query + schema: + type: string + - name: tagtype[].tag.tag- + description: Remove comma separated tags from the set of items + in: query + schema: + type: string + - name: tagtype[].tag + description: Remove associations of this type (e.g. genre) from the set of items + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: The set of parameters are inconsistent or invalid values + content: + text/html: {} + '404': + description: A required item could not be found + content: + text/html: {} + '409': + description: Rename of a collection to a name that's already taken + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.UpdateItems(ctx, operations.UpdateItemsRequest{ + SectionID: "", + FieldLocked: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.UpdateItemsRequest; + import dev.plexapi.sdk.models.operations.UpdateItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + UpdateItemsRequest req = UpdateItemsRequest.builder() + .sectionId("") + .fieldLocked(BoolInt.ONE) + .build(); + + UpdateItemsResponse res = sdk.library().updateItems() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.updateItems({ + sectionId: "", + fieldLocked: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/allLeaves: + get: + summary: Set section leaves + operationId: getAllLeaves + description: Get all leaves in a section (such as episodes in a show section) + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + example: + MediaContainer: + content: secondary + allowSync: false + art: /:/resources/show-fanart.jpg + identifier: com.plexapp.plugins.library + mediaTagPrefix: /system/bundle/media/flags/ + mediaTagVersion: 1680272530 + Metadata: + - addedAt: 1348327790 + art: /library/metadata/148/art/1715112830 + audienceRating: 7.7 + audienceRatingImage: themoviedb://image.rating + chapterSource: media + contentRating: TV-PG + Director: + - tag: Stephen Furst + duration: 2625089 + grandparentArt: /library/metadata/148/art/1715112830 + grandparentGuid: plex://show/5d9c087202391c001f58a287 + grandparentKey: /library/metadata/148 + grandparentRatingKey: '148' + grandparentSlug: babylon-5 + grandparentTheme: /library/metadata/148/theme/1715112830 + grandparentThumb: /library/metadata/148/thumb/1715112830 + grandparentTitle: Babylon 5 + guid: plex://episode/5d9c1359e264b7001fcb529c + index: 8 + key: /library/metadata/150 + lastViewedAt: 1612468663 + Media: + - aspectRatio: 1.78 + audioChannels: 6 + audioCodec: ac3 + bitrate: 5741 + container: mkv + duration: 2625089 + height: 480 + id: 376 + Part: + - container: mkv + duration: 2625089 + file: /Volumes/Media/TV Shows/Babylon 5/Season 4/Babylon 5 S04E08 The Illusion of Truth.mkv + id: 872 + key: /library/parts/872/1348327790/file.mkv + size: 1883816967 + videoProfile: main + videoCodec: mpeg2video + videoFrameRate: NTSC + videoProfile: main + videoResolution: '480' + width: 720 + originallyAvailableAt: '1997-02-17' + parentGuid: plex://season/602e691b66dfdb002c0a5034 + parentIndex: 4 + parentKey: /library/metadata/149 + parentRatingKey: '149' + parentThumb: /library/metadata/149/thumb/1681152133 + parentTitle: Season 4 + ratingKey: '150' + Role: + - tag: Hank Delgado + - tag: Diana Morgan + - tag: Jeff Griggs + summary: A team of ISN reporters arrives at the station wanting to do a story about Babylon 5. Sheridan refuses at first, but finally agrees on the theory that at least a small part of their side of the conflict will be shown. + thumb: /library/metadata/150/thumb/1681283788 + title: The Illusion of Truth + titleSort: Illusion of Truth + type: episode + updatedAt: 1681283788 + viewCount: 1 + Writer: + - tag: J. Michael Straczynski + year: 1997 + nocache: true + size: 41 + thumb: /:/resources/show.png + title1: TV Shows + viewGroup: show + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetAllLeaves(ctx, operations.GetAllLeavesRequest{ + SectionID: 633197, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAllLeavesRequest; + import dev.plexapi.sdk.models.operations.GetAllLeavesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetAllLeavesRequest req = GetAllLeavesRequest.builder() + .sectionId(633197L) + .build(); + + GetAllLeavesResponse res = sdk.content().getAllLeaves() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getAllLeaves({ + sectionId: 633197, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/analyze: + put: + summary: Analyze a section + operationId: startAnalysis + description: Start analysis of all items in a section. If BIF generation is enabled, this will also be started on this section + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.StartAnalysis(ctx, operations.StartAnalysisRequest{ + SectionID: 158829, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.StartAnalysisRequest; + import dev.plexapi.sdk.models.operations.StartAnalysisResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StartAnalysisRequest req = StartAnalysisRequest.builder() + .sectionId(158829L) + .build(); + + StartAnalysisResponse res = sdk.library().startAnalysis() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.startAnalysis({ + sectionId: 158829, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/arts: + get: + summary: Set section artwork + operationId: getArts + description: Get artwork for a library section + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithArtwork' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetArts(ctx, operations.GetArtsRequest{ + SectionID: 859200, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithArtwork != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetArtsRequest; + import dev.plexapi.sdk.models.operations.GetArtsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetArtsRequest req = GetArtsRequest.builder() + .sectionId(859200L) + .build(); + + GetArtsResponse res = sdk.content().getArts() + .request(req) + .call(); + + if (res.mediaContainerWithArtwork().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getArts({ + sectionId: 859200, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/autocomplete: + get: + summary: Get autocompletions for search + operationId: autocomplete + description: |- + 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 + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: type + description: Item type + in: query + schema: + type: integer + - name: field.query + description: The "field" stands in for any field, the value is a partial string for matching + in: query + schema: + type: string + - $ref: '#/components/parameters/mediaQuery' + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '400': + description: A paramater is either invalid or missing + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.Autocomplete(ctx, operations.AutocompleteRequest{ + SectionID: 942007, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AutocompleteRequest; + import dev.plexapi.sdk.models.operations.AutocompleteResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AutocompleteRequest req = AutocompleteRequest.builder() + .sectionId(942007L) + .build(); + + AutocompleteResponse res = sdk.library().autocomplete() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.autocomplete({ + sectionId: 942007, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/categories: + get: + summary: Set section categories + operationId: getCategories + description: Get categories in a library section + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithArtwork' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetCategories(ctx, operations.GetCategoriesRequest{ + SectionID: 21841, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithArtwork != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCategoriesRequest; + import dev.plexapi.sdk.models.operations.GetCategoriesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCategoriesRequest req = GetCategoriesRequest.builder() + .sectionId(21841L) + .build(); + + GetCategoriesResponse res = sdk.content().getCategories() + .request(req) + .call(); + + if (res.mediaContainerWithArtwork().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getCategories({ + sectionId: 21841, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/cluster: + get: + summary: Set section clusters + operationId: getCluster + description: Get clusters in a library section (typically for photos) + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithArtwork' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetCluster(ctx, operations.GetClusterRequest{ + SectionID: 138560, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithArtwork != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetClusterRequest; + import dev.plexapi.sdk.models.operations.GetClusterResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetClusterRequest req = GetClusterRequest.builder() + .sectionId(138560L) + .build(); + + GetClusterResponse res = sdk.content().getCluster() + .request(req) + .call(); + + if (res.mediaContainerWithArtwork().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getCluster({ + sectionId: 138560, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/collections: + get: + summary: Get collections in a section + operationId: getCollections + description: Get all collections in a section + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - $ref: '#/components/parameters/mediaQuery' + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetCollections(ctx, operations.GetCollectionsRequest{ + SectionID: 348838, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCollectionsRequest; + import dev.plexapi.sdk.models.operations.GetCollectionsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCollectionsRequest req = GetCollectionsRequest.builder() + .sectionId(348838L) + .build(); + + GetCollectionsResponse res = sdk.library().getCollections() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getCollections({ + sectionId: 348838, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/common: + get: + summary: Get common fields for items + operationId: getCommon + description: |- + 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 + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: type + description: Item type + in: query + schema: + type: integer + - $ref: '#/components/parameters/mediaQuery' + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetCommon(ctx, operations.GetCommonRequest{ + SectionID: 298154, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCommonRequest; + import dev.plexapi.sdk.models.operations.GetCommonResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCommonRequest req = GetCommonRequest.builder() + .sectionId(298154L) + .build(); + + GetCommonResponse res = sdk.library().getCommon() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getCommon({ + sectionId: 298154, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/computePath: + get: + summary: Similar tracks to transition from one to another + operationId: getSonicPath + description: Get a list of audio tracks starting at one and ending at another which are similar across the path + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: startID + description: The starting metadata item id + in: query + required: true + schema: + type: integer + - name: endID + description: The ending metadata item id + in: query + required: true + schema: + type: integer + - $ref: '#/components/parameters/count' + - name: maxDistance + description: The maximum distance allowed along the path; defaults to 0.25 + in: query + schema: + type: number + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetSonicPath(ctx, operations.GetSonicPathRequest{ + SectionID: 914549, + StartID: 629990, + EndID: 687740, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSonicPathRequest; + import dev.plexapi.sdk.models.operations.GetSonicPathResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSonicPathRequest req = GetSonicPathRequest.builder() + .sectionId(914549L) + .startID(629990L) + .endID(687740L) + .build(); + + GetSonicPathResponse res = sdk.content().getSonicPath() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getSonicPath({ + sectionId: 914549, + startID: 629990, + endID: 687740, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/emptyTrash: + put: + summary: Empty section trash + operationId: emptyTrash + description: Empty trash in the section, permanently deleting media/metadata for missing media + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.EmptyTrash(ctx, operations.EmptyTrashRequest{ + SectionID: 30052, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.EmptyTrashRequest; + import dev.plexapi.sdk.models.operations.EmptyTrashResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + EmptyTrashRequest req = EmptyTrashRequest.builder() + .sectionId(30052L) + .build(); + + EmptyTrashResponse res = sdk.library().emptyTrash() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.emptyTrash({ + sectionId: 30052, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/filters: + get: + summary: Get section filters + operationId: getSectionFilters + description: Get common filters on a section + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: The filters on the section + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Directory: + items: + $ref: '#/components/schemas/Directory' + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetSectionFilters(ctx, operations.GetSectionFiltersRequest{ + SectionID: 380557, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSectionFiltersRequest; + import dev.plexapi.sdk.models.operations.GetSectionFiltersResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSectionFiltersRequest req = GetSectionFiltersRequest.builder() + .sectionId(380557L) + .build(); + + GetSectionFiltersResponse res = sdk.library().getSectionFilters() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getSectionFilters({ + sectionId: 380557, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/firstCharacters: + get: + summary: Get list of first characters + operationId: getFirstCharacters + description: Get list of first characters in this section + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: type + description: The metadata type to filter on + in: query + schema: + type: integer + - name: sort + description: The metadata type to filter on + in: query + schema: + type: integer + - $ref: '#/components/parameters/mediaQuery' + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Directory: + items: + properties: + key: + type: string + size: + description: The number of items starting with this character + type: integer + title: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetFirstCharacters(ctx, operations.GetFirstCharactersRequest{ + SectionID: 3947, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetFirstCharactersRequest; + import dev.plexapi.sdk.models.operations.GetFirstCharactersResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetFirstCharactersRequest req = GetFirstCharactersRequest.builder() + .sectionId(3947L) + .build(); + + GetFirstCharactersResponse res = sdk.library().getFirstCharacters() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getFirstCharacters({ + sectionId: 3947, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/indexes: + delete: + summary: Delete section indexes + operationId: deleteIndexes + description: Delete all the indexes in a section + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteIndexes(ctx, operations.DeleteIndexesRequest{ + SectionID: 588437, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteIndexesRequest; + import dev.plexapi.sdk.models.operations.DeleteIndexesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteIndexesRequest req = DeleteIndexesRequest.builder() + .sectionId(588437L) + .build(); + + DeleteIndexesResponse res = sdk.library().deleteIndexes() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteIndexes({ + sectionId: 588437, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/intros: + delete: + summary: Delete section intro markers + operationId: deleteIntros + description: Delete all the intro markers in a section + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteIntros(ctx, operations.DeleteIntrosRequest{ + SectionID: 498656, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteIntrosRequest; + import dev.plexapi.sdk.models.operations.DeleteIntrosResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteIntrosRequest req = DeleteIntrosRequest.builder() + .sectionId(498656L) + .build(); + + DeleteIntrosResponse res = sdk.library().deleteIntros() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteIntros({ + sectionId: 498656, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/location: + get: + summary: Get all folder locations + operationId: getFolders + description: Get all folder locations of the media in a section + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Directory: + items: + properties: + fastKey: + type: string + key: + type: string + title: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetFolders(ctx, operations.GetFoldersRequest{ + SectionID: 892532, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetFoldersRequest; + import dev.plexapi.sdk.models.operations.GetFoldersResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetFoldersRequest req = GetFoldersRequest.builder() + .sectionId(892532L) + .build(); + + GetFoldersResponse res = sdk.content().getFolders() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getFolders({ + sectionId: 892532, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/moment: + get: + summary: Set section moments + operationId: listMoments + description: Get moments in a library section (typically for photos) + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithArtwork' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.ListMoments(ctx, operations.ListMomentsRequest{ + SectionID: 403239, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithArtwork != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListMomentsRequest; + import dev.plexapi.sdk.models.operations.ListMomentsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListMomentsRequest req = ListMomentsRequest.builder() + .sectionId(403239L) + .build(); + + ListMomentsResponse res = sdk.content().listMoments() + .request(req) + .call(); + + if (res.mediaContainerWithArtwork().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.listMoments({ + sectionId: 403239, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/nearest: + get: + summary: The nearest audio tracks + operationId: getSonicallySimilar + description: Get the nearest audio tracks to a particular analysis + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: type + description: The metadata type to fetch (should be 10 for audio track) + in: query + schema: + type: integer + - name: values + description: The music analysis to center the search. Typically obtained from the `musicAnalysis` of a track + in: query + required: true + explode: false + schema: + type: array + items: + maximum: 50 + minimum: 50 + type: integer + - name: limit + description: The limit of the number of items to fetch; defaults to 50 + in: query + schema: + type: integer + - name: maxDistance + description: The maximum distance to search, defaults to 0.25 + in: query + schema: + type: number + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetSonicallySimilar(ctx, operations.GetSonicallySimilarRequest{ + SectionID: 525956, + Values: []int64{}, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSonicallySimilarRequest; + import dev.plexapi.sdk.models.operations.GetSonicallySimilarResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSonicallySimilarRequest req = GetSonicallySimilarRequest.builder() + .sectionId(525956L) + .values(List.of()) + .build(); + + GetSonicallySimilarResponse res = sdk.content().getSonicallySimilar() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getSonicallySimilar({ + sectionId: 525956, + values: [], + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/prefs: + get: + summary: Get section prefs + operationId: getSectionPreferences + description: Get the prefs for a section by id and potentially overriding the agent + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: agent + in: query + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithSettings' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetSectionPreferences(ctx, operations.GetSectionPreferencesRequest{ + SectionID: 754869, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithSettings != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSectionPreferencesRequest; + import dev.plexapi.sdk.models.operations.GetSectionPreferencesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSectionPreferencesRequest req = GetSectionPreferencesRequest.builder() + .sectionId(754869L) + .build(); + + GetSectionPreferencesResponse res = sdk.library().getSectionPreferences() + .request(req) + .call(); + + if (res.mediaContainerWithSettings().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getSectionPreferences({ + sectionId: 754869, + }); + + console.log(result); + } + + run(); + put: + summary: Set section prefs + operationId: setSectionPreferences + description: Set the prefs for a section by id + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: prefs + in: query + required: true + schema: + type: object + example: + enableCinemaTrailers: 1 + hidden: 0 + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.SetSectionPreferences(ctx, operations.SetSectionPreferencesRequest{ + SectionID: 349936, + Prefs: operations.SetSectionPreferencesQueryParamPrefs{}, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetSectionPreferencesRequest req = SetSectionPreferencesRequest.builder() + .sectionId(349936L) + .prefs(SetSectionPreferencesQueryParamPrefs.builder() + .build()) + .build(); + + SetSectionPreferencesResponse res = sdk.library().setSectionPreferences() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.setSectionPreferences({ + sectionId: 349936, + prefs: {}, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/refresh: + delete: + summary: Cancel section refresh + operationId: cancelRefresh + description: Cancel the refresh of a section + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.CancelRefresh(ctx, operations.CancelRefreshRequest{ + SectionID: 326852, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CancelRefreshRequest; + import dev.plexapi.sdk.models.operations.CancelRefreshResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CancelRefreshRequest req = CancelRefreshRequest.builder() + .sectionId(326852L) + .build(); + + CancelRefreshResponse res = sdk.library().cancelRefresh() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.cancelRefresh({ + sectionId: 326852, + }); + + console.log(result); + } + + run(); + post: + summary: Refresh section + operationId: refreshSection + description: Start a refresh of this section + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: force + description: Whether the update of metadata and items should be performed even if modification dates indicate the items have not change + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: path + description: Restrict refresh to the specified path + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.RefreshSection(ctx, operations.RefreshSectionRequest{ + SectionID: 450300, + Force: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RefreshSectionRequest; + import dev.plexapi.sdk.models.operations.RefreshSectionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RefreshSectionRequest req = RefreshSectionRequest.builder() + .sectionId(450300L) + .force(BoolInt.ONE) + .build(); + + RefreshSectionResponse res = sdk.library().refreshSection() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.refreshSection({ + sectionId: 450300, + force: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/sorts: + get: + summary: Get a section sorts + operationId: getAvailableSorts + description: Get the sort mechanisms available in a section + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Directory: + items: + $ref: '#/components/schemas/Sort' + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetAvailableSorts(ctx, operations.GetAvailableSortsRequest{ + SectionID: 212498, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetAvailableSortsRequest; + import dev.plexapi.sdk.models.operations.GetAvailableSortsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetAvailableSortsRequest req = GetAvailableSortsRequest.builder() + .sectionId(212498L) + .build(); + + GetAvailableSortsResponse res = sdk.library().getAvailableSorts() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getAvailableSorts({ + sectionId: 212498, + }); + + console.log(result); + } + + run(); + /library/streams/{streamId}/levels: + get: + summary: Get loudness about a stream in json + operationId: getStreamLevels + description: The the loudness of a stream in db, one entry per 100ms + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: streamId + description: The id of the stream + in: path + required: true + schema: + type: integer + - name: subsample + description: Subsample result down to return only the provided number of samples + in: query + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Level: + items: + properties: + v: + description: The level in db. + type: number + type: object + type: array + totalSamples: + description: The total number of samples (as a string) + type: string + type: object + type: object + '403': + $ref: '#/components/responses/responses-403' + '404': + $ref: '#/components/responses/responses-404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetStreamLevels(ctx, operations.GetStreamLevelsRequest{ + StreamID: 447611, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetStreamLevelsRequest; + import dev.plexapi.sdk.models.operations.GetStreamLevelsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetStreamLevelsRequest req = GetStreamLevelsRequest.builder() + .streamId(447611L) + .build(); + + GetStreamLevelsResponse res = sdk.library().getStreamLevels() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getStreamLevels({ + streamId: 447611, + }); + + console.log(result); + } + + run(); + /library/streams/{streamId}/loudness: + get: + summary: Get loudness about a stream + operationId: getStreamLoudness + description: The the loudness of a stream in db, one number per line, one entry per 100ms + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: streamId + description: The id of the stream + in: path + required: true + schema: + type: integer + - name: subsample + description: Subsample result down to return only the provided number of samples + in: query + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + '403': + description: The media is not accessible to the user + content: + text/html: {} + '404': + description: The stream doesn't exist, or the loudness feature is not available on this PMS + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetStreamLoudness(ctx, operations.GetStreamLoudnessRequest{ + StreamID: 277271, + }) + if err != nil { + log.Fatal(err) + } + if res.Res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetStreamLoudnessRequest; + import dev.plexapi.sdk.models.operations.GetStreamLoudnessResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetStreamLoudnessRequest req = GetStreamLoudnessRequest.builder() + .streamId(277271L) + .build(); + + GetStreamLoudnessResponse res = sdk.library().getStreamLoudness() + .request(req) + .call(); + + if (res.res().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getStreamLoudness({ + streamId: 277271, + }); + + console.log(result); + } + + run(); + /livetv/dvrs/{dvrId}: + delete: + summary: Delete a single DVR + operationId: deleteDVR + description: Delete a single DVR by its id (key) + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.DeleteDVR(ctx, operations.DeleteDVRRequest{ + DvrID: 855088, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteDVRRequest; + import dev.plexapi.sdk.models.operations.DeleteDVRResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteDVRRequest req = DeleteDVRRequest.builder() + .dvrId(855088L) + .build(); + + DeleteDVRResponse res = sdk.dvRs().deleteDVR() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.deleteDVR({ + dvrId: 855088, + }); + + console.log(result); + } + + run(); + get: + summary: Get a single DVR + operationId: getDVR + description: Get a single DVR by its id (key) + tags: + - DVRs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.GetDVR(ctx, operations.GetDVRRequest{ + DvrID: 973518, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetDVRRequest; + import dev.plexapi.sdk.models.operations.GetDVRResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetDVRRequest req = GetDVRRequest.builder() + .dvrId(973518L) + .build(); + + GetDVRResponse res = sdk.dvRs().getDVR() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.getDVR({ + dvrId: 973518, + }); + + console.log(result); + } + + run(); + /livetv/dvrs/{dvrId}/lineups: + delete: + summary: Delete a DVR Lineup + operationId: deleteLineup + description: Deletes a DVR device's lineup. + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + - name: lineup + description: The lineup to delete + in: query + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.DeleteLineup(ctx, operations.DeleteLineupRequest{ + DvrID: 454470, + Lineup: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteLineupRequest; + import dev.plexapi.sdk.models.operations.DeleteLineupResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteLineupRequest req = DeleteLineupRequest.builder() + .dvrId(454470L) + .lineup("") + .build(); + + DeleteLineupResponse res = sdk.dvRs().deleteLineup() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.deleteLineup({ + dvrId: 454470, + lineup: "", + }); + + console.log(result); + } + + run(); + put: + summary: Add a DVR Lineup + operationId: addLineup + description: Add a lineup to a DVR device's set of lineups. + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + - name: lineup + description: The lineup to delete + in: query + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.AddLineup(ctx, operations.AddLineupRequest{ + DvrID: 945235, + Lineup: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddLineupRequest; + import dev.plexapi.sdk.models.operations.AddLineupResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddLineupRequest req = AddLineupRequest.builder() + .dvrId(945235L) + .lineup("") + .build(); + + AddLineupResponse res = sdk.dvRs().addLineup() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.addLineup({ + dvrId: 945235, + lineup: "", + }); + + console.log(result); + } + + run(); + /livetv/dvrs/{dvrId}/prefs: + put: + summary: Set DVR preferences + operationId: setDVRPreferences + description: Set DVR preferences by name avd value + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + - name: name + description: Set the `name` preference to the provided value + in: query + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.SetDVRPreferences(ctx, operations.SetDVRPreferencesRequest{ + DvrID: 116357, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SetDVRPreferencesRequest; + import dev.plexapi.sdk.models.operations.SetDVRPreferencesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetDVRPreferencesRequest req = SetDVRPreferencesRequest.builder() + .dvrId(116357L) + .build(); + + SetDVRPreferencesResponse res = sdk.dvRs().setDVRPreferences() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.setDVRPreferences({ + dvrId: 116357, + }); + + console.log(result); + } + + run(); + /livetv/dvrs/{dvrId}/reloadGuide: + delete: + summary: Tell a DVR to stop reloading program guide + operationId: stopDVRReload + description: Tell a DVR to stop reloading program guide + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.StopDVRReload(ctx, operations.StopDVRReloadRequest{ + DvrID: 348053, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.StopDVRReloadRequest; + import dev.plexapi.sdk.models.operations.StopDVRReloadResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StopDVRReloadRequest req = StopDVRReloadRequest.builder() + .dvrId(348053L) + .build(); + + StopDVRReloadResponse res = sdk.dvRs().stopDVRReload() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.stopDVRReload({ + dvrId: 348053, + }); + + console.log(result); + } + + run(); + post: + summary: Tell a DVR to reload program guide + operationId: reloadGuide + description: Tell a DVR to reload program guide + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Activity: + description: The activity of the reload process + schema: + type: string + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.ReloadGuide(ctx, operations.ReloadGuideRequest{ + DvrID: 140753, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ReloadGuideRequest; + import dev.plexapi.sdk.models.operations.ReloadGuideResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ReloadGuideRequest req = ReloadGuideRequest.builder() + .dvrId(140753L) + .build(); + + ReloadGuideResponse res = sdk.dvRs().reloadGuide() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.reloadGuide({ + dvrId: 140753, + }); + + console.log(result); + } + + run(); + /livetv/sessions/{sessionId}: + get: + summary: Get a single session + operationId: getLiveTVSession + description: Get a single livetv session and metadata + tags: + - Live TV + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sessionId + description: The session id + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LiveTV.GetLiveTVSession(ctx, operations.GetLiveTVSessionRequest{ + SessionID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetLiveTVSessionRequest; + import dev.plexapi.sdk.models.operations.GetLiveTVSessionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetLiveTVSessionRequest req = GetLiveTVSessionRequest.builder() + .sessionId("") + .build(); + + GetLiveTVSessionResponse res = sdk.liveTV().getLiveTVSession() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.liveTV.getLiveTVSession({ + sessionId: "", + }); + + console.log(result); + } + + run(); + /media/grabbers/devices/{deviceId}: + delete: + summary: Remove a device + operationId: removeDevice + description: Remove a devices by its id along with its channel mappings + tags: + - Devices + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + message: + type: string + status: + type: integer + type: object + type: object + '404': + description: Device not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.RemoveDevice(ctx, operations.RemoveDeviceRequest{ + DeviceID: 685908, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RemoveDeviceRequest; + import dev.plexapi.sdk.models.operations.RemoveDeviceResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RemoveDeviceRequest req = RemoveDeviceRequest.builder() + .deviceId(685908L) + .build(); + + RemoveDeviceResponse res = sdk.devices().removeDevice() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.removeDevice({ + deviceId: 685908, + }); + + console.log(result); + } + + run(); + get: + summary: Get device details + operationId: getDeviceDetails + description: Get a device's details by its id + tags: + - Devices + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithDevice' + '404': + description: Device not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.GetDeviceDetails(ctx, operations.GetDeviceDetailsRequest{ + DeviceID: 170949, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDevice != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetDeviceDetailsRequest; + import dev.plexapi.sdk.models.operations.GetDeviceDetailsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetDeviceDetailsRequest req = GetDeviceDetailsRequest.builder() + .deviceId(170949L) + .build(); + + GetDeviceDetailsResponse res = sdk.devices().getDeviceDetails() + .request(req) + .call(); + + if (res.mediaContainerWithDevice().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.getDeviceDetails({ + deviceId: 170949, + }); + + console.log(result); + } + + run(); + put: + summary: Enable or disable a device + operationId: modifyDevice + description: Enable or disable a device by its id + tags: + - Devices + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + - name: enabled + description: Whether to enable the device + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + message: + type: string + status: + type: integer + type: object + type: object + '404': + description: Device not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.ModifyDevice(ctx, operations.ModifyDeviceRequest{ + DeviceID: 879135, + Enabled: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ModifyDeviceRequest; + import dev.plexapi.sdk.models.operations.ModifyDeviceResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ModifyDeviceRequest req = ModifyDeviceRequest.builder() + .deviceId(879135L) + .enabled(BoolInt.ONE) + .build(); + + ModifyDeviceResponse res = sdk.devices().modifyDevice() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.modifyDevice({ + deviceId: 879135, + enabled: BoolInt.One, + }); + + console.log(result); + } + + run(); + /media/grabbers/devices/{deviceId}/channelmap: + put: + summary: Set a device's channel mapping + operationId: setChannelmap + description: Set a device's channel mapping + tags: + - Devices + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + - name: channelMapping + description: The mapping of changes, passed as a map of device channel to lineup VCN. + in: query + style: deepObject + schema: + type: object + example: + '46.3': 2 + '48.9': 4 + - name: channelMappingByKey + description: The mapping of changes, passed as a map of device channel to lineup key. + in: query + style: deepObject + schema: + type: object + example: + '46.3': 5cc83d73af4a72001e9b16d7-5cab3c634df507001fefcad0 + '48.9': 5cc83d73af4a72001e9b16d7-5cab3c63ec158a001d32db8d + - name: channelsEnabled + description: The channels which are enabled. + in: query + schema: + type: array + items: + type: string + example: 46.1,44.1,45.1 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithDevice' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.SetChannelmap(ctx, operations.SetChannelmapRequest{ + DeviceID: 937661, + ChannelMapping: &operations.ChannelMapping{}, + ChannelMappingByKey: &operations.ChannelMappingByKey{}, + ChannelsEnabled: []string{ + "4", + "6", + ".", + "1", + ",", + "4", + "4", + ".", + "1", + ",", + "4", + "5", + ".", + "1", + }, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDevice != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetChannelmapRequest req = SetChannelmapRequest.builder() + .deviceId(937661L) + .channelMapping(ChannelMapping.builder() + .build()) + .channelMappingByKey(ChannelMappingByKey.builder() + .build()) + .channelsEnabled(List.of( + "4", + "6", + ".", + "1", + ",", + "4", + "4", + ".", + "1", + ",", + "4", + "5", + ".", + "1")) + .build(); + + SetChannelmapResponse res = sdk.devices().setChannelmap() + .request(req) + .call(); + + if (res.mediaContainerWithDevice().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.setChannelmap({ + deviceId: 937661, + channelMapping: {}, + channelMappingByKey: {}, + channelsEnabled: [ + "4", + "6", + ".", + "1", + ",", + "4", + "4", + ".", + "1", + ",", + "4", + "5", + ".", + "1", + ], + }); + + console.log(result); + } + + run(); + /media/grabbers/devices/{deviceId}/channels: + get: + summary: Get a device's channels + operationId: getDevicesChannels + description: Get a device's channels by its id + tags: + - Devices + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + DeviceChannel: + items: + properties: + drm: + description: Indicates the channel is DRMed and thus may not be playable + type: boolean + favorite: + type: boolean + hd: + type: boolean + identifier: + type: string + key: + type: string + name: + type: string + signalQuality: + type: integer + signalStrength: + type: integer + type: object + type: array + type: object + type: object + '404': + description: Device not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.GetDevicesChannels(ctx, operations.GetDevicesChannelsRequest{ + DeviceID: 517209, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetDevicesChannelsRequest; + import dev.plexapi.sdk.models.operations.GetDevicesChannelsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetDevicesChannelsRequest req = GetDevicesChannelsRequest.builder() + .deviceId(517209L) + .build(); + + GetDevicesChannelsResponse res = sdk.devices().getDevicesChannels() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.getDevicesChannels({ + deviceId: 517209, + }); + + console.log(result); + } + + run(); + /media/grabbers/devices/{deviceId}/prefs: + put: + summary: Set device preferences + operationId: setDevicePreferences + description: Set device preferences by its id + tags: + - Devices + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + - name: name + description: The preference names and values. + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.SetDevicePreferences(ctx, operations.SetDevicePreferencesRequest{ + DeviceID: 420973, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SetDevicePreferencesRequest; + import dev.plexapi.sdk.models.operations.SetDevicePreferencesResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetDevicePreferencesRequest req = SetDevicePreferencesRequest.builder() + .deviceId(420973L) + .build(); + + SetDevicePreferencesResponse res = sdk.devices().setDevicePreferences() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.setDevicePreferences({ + deviceId: 420973, + }); + + console.log(result); + } + + run(); + /media/grabbers/devices/{deviceId}/scan: + delete: + summary: Tell a device to stop scanning for channels + operationId: stopScan + description: Tell a device to stop scanning for channels + tags: + - Devices + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithDevice' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.StopScan(ctx, operations.StopScanRequest{ + DeviceID: 576494, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDevice != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.StopScanRequest; + import dev.plexapi.sdk.models.operations.StopScanResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StopScanRequest req = StopScanRequest.builder() + .deviceId(576494L) + .build(); + + StopScanResponse res = sdk.devices().stopScan() + .request(req) + .call(); + + if (res.mediaContainerWithDevice().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.stopScan({ + deviceId: 576494, + }); + + console.log(result); + } + + run(); + post: + summary: Tell a device to scan for channels + operationId: scan + description: Tell a device to scan for channels + tags: + - Devices + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + - name: source + description: A valid source for the scan + in: query + schema: + type: string + example: Cable + responses: + '200': + description: OK + headers: + X-Plex-Activity: + description: The activity of the reload process + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithDevice' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.Scan(ctx, operations.ScanRequest{ + DeviceID: 57391, + Source: plexgo.Pointer("Cable"), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDevice != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ScanRequest; + import dev.plexapi.sdk.models.operations.ScanResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ScanRequest req = ScanRequest.builder() + .deviceId(57391L) + .source("Cable") + .build(); + + ScanResponse res = sdk.devices().scan() + .request(req) + .call(); + + if (res.mediaContainerWithDevice().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.scan({ + deviceId: 57391, + source: "Cable", + }); + + console.log(result); + } + + run(); + /media/grabbers/operations/{operationId}: + delete: + summary: Cancel an existing grab + operationId: cancelGrab + description: |- + 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. + tags: + - Subscriptions + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: operationId + description: The ID of the operation. + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '403': + description: User is not owner of the grab and not the admin + content: + text/html: {} + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.CancelGrab(ctx, operations.CancelGrabRequest{ + OperationID: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.CancelGrabRequest; + import dev.plexapi.sdk.models.operations.CancelGrabResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + CancelGrabRequest req = CancelGrabRequest.builder() + .operationId("") + .build(); + + CancelGrabResponse res = sdk.subscriptions().cancelGrab() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.cancelGrab({ + operationId: "", + }); + + console.log(result); + } + + run(); + /media/providers/{provider}: + delete: + summary: Delete a media provider + operationId: deleteMediaProvider + description: Deletes a media provider with the given id + tags: + - Provider + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: provider + description: The ID of the media provider to delete + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '400': + $ref: '#/components/responses/400' + '403': + description: Cannot delete a provider which is a child of another provider + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Provider.DeleteMediaProvider(ctx, operations.DeleteMediaProviderRequest{ + Provider: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteMediaProviderRequest; + import dev.plexapi.sdk.models.operations.DeleteMediaProviderResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteMediaProviderRequest req = DeleteMediaProviderRequest.builder() + .provider("") + .build(); + + DeleteMediaProviderResponse res = sdk.provider().deleteMediaProvider() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.provider.deleteMediaProvider({ + provider: "", + }); + + console.log(result); + } + + run(); + /media/subscriptions/{subscriptionId}: + delete: + summary: Delete a subscription + operationId: deleteSubscription + description: Delete a subscription, cancelling all of its grabs as well + tags: + - Subscriptions + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: subscriptionId + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + '400': + $ref: '#/components/responses/400' + '403': + description: User cannot access DVR on this server or cannot access this subscription + content: + text/html: {} + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.DeleteSubscription(ctx, operations.DeleteSubscriptionRequest{ + SubscriptionID: 974618, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteSubscriptionRequest; + import dev.plexapi.sdk.models.operations.DeleteSubscriptionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteSubscriptionRequest req = DeleteSubscriptionRequest.builder() + .subscriptionId(974618L) + .build(); + + DeleteSubscriptionResponse res = sdk.subscriptions().deleteSubscription() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.deleteSubscription({ + subscriptionId: 974618, + }); + + console.log(result); + } + + run(); + get: + summary: Get a single subscription + operationId: getSubscription + description: Get a single subscription and potentially the grabs too + tags: + - Subscriptions + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: subscriptionId + in: path + required: true + schema: + type: integer + - name: includeGrabs + description: Indicates whether the active grabs should be included as well + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: includeStorage + description: Compute the storage of recorded items desired by this subscription + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithSubscription' + '400': + $ref: '#/components/responses/400' + '403': + description: User cannot access DVR on this server or cannot access this subscription + content: + text/html: {} + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.GetSubscription(ctx, operations.GetSubscriptionRequest{ + SubscriptionID: 186713, + IncludeGrabs: components.BoolIntOne.ToPointer(), + IncludeStorage: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithSubscription != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSubscriptionRequest; + import dev.plexapi.sdk.models.operations.GetSubscriptionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSubscriptionRequest req = GetSubscriptionRequest.builder() + .subscriptionId(186713L) + .includeGrabs(BoolInt.ONE) + .includeStorage(BoolInt.ONE) + .build(); + + GetSubscriptionResponse res = sdk.subscriptions().getSubscription() + .request(req) + .call(); + + if (res.mediaContainerWithSubscription().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.getSubscription({ + subscriptionId: 186713, + includeGrabs: BoolInt.One, + includeStorage: BoolInt.One, + }); + + console.log(result); + } + + run(); + put: + summary: Edit a subscription + operationId: editSubscriptionPreferences + description: Edit a subscription's preferences + tags: + - Subscriptions + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: subscriptionId + in: path + required: true + schema: + type: integer + - name: prefs + in: query + style: deepObject + schema: + type: object + example: + minVideoQuality: 720 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithSubscription' + '400': + $ref: '#/components/responses/400' + '403': + description: User cannot access DVR on this server or cannot access this subscription + content: + text/html: {} + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.EditSubscriptionPreferences(ctx, operations.EditSubscriptionPreferencesRequest{ + SubscriptionID: 673918, + Prefs: &operations.EditSubscriptionPreferencesQueryParamPrefs{}, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithSubscription != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + EditSubscriptionPreferencesRequest req = EditSubscriptionPreferencesRequest.builder() + .subscriptionId(673918L) + .prefs(EditSubscriptionPreferencesQueryParamPrefs.builder() + .build()) + .build(); + + EditSubscriptionPreferencesResponse res = sdk.subscriptions().editSubscriptionPreferences() + .request(req) + .call(); + + if (res.mediaContainerWithSubscription().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.editSubscriptionPreferences({ + subscriptionId: 673918, + prefs: {}, + }); + + console.log(result); + } + + run(); + /media/subscriptions/{subscriptionId}/move: + put: + summary: Re-order a subscription + operationId: reorderSubscription + description: Re-order a subscription to change its priority + tags: + - Subscriptions + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: subscriptionId + in: path + required: true + schema: + type: integer + - name: after + description: The subscription to move this sub after. If missing will insert at the beginning of the list + in: query + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithSubscription' + '400': + $ref: '#/components/responses/400' + '403': + description: User cannot access DVR on this server or cannot access this subscription + content: + text/html: {} + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Subscriptions.ReorderSubscription(ctx, operations.ReorderSubscriptionRequest{ + SubscriptionID: 440634, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithSubscription != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ReorderSubscriptionRequest; + import dev.plexapi.sdk.models.operations.ReorderSubscriptionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ReorderSubscriptionRequest req = ReorderSubscriptionRequest.builder() + .subscriptionId(440634L) + .build(); + + ReorderSubscriptionResponse res = sdk.subscriptions().reorderSubscription() + .request(req) + .call(); + + if (res.mediaContainerWithSubscription().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.subscriptions.reorderSubscription({ + subscriptionId: 440634, + }); + + console.log(result); + } + + run(); + /playlists/{playlistId}: + delete: + summary: Delete a Playlist + operationId: deletePlaylist + description: Deletes a playlist by provided id + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + responses: + '204': + $ref: '#/components/responses/204' + '404': + description: Playlist not found (or user may not have permission to access playlist) + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.DeletePlaylist(ctx, operations.DeletePlaylistRequest{ + PlaylistID: 343293, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeletePlaylistRequest; + import dev.plexapi.sdk.models.operations.DeletePlaylistResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeletePlaylistRequest req = DeletePlaylistRequest.builder() + .playlistId(343293L) + .build(); + + DeletePlaylistResponse res = sdk.libraryPlaylists().deletePlaylist() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.deletePlaylist({ + playlistId: 343293, + }); + + console.log(result); + } + + run(); + get: + summary: Retrieve Playlist + operationId: getPlaylist + description: |- + 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. + tags: + - Playlist + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithPlaylistMetadata' + '404': + description: Playlist not found (or user may not have permission to access playlist) + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Playlist.GetPlaylist(ctx, operations.GetPlaylistRequest{ + PlaylistID: 841953, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPlaylistRequest; + import dev.plexapi.sdk.models.operations.GetPlaylistResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPlaylistRequest req = GetPlaylistRequest.builder() + .playlistId(841953L) + .build(); + + GetPlaylistResponse res = sdk.playlist().getPlaylist() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playlist.getPlaylist({ + playlistId: 841953, + }); + + console.log(result); + } + + run(); + put: + summary: Editing a Playlist + operationId: updatePlaylist + description: Edits a playlist in the same manner as [editing metadata](#tag/Provider/operation/metadataPutItem) + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + responses: + '204': + $ref: '#/components/responses/204' + '404': + description: Playlist not found (or user may not have permission to access playlist) + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.UpdatePlaylist(ctx, operations.UpdatePlaylistRequest{ + PlaylistID: 157966, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.UpdatePlaylistRequest; + import dev.plexapi.sdk.models.operations.UpdatePlaylistResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + UpdatePlaylistRequest req = UpdatePlaylistRequest.builder() + .playlistId(157966L) + .build(); + + UpdatePlaylistResponse res = sdk.libraryPlaylists().updatePlaylist() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.updatePlaylist({ + playlistId: 157966, + }); + + console.log(result); + } + + run(); + /playlists/{playlistId}/generators: + get: + summary: Get a playlist's generators + operationId: getPlaylistGenerators + description: Get all the generators in a playlist + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + PlayQueueGenerator: + items: + properties: + changedAt: + type: integer + createdAt: + type: integer + id: + type: integer + playlistID: + type: integer + type: + description: | + The type of playlist generator. + + - -1: A smart playlist generator + - 42: A optimized version generator + enum: + - -1 + - 42 + type: integer + updatedAt: + type: integer + uri: + description: The URI indicating the search for this generator + type: string + type: object + type: array + type: object + type: object + '404': + description: Playlist not found (or user may not have permission to access playlist) or generator not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.GetPlaylistGenerators(ctx, operations.GetPlaylistGeneratorsRequest{ + PlaylistID: 162342, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPlaylistGeneratorsRequest; + import dev.plexapi.sdk.models.operations.GetPlaylistGeneratorsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPlaylistGeneratorsRequest req = GetPlaylistGeneratorsRequest.builder() + .playlistId(162342L) + .build(); + + GetPlaylistGeneratorsResponse res = sdk.libraryPlaylists().getPlaylistGenerators() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.getPlaylistGenerators({ + playlistId: 162342, + }); + + console.log(result); + } + + run(); + /playlists/{playlistId}/items: + delete: + summary: Clearing a playlist + operationId: clearPlaylistItems + description: Clears a playlist, only works with dumb playlists. Returns the playlist. + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.ClearPlaylistItems(ctx, operations.ClearPlaylistItemsRequest{ + PlaylistID: 552140, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ClearPlaylistItemsRequest; + import dev.plexapi.sdk.models.operations.ClearPlaylistItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ClearPlaylistItemsRequest req = ClearPlaylistItemsRequest.builder() + .playlistId(552140L) + .build(); + + ClearPlaylistItemsResponse res = sdk.libraryPlaylists().clearPlaylistItems() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.clearPlaylistItems({ + playlistId: 552140, + }); + + console.log(result); + } + + run(); + get: + summary: Retrieve Playlist Contents + operationId: getPlaylistItems + description: 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. + tags: + - Playlist + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: type + description: The metadata types of the item to return. Values past the first are only used in fetching items from the background processing playlist. + in: query + explode: false + schema: + type: array + items: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '404': + description: Playlist not found (or user may not have permission to access playlist) + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Playlist.GetPlaylistItems(ctx, operations.GetPlaylistItemsRequest{ + PlaylistID: 118195, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPlaylistItemsRequest; + import dev.plexapi.sdk.models.operations.GetPlaylistItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPlaylistItemsRequest req = GetPlaylistItemsRequest.builder() + .playlistId(118195L) + .build(); + + GetPlaylistItemsResponse res = sdk.playlist().getPlaylistItems() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playlist.getPlaylistItems({ + playlistId: 118195, + }); + + console.log(result); + } + + run(); + put: + summary: Adding to a Playlist + operationId: addPlaylistItems + description: 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. + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: uri + description: The content URI for the playlist. + in: query + schema: + type: string + - name: playQueueID + description: The play queue to add to a playlist. + in: query + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.AddPlaylistItems(ctx, operations.AddPlaylistItemsRequest{ + PlaylistID: 533723, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddPlaylistItemsRequest; + import dev.plexapi.sdk.models.operations.AddPlaylistItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddPlaylistItemsRequest req = AddPlaylistItemsRequest.builder() + .playlistId(533723L) + .build(); + + AddPlaylistItemsResponse res = sdk.libraryPlaylists().addPlaylistItems() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.addPlaylistItems({ + playlistId: 533723, + }); + + console.log(result); + } + + run(); + /playQueues/{playQueueId}: + get: + summary: Retrieve a play queue + operationId: getPlayQueue + description: 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. + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + - name: own + description: If the server should transfer ownership to the requesting client (used in remote control scenarios). + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: center + description: The play queue item ID for the center of the window - this doesn't change the current selected item. + in: query + schema: + type: string + - name: window + description: How many items on each side of the center of the window + in: query + schema: + type: integer + - name: includeBefore + description: Whether to include the items before the center (if 0, center is not included either), defaults to 1. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: includeAfter + description: Whether to include the items after the center (if 0, center is not included either), defaults to 1. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Play queue not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.GetPlayQueue(ctx, operations.GetPlayQueueRequest{ + PlayQueueID: 210646, + Own: components.BoolIntOne.ToPointer(), + IncludeBefore: components.BoolIntOne.ToPointer(), + IncludeAfter: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPlayQueueRequest; + import dev.plexapi.sdk.models.operations.GetPlayQueueResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPlayQueueRequest req = GetPlayQueueRequest.builder() + .playQueueId(210646L) + .own(BoolInt.ONE) + .includeBefore(BoolInt.ONE) + .includeAfter(BoolInt.ONE) + .build(); + + GetPlayQueueResponse res = sdk.playQueue().getPlayQueue() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.getPlayQueue({ + playQueueId: 210646, + own: BoolInt.One, + includeBefore: BoolInt.One, + includeAfter: BoolInt.One, + }); + + console.log(result); + } + + run(); + put: + summary: Add a generator or playlist to a play queue + operationId: addToPlayQueue + description: 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. + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + - name: uri + description: The content URI for what we're adding to the queue. + in: query + schema: + type: string + - name: playlistID + description: The ID of the playlist to add to the playQueue. + in: query + schema: + type: string + - name: next + description: Play this item next (defaults to 0 - queueing at the end of manually queued items). + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Play queue not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.AddToPlayQueue(ctx, operations.AddToPlayQueueRequest{ + PlayQueueID: 919248, + Next: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddToPlayQueueRequest; + import dev.plexapi.sdk.models.operations.AddToPlayQueueResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddToPlayQueueRequest req = AddToPlayQueueRequest.builder() + .playQueueId(919248L) + .next(BoolInt.ONE) + .build(); + + AddToPlayQueueResponse res = sdk.playQueue().addToPlayQueue() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.addToPlayQueue({ + playQueueId: 919248, + next: BoolInt.One, + }); + + console.log(result); + } + + run(); + /playQueues/{playQueueId}/items: + delete: + summary: Clear a play queue + operationId: clearPlayQueue + description: Deletes all items in the play queue, and increases the version of the play queue. + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithPlaylistMetadata' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.ClearPlayQueue(ctx, operations.ClearPlayQueueRequest{ + PlayQueueID: 86357, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ClearPlayQueueRequest; + import dev.plexapi.sdk.models.operations.ClearPlayQueueResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ClearPlayQueueRequest req = ClearPlayQueueRequest.builder() + .playQueueId(86357L) + .build(); + + ClearPlayQueueResponse res = sdk.playQueue().clearPlayQueue() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.clearPlayQueue({ + playQueueId: 86357, + }); + + console.log(result); + } + + run(); + /playQueues/{playQueueId}/reset: + put: + summary: Reset a play queue + operationId: resetPlayQueue + description: Reset a play queue to the first item being the current item + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Play queue not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.ResetPlayQueue(ctx, operations.ResetPlayQueueRequest{ + PlayQueueID: 581891, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ResetPlayQueueRequest; + import dev.plexapi.sdk.models.operations.ResetPlayQueueResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ResetPlayQueueRequest req = ResetPlayQueueRequest.builder() + .playQueueId(581891L) + .build(); + + ResetPlayQueueResponse res = sdk.playQueue().resetPlayQueue() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.resetPlayQueue({ + playQueueId: 581891, + }); + + console.log(result); + } + + run(); + /playQueues/{playQueueId}/shuffle: + put: + summary: Shuffle a play queue + operationId: shuffle + description: 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. + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithPlaylistMetadata' + '400': + $ref: '#/components/responses/400' + '404': + description: Play queue not found or current item not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.Shuffle(ctx, operations.ShuffleRequest{ + PlayQueueID: 316150, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ShuffleRequest; + import dev.plexapi.sdk.models.operations.ShuffleResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ShuffleRequest req = ShuffleRequest.builder() + .playQueueId(316150L) + .build(); + + ShuffleResponse res = sdk.playQueue().shuffle() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.shuffle({ + playQueueId: 316150, + }); + + console.log(result); + } + + run(); + /playQueues/{playQueueId}/unshuffle: + put: + summary: Unshuffle a play queue + operationId: unshuffle + description: 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. + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Play queue not found or current item not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.Unshuffle(ctx, operations.UnshuffleRequest{ + PlayQueueID: 484388, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.UnshuffleRequest; + import dev.plexapi.sdk.models.operations.UnshuffleResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + UnshuffleRequest req = UnshuffleRequest.builder() + .playQueueId(484388L) + .build(); + + UnshuffleResponse res = sdk.playQueue().unshuffle() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.unshuffle({ + playQueueId: 484388, + }); + + console.log(result); + } + + run(); + /status/sessions/history/{historyId}: + delete: + summary: Delete Single History Item + operationId: deleteHistory + description: Delete a single history item by id + tags: + - Status + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: historyId + description: The id of the history item (the `historyKey` from above) + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainer' + '404': + description: History item not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Status.DeleteHistory(ctx, operations.DeleteHistoryRequest{ + HistoryID: 953579, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainer != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteHistoryRequest; + import dev.plexapi.sdk.models.operations.DeleteHistoryResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteHistoryRequest req = DeleteHistoryRequest.builder() + .historyId(953579L) + .build(); + + DeleteHistoryResponse res = sdk.status().deleteHistory() + .request(req) + .call(); + + if (res.mediaContainer().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.status.deleteHistory({ + historyId: 953579, + }); + + console.log(result); + } + + run(); + get: + summary: Get Single History Item + operationId: getHistoryItem + description: Get a single history item by id + tags: + - Status + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: historyId + description: The id of the history item (the `historyKey` from above) + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/historyAll-get-responses-200' + '404': + description: History item not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Status.GetHistoryItem(ctx, operations.GetHistoryItemRequest{ + HistoryID: 832213, + }) + if err != nil { + log.Fatal(err) + } + if res.HistoryAllGetResponses200 != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetHistoryItemRequest; + import dev.plexapi.sdk.models.operations.GetHistoryItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetHistoryItemRequest req = GetHistoryItemRequest.builder() + .historyId(832213L) + .build(); + + GetHistoryItemResponse res = sdk.status().getHistoryItem() + .request(req) + .call(); + + if (res.historyAllGetResponses200().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.status.getHistoryItem({ + historyId: 832213, + }); + + console.log(result); + } + + run(); + /{transcodeType}/:/transcode/universal/start.{extension}: + get: + summary: Start A Transcoding Session + operationId: startTranscodeSession + x-speakeasy-usage-example: true + description: Starts the transcoder and returns the corresponding streaming resource document. + tags: + - Transcoder + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - $ref: '#/components/parameters/transcodeType' + - $ref: '#/components/parameters/transcodeSessionId' + - name: extension + description: "Extension \n" + in: path + required: true + schema: + type: string + enum: + - m3u8 + - mpd + - $ref: '#/components/parameters/advancedSubtitles' + - name: audioBoost + description: Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc) + in: query + schema: + minimum: 1 + type: integer + example: 50 + - name: audioChannelCount + description: Target video number of audio channels. + in: query + schema: + maximum: 8 + minimum: 1 + type: integer + example: 5 + - name: autoAdjustQuality + description: Indicates the client supports ABR. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: autoAdjustSubtitle + description: Indicates if the server should adjust subtitles based on Voice Activity Data. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directPlay + description: Indicates the client supports direct playing the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directStream + description: Indicates the client supports direct streaming the video of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: directStreamAudio + description: Indicates the client supports direct streaming the audio of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: disableResolutionRotation + description: Indicates if resolution should be adjusted for orientation. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: hasMDE + description: Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1 + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + - name: location + description: Network type of the client, can be used to help determine target bitrate. + in: query + schema: + type: string + enum: + - lan + - wan + - cellular + example: wan + - name: mediaBufferSize + description: Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks. + in: query + schema: + type: integer + example: 102400 + - name: mediaIndex + description: Index of the media to transcode. -1 or not specified indicates let the server choose. + in: query + schema: + type: integer + example: 0 + - name: musicBitrate + description: Target bitrate for audio only files (in kbps, used to transcode). + in: query + schema: + minimum: 0 + type: integer + example: 5000 + - name: offset + description: Offset from the start of the media (in seconds). + in: query + schema: + type: number + example: 90.5 + - name: partIndex + description: Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode + in: query + schema: + type: integer + example: 0 + - name: path + description: Internal PMS path of the media to transcode. + in: query + schema: + type: string + example: /library/metadata/151671 + - name: peakBitrate + description: Maximum bitrate (in kbps) to use in ABR. + in: query + schema: + minimum: 0 + type: integer + example: 12000 + - name: photoResolution + description: Target photo resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 + - name: protocol + description: | + Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022) + in: query + schema: + type: string + enum: + - http + - hls + - dash + example: dash + - name: secondsPerSegment + description: Number of seconds to include in each transcoded segment + in: query + schema: + type: integer + example: 5 + - name: subtitleSize + description: Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect) + in: query + schema: + minimum: 1 + type: integer + example: 50 + - name: subtitles + description: | + Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream + in: query + schema: + type: string + enum: + - auto + - burn + - none + - sidecar + - embedded + - segmented + - unknown + example: Burn + - name: videoBitrate + description: Target video bitrate (in kbps). + in: query + schema: + minimum: 0 + type: integer + example: 12000 + - name: videoQuality + description: Target photo quality. + in: query + schema: + maximum: 99 + minimum: 0 + type: integer + example: 50 + - name: videoResolution + description: Target maximum video resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 + - name: X-Plex-Client-Identifier + description: Unique per client. + in: header + required: true + schema: + type: string + - name: X-Plex-Client-Profile-Extra + description: See [Profile Augmentations](#section/API-Info/Profile-Augmentations) . + in: header + schema: + type: string + example: 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) + - name: X-Plex-Client-Profile-Name + description: Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile. + in: header + schema: + type: string + example: generic + - name: X-Plex-Device + description: Device the client is running on + in: header + schema: + type: string + example: Windows + - name: X-Plex-Model + description: Model of the device the client is running on + in: header + schema: + type: string + example: standalone + - name: X-Plex-Platform + description: Client Platform + in: header + schema: + type: string + example: Chrome + - name: X-Plex-Platform-Version + description: Client Platform Version + in: header + schema: + type: string + example: 135 + - name: X-Plex-Session-Identifier + description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs) + in: header + schema: + type: string + responses: + '200': + description: MPD file (see ISO/IEC 23009-1:2022), m3u8 file (see RFC 8216), or binary http stream + content: + application/vnd.apple.mpegurl: + example: | + #EXTM3U + #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3538000,RESOLUTION=1280x720,FRAME-RATE=60.000000 + session/32635662-0d05-4acd-8f72-512cc64396d4/base/index.m3u8 + text/html: + example: | + + + + + + + + + + + + + + + + + + + video/x-matroska: + schema: + format: binary + type: string + '400': + $ref: '#/components/responses/400' + '403': + $ref: '#/components/responses/403' + '404': + $ref: '#/components/responses/404' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Transcoder.StartTranscodeSession(ctx, operations.StartTranscodeSessionRequest{ + TranscodeType: components.TranscodeTypeMusic, + Extension: operations.ExtensionMpd, + AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(), + AudioBoost: plexgo.Pointer[int64](50), + AudioChannelCount: plexgo.Pointer[int64](5), + AutoAdjustQuality: components.BoolIntOne.ToPointer(), + AutoAdjustSubtitle: components.BoolIntOne.ToPointer(), + DirectPlay: components.BoolIntOne.ToPointer(), + DirectStream: components.BoolIntOne.ToPointer(), + DirectStreamAudio: components.BoolIntOne.ToPointer(), + DisableResolutionRotation: components.BoolIntOne.ToPointer(), + HasMDE: components.BoolIntOne.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), + VideoBitrate: plexgo.Pointer[int64](12000), + VideoQuality: plexgo.Pointer[int64](50), + VideoResolution: plexgo.Pointer("1080x1080"), + 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.ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.*; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + StartTranscodeSessionRequest req = StartTranscodeSessionRequest.builder() + .transcodeType(TranscodeType.MUSIC) + .extension(Extension.MPD) + .advancedSubtitles(AdvancedSubtitles.BURN) + .audioBoost(50L) + .audioChannelCount(5L) + .autoAdjustQuality(BoolInt.ONE) + .autoAdjustSubtitle(BoolInt.ONE) + .directPlay(BoolInt.ONE) + .directStream(BoolInt.ONE) + .directStreamAudio(BoolInt.ONE) + .disableResolutionRotation(BoolInt.ONE) + .hasMDE(BoolInt.ONE) + .location(StartTranscodeSessionQueryParamLocation.WAN) + .mediaBufferSize(102400L) + .mediaIndex(0L) + .musicBitrate(5000L) + .offset(90.5) + .partIndex(0L) + .path("/library/metadata/151671") + .peakBitrate(12000L) + .photoResolution("1080x1080") + .protocol(StartTranscodeSessionQueryParamProtocol.DASH) + .secondsPerSegment(5L) + .subtitleSize(50L) + .videoBitrate(12000L) + .videoQuality(50L) + .videoResolution("1080x1080") + .xPlexClientProfileExtra("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("generic") + .build(); + + StartTranscodeSessionResponse res = sdk.transcoder().startTranscodeSession() + .request(req) + .call(); + + if (res.responseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Extension, StartTranscodeSessionLocation, StartTranscodeSessionProtocol } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, AdvancedSubtitles, BoolInt, TranscodeType } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.transcoder.startTranscodeSession({ + transcodeType: TranscodeType.Music, + extension: Extension.Mpd, + advancedSubtitles: AdvancedSubtitles.Burn, + audioBoost: 50, + audioChannelCount: 5, + autoAdjustQuality: BoolInt.One, + autoAdjustSubtitle: BoolInt.One, + directPlay: BoolInt.One, + directStream: BoolInt.One, + directStreamAudio: BoolInt.One, + disableResolutionRotation: BoolInt.One, + hasMDE: BoolInt.One, + location: StartTranscodeSessionLocation.Wan, + mediaBufferSize: 102400, + mediaIndex: 0, + musicBitrate: 5000, + offset: 90.5, + partIndex: 0, + path: "/library/metadata/151671", + peakBitrate: 12000, + photoResolution: "1080x1080", + protocol: StartTranscodeSessionProtocol.Dash, + secondsPerSegment: 5, + subtitleSize: 50, + videoBitrate: 12000, + videoQuality: 50, + videoResolution: "1080x1080", + xPlexClientProfileExtra: "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: "generic", + }); + + console.log(result); + } + + run(); + /downloadQueue/{queueId}/item/{itemId}/decision: + get: + summary: Grab download queue item decision + operationId: getItemDecision + description: | + Available: 0.2.0 + + Grab the decision for a download queue item + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + - name: itemId + description: The item ids + in: path + required: true + schema: + type: integer + example: 32 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithDecision' + '400': + description: The item is not in a state where a decision is available + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.GetItemDecision(ctx, operations.GetItemDecisionRequest{ + QueueID: 231605, + ItemID: 32, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithDecision != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetItemDecisionRequest; + import dev.plexapi.sdk.models.operations.GetItemDecisionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetItemDecisionRequest req = GetItemDecisionRequest.builder() + .queueId(231605L) + .itemId(32L) + .build(); + + GetItemDecisionResponse res = sdk.downloadQueue().getItemDecision() + .request(req) + .call(); + + if (res.mediaContainerWithDecision().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.getItemDecision({ + queueId: 231605, + itemId: 32, + }); + + console.log(result); + } + + run(); + /downloadQueue/{queueId}/item/{itemId}/media: + get: + summary: Grab download queue media + operationId: getDownloadQueueMedia + description: | + Available: 0.2.0 + + Grab the media for a download queue item + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + - name: itemId + description: The item ids + in: path + required: true + schema: + type: integer + example: 32 + responses: + '200': + description: The raw media file + '503': + description: | + ![503](https://http.cat/503.jpg) + + The queue item is not yet complete and is currently transcoding or waiting to transcode + headers: + Retry-After: + description: The estimated time before completion or -1 if unknown + schema: + type: integer + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.GetDownloadQueueMedia(ctx, operations.GetDownloadQueueMediaRequest{ + QueueID: 663184, + ItemID: 32, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetDownloadQueueMediaRequest; + import dev.plexapi.sdk.models.operations.GetDownloadQueueMediaResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetDownloadQueueMediaRequest req = GetDownloadQueueMediaRequest.builder() + .queueId(663184L) + .itemId(32L) + .build(); + + GetDownloadQueueMediaResponse res = sdk.downloadQueue().getDownloadQueueMedia() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.getDownloadQueueMedia({ + queueId: 663184, + itemId: 32, + }); + + console.log(result); + } + + run(); + /downloadQueue/{queueId}/items/{itemId}: + delete: + summary: Delete download queue items + operationId: removeDownloadQueueItems + description: delete items from a download queue + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + - name: itemId + description: The item id + in: path + required: true + explode: false + schema: + type: array + items: + type: integer + example: + - 32 + - 345 + - 23 + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.RemoveDownloadQueueItems(ctx, operations.RemoveDownloadQueueItemsRequest{ + QueueID: 946275, + ItemID: []int64{ + 32, + 345, + 23, + }, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RemoveDownloadQueueItemsRequest; + import dev.plexapi.sdk.models.operations.RemoveDownloadQueueItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RemoveDownloadQueueItemsRequest req = RemoveDownloadQueueItemsRequest.builder() + .queueId(946275L) + .itemId(List.of( + 32L, + 345L, + 23L)) + .build(); + + RemoveDownloadQueueItemsResponse res = sdk.downloadQueue().removeDownloadQueueItems() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.removeDownloadQueueItems({ + queueId: 946275, + itemId: [ + 32, + 345, + 23, + ], + }); + + console.log(result); + } + + run(); + get: + summary: Get download queue items + operationId: getDownloadQueueItems + description: | + Available: 0.2.0 + + Get items from a download queue + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + - name: itemId + description: The item ids + in: path + required: true + explode: false + schema: + type: array + items: + type: integer + example: + - 32 + - 345 + - 23 + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + DownloadQueueItem: + items: + properties: + DecisionResult: + properties: + availableBandwidth: + description: The maximum bitrate set when item was added + type: integer + directPlayDecisionCode: + type: integer + directPlayDecisionText: + type: string + generalDecisionCode: + type: integer + generalDecisionText: + type: string + mdeDecisionCode: + description: The code indicating the status of evaluation of playback when client indicates `hasMDE=1` + type: integer + mdeDecisionText: + description: Descriptive text for the above code + type: string + transcodeDecisionCode: + type: integer + transcodeDecisionText: + type: string + type: object + error: + description: The error encountered in transcoding or decision + type: string + id: + type: integer + key: + type: string + queueId: + type: integer + status: + description: | + The state of the item: + - deciding: The item decision is pending + - waiting: The item is waiting for transcode + - processing: The item is being transcoded + - available: The item is available for download + - error: The item encountered an error in the decision or transcode + - expired: The transcoded item has timed out and is no longer available + enum: + - deciding + - waiting + - processing + - available + - error + - expired + type: string + transcode: + description: The transcode session object which is not yet documented otherwise it'd be a $ref here. + type: object + TranscodeSession: + $ref: '#/components/schemas/TranscodeSession' + type: object + type: array + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.GetDownloadQueueItems(ctx, operations.GetDownloadQueueItemsRequest{ + QueueID: 809886, + ItemID: []int64{ + 32, + 345, + 23, + }, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetDownloadQueueItemsRequest; + import dev.plexapi.sdk.models.operations.GetDownloadQueueItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetDownloadQueueItemsRequest req = GetDownloadQueueItemsRequest.builder() + .queueId(809886L) + .itemId(List.of( + 32L, + 345L, + 23L)) + .build(); + + GetDownloadQueueItemsResponse res = sdk.downloadQueue().getDownloadQueueItems() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.getDownloadQueueItems({ + queueId: 809886, + itemId: [ + 32, + 345, + 23, + ], + }); + + console.log(result); + } + + run(); + /downloadQueue/{queueId}/items/{itemId}/restart: + post: + summary: Restart processing of items from the decision + operationId: restartProcessingDownloadQueueItems + description: | + Available: 0.2.0 + + Reprocess download queue items with previous decision parameters + tags: + - Download Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: queueId + description: The queue id + in: path + required: true + schema: + type: integer + - name: itemId + description: The item ids + in: path + required: true + explode: false + schema: + type: array + items: + type: integer + example: + - 32 + - 345 + - 23 + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DownloadQueue.RestartProcessingDownloadQueueItems(ctx, operations.RestartProcessingDownloadQueueItemsRequest{ + QueueID: 713001, + ItemID: []int64{ + 32, + 345, + 23, + }, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RestartProcessingDownloadQueueItemsRequest; + import dev.plexapi.sdk.models.operations.RestartProcessingDownloadQueueItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + import java.util.List; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RestartProcessingDownloadQueueItemsRequest req = RestartProcessingDownloadQueueItemsRequest.builder() + .queueId(713001L) + .itemId(List.of( + 32L, + 345L, + 23L)) + .build(); + + RestartProcessingDownloadQueueItemsResponse res = sdk.downloadQueue().restartProcessingDownloadQueueItems() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.downloadQueue.restartProcessingDownloadQueueItems({ + queueId: 713001, + itemId: [ + 32, + 345, + 23, + ], + }); + + console.log(result); + } + + run(); + /hubs/sections/{sectionId}/manage/{identifier}: + delete: + summary: Delete a custom hub + operationId: deleteCustomHub + description: Delete a custom hub from the server + tags: + - Hubs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section ID for the hubs to change + in: path + required: true + schema: + type: integer + - name: identifier + description: The identifier of the hub to change + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: The hub is not a custom hub + content: + text/html: {} + '403': + $ref: '#/components/responses/403' + '404': + description: The section or hub was not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.DeleteCustomHub(ctx, operations.DeleteCustomHubRequest{ + SectionID: 625677, + Identifier: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteCustomHubRequest; + import dev.plexapi.sdk.models.operations.DeleteCustomHubResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteCustomHubRequest req = DeleteCustomHubRequest.builder() + .sectionId(625677L) + .identifier("") + .build(); + + DeleteCustomHubResponse res = sdk.hubs().deleteCustomHub() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.deleteCustomHub({ + sectionId: 625677, + identifier: "", + }); + + console.log(result); + } + + run(); + put: + summary: Change hub visibility + operationId: updateHubVisibility + description: Changed the visibility of a hub for both the admin and shared users + tags: + - Hubs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: The section ID for the hubs to change + in: path + required: true + schema: + type: integer + - name: identifier + description: The identifier of the hub to change + in: path + required: true + schema: + type: string + - name: promotedToRecommended + description: Whether this hub should be displayed in recommended + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: promotedToOwnHome + description: Whether this hub should be displayed in admin's home + in: query + schema: + $ref: "#/components/schemas/BoolInt" + - name: promotedToSharedHome + description: Whether this hub should be displayed in shared user's home + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + '403': + $ref: '#/components/responses/403' + '404': + description: Section id was not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Hubs.UpdateHubVisibility(ctx, operations.UpdateHubVisibilityRequest{ + SectionID: 341650, + Identifier: "", + PromotedToRecommended: components.BoolIntOne.ToPointer(), + PromotedToOwnHome: components.BoolIntOne.ToPointer(), + PromotedToSharedHome: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.UpdateHubVisibilityRequest; + import dev.plexapi.sdk.models.operations.UpdateHubVisibilityResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + UpdateHubVisibilityRequest req = UpdateHubVisibilityRequest.builder() + .sectionId(341650L) + .identifier("") + .promotedToRecommended(BoolInt.ONE) + .promotedToOwnHome(BoolInt.ONE) + .promotedToSharedHome(BoolInt.ONE) + .build(); + + UpdateHubVisibilityResponse res = sdk.hubs().updateHubVisibility() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.hubs.updateHubVisibility({ + sectionId: 341650, + identifier: "", + promotedToRecommended: BoolInt.One, + promotedToOwnHome: BoolInt.One, + promotedToSharedHome: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/collections/{collectionId}/composite/{updatedAt}: + get: + summary: Get a collection's image + operationId: getCollectionImage + description: Get an image for the collection based on the items within + tags: + - Content + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: collectionId + description: The collection id + in: path + required: true + schema: + type: integer + - name: updatedAt + description: The update time of the image. Used for busting cache. + in: path + required: true + schema: + type: integer + - $ref: '#/components/parameters/composite' + responses: + '200': + description: OK + content: + image/jpeg: + schema: + format: binary + type: string + '404': + description: Collection not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Content.GetCollectionImage(ctx, operations.GetCollectionImageRequest{ + CollectionID: 474227, + UpdatedAt: 759379, + }) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCollectionImageRequest; + import dev.plexapi.sdk.models.operations.GetCollectionImageResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCollectionImageRequest req = GetCollectionImageRequest.builder() + .collectionId(474227L) + .updatedAt(759379L) + .build(); + + GetCollectionImageResponse res = sdk.content().getCollectionImage() + .request(req) + .call(); + + if (res.responseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.content.getCollectionImage({ + collectionId: 474227, + updatedAt: 759379, + }); + + console.log(result); + } + + run(); + /library/collections/{collectionId}/items/{itemId}: + put: + summary: Delete an item from a collection + operationId: deleteCollectionItem + description: Delete an item from a collection + tags: + - Library Collections + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: collectionId + description: The collection id + in: path + required: true + schema: + type: integer + - name: itemId + description: The item to delete + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '400': + description: Item not found + content: + text/html: {} + '404': + description: Collection not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryCollections.DeleteCollectionItem(ctx, operations.DeleteCollectionItemRequest{ + CollectionID: 320928, + ItemID: 406983, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteCollectionItemRequest; + import dev.plexapi.sdk.models.operations.DeleteCollectionItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteCollectionItemRequest req = DeleteCollectionItemRequest.builder() + .collectionId(320928L) + .itemId(406983L) + .build(); + + DeleteCollectionItemResponse res = sdk.libraryCollections().deleteCollectionItem() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryCollections.deleteCollectionItem({ + collectionId: 320928, + itemId: 406983, + }); + + console.log(result); + } + + run(); + /library/collections/{collectionId}/items/{itemId}/move: + put: + summary: Reorder an item in the collection + operationId: moveCollectionItem + description: Reorder items in a collection with one item after another + tags: + - Library Collections + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: collectionId + description: The collection id + in: path + required: true + schema: + type: integer + - name: itemId + description: The item to move + in: path + required: true + schema: + type: integer + - name: after + description: The item to move this item after. If not provided, this item will be moved to the beginning + in: query + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '400': + description: Item not found + content: + text/html: {} + '404': + description: Collection not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryCollections.MoveCollectionItem(ctx, operations.MoveCollectionItemRequest{ + CollectionID: 239532, + ItemID: 513864, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.MoveCollectionItemRequest; + import dev.plexapi.sdk.models.operations.MoveCollectionItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MoveCollectionItemRequest req = MoveCollectionItemRequest.builder() + .collectionId(239532L) + .itemId(513864L) + .build(); + + MoveCollectionItemResponse res = sdk.libraryCollections().moveCollectionItem() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryCollections.moveCollectionItem({ + collectionId: 239532, + itemId: 513864, + }); + + console.log(result); + } + + run(); + /library/media/{mediaId}/chapterImages/{chapter}: + get: + summary: Get a chapter image + operationId: getChapterImage + description: Get a single chapter image for a piece of media + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: mediaId + description: The id of the media item + in: path + required: true + schema: + type: integer + - name: chapter + description: The index of the chapter + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + image/jpeg: + schema: + format: binary + type: string + '404': + description: Either the media item or the chapter image was not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetChapterImage(ctx, operations.GetChapterImageRequest{ + MediaID: 892563, + Chapter: 48348, + }) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetChapterImageRequest; + import dev.plexapi.sdk.models.operations.GetChapterImageResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetChapterImageRequest req = GetChapterImageRequest.builder() + .mediaId(892563L) + .chapter(48348L) + .build(); + + GetChapterImageResponse res = sdk.library().getChapterImage() + .request(req) + .call(); + + if (res.responseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getChapterImage({ + mediaId: 892563, + chapter: 48348, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/{element}: + post: + summary: Set an item's artwork, theme, etc + operationId: setItemArtwork + description: |- + 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 + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: element + in: path + required: true + schema: + type: string + enum: + - thumb + - art + - clearLogo + - banner + - poster + - theme + - name: url + description: The url of the new asset. If not provided, the binary of the asset must be provided in the post body. + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.SetItemArtwork(ctx, operations.SetItemArtworkRequest{ + Ids: "", + Element: operations.ElementBanner, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetItemArtworkRequest req = SetItemArtworkRequest.builder() + .ids("") + .element(Element.BANNER) + .build(); + + SetItemArtworkResponse res = sdk.library().setItemArtwork() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { SetItemArtworkElement } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.setItemArtwork({ + ids: "", + element: SetItemArtworkElement.Banner, + }); + + console.log(result); + } + + run(); + put: + summary: Set an item's artwork, theme, etc + operationId: updateItemArtwork + description: |- + 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 + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: element + in: path + required: true + schema: + type: string + enum: + - thumb + - art + - clearLogo + - banner + - poster + - theme + - name: url + description: The url of the new asset. + in: query + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.UpdateItemArtwork(ctx, operations.UpdateItemArtworkRequest{ + Ids: "", + Element: operations.PathParamElementClearLogo, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + UpdateItemArtworkRequest req = UpdateItemArtworkRequest.builder() + .ids("") + .element(PathParamElement.CLEAR_LOGO) + .build(); + + UpdateItemArtworkResponse res = sdk.library().updateItemArtwork() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { UpdateItemArtworkElement } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.updateItemArtwork({ + ids: "", + element: UpdateItemArtworkElement.ClearLogo, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/marker/{marker}: + delete: + summary: Delete a marker + operationId: deleteMarker + description: Delete a marker for this user on the metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: marker + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Marker is not a bookmark + content: + text/html: {} + '404': + description: Marker could not be found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteMarker(ctx, operations.DeleteMarkerRequest{ + Ids: "", + Marker: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteMarkerRequest; + import dev.plexapi.sdk.models.operations.DeleteMarkerResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteMarkerRequest req = DeleteMarkerRequest.builder() + .ids("") + .marker("") + .build(); + + DeleteMarkerResponse res = sdk.library().deleteMarker() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteMarker({ + ids: "", + marker: "", + }); + + console.log(result); + } + + run(); + put: + summary: Edit a marker + operationId: editMarker + description: Edit a marker for this user on the metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: marker + description: The id of the marker to edit + in: path + required: true + schema: + type: string + - name: type + description: The type of marker to edit/create + in: query + required: true + schema: + type: integer + - name: startTimeOffset + description: The start time of the marker + in: query + required: true + schema: + type: integer + - name: endTimeOffset + description: The end time of the marker + in: query + schema: + type: integer + - name: attributes + description: The attributes to assign to this marker + in: query + style: deepObject + schema: + type: object + example: + title: My favorite spot + responses: + '200': + $ref: '#/components/responses/post-responses-200' + '400': + $ref: '#/components/responses/responses-400' + '404': + description: The marker could not be found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.EditMarker(ctx, operations.EditMarkerRequest{ + Ids: "", + Marker: "", + Type: 884347, + StartTimeOffset: 517251, + Attributes: &operations.QueryParamAttributes{}, + }) + if err != nil { + log.Fatal(err) + } + if res.PostResponses200 != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + EditMarkerRequest req = EditMarkerRequest.builder() + .ids("") + .marker("") + .type(884347L) + .startTimeOffset(517251L) + .attributes(QueryParamAttributes.builder() + .build()) + .build(); + + EditMarkerResponse res = sdk.library().editMarker() + .request(req) + .call(); + + if (res.postResponses200().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.editMarker({ + ids: "", + marker: "", + type: 884347, + startTimeOffset: 517251, + attributes: {}, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/media/{mediaItem}: + delete: + summary: Delete a media item + operationId: deleteMediaItem + description: Delete a single media from a metadata item in the library + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: mediaItem + in: path + required: true + schema: + type: string + - name: proxy + description: Whether proxy items, such as media optimized versions, should also be deleted. Defaults to false. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + $ref: '#/components/responses/200' + '400': + description: Media item could not be deleted + content: + text/html: {} + '404': + description: Media item could not be found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteMediaItem(ctx, operations.DeleteMediaItemRequest{ + Ids: "", + MediaItem: "", + Proxy: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteMediaItemRequest; + import dev.plexapi.sdk.models.operations.DeleteMediaItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteMediaItemRequest req = DeleteMediaItemRequest.builder() + .ids("") + .mediaItem("") + .proxy(BoolInt.ONE) + .build(); + + DeleteMediaItemResponse res = sdk.library().deleteMediaItem() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteMediaItem({ + ids: "", + mediaItem: "", + proxy: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/parts/{partId}/indexes/{index}: + get: + summary: Get BIF index for a part + operationId: getPartIndex + description: Get BIF index for a part by index type + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: partId + description: The part id who's index is to be fetched + in: path + required: true + schema: + type: integer + - name: index + description: The type of index to grab. + in: path + required: true + schema: + type: string + enum: + - sd + - name: interval + description: The interval between images to return in ms. + in: query + schema: + type: integer + responses: + '200': + description: OK + content: + application/octet-stream: + schema: + format: binary + type: string + '404': + description: The part or the index doesn't exist or the interval is too small + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetPartIndex(ctx, operations.GetPartIndexRequest{ + PartID: 724750, + Index: operations.IndexSd, + }) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPartIndexRequest req = GetPartIndexRequest.builder() + .partId(724750L) + .index(Index.SD) + .build(); + + GetPartIndexResponse res = sdk.library().getPartIndex() + .request(req) + .call(); + + if (res.responseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { GetPartIndexIndex } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getPartIndex({ + partId: 724750, + index: GetPartIndexIndex.Sd, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/collection/{collectionId}: + delete: + summary: Delete a collection + operationId: deleteCollection + description: Delete a library collection from the PMS + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: collectionId + description: Collection Id + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/200' + '404': + description: Collection not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteCollection(ctx, operations.DeleteCollectionRequest{ + SectionID: 283619, + CollectionID: 680895, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteCollectionRequest; + import dev.plexapi.sdk.models.operations.DeleteCollectionResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteCollectionRequest req = DeleteCollectionRequest.builder() + .sectionId(283619L) + .collectionId(680895L) + .build(); + + DeleteCollectionResponse res = sdk.library().deleteCollection() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteCollection({ + sectionId: 283619, + collectionId: 680895, + }); + + console.log(result); + } + + run(); + /library/sections/{sectionId}/composite/{updatedAt}: + get: + summary: Get a section composite image + operationId: getSectionImage + description: Get a composite image of images in this section + tags: + - Library + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sectionId + description: Section identifier + in: path + required: true + schema: + type: integer + - name: updatedAt + description: The update time of the image. Used for busting cache. + in: path + required: true + schema: + type: integer + - $ref: '#/components/parameters/mediaQuery' + - $ref: '#/components/parameters/composite' + responses: + '200': + $ref: '#/components/responses/200' + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetSectionImage(ctx, operations.GetSectionImageRequest{ + SectionID: 925611, + UpdatedAt: 117413, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSectionImageRequest; + import dev.plexapi.sdk.models.operations.GetSectionImageResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSectionImageRequest req = GetSectionImageRequest.builder() + .sectionId(925611L) + .updatedAt(117413L) + .build(); + + GetSectionImageResponse res = sdk.library().getSectionImage() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getSectionImage({ + sectionId: 925611, + updatedAt: 117413, + }); + + console.log(result); + } + + run(); + /library/streams/{streamId}.{ext}: + delete: + summary: Delete a stream + operationId: deleteStream + description: Delete a stream. Only applies to downloaded subtitle streams or a sidecar subtitle when media deletion is enabled. + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: streamId + description: The id of the stream + in: path + required: true + schema: + type: integer + - name: ext + description: This is not a part of this endpoint but documented here to satisfy OpenAPI + in: path + required: true + schema: + type: string + responses: + '200': + $ref: '#/components/responses/200' + '403': + description: This user cannot delete this stream + content: + text/html: {} + '500': + description: The stream cannot be deleted + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.DeleteStream(ctx, operations.DeleteStreamRequest{ + StreamID: 841510, + Ext: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeleteStreamRequest; + import dev.plexapi.sdk.models.operations.DeleteStreamResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeleteStreamRequest req = DeleteStreamRequest.builder() + .streamId(841510L) + .ext("") + .build(); + + DeleteStreamResponse res = sdk.library().deleteStream() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.deleteStream({ + streamId: 841510, + ext: "", + }); + + console.log(result); + } + + run(); + get: + summary: Get a stream + operationId: getStream + description: Get a stream (such as a sidecar subtitle stream) + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: streamId + description: The id of the stream + in: path + required: true + schema: + type: integer + - name: ext + description: The extension of the stream. Required to fetch the `sub` portion of `idx`/`sub` subtitles + in: path + required: true + schema: + type: string + - name: encoding + description: The requested encoding for the subtitle (only used for text subtitles) + in: query + required: false + schema: + type: string + - name: format + description: The requested format for the subtitle to convert the subtitles to (only used for text subtitles) + in: query + required: false + schema: + type: string + - name: autoAdjustSubtitle + description: Whether the server should attempt to automatically adjust the subtitle timestamps to match the media + in: query + required: false + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: The stream in the requested format. + '403': + description: The media is not accessible to the user + content: + text/html: {} + '404': + description: The stream doesn't exist or has no data + content: + text/html: {} + '501': + description: The stream is not a sidecar subtitle + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetStream(ctx, operations.GetStreamRequest{ + StreamID: 314506, + Ext: "", + AutoAdjustSubtitle: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetStreamRequest; + import dev.plexapi.sdk.models.operations.GetStreamResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetStreamRequest req = GetStreamRequest.builder() + .streamId(314506L) + .ext("") + .autoAdjustSubtitle(BoolInt.ONE) + .build(); + + GetStreamResponse res = sdk.library().getStream() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getStream({ + streamId: 314506, + ext: "", + autoAdjustSubtitle: BoolInt.One, + }); + + console.log(result); + } + + run(); + put: + summary: Set a stream offset + operationId: setStreamOffset + description: Set a stream offset in ms. This may not be respected by all clients + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: streamId + description: The id of the stream + in: path + required: true + schema: + type: integer + - name: ext + description: This is not a part of this endpoint but documented here to satisfy OpenAPI + in: path + required: true + schema: + type: string + - name: offset + description: The offest in ms + in: query + required: false + schema: + type: integer + responses: + '200': + description: The stream in the requested format. + '400': + description: The stream doesn't exist + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.SetStreamOffset(ctx, operations.SetStreamOffsetRequest{ + StreamID: 606295, + Ext: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.SetStreamOffsetRequest; + import dev.plexapi.sdk.models.operations.SetStreamOffsetResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + SetStreamOffsetRequest req = SetStreamOffsetRequest.builder() + .streamId(606295L) + .ext("") + .build(); + + SetStreamOffsetResponse res = sdk.library().setStreamOffset() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.setStreamOffset({ + streamId: 606295, + ext: "", + }); + + console.log(result); + } + + run(); + /livetv/dvrs/{dvrId}/channels/{channel}/tune: + post: + summary: Tune a channel on a DVR + operationId: tuneChannel + description: Tune a channel on a DVR to the provided channel + tags: + - DVRs + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + - name: channel + description: The channel ID to tune + in: path + required: true + schema: + type: string + example: '2.1' + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithMetadata' + '500': + description: Tuning failed + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.TuneChannel(ctx, operations.TuneChannelRequest{ + DvrID: 834281, + Channel: "2.1", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.TuneChannelRequest; + import dev.plexapi.sdk.models.operations.TuneChannelResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + TuneChannelRequest req = TuneChannelRequest.builder() + .dvrId(834281L) + .channel("2.1") + .build(); + + TuneChannelResponse res = sdk.dvRs().tuneChannel() + .request(req) + .call(); + + if (res.mediaContainerWithMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.tuneChannel({ + dvrId: 834281, + channel: "2.1", + }); + + console.log(result); + } + + run(); + /livetv/dvrs/{dvrId}/devices/{deviceId}: + delete: + summary: Remove a device from an existing DVR + operationId: removeDeviceFromDVR + description: Remove a device from an existing DVR + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + - name: deviceId + description: The ID of the device to add. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.RemoveDeviceFromDVR(ctx, operations.RemoveDeviceFromDVRRequest{ + DvrID: 945416, + DeviceID: 260761, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.RemoveDeviceFromDVRRequest; + import dev.plexapi.sdk.models.operations.RemoveDeviceFromDVRResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RemoveDeviceFromDVRRequest req = RemoveDeviceFromDVRRequest.builder() + .dvrId(945416L) + .deviceId(260761L) + .build(); + + RemoveDeviceFromDVRResponse res = sdk.dvRs().removeDeviceFromDVR() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.removeDeviceFromDVR({ + dvrId: 945416, + deviceId: 260761, + }); + + console.log(result); + } + + run(); + put: + summary: Add a device to an existing DVR + operationId: addDeviceToDVR + description: Add a device to an existing DVR + tags: + - DVRs + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: dvrId + description: The ID of the DVR. + in: path + required: true + schema: + type: integer + - name: deviceId + description: The ID of the device to add. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.DVRs.AddDeviceToDVR(ctx, operations.AddDeviceToDVRRequest{ + DvrID: 334755, + DeviceID: 852930, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.AddDeviceToDVRRequest; + import dev.plexapi.sdk.models.operations.AddDeviceToDVRResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + AddDeviceToDVRRequest req = AddDeviceToDVRRequest.builder() + .dvrId(334755L) + .deviceId(852930L) + .build(); + + AddDeviceToDVRResponse res = sdk.dvRs().addDeviceToDVR() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.dvRs.addDeviceToDVR({ + dvrId: 334755, + deviceId: 852930, + }); + + console.log(result); + } + + run(); + /livetv/epg/countries/{country}/{epgId}/lineups: + get: + summary: Get lineups for a country via postal code + operationId: getCountriesLineups + description: Returns a list of lineups for a given country, EPG provider and postal code + tags: + - EPG + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: country + description: 3 letter country code + in: path + required: true + schema: + type: string + - name: epgId + description: The `providerIdentifier` of the provider + in: path + required: true + schema: + type: string + - name: postalCode + description: The postal code for the lineups to fetch + in: query + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithLineup' + '404': + description: No provider with the identifier was found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Epg.GetCountriesLineups(ctx, operations.GetCountriesLineupsRequest{ + Country: "Malawi", + EpgID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithLineup != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCountriesLineupsRequest; + import dev.plexapi.sdk.models.operations.GetCountriesLineupsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCountriesLineupsRequest req = GetCountriesLineupsRequest.builder() + .country("Malawi") + .epgId("") + .build(); + + GetCountriesLineupsResponse res = sdk.epg().getCountriesLineups() + .request(req) + .call(); + + if (res.mediaContainerWithLineup().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.epg.getCountriesLineups({ + country: "Malawi", + epgId: "", + }); + + console.log(result); + } + + run(); + /livetv/epg/countries/{country}/{epgId}/regions: + get: + summary: Get regions for a country + operationId: getCountryRegions + description: Get regions for a country within an EPG provider + tags: + - EPG + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: country + description: 3 letter country code + in: path + required: true + schema: + type: string + - name: epgId + description: The `providerIdentifier` of the provider + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Country: + items: + properties: + key: + type: string + national: + type: boolean + title: + type: string + type: + type: string + type: object + type: array + type: object + type: object + '404': + description: No provider with the identifier was found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Epg.GetCountryRegions(ctx, operations.GetCountryRegionsRequest{ + Country: "Morocco", + EpgID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetCountryRegionsRequest; + import dev.plexapi.sdk.models.operations.GetCountryRegionsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetCountryRegionsRequest req = GetCountryRegionsRequest.builder() + .country("Morocco") + .epgId("") + .build(); + + GetCountryRegionsResponse res = sdk.epg().getCountryRegions() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.epg.getCountryRegions({ + country: "Morocco", + epgId: "", + }); + + console.log(result); + } + + run(); + /livetv/sessions/{sessionId}/{consumerId}/index.m3u8: + get: + summary: Get a session playlist index + operationId: getSessionPlaylistIndex + description: Get a playlist index for playing this session + tags: + - Live TV + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sessionId + description: The session id + in: path + required: true + schema: + type: string + - name: consumerId + description: The consumer id + in: path + required: true + schema: + type: string + responses: + '200': + description: Index playlist for playing HLS content + content: + application/vnd.apple.mpegurl: {} + '404': + description: Session or consumer not found + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LiveTV.GetSessionPlaylistIndex(ctx, operations.GetSessionPlaylistIndexRequest{ + SessionID: "", + ConsumerID: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSessionPlaylistIndexRequest; + import dev.plexapi.sdk.models.operations.GetSessionPlaylistIndexResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSessionPlaylistIndexRequest req = GetSessionPlaylistIndexRequest.builder() + .sessionId("") + .consumerId("") + .build(); + + GetSessionPlaylistIndexResponse res = sdk.liveTV().getSessionPlaylistIndex() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.liveTV.getSessionPlaylistIndex({ + sessionId: "", + consumerId: "", + }); + + console.log(result); + } + + run(); + /media/grabbers/devices/{deviceId}/thumb/{version}: + get: + summary: Get device thumb + operationId: getThumb + description: Get a device's thumb for display to the user + tags: + - Devices + security: + - token: + - admin + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: deviceId + description: The ID of the device. + in: path + required: true + schema: + type: integer + - name: version + description: A version number of the thumb used for busting cache + in: path + required: true + schema: + type: integer + responses: + '200': + description: The thumbnail for the device + '301': + description: The thumb URL on the device + '404': + description: No thumb found for this device + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Devices.GetThumb(ctx, operations.GetThumbRequest{ + DeviceID: 960617, + VersionPathParameter: 1025, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetThumbRequest; + import dev.plexapi.sdk.models.operations.GetThumbResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetThumbRequest req = GetThumbRequest.builder() + .deviceId(960617L) + .versionPathParameter(1025L) + .build(); + + GetThumbResponse res = sdk.devices().getThumb() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.devices.getThumb({ + deviceId: 960617, + versionPathParameter: 1025, + }); + + console.log(result); + } + + run(); + /playlists/{playlistId}/items/{generatorId}: + delete: + summary: Delete a Generator + operationId: deletePlaylistItem + description: Deletes an item from a playlist. Only works with dumb playlists. + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: generatorId + description: The generator item ID to delete. + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) or generator not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.DeletePlaylistItem(ctx, operations.DeletePlaylistItemRequest{ + PlaylistID: 981646, + GeneratorID: 194010, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeletePlaylistItemRequest; + import dev.plexapi.sdk.models.operations.DeletePlaylistItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeletePlaylistItemRequest req = DeletePlaylistItemRequest.builder() + .playlistId(981646L) + .generatorId(194010L) + .build(); + + DeletePlaylistItemResponse res = sdk.libraryPlaylists().deletePlaylistItem() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.deletePlaylistItem({ + playlistId: 981646, + generatorId: 194010, + }); + + console.log(result); + } + + run(); + get: + summary: Get a playlist generator + operationId: getPlaylistGenerator + description: Get a playlist's generator. Only used for optimized versions + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: generatorId + description: The generator item ID to delete. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Item: + items: + properties: + composite: + description: The composite thumbnail image path + type: string + Device: + properties: + profile: + type: string + type: object + id: + type: integer + Location: + properties: + librarySectionID: + type: integer + uri: + type: string + type: object + MediaSettings: + properties: + advancedSubtitles: + enum: + - auto + - burn + - none + - sidecar + - embedded + - segmented + type: string + audioBoost: + type: integer + audioChannelCount: + type: integer + autoAdjustQuality: + type: boolean + autoAdjustSubtitle: + type: boolean + directPlay: + type: boolean + directStream: + type: boolean + directStreamAudio: + type: boolean + disableResolutionRotation: + type: boolean + maxVideoBitrate: + type: integer + musicBitrate: + type: integer + peakBitrate: + type: integer + photoQuality: + maximum: 100 + minimum: 0 + type: integer + photoResolution: + type: string + secondsPerSegment: + type: integer + subtitles: + enum: + - auto + - burn + - none + - sidecar + - embedded + - segmented + type: string + subtitleSize: + type: integer + videoBitrate: + type: integer + videoQuality: + maximum: 100 + minimum: 0 + type: integer + videoResolution: + type: string + type: object + Policy: + properties: + scope: + enum: + - all + - count + type: string + unwatched: + description: True if only unwatched items are optimized + type: boolean + value: + description: If the scope is count, the number of items to optimize + type: integer + type: object + Status: + properties: + itemsCompleteCount: + type: integer + itemsCount: + type: integer + itemsSuccessfulCount: + type: integer + state: + enum: + - pending + - complete + - failed + type: string + totalSize: + type: integer + type: object + target: + type: string + targetTagID: + description: The tag of this generator's settings + type: integer + title: + type: string + type: + description: The type of this generator + enum: + - -1 + - 42 + type: integer + type: object + type: array + type: object + type: object + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) or generator not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.GetPlaylistGenerator(ctx, operations.GetPlaylistGeneratorRequest{ + PlaylistID: 744880, + GeneratorID: 322168, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPlaylistGeneratorRequest; + import dev.plexapi.sdk.models.operations.GetPlaylistGeneratorResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPlaylistGeneratorRequest req = GetPlaylistGeneratorRequest.builder() + .playlistId(744880L) + .generatorId(322168L) + .build(); + + GetPlaylistGeneratorResponse res = sdk.libraryPlaylists().getPlaylistGenerator() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.getPlaylistGenerator({ + playlistId: 744880, + generatorId: 322168, + }); + + console.log(result); + } + + run(); + put: + summary: Modify a Generator + operationId: modifyPlaylistGenerator + description: Modify a playlist generator. Only used for optimizer + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: generatorId + description: The generator item ID to modify. + in: path + required: true + schema: + type: integer + - name: Item + description: | + Note: OpenAPI cannot properly render this query parameter example ([See GHI](https://github.com/OAI/OpenAPI-Specification/issues/1706)). It should be rendered as: + + Item[type]=42&Item[title]=Jack-Jack Attack&Item[target]=&Item[targetTagID]=1&Item[locationID]=-1&Item[Location][uri]=library://82503060-0d68-4603-b594-8b071d54819e/item//library/metadata/146&Item[Policy][scope]=all&Item[Policy][value]=&Item[Policy][unwatched]=0 + in: query + style: deepObject + explode: true + schema: + type: object + properties: + Location: + type: object + properties: + uri: + type: string + locationID: + type: integer + Policy: + type: object + properties: + value: + type: integer + scope: + type: string + enum: + - all + - count + unwatched: + $ref: "#/components/schemas/BoolInt" + target: + type: string + targetTagID: + type: integer + title: + type: string + type: + type: integer + example: + Location: + uri: library://82503060-0d68-4603-b594-8b071d54819e/item/%2Flibrary%2Fmetadata%2F146 + locationID: -1 + Policy: + value: '' + scope: all + unwatched: 0 + target: '' + targetTagID: 1 + title: Jack-Jack Attack + type: 42 + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) or generator not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.ModifyPlaylistGenerator(ctx, operations.ModifyPlaylistGeneratorRequest{ + PlaylistID: 972007, + GeneratorID: 208334, + Item: &operations.Item{ + Location: &operations.ModifyPlaylistGeneratorQueryParamLocation{ + URI: plexgo.Pointer("library://82503060-0d68-4603-b594-8b071d54819e/item/%2Flibrary%2Fmetadata%2F146"), + }, + LocationID: plexgo.Pointer[int64](-1), + Policy: &operations.Policy{ + Value: plexgo.Pointer[int64](), + Scope: operations.QueryParamScopeAll.ToPointer(), + Unwatched: components.BoolIntZero.ToPointer(), + }, + Target: plexgo.Pointer(""), + TargetTagID: plexgo.Pointer[int64](1), + Title: plexgo.Pointer("Jack-Jack Attack"), + Type: plexgo.Pointer[int64](42), + }, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { ModifyPlaylistGeneratorScope } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.modifyPlaylistGenerator({ + playlistId: 972007, + generatorId: 208334, + item: { + location: { + uri: "library://82503060-0d68-4603-b594-8b071d54819e/item/%2Flibrary%2Fmetadata%2F146", + }, + locationID: -1, + policy: { + scope: ModifyPlaylistGeneratorScope.All, + unwatched: BoolInt.Zero, + }, + target: "", + targetTagID: 1, + title: "Jack-Jack Attack", + type: 42, + }, + }); + + console.log(result); + } + + run(); + /playlists/{playlistId}/items/{generatorId}/items: + get: + summary: Get a playlist generator's items + operationId: getPlaylistGeneratorItems + description: Get a playlist generator's items + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: generatorId + description: The generator item ID to delete. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + - properties: + processingState: + description: The state of processing if this generator is part of an optimizer playlist + enum: + - processed + - completed + - tombstoned + - disabled + - error + - pending + type: string + processingStateContext: + description: The error which could have occurred (or `good`) + enum: + - good + - sourceFileUnavailable + - sourceFileMetadataError + - clientProfileError + - ioError + - transcoderError + - unknownError + - mediaAnalysisError + - downloadFailed + - accessDenied + - cannotTranscode + - codecInstallError + type: string + type: object + type: object + type: object + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) or generator not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.GetPlaylistGeneratorItems(ctx, operations.GetPlaylistGeneratorItemsRequest{ + PlaylistID: 77230, + GeneratorID: 979714, + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetPlaylistGeneratorItemsRequest; + import dev.plexapi.sdk.models.operations.GetPlaylistGeneratorItemsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetPlaylistGeneratorItemsRequest req = GetPlaylistGeneratorItemsRequest.builder() + .playlistId(77230L) + .generatorId(979714L) + .build(); + + GetPlaylistGeneratorItemsResponse res = sdk.libraryPlaylists().getPlaylistGeneratorItems() + .request(req) + .call(); + + if (res.object().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.getPlaylistGeneratorItems({ + playlistId: 77230, + generatorId: 979714, + }); + + console.log(result); + } + + run(); + /playlists/{playlistId}/items/{playlistItemId}/move: + put: + summary: Moving items in a playlist + operationId: movePlaylistItem + description: Moves an item in a playlist. Only works with dumb playlists. + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: playlistItemId + description: The playlist item ID to move. + in: path + required: true + schema: + type: integer + - name: after + description: The playlist item ID to insert the new item after. If not provided, item is moved to beginning of playlist + in: query + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.MovePlaylistItem(ctx, operations.MovePlaylistItemRequest{ + PlaylistID: 940298, + PlaylistItemID: 375626, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.MovePlaylistItemRequest; + import dev.plexapi.sdk.models.operations.MovePlaylistItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MovePlaylistItemRequest req = MovePlaylistItemRequest.builder() + .playlistId(940298L) + .playlistItemId(375626L) + .build(); + + MovePlaylistItemResponse res = sdk.libraryPlaylists().movePlaylistItem() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.movePlaylistItem({ + playlistId: 940298, + playlistItemId: 375626, + }); + + console.log(result); + } + + run(); + /playQueues/{playQueueId}/items/{playQueueItemId}: + delete: + summary: Delete an item from a play queue + operationId: deletePlayQueueItem + description: Deletes an item in a play queue. Increments the version of the play queue. Returns the modified play queue. + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + - name: playQueueItemId + description: The play queue item ID to delete. + in: path + required: true + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Play queue not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.DeletePlayQueueItem(ctx, operations.DeletePlayQueueItemRequest{ + PlayQueueID: 285738, + PlayQueueItemID: 464354, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.DeletePlayQueueItemRequest; + import dev.plexapi.sdk.models.operations.DeletePlayQueueItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + DeletePlayQueueItemRequest req = DeletePlayQueueItemRequest.builder() + .playQueueId(285738L) + .playQueueItemId(464354L) + .build(); + + DeletePlayQueueItemResponse res = sdk.playQueue().deletePlayQueueItem() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.deletePlayQueueItem({ + playQueueId: 285738, + playQueueItemId: 464354, + }); + + console.log(result); + } + + run(); + /playQueues/{playQueueId}/items/{playQueueItemId}/move: + put: + summary: Move an item in a play queue + operationId: movePlayQueueItem + description: Moves an item in a play queue, and increases the version of the play queue. Returns the modified play queue. + tags: + - Play Queue + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playQueueId + description: The ID of the play queue. + in: path + required: true + schema: + type: integer + - name: playQueueItemId + description: The play queue item ID to delete. + in: path + required: true + schema: + type: integer + - name: after + description: The play queue item ID to insert the new item after. If not present, moves to the beginning. + in: query + schema: + type: integer + responses: + '200': + $ref: '#/components/responses/slash-post-responses-200' + '400': + $ref: '#/components/responses/400' + '404': + description: Play queue or queue item not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.PlayQueue.MovePlayQueueItem(ctx, operations.MovePlayQueueItemRequest{ + PlayQueueID: 31341, + PlayQueueItemID: 495865, + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithPlaylistMetadata != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.MovePlayQueueItemRequest; + import dev.plexapi.sdk.models.operations.MovePlayQueueItemResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + MovePlayQueueItemRequest req = MovePlayQueueItemRequest.builder() + .playQueueId(31341L) + .playQueueItemId(495865L) + .build(); + + MovePlayQueueItemResponse res = sdk.playQueue().movePlayQueueItem() + .request(req) + .call(); + + if (res.mediaContainerWithPlaylistMetadata().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.playQueue.movePlayQueueItem({ + playQueueId: 31341, + playQueueItemId: 495865, + }); + + console.log(result); + } + + run(); + /library/metadata/{ids}/{element}/{timestamp}: + get: + summary: Get an item's artwork, theme, etc + operationId: getItemArtwork + description: Get the artwork, thumb, element for a metadata item + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: ids + in: path + required: true + schema: + type: string + - name: element + in: path + required: true + schema: + type: string + enum: + - thumb + - art + - clearLogo + - banner + - poster + - theme + - name: timestamp + description: A timestamp on the element used for cache management in the client + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + audio/mpeg3: + schema: + format: binary + type: string + image/jpeg: + schema: + format: binary + type: string + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetItemArtwork(ctx, operations.GetItemArtworkRequest{ + Ids: "", + Element: operations.GetItemArtworkPathParamElementPoster, + Timestamp: 999555, + }) + if err != nil { + log.Fatal(err) + } + if res.TwoHundredAudioMpeg3ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetItemArtworkRequest req = GetItemArtworkRequest.builder() + .ids("") + .element(GetItemArtworkPathParamElement.POSTER) + .timestamp(999555L) + .build(); + + GetItemArtworkResponse res = sdk.library().getItemArtwork() + .request(req) + .call(); + + if (res.twoHundredAudioMpeg3ResponseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { GetItemArtworkElement } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getItemArtwork({ + ids: "", + element: GetItemArtworkElement.Poster, + timestamp: 999555, + }); + + console.log(result); + } + + run(); + /library/parts/{partId}/{changestamp}/{filename}: + get: + summary: Get a media part + operationId: getMediaPart + description: | + 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. + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: partId + description: The part id who's index is to be fetched + in: path + required: true + schema: + type: integer + - name: changestamp + description: The changestamp of the part; used for busting potential caches. Provided in the `key` for the part + in: path + required: true + schema: + type: integer + - name: filename + description: A generic filename used for a client media stack which relies on the extension in the request. Provided in the `key` for the part + in: path + required: true + schema: + type: string + - name: download + description: Whether this is a file download + in: query + schema: + $ref: "#/components/schemas/BoolInt" + responses: + '200': + description: OK + headers: + Content-Disposition: + description: 'Note: This header is only included in download requests' + schema: + type: string + '403': + description: Client requested download and server owner has forbidden download of media + content: + text/html: {} + '404': + description: The part doesn't exist + content: + text/html: {} + '503': + description: Client requested the part without a decision and no decision could be made or decision is for a transcode + content: + text/html: {} + '509': + description: Client requested the part without a decision and no decision could be made because there is insufficient bandwidth for client to direct play this part + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetMediaPart(ctx, operations.GetMediaPartRequest{ + PartID: 877105, + Changestamp: 970622, + Filename: "example.file", + Download: components.BoolIntOne.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetMediaPartRequest; + import dev.plexapi.sdk.models.operations.GetMediaPartResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import dev.plexapi.sdk.models.shared.BoolInt; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetMediaPartRequest req = GetMediaPartRequest.builder() + .partId(877105L) + .changestamp(970622L) + .filename("example.file") + .download(BoolInt.ONE) + .build(); + + GetMediaPartResponse res = sdk.library().getMediaPart() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getMediaPart({ + partId: 877105, + changestamp: 970622, + filename: "example.file", + download: BoolInt.One, + }); + + console.log(result); + } + + run(); + /library/parts/{partId}/indexes/{index}/{offset}: + get: + summary: Get an image from part BIF + operationId: getImageFromBif + description: Extract an image from the BIF for a part at a particular offset + tags: + - Library + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: partId + description: The part id who's index is to be fetched + in: path + required: true + schema: + type: integer + - name: index + description: The type of index to grab. + in: path + required: true + schema: + type: string + enum: + - sd + - name: offset + description: The offset to seek in ms. + in: path + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + image/jpeg: + schema: + format: binary + type: string + '404': + description: The part or the index doesn't exist + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Library.GetImageFromBif(ctx, operations.GetImageFromBifRequest{ + PartID: 304273, + Index: operations.PathParamIndexSd, + Offset: 939569, + }) + if err != nil { + log.Fatal(err) + } + if res.ResponseStream != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetImageFromBifRequest req = GetImageFromBifRequest.builder() + .partId(304273L) + .index(PathParamIndex.SD) + .offset(939569L) + .build(); + + GetImageFromBifResponse res = sdk.library().getImageFromBif() + .request(req) + .call(); + + if (res.responseStream().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { GetImageFromBifIndex } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.library.getImageFromBif({ + partId: 304273, + index: GetImageFromBifIndex.Sd, + offset: 939569, + }); + + console.log(result); + } + + run(); + /livetv/epg/countries/{country}/{epgId}/regions/{region}/lineups: + get: + summary: Get lineups for a region + operationId: listLineups + description: Get lineups for a region within an EPG provider + tags: + - EPG + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: country + description: 3 letter country code + in: path + required: true + schema: + type: string + - name: epgId + description: The `providerIdentifier` of the provider + in: path + required: true + schema: + type: string + - name: region + description: The region for the lineup + in: path + required: true + schema: + type: string + responses: + '200': + description: OK + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of objects available + schema: + type: integer + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithLineup' + '404': + description: No provider with the identifier was found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.Epg.ListLineups(ctx, operations.ListLineupsRequest{ + Country: "Vanuatu", + EpgID: "", + Region: "", + }) + if err != nil { + log.Fatal(err) + } + if res.MediaContainerWithLineup != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.ListLineupsRequest; + import dev.plexapi.sdk.models.operations.ListLineupsResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + ListLineupsRequest req = ListLineupsRequest.builder() + .country("Vanuatu") + .epgId("") + .region("") + .build(); + + ListLineupsResponse res = sdk.epg().listLineups() + .request(req) + .call(); + + if (res.mediaContainerWithLineup().isPresent()) { + // handle response + } + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.epg.listLineups({ + country: "Vanuatu", + epgId: "", + region: "", + }); + + console.log(result); + } + + run(); + /livetv/sessions/{sessionId}/{consumerId}/{segmentId}: + get: + summary: Get a single session segment + operationId: getSessionSegment + description: Get a single LiveTV session segment + tags: + - Live TV + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: sessionId + description: The session id + in: path + required: true + schema: + type: string + - name: consumerId + description: The consumer id + in: path + required: true + schema: + type: string + - name: segmentId + description: The segment id + in: path + required: true + schema: + type: string + responses: + '200': + description: MPEG-TS segment for playing HLS content + '404': + description: Session, consumer, or segment not found + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LiveTV.GetSessionSegment(ctx, operations.GetSessionSegmentRequest{ + SessionID: "", + ConsumerID: "", + SegmentID: "", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.GetSessionSegmentRequest; + import dev.plexapi.sdk.models.operations.GetSessionSegmentResponse; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + GetSessionSegmentRequest req = GetSessionSegmentRequest.builder() + .sessionId("") + .consumerId("") + .segmentId("") + .build(); + + GetSessionSegmentResponse res = sdk.liveTV().getSessionSegment() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.liveTV.getSessionSegment({ + sessionId: "", + consumerId: "", + segmentId: "", + }); + + console.log(result); + } + + run(); + /playlists/{playlistId}/items/{generatorId}/{metadataId}/{action}: + put: + summary: Reprocess a generator + operationId: refreshPlaylist + description: Make a generator reprocess (refresh) + tags: + - Library Playlists + parameters: + - $ref: "#/components/parameters/accepts" + - $ref: "#/components/parameters/X-Plex-Client-Identifier" + - $ref: "#/components/parameters/X-Plex-Product" + - $ref: "#/components/parameters/X-Plex-Version" + - $ref: "#/components/parameters/X-Plex-Platform" + - $ref: "#/components/parameters/X-Plex-Platform-Version" + - $ref: "#/components/parameters/X-Plex-Device" + - $ref: "#/components/parameters/X-Plex-Model" + - $ref: "#/components/parameters/X-Plex-Device-Vendor" + - $ref: "#/components/parameters/X-Plex-Device-Name" + - $ref: "#/components/parameters/X-Plex-Marketplace" + - name: playlistId + description: The ID of the playlist + in: path + required: true + schema: + type: integer + - name: generatorId + description: The generator item ID to act on + in: path + required: true + schema: + type: integer + - name: metadataId + description: The metadata item ID to act on + in: path + required: true + schema: + type: integer + - name: action + description: The action to perform for this item on this optimizer queue + in: path + required: true + schema: + type: string + enum: + - reprocess + - disable + - enable + responses: + '200': + $ref: '#/components/responses/200' + '400': + $ref: '#/components/responses/400' + '404': + description: Playlist not found (or user may not have permission to access playlist) or generator or metadata item not found + content: + text/html: {} + x-codeSamples: + - lang: go + label: PlexGO + source: |- + package main + + import( + "context" + "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo" + "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(""), + ) + + res, err := s.LibraryPlaylists.RefreshPlaylist(ctx, operations.RefreshPlaylistRequest{ + PlaylistID: 895314, + GeneratorID: 629742, + MetadataID: 724422, + Action: operations.ActionDisable, + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - lang: java + label: PlexJava + source: |- + package hello.world; + + import dev.plexapi.sdk.PlexAPI; + import dev.plexapi.sdk.models.operations.*; + import dev.plexapi.sdk.models.shared.Accepts; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws Exception { + + PlexAPI sdk = PlexAPI.builder() + .accepts(Accepts.APPLICATION_XML) + .clientIdentifier("abc123") + .product("Plex for Roku") + .version("2.4.1") + .platform("Roku") + .platformVersion("4.3 build 1057") + .device("Roku 3") + .model("4200X") + .deviceVendor("Roku") + .deviceName("Living Room TV") + .marketplace("googlePlay") + .token(System.getenv().getOrDefault("TOKEN", "")) + .build(); + + RefreshPlaylistRequest req = RefreshPlaylistRequest.builder() + .playlistId(895314L) + .generatorId(629742L) + .metadataId(724422L) + .action(Action.DISABLE) + .build(); + + RefreshPlaylistResponse res = sdk.libraryPlaylists().refreshPlaylist() + .request(req) + .call(); + + // handle response + } + } + - lang: typescript + label: PlexJS + source: |- + import { PlexAPI } from "@lukehagar/plexjs"; + import { Action } from "@lukehagar/plexjs/sdk/models/operations"; + import { Accepts } from "@lukehagar/plexjs/sdk/models/shared"; + + const plexAPI = new PlexAPI({ + accepts: Accepts.ApplicationXml, + clientIdentifier: "abc123", + product: "Plex for Roku", + version: "2.4.1", + platform: "Roku", + platformVersion: "4.3 build 1057", + device: "Roku 3", + model: "4200X", + deviceVendor: "Roku", + deviceName: "Living Room TV", + marketplace: "googlePlay", + }); + + async function run() { + const result = await plexAPI.libraryPlaylists.refreshPlaylist({ + playlistId: 895314, + generatorId: 629742, + metadataId: 724422, + action: Action.Disable, + }); + + console.log(result); + } + + run(); +components: + securitySchemes: + token: + name: X-Plex-Token + description: | + The token which identifies the user accessing the PMS. This can be either: + - A traditional access token obtained from plex.tv + - A JWT token obtained through the JWT authentication flow + + JWT tokens provide better security with: + - Short-lived tokens (7 days expiration) + - Public-key cryptography (ED25519) + - Better clock synchronization + - Individual device revocation capability + type: apiKey + in: header + parameters: + accepts: + name: accepts + description: Indicates the client accepts the indicated media types + in: header + schema: + type: string + default: application/xml + enum: + - application/json + - application/xml + advancedSubtitles: + name: advancedSubtitles + description: | + Indicates how incompatible advanced subtitles (such as ass/ssa) should be included: * 'burn' - Burn incompatible advanced text subtitles into the video stream * 'text' - Transcode incompatible advanced text subtitles to a compatible text format, even if some markup is lost + in: query + schema: + type: string + enum: + - burn + - text + - unknown + example: burn + audioBoost: + name: audioBoost + description: Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc) + in: query + schema: + type: integer + minimum: 1 + example: 50 + audioChannelCount: + name: audioChannelCount + description: Target video number of audio channels. + in: query + schema: + type: integer + minimum: 1 + maximum: 8 + example: 5 + autoAdjustQuality: + name: autoAdjustQuality + description: Indicates the client supports ABR. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + autoAdjustSubtitle: + name: autoAdjustSubtitle + description: Indicates if the server should adjust subtitles based on Voice Activity Data. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + composite: + name: composite + in: query + schema: + type: object + properties: + type: + description: Limit composite to specified metadata types + type: integer + format: + description: The image type + type: string + enum: + - jpg + - png + backgroundColor: + description: 6 character hex RGB value for background color for image + type: string + border: + description: The width of the intra-image border + type: integer + cols: + description: Number of columns to construct in the composite image + type: integer + crop: + description: Where to crop source images to fit into composite image proportions + type: string + enum: + - center + - top + height: + description: The height of the image + type: integer + media: + description: The default image type to use as the sources + type: string + enum: + - thumb + - art + - banner + repeat: + description: Allow repetion of images if there are not enough source images to fill grid + type: boolean + rows: + description: Number of rows to construct in the composite image + type: integer + width: + description: The width of the image + type: integer + count: + name: count + description: Limit results to count items + in: query + schema: + type: integer + directPlay: + name: directPlay + description: Indicates the client supports direct playing the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + directStream: + name: directStream + description: Indicates the client supports direct streaming the video of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + directStreamAudio: + name: directStreamAudio + description: Indicates the client supports direct streaming the audio of the indicated content. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + disableResolutionRotation: + name: disableResolutionRotation + description: Indicates if resolution should be adjusted for orientation. + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + hasMDE: + name: hasMDE + description: Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1 + in: query + schema: + $ref: "#/components/schemas/BoolInt" + example: 1 + location: + name: location + description: Network type of the client, can be used to help determine target bitrate. + in: query + schema: + type: string + enum: + - lan + - wan + - cellular + example: wan + mediaBufferSize: + name: mediaBufferSize + description: Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks. + in: query + schema: + type: integer + example: 102400 + mediaIndex: + name: mediaIndex + description: Index of the media to transcode. -1 or not specified indicates let the server choose. + in: query + schema: + type: integer + example: 0 + mediaQuery: + name: mediaQuery + description: This is a complex query built of several parameters. See [API Info section](#section/API-Info/Media-Queries) for information on building media queries + in: query + schema: + type: object + musicBitrate: + name: musicBitrate + description: Target bitrate for audio only files (in kbps, used to transcode). + in: query + schema: + type: integer + minimum: 0 + example: 5000 + offset: + name: offset + description: Offset from the start of the media (in seconds). + in: query + schema: + type: number + example: 90.5 + partIndex: + name: partIndex + description: Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode + in: query + schema: + type: integer + example: 0 + path: + name: path + description: Internal PMS path of the media to transcode. + in: query + schema: + type: string + example: /library/metadata/151671 + peakBitrate: + name: peakBitrate + description: Maximum bitrate (in kbps) to use in ABR. + in: query + schema: + type: integer + minimum: 0 + example: 12000 + photoResolution: + name: photoResolution + description: Target photo resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 + protocol: + name: protocol + description: | + Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022) + in: query + schema: + type: string + enum: + - http + - hls + - dash + example: dash + secondsPerSegment: + name: secondsPerSegment + description: Number of seconds to include in each transcoded segment + in: query + schema: + type: integer + example: 5 + smart: + name: smart + description: Whether this is a smart collection/playlist + in: query + schema: + type: boolean + subtitles: + name: subtitles + description: | + Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream + in: query + schema: + type: string + enum: + - auto + - burn + - none + - sidecar + - embedded + - segmented + - unknown + example: Burn + subtitleSize: + name: subtitleSize + description: Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect) + in: query + schema: + type: integer + minimum: 1 + example: 50 + title: + name: title + description: The title to filter by or assign + in: query + schema: + type: string + transcodeSessionId: + name: transcodeSessionId + description: Transcode session UUID + in: query + schema: + type: string + transcodeType: + name: transcodeType + description: Type of transcode media + in: path + required: true + schema: + type: string + enum: + - video + - music + - audio + - subtitles + type: + name: type + description: The metadata type to filter by + in: query + schema: + type: integer + videoBitrate: + name: videoBitrate + description: Target video bitrate (in kbps). + in: query + schema: + type: integer + minimum: 0 + example: 12000 + videoQuality: + name: videoQuality + description: Target photo quality. + in: query + schema: + type: integer + minimum: 0 + maximum: 99 + example: 50 + videoResolution: + name: videoResolution + description: Target maximum video resolution. + in: query + schema: + type: string + pattern: ^\d[x:]\d$ + example: 1080x1080 + X-Plex-Client-Identifier: + name: X-Plex-Client-Identifier + x-speakeasy-name-override: Client-Identifier + in: header + description: An opaque identifier unique to the client + required: true + schema: + type: string + example: abc123 + example: abc123 + X-Plex-Client-Profile-Extra: + name: X-Plex-Client-Profile-Extra + x-speakeasy-name-override: Client-Profile-Extra + description: See [Profile Augmentations](#section/API-Info/Profile-Augmentations) . + in: header + schema: + type: string + example: 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) + example: 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) + X-Plex-Client-Profile-Name: + name: X-Plex-Client-Profile-Name + x-speakeasy-name-override: Client-Profile-Name + description: Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile. + in: header + schema: + type: string + example: generic + example: generic + X-Plex-Session-Identifier: + name: X-Plex-Session-Identifier + x-speakeasy-name-override: Session-Identifier + description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs) + in: header + schema: + type: string + example: abc123 + example: abc123 + X-Plex-Product: + name: X-Plex-Product + x-speakeasy-name-override: Product + in: header + description: The name of the client product + schema: + type: string + example: Plex for Roku + example: Plex for Roku + X-Plex-Version: + name: X-Plex-Version + x-speakeasy-name-override: Version + in: header + description: The version of the client application + schema: + type: string + example: 2.4.1 + example: 2.4.1 + X-Plex-Platform: + name: X-Plex-Platform + x-speakeasy-name-override: Platform + in: header + description: The platform of the client + schema: + type: string + example: Roku + example: Roku + X-Plex-Platform-Version: + name: X-Plex-Platform-Version + x-speakeasy-name-override: Platform-Version + in: header + description: The version of the platform + schema: + type: string + example: 4.3 build 1057 + example: 4.3 build 1057 + X-Plex-Device: + name: X-Plex-Device + x-speakeasy-name-override: Device + in: header + description: A relatively friendly name for the client device + schema: + type: string + example: Roku 3 + example: Roku 3 + X-Plex-Model: + name: X-Plex-Model + x-speakeasy-name-override: Model + in: header + description: A potentially less friendly identifier for the device model + schema: + type: string + example: 4200X + example: 4200X + X-Plex-Device-Vendor: + name: X-Plex-Device-Vendor + x-speakeasy-name-override: Device-Vendor + in: header + description: The device vendor + schema: + type: string + example: Roku + example: Roku + X-Plex-Device-Name: + name: X-Plex-Device-Name + x-speakeasy-name-override: Device-Name + in: header + description: A friendly name for the client + schema: + type: string + example: Living Room TV + example: Living Room TV + X-Plex-Marketplace: + name: X-Plex-Marketplace + x-speakeasy-name-override: Marketplace + in: header + description: The marketplace on which the client application is distributed + schema: + type: string + example: googlePlay + example: googlePlay + headers: + X-Plex-Container-Start: + description: Provided on all MediaContainer objects indicating the offset of where this container page starts + schema: + type: integer + X-Plex-Container-Total-Size: + description: Provided on all MediaContainer objects indicating the total size of the collection + schema: + type: integer + minimum: 0 + example: 100 + responses: + '200': + description: OK + content: + text/html: {} + '204': + description: No Content + content: + text/html: {} + '400': + description: Bad Request + content: + text/html: {} + '403': + description: Forbidden + content: + text/html: {} + '404': + description: Not Found + content: + text/html: {} + '500': + description: Internal Server Error + content: + text/html: {} + dvrRequestHandler_slash-get-responses-200: + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainerWithStatus' + - properties: + DVR: + items: + properties: + Device: + items: + $ref: '#/components/schemas/Device' + type: array + key: + type: string + language: + type: string + lineup: + type: string + uuid: + type: string + type: object + type: array + type: object + type: object + get-responses-200: + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Hub: + items: + properties: + homeVisibility: + description: | + Whether this hub is visible on the home screen + - all: Visible to all users + - none: Visible to no users + - admin: Visible to only admin users + - shared: Visible to shared users + enum: + - all + - none + - admin + - shared + type: string + identifier: + description: The identifier for this hub + type: string + promotedToOwnHome: + description: Whether this hub is visible to admin user home + type: boolean + promotedToRecommended: + description: Whether this hub is promoted to all for recommendations + type: boolean + promotedToSharedHome: + description: Whether this hub is visible to shared user's home + type: boolean + recommendationsVisibility: + description: | + The visibility of this hub in recommendations: + - all: Visible to all users + - none: Visible to no users + - admin: Visible to only admin users + - shared: Visible to shared users + enum: + - all + - none + - admin + - shared + type: string + title: + description: The title of this hub + type: string + type: object + type: array + type: object + type: object + historyAll-get-responses-200: + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - properties: + Metadata: + items: + properties: + accountID: + description: The account id of this playback + type: integer + deviceID: + description: The device id which played the item + type: integer + historyKey: + description: The key for this individual history item + type: string + key: + description: The metadata key for the item played + type: string + librarySectionID: + description: The library section id containing the item played + type: string + originallyAvailableAt: + description: The originally available at of the item played + type: string + ratingKey: + description: The rating key for the item played + type: string + thumb: + description: The thumb of the item played + type: string + title: + description: The title of the item played + type: string + type: + description: The metadata type of the item played + type: string + viewedAt: + description: The time when the item was played + type: integer + type: object + type: array + type: object + type: object + post-responses-200: + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - additionalProperties: true + properties: + color: + type: string + endTimeOffset: + type: integer + id: + type: integer + startTimeOffset: + type: integer + title: + type: string + type: + enum: + - intro + - commercial + - bookmark + - resume + - credit + type: string + type: object + type: object + LibrarySections: + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/ServerConfiguration' + - properties: + Directory: + items: + properties: + count: + type: integer + key: + description: The key where this directory is found + type: string + title: + type: string + type: object + type: array + type: object + type: object + responses-200: + description: OK + headers: + X-Plex-Container-Start: + $ref: '#/components/headers/X-Plex-Container-Start' + X-Plex-Container-Total-Size: + $ref: '#/components/headers/X-Plex-Container-Total-Size' + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithHubs' + responses-400: + description: Request parameters are bad, such as an `endTimeOffset` prior to the `startTimeOffset` + content: + text/html: {} + responses-403: + description: The media is not accessible to the user + content: + text/html: {} + responses-404: + description: The stream doesn't exist, or the loudness feature is not available on this PMS + content: + text/html: {} + slash-get-responses-200: + description: OK + content: + application/json: + schema: + properties: + MediaContainer: + properties: + content: + description: |- + The flavors of directory found here: + - Primary: (e.g. all, On Deck) These are still used in some clients to provide "shortcuts" to subsets of media. However, with the exception of On Deck, all of them can be created by media queries, and the desire is to allow these to be customized by users. + - Secondary: These are marked with `"secondary": true` and were used by old clients to provide nested menus allowing for primative (but structured) navigation. + - Special: There is a By Folder entry which allows browsing the media by the underlying filesystem structure, and there's a completely obsolete entry marked `"search": true` which used to be used to allow clients to build search dialogs on the fly. + type: string + allowSync: + type: boolean + art: + type: string + Directory: + items: + $ref: '#/components/schemas/Metadata' + type: array + identifier: + type: string + librarySectionID: + type: integer + mediaTagPrefix: + type: string + mediaTagVersion: + type: integer + size: + type: integer + sortAsc: + type: boolean + thumb: + type: string + title1: + type: string + viewGroup: + type: string + viewMode: + type: integer + type: object + slash-post-responses-200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MediaContainerWithPlaylistMetadata' + schemas: + AllowSync: + type: boolean + Art: + type: string + BoolInt: + type: integer + enum: + - 0 + - 1 + Channel: + type: object + properties: + title: + type: string + callSign: + type: string + channelVcn: + type: string + hd: + type: boolean + identifier: + type: string + key: + type: string + language: + type: string + thumb: + type: string + ChannelMapping: + type: object + properties: + channelKey: + type: string + deviceIdentifier: + type: string + enabled: + type: string + lineupIdentifier: + type: string + Content: + type: boolean + Device: + type: object + properties: + ChannelMapping: + type: array + items: + $ref: '#/components/schemas/ChannelMapping' + key: + type: string + lastSeenAt: + type: integer + make: + type: string + model: + type: string + modelNumber: + type: string + protocol: + type: string + sources: + type: string + state: + type: string + status: + type: string + tuners: + type: string + uri: + type: string + uuid: + type: string + Directory: + type: object + additionalProperties: true + properties: + title: + type: string + type: + type: string + art: + type: string + content: + type: boolean + filter: + type: string + hasPrefs: + type: boolean + hasStoreServices: + type: boolean + hubKey: + type: string + identifier: + type: string + key: + type: string + lastAccessedAt: + type: integer + Pivot: + type: array + items: + type: object + properties: + title: + type: string + type: + type: string + context: + type: string + id: + type: string + key: + type: string + symbol: + type: string + share: + type: integer + thumb: + type: string + titleBar: + type: string + Filter: + allOf: + - $ref: '#/components/schemas/Directory' + - description: | + Each `Filter` object contains a description of the filter. Note that it is not an exhaustive list of the full media query language, but an important subset useful for top-level API. + type: object + properties: + title: + description: The title for the filter. + type: string + filter: + description: This represents the filter name used for the filter, which can be used to construct complex media queries with. + type: string + filterType: + description: This is either `string`, `integer`, or `boolean`, and describes the type of values used for the filter. + type: string + key: + description: This provides the endpoint where the possible range of values for the filter can be retrieved (e.g. for a "Genre" filter, it returns a list of all the genres in the library). This will include a `type` argument that matches the metadata type of the Type element. + type: string + Hub: + type: object + additionalProperties: true + properties: + title: + description: A title for this grouping of content + type: string + type: + description: The type of the items contained in this hub, or possibly `mixed` if there are multiple types + type: string + example: track + context: + type: string + example: hub.home.onDeck + hubIdentifier: + description: A unique identifier for the hub + type: string + example: home.onDeck + hubKey: + description: | + A key at which the exact content currently displayed can be fetched again. This is particularly important when a hub is marked as random and requesting the `key` may get different results. It's otherwise optional. + type: string + key: + description: The key at which all of the content for this hub can be retrieved + type: string + example: /hubs/sections/home/onDeck + Metadata: + type: array + items: + $ref: '#/components/schemas/Metadata' + more: + description: | + "A boolean indicating that the hub contains more than what's included in the current response." + type: boolean + promoted: + description: Indicating if the hub should be promoted to the user's homescreen + type: boolean + random: + description: Indicating that the contents of the hub may change on each request + type: boolean + size: + type: integer + example: 1 + style: + description: A suggestion on how this hub's contents might be displayed by a client. Some examples include `hero`, `list`, `spotlight`, and `upsell` + type: string + subtype: + description: The subtype of the items contained in this hub, or possibly `mixed` if there are multiple types + type: string + example: podcast + totalSize: + type: integer + example: 8 + Image: + description: | + Images such as movie posters and background artwork are represented by Image elements. + type: object + properties: + type: + description: Describes both the purpose and intended presentation of the image. + type: string + enum: + - background + - banner + - clearLogo + - coverPoster + - snapshot + alt: + description: Title to use for accessibility. + type: string + url: + description: The relative path or absolute url for the image. + type: string + Items: + type: object + allOf: + - $ref: '#/components/schemas/Metadata' + - type: object + properties: + MetadataItem: + type: array + items: + $ref: '#/components/schemas/Items' + description: Nested metadata items + type: object + Key: + type: string + LibrarySection: + type: object + properties: + title: + $ref: '#/components/schemas/Title' + type: + $ref: '#/components/schemas/Type' + agent: + type: string + allowSync: + type: boolean + art: + $ref: '#/components/schemas/Art' + composite: + type: string + content: + $ref: '#/components/schemas/Content' + contentChangedAt: + type: integer + createdAt: + type: integer + directory: + type: boolean + filters: + description: Indicates whether this section has filtering capabilities + type: boolean + hidden: + type: boolean + key: + $ref: '#/components/schemas/Key' + language: + type: string + Location: + type: array + items: + description: Represents a top-level location on disk where media in this library section is stored + type: object + properties: + id: + type: integer + path: + description: The path of where this directory exists on disk + refreshing: + description: Indicates whether this library section is currently scanning + type: boolean + scannedAt: + type: integer + scanner: + type: string + thumb: + $ref: '#/components/schemas/Thumb' + updatedAt: + type: integer + Lineup: + type: object + properties: + title: + type: string + type: + description: The type of this object (`lineup` in this case) + type: string + lineupType: + description: | + - `-1`: N/A + - `0`: Over the air + - `1`: Cable + - `2`: Satellite + - `3`: IPTV + - `4`: Virtual + type: integer + enum: + - -1 + - 0 + - 1 + - 2 + - 3 + - 4 + location: + type: string + uuid: + description: The uuid of this lineup + type: string + Media: + description: | + `Media` represents an one or more media files (parts) and is a child of a metadata item. There aren't necessarily any guaranteed attributes on media elements since the attributes will vary based on the type. The possible attributes are not documented here, but they typically have self-evident names. High-level media information that can be used for badging and flagging, such as `videoResolution` and codecs, is included on the media element. + type: object + additionalProperties: true + properties: + aspectRatio: + type: number + example: 2.35 + audioChannels: + type: integer + example: 2 + audioCodec: + example: aac + audioProfile: + example: lc + bitrate: + type: integer + example: 5612 + container: + example: mov + duration: + type: integer + example: 150192 + has64bitOffsets: + type: boolean + example: false + hasVoiceActivity: + type: boolean + example: true + height: + type: integer + example: 544 + id: + type: integer + example: 1 + optimizedForStreaming: + type: boolean + example: false + Part: + type: array + items: + $ref: '#/components/schemas/Part' + videoCodec: + example: h264 + videoFrameRate: + example: 24p + videoProfile: + example: main + videoResolution: + example: '720' + width: + type: integer + example: 1280 + MediaContainer: + description: | + `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable. + Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination) + The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track. + type: object + properties: + identifier: + type: string + offset: + description: | + The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header. + type: integer + size: + type: integer + totalSize: + description: | + The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header. + type: integer + MediaContainerWithArtwork: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Metadata: + type: array + items: + type: object + additionalProperties: true + properties: + title: + description: The title of the item + type: string + type: + type: string + enum: + - image + key: + description: The path to the artwork + type: string + MediaContainerWithDecision: + description: | + `MediaContainer` is commonly found as the root of a response and is a pretty generic container. Common attributes include `identifier` and things related to paging (`offset`, `size`, `totalSize`). + + It is also common for a `MediaContainer` to contain attributes "hoisted" from its children. If every element in the container would have had the same attribute, then that attribute can be present on the container instead of being repeated on every element. For example, an album's list of tracks might include `parentTitle` on the container since all of the tracks have the same album title. A container may have a `source` attribute when all of the items came from the same source. Generally speaking, when looking for an attribute on an item, if the attribute wasn't found then the container should be checked for that attribute as well. + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + availableBandwidth: + description: The maximum available bitrate when the decision was rendered. + type: integer + directPlayDecisionCode: + type: integer + directPlayDecisionText: + type: string + generalDecisionCode: + description: The overall decision. 1xxx are playback can succeed, 2xxx are a general error (such as insufficient bandwidth), 3xxx are errors in direct play, and 4xxx are errors in transcodes. Same codes are used in all. + type: integer + generalDecisionText: + type: string + mdeDecisionCode: + description: The code indicating the status of evaluation of playback when client indicates `hasMDE=1` + type: integer + mdeDecisionText: + description: Descriptive text for the above code + type: string + Metadata: + type: array + items: + allOf: + - $ref: '#/components/schemas/Metadata' + - type: object + properties: + Media: + type: array + items: + allOf: + - $ref: '#/components/schemas/Media' + - type: object + properties: + abr: + type: boolean + Part: + type: array + items: + allOf: + - $ref: '#/components/schemas/Part' + - type: object + properties: + decision: + type: string + enum: + - directplay + - transcode + - none + selected: + type: boolean + Stream: + type: array + items: + allOf: + - $ref: '#/components/schemas/Stream' + - type: object + properties: + decision: + type: string + enum: + - copy + - transcode + - burn + - unavailable + - ignore + - none + location: + type: string + enum: + - direct + - sidecar-subs + - segments-video + - segments-audio + - segments-av + - segments-subs + - embedded + - sidecar + resourceSession: + type: string + selected: + type: boolean + transcodeDecisionCode: + type: integer + transcodeDecisionText: + type: string + MediaContainerWithDevice: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Device: + type: array + items: + type: object + properties: + ChannelMapping: + type: array + items: + $ref: '#/components/schemas/ChannelMapping' + key: + type: string + lastSeenAt: + type: integer + make: + type: string + model: + type: string + modelNumber: + type: string + protocol: + type: string + sources: + type: string + state: + type: string + status: + type: string + tuners: + type: string + uri: + type: string + uuid: + type: string + MediaContainerWithDirectory: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Directory: + type: array + items: + $ref: '#/components/schemas/Directory' + MediaContainerWithHubs: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Hub: + type: array + items: + $ref: '#/components/schemas/Hub' + MediaContainerWithLineup: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Lineup: + type: array + items: + $ref: '#/components/schemas/Lineup' + uuid: + description: The UUID of this set lineups + type: string + MediaContainerWithMetadata: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Metadata: + type: array + items: + $ref: '#/components/schemas/Metadata' + MediaContainerWithNestedMetadata: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + MetadataItem: + type: array + items: + type: object + allOf: + - $ref: '#/components/schemas/Metadata' + - type: object + properties: + MetadataItem: + type: array + items: + $ref: '#/components/schemas/Items' + description: Nested metadata items + type: object + MediaContainerWithPlaylistMetadata: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Metadata: + type: array + items: + allOf: + - type: object + properties: + readOnly: + description: If we return this as true then this playlist cannot be altered or deleted directly by the client. + type: boolean + composite: + description: A composite image for the playlist. + type: string + duration: + description: The total duration of the playlist in ms + type: integer + key: + description: Leads to a list of items in the playlist. + type: string + leafCount: + description: The number of items in the playlist. + type: integer + playlistType: + description: The type of the playlist. + type: string + enum: + - audio + - video + - photo + smart: + description: Whether or not the playlist is smart. + type: boolean + specialPlaylistType: + description: If this is a special playlist, this returns its type (e.g. favorites). + type: string + - $ref: '#/components/schemas/Metadata' + MediaContainerWithSettings: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + Setting: + type: array + items: + $ref: '#/components/schemas/Setting' + MediaContainerWithStatus: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + status: + description: A status indicator. If present and non-zero, indicates an error + type: integer + MediaContainerWithSubscription: + type: object + properties: + MediaContainer: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + MediaSubscription: + type: array + items: + $ref: '#/components/schemas/MediaSubscription' + MediaGrabOperation: + description: | + A media grab opration represents a scheduled or active recording of media + type: object + properties: + currentSize: + type: integer + grabberIdentifier: + type: string + grabberProtocol: + type: string + id: + type: string + key: + type: string + mediaIndex: + type: integer + mediaSubscriptionID: + type: integer + Metadata: + $ref: '#/components/schemas/Metadata' + percent: + type: number + provider: + type: string + status: + type: string + enum: + - inactive + - scheduled + - inprogress + - complete + - cancelled + - error + - postprocessing + - paused + MediaSubscription: + description: | + A media subscription contains a representation of metadata desired to be recorded + type: object + properties: + title: + type: string + type: + description: The metadata type of the root item of the subscription + type: integer + airingsType: + type: string + enum: + - New Airings Only + - New and Repeat Airings + createdAt: + type: integer + Directory: + description: Media Matching Hints + additionalProperties: true + durationTotal: + description: Only included if `includeStorage` is specified + type: integer + key: + type: string + librarySectionTitle: + type: string + locationPath: + type: string + MediaGrabOperation: + type: array + items: + $ref: '#/components/schemas/MediaGrabOperation' + Playlist: + description: Media Matching Hints + additionalProperties: true + Setting: + type: array + items: + $ref: '#/components/schemas/Setting' + storageTotal: + description: Only included if `includeStorage` is specified + type: integer + targetLibrarySectionID: + description: The library section id for where the item is to be recorded + type: integer + targetSectionLocationID: + description: The library section location id for where the item is to be recorded + type: integer + Video: + description: Media Matching Hints + additionalProperties: true + Metadata: + description: | + Items in a library are referred to as "metadata items." These metadata items are distinct from "media items" which represent actual instances of media that can be consumed. Consider a TV library that has a single video file in it for a particular episode of a show. The library has a single media item, but it has three metadata items: one for the show, one for the season, and one for the episode. Consider a movie library that has two video files in it: the same movie, but two different resolutions. The library has a single metadata item for the movie, but that metadata item has two media items, one for each resolution. Additionally a "media item" will have one or more "media parts" where the the parts are intended to be watched together, such as a CD1 and CD2 parts of the same movie. + + Note that when a metadata item has multiple media items, those media items should be isomorphic. That is, a 4K version and 1080p version of a movie are different versions of the same movie. They have the same duration, same summary, same rating, etc. and they can generally be considered interchangeable. A theatrical release vs. director's cut vs. unrated version on the other hand would be separate metadata items. + + Metadata items can often live in a hierarchy with relationships between them. For example, the metadata item for an episodes is associated with a season metadata item which is associated with a show metadata item. A similar hierarchy exists with track, album, and artist and photos and photo album. The relationships may be expressed via relative terms and absolute terms. For example, "leaves" refer to metadata items which has associated media (there is no media for a season nor show). A show will have "children" in the form of seasons and a season will have "children" in the form of episodes and episodes have "parent" in the form of a season which has a "parent" in the form of a show. Similarly, a show has "grandchildren" in the form of episodse and an episode has a "grandparent" in the form of a show. + type: object + additionalProperties: true + properties: + title: + description: The title of the item (e.g. “300” or “The Simpsons”) + type: + description: The type of the video item, such as `movie`, `episode`, or `clip`. + absoluteIndex: + description: When present, contains the disc number for a track on multi-disc albums. + type: integer + addedAt: + description: In units of seconds since the epoch, returns the time at which the item was added to the library. + type: integer + art: + description: When present, the URL for the background artwork for the item. + audienceRating: + description: Some rating systems separate reviewer ratings from audience ratings + type: number + minimum: 0 + maximum: 10 + audienceRatingImage: + description: A URI representing the image to be shown with the audience rating (e.g. rottentomatoes://image.rating.spilled). + Autotag: + type: array + items: + $ref: '#/components/schemas/Tag' + banner: + description: When present, the URL for a banner graphic for the item. + chapterSource: + description: When present, indicates the source for the chapters in the media file. Can be media (the chapters were embedded in the media itself), agent (a metadata agent computed them), or mixed (a combination of the two). + composite: + description: When present, the URL for a composite image for descendent items (e.g. photo albums or playlists). + contentRating: + description: If known, the content rating (e.g. MPAA) for an item. + Country: + type: array + items: + $ref: '#/components/schemas/Tag' + Director: + type: array + items: + $ref: '#/components/schemas/Tag' + duration: + description: When present, the duration for the item, in units of milliseconds. + type: integer + Filter: + description: Typically only seen in metadata at a library's top level + type: array + items: + $ref: '#/components/schemas/Filter' + Genre: + type: array + items: + $ref: '#/components/schemas/Tag' + grandparentArt: + description: The `art` of the grandparent + type: string + grandparentHero: + description: The `hero` of the grandparent + type: string + grandparentKey: + description: The `key` of the grandparent + type: string + grandparentRatingKey: + description: The `ratingKey` of the grandparent + type: string + grandparentTheme: + description: The `theme` of the grandparent + type: string + grandparentThumb: + description: The `thumb` of the grandparent + type: string + grandparentTitle: + description: The `title` of the grandparent + type: string + Guid: + type: array + items: + $ref: '#/components/schemas/Tag' + hero: + description: When present, the URL for a hero image for the item. + Image: + type: array + items: + $ref: '#/components/schemas/Image' + index: + description: When present, this represents the episode number for episodes, season number for seasons, or track number for audio tracks. + type: integer + key: + description: The key at which the item's details can be fetched. In many cases a metadata item may be passed without all the details (such as in a hub) and this key corresponds to the endpoint to fetch additional details. + lastViewedAt: + description: When a user has watched or listened to an item, this contains a timestamp (epoch seconds) for that last consumption time. + type: integer + leafCount: + description: For shows and seasons, contains the number of total episodes. + type: integer + Media: + type: array + items: + $ref: '#/components/schemas/Media' + originallyAvailableAt: + description: When present, in the format YYYY-MM-DD [HH:MM:SS] (the hours/minutes/seconds part is not always present). The air date, or a higher resolution release date for an item, depending on type. For example, episodes usually have air date like 1979-08-10 (we don't use epoch seconds because media existed prior to 1970). In some cases, recorded over-the-air content has higher resolution air date which includes a time component. Albums and movies may have day-resolution release dates as well. + originalTitle: + description: When present, used to indicate an item's original title, e.g. a movie's foreign title. + parentHero: + description: The `hero` of the parent + type: string + parentIndex: + description: The `index` of the parent + type: integer + parentKey: + description: The `key` of the parent + type: string + parentRatingKey: + description: The `ratingKey` of the parent + type: string + parentThumb: + description: The `thumb` of the parent + type: string + parentTitle: + description: The `title` of the parent + type: string + primaryExtraKey: + description: Indicates that the item has a primary extra; for a movie, this is a trailer, and for a music track it is a music video. The URL points to the metadata details endpoint for the item. + prompt: + description: Prompt to give the user for this directory (such as `Search Movies`) + type: string + rating: + description: When present, the rating for the item. The exact meaning and representation depends on where the rating was sourced from. + type: number + minimum: 0 + maximum: 10 + Rating: + type: array + items: + $ref: '#/components/schemas/Tag' + x-speakeasy-name-override: RatingArray + ratingCount: + description: Number of ratings under this metadata + type: integer + ratingImage: + description: When present, indicates an image to be shown with the rating. This is passed back as a small set of defined URI values, e.g. rottentomatoes://image.rating.rotten. + ratingKey: + description: This is the opaque string to be passed into timeline, scrobble, and rating endpoints to identify them. While it often appears to be numeric, this is not guaranteed. + Role: + type: array + items: + $ref: '#/components/schemas/Tag' + search: + description: Indicates this is a search directory + type: boolean + secondary: + description: Used by old clients to provide nested menus allowing for primative (but structured) navigation. + type: boolean + skipChildren: + description: When found on a show item, indicates that the children (seasons) should be skipped in favor of the grandchildren (episodes). Useful for mini-series, etc. + type: boolean + skipParent: + description: When present on an episode or track item, indicates parent should be skipped in favor of grandparent (show). + type: boolean + Sort: + description: Typically only seen in metadata at a library's top level + type: array + items: + $ref: '#/components/schemas/Sort' + studio: + description: When present, the studio or label which produced an item (e.g. movie studio for movies, record label for albums). + subtype: + description: The subtype of the video item, such as `photo` when the video item is in a photo library + summary: + description: When present, the extended textual information about the item (e.g. movie plot, artist biography, album review). + tagline: + description: When present, a pithy one-liner about the item (usually only seen for movies). + theme: + description: When present, the URL for theme music for the item (usually only for TV shows). + thumb: + description: When present, the URL for the poster or thumbnail for the item. When available for types like movie, it will be the poster graphic, but fall-back to the extracted media thumbnail. + titleSort: + description: Whene present, this is the string used for sorting the item. It's usually the title with any leading articles removed (e.g. “Simpsons”). + updatedAt: + description: In units of seconds since the epoch, returns the time at which the item was last changed (e.g. had its metadata updated). + type: integer + userRating: + description: When the user has rated an item, this contains the user rating + type: number + minimum: 0 + maximum: 10 + viewCount: + description: When a users has completed watched or listened to an item, this attribute contains the number of consumptions. + type: integer + viewedLeafCount: + description: For shows and seasons, contains the number of viewed episodes. + type: integer + viewOffset: + description: When a user is in the process of viewing or listening to this item, this attribute contains the current offset, in units of milliseconds. + type: integer + Writer: + type: array + items: + $ref: '#/components/schemas/Tag' + year: + description: When present, the year associated with the item's release (e.g. release year for a movie). + type: integer + Part: + description: | + `Part` represents a particular file or "part" of a media item. The part is the playable unit of the media hierarchy. Suppose that a movie library contains a movie that is broken up into files, reminiscent of a movie split across two BDs. The metadata item represents information about the movie, the media item represents this instance of the movie at this resolution and quality, and the part items represent the two playable files. If another media were added which contained the joining of these two parts transcoded down to a lower resolution, then this metadata would contain 2 medias, one with 2 parts and one with 1 part. + type: object + additionalProperties: true + properties: + audioProfile: + example: lc + container: + description: The container of the media file, such as `mp4` or `mkv` + example: mov + duration: + description: The duration of the media item, in milliseconds + type: integer + example: 150192 + file: + description: The local file path at which the part is stored on the server + example: /home/schuyler/Videos/Trailers/Cloud Atlas (2012).mov + has64bitOffsets: + type: boolean + example: false + id: + type: integer + example: 1 + key: + description: The key from which the media can be streamed + example: /library/parts/1/1531779263/file.mov + optimizedForStreaming: + type: boolean + example: false + size: + description: The size of the media, in bytes + type: integer + example: 105355654 + Stream: + type: array + items: + $ref: '#/components/schemas/Stream' + videoProfile: + example: main + Player: + description: Information about the player being used for playback + type: object + properties: + title: + description: The title of the client + type: string + address: + description: The remote address + type: string + local: + description: Indicating if the client is playing from the local LAN + type: boolean + machineIdentifier: + description: The identifier of the client + type: string + model: + description: The model of the client + type: string + platform: + description: The platform of the client + type: string + platformVersion: + description: The platformVersion of the client + type: string + product: + description: The product name of the client + type: string + relayed: + description: Indicating if the client is playing over a relay connection + type: boolean + remotePublicAddress: + description: The client's public address + type: string + secure: + description: Indicating if the client is playing over HTTPS + type: boolean + state: + description: The client's last reported state + type: string + userID: + description: The id of the user + type: integer + vendor: + description: The vendor of the client + type: string + version: + description: The version of the client + type: string + ServerConfiguration: + allOf: + - $ref: '#/components/schemas/MediaContainer' + - type: object + properties: + allowCameraUpload: + type: boolean + allowChannelAccess: + type: boolean + allowMediaDeletion: + type: boolean + allowSharing: + type: boolean + allowSync: + type: boolean + allowTuners: + type: boolean + backgroundProcessing: + type: boolean + certificate: + type: boolean + companionProxy: + type: boolean + countryCode: + type: string + diagnostics: + type: string + eventStream: + type: boolean + friendlyName: + type: string + hubSearch: + type: boolean + itemClusters: + type: boolean + livetv: + type: integer + example: 7 + machineIdentifier: + example: 0123456789abcdef0123456789abcdef012345678 + mediaProviders: + type: boolean + multiuser: + type: boolean + musicAnalysis: + type: integer + example: 2 + myPlex: + type: boolean + myPlexMappingState: + example: mapped + myPlexSigninState: + example: ok + myPlexSubscription: + type: boolean + myPlexUsername: + type: string + offlineTranscode: + example: 1 + ownerFeatures: + description: A comma-separated list of features which are enabled for the server owner + type: string + platform: + type: string + platformVersion: + type: string + pluginHost: + type: boolean + pushNotifications: + type: boolean + readOnlyLibraries: + type: boolean + streamingBrainABRVersion: + type: integer + streamingBrainVersion: + type: integer + sync: + type: boolean + transcoderActiveVideoSessions: + type: integer + transcoderAudio: + type: boolean + transcoderLyrics: + type: boolean + transcoderPhoto: + type: boolean + transcoderSubtitles: + type: boolean + transcoderVideo: + type: boolean + transcoderVideoBitrates: + description: The suggested video quality bitrates to present to the user + transcoderVideoQualities: + type: string + transcoderVideoResolutions: + description: The suggested video resolutions to the above quality bitrates + updatedAt: + type: integer + updater: + type: boolean + version: + type: string + voiceSearch: + type: boolean + Session: + description: Information about the playback session + type: object + properties: + bandwidth: + description: The bandwidth used by this client's playback in kbps + type: integer + id: + description: The id of the playback session + type: string + location: + description: The location of the client + type: string + enum: + - lan + - wan + Setting: + description: A configuration setting or preference + type: object + properties: + type: + description: The type of the value of this setting + type: string + enum: + - bool + - int + - text + - double + default: + description: The default value of this setting + oneOf: + - type: string + - type: number + - type: boolean + advanced: + description: Whether the setting is considered advanced and normally hidden from the user + type: boolean + enumValues: + description: The possible values for this setting if restricted. The list is `|` separated with `value:name` entries. + type: string + group: + description: The group name of this setting to aid in display of a hierarchy + type: string + hidden: + description: Whether the setting is hidden or not + type: boolean + id: + description: The query parameter name for this setting + type: string + label: + description: A user-friendly name for the setting + type: string + summary: + description: A description of the setting + type: string + value: + description: The current value of this setting + oneOf: + - type: string + - type: number + - type: boolean + Sort: + allOf: + - $ref: '#/components/schemas/Directory' + - description: | + Each `Sort` object contains a description of the sort field. + type: object + properties: + title: + description: The title of the field. + type: string + default: + description: If present, this sort is the default and in this direction + type: string + enum: + - asc + - desc + defaultDirection: + description: This default diction of this sort + type: string + enum: + - asc + - desc + descKey: + description: The key for sorting this field in reverse order + type: string + firstCharacterKey: + description: The key to use to get items sorted by this field and indexed by the first character + type: string + key: + description: The key to use in the sort field to make items sort by this item + type: string + Stream: + description: | + `Stream` represents a particular stream from a media item, such as the video stream, audio stream, or subtitle stream. The stream may either be part of the file represented by the parent `Part` or, especially for subtitles, an external file. The stream contains more detailed information about the specific stream. For example, a video may include the `aspectRatio` at the `Media` level, but detailed information about the video stream like the color space will be included on the `Stream` for the video stream. Note that photos do not have streams (mostly as an optimization). + type: object + additionalProperties: true + properties: + default: + type: boolean + example: true + audioChannelLayout: + example: stereo + bitDepth: + type: integer + example: 8 + bitrate: + type: integer + example: 5466 + canAutoSync: + description: For subtitle streams only. If `true` then the server can attempt to automatically sync the subtitle timestamps with the video. + type: boolean + example: true + chromaLocation: + example: topleft + chromaSubsampling: + example: '4:2:0' + codec: + description: The codec of the stream, such as `h264` or `aac` + example: h264 + colorPrimaries: + example: bt709 + colorRange: + example: tv + colorSpace: + example: bt709 + colorTrc: + example: bt709 + displayTitle: + description: A friendly name for the stream, often comprised of the language and codec information + example: English (H.264 Main) + frameRate: + type: number + example: 23.976 + hasScalingMatrix: + example: false + height: + type: integer + example: 544 + id: + type: integer + example: 1 + index: + description: If the stream is part of the `Part` and not an external resource, the index of the stream within that part + type: integer + example: 0 + key: + description: If the stream is independently streamable, the key from which it can be streamed + example: /library/streams/1 + language: + example: English + languageCode: + description: The three character language code for the stream contents + example: eng + level: + type: integer + example: 31 + profile: + example: main + refFrames: + type: integer + example: 2 + samplingRate: + type: integer + example: 48000 + selected: + type: boolean + streamIdentifier: + type: integer + example: 1 + streamType: + description: A number indicating the type of the stream. `1` for video, `2` for audio, `3` for subtitles, `4` for lyrics + type: integer + example: 1 + width: + type: integer + example: 1280 + Tag: + description: | + A variety of extra information about a metadata item is included as tags. These tags use their own element names such as `Genre`, `Writer`, `Directory`, and `Role`. Individual tag types may introduce their own extra attributes. + type: object + properties: + confidence: + description: Measure of the confidence of an automatic tag + type: number + context: + type: string + filter: + description: A filter parameter that can be used to query for more content that matches this tag value. + example: actor=49 + id: + type: integer + ratingKey: + type: string + role: + description: The role this actor played + example: Secretary + tag: + description: The value of the tag (the name) + example: Shaun Lawton + tagKey: + description: Plex identifier for this tag which can be used to fetch additional information from plex.tv + example: 5d3ee12c4cde6a001c3e0b27 + tagType: + type: integer + thumb: + example: http://image.tmdb.org/t/p/original/lcJ8qM51ClAR2UzXU1mkZGfnn3o.jpg + Thumb: + type: string + Title: + type: string + TranscodeSession: + description: The transcode session if item is currently being transcoded + type: object + properties: + complete: + type: boolean + context: + type: string + duration: + type: integer + error: + type: boolean + key: + type: string + progress: + type: number + minimum: 0 + maximum: 100 + protocol: + type: string + size: + type: integer + sourceAudioCodec: + type: string + sourceVideoCodec: + type: string + speed: + type: number + throttled: + type: boolean + transcodeHwFullPipeline: + type: boolean + transcodeHwRequested: + type: boolean + Type: + type: string + User: + description: The user playing the content + type: object + properties: + title: + description: The username + type: string + id: + description: The id of the user + type: string + thumb: + description: Thumb image to display for the user + type: string