Endpoints for manipulating playlists.
- CreatePlaylist - Create a Playlist
- UploadPlaylist - Upload media art
- DeletePlaylist - Delete a Playlist
- UpdatePlaylist - Editing a Playlist
- GetPlaylistGenerators - Get a playlist's generators
- ClearPlaylistItems - Clearing a playlist
- AddPlaylistItems - Adding to a Playlist
- DeletePlaylistItem - Delete a Generator
- GetPlaylistGenerator - Get a playlist generator
- ModifyPlaylistGenerator - Modify a Generator
- GetPlaylistGeneratorItems - Get a playlist generator's items
- MovePlaylistItem - Moving items in a playlist
- RefreshPlaylist - Reprocess a generator
Create a new playlist. By default the playlist is blank.
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{ URI: plexgo.Pointer("https://short-term-disconnection.name/"), }) if err != nil { log.Fatal(err) } if res.MediaContainerWithPlaylistMetadata != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreatePlaylistRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreatePlaylistResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
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.
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.UploadPlaylist(ctx, operations.UploadPlaylistRequest{ Path: plexgo.Pointer("/home/barkley/playlist.m3u"), Force: components.BoolIntTrue.ToPointer(), }) if err != nil { log.Fatal(err) } if res != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UploadPlaylistRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UploadPlaylistResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Deletes a playlist by provided id
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.DeletePlaylist(ctx, operations.DeletePlaylistRequest{ PlaylistID: 343293, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.DeletePlaylistRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.DeletePlaylistResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Edits a playlist in the same manner as editing metadata
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.UpdatePlaylist(ctx, operations.UpdatePlaylistRequest{ PlaylistID: 157966, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpdatePlaylistRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdatePlaylistResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Get all the generators in a playlist
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.GetPlaylistGenerators(ctx, operations.GetPlaylistGeneratorsRequest{ PlaylistID: 162342, }) if err != nil { log.Fatal(err) } if res.Object != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetPlaylistGeneratorsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetPlaylistGeneratorsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Clears a playlist, only works with dumb playlists. Returns the playlist.
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.ClearPlaylistItems(ctx, operations.ClearPlaylistItemsRequest{ PlaylistID: 552140, }) if err != nil { log.Fatal(err) } if res.MediaContainerWithPlaylistMetadata != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ClearPlaylistItemsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ClearPlaylistItemsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
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.
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.AddPlaylistItems(ctx, operations.AddPlaylistItemsRequest{ PlaylistID: 533723, }) if err != nil { log.Fatal(err) } if res.MediaContainerWithPlaylistMetadata != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AddPlaylistItemsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AddPlaylistItemsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Deletes an item from a playlist. Only works with dumb playlists.
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.DeletePlaylistItem(ctx, operations.DeletePlaylistItemRequest{ PlaylistID: 981646, GeneratorID: 194010, }) if err != nil { log.Fatal(err) } if res.MediaContainerWithPlaylistMetadata != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.DeletePlaylistItemRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.DeletePlaylistItemResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Get a playlist's generator. Only used for optimized versions
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.GetPlaylistGenerator(ctx, operations.GetPlaylistGeneratorRequest{ PlaylistID: 744880, GeneratorID: 322168, }) if err != nil { log.Fatal(err) } if res.Object != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetPlaylistGeneratorRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetPlaylistGeneratorResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Modify a playlist generator. Only used for optimizer
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.ModifyPlaylistGenerator(ctx, operations.ModifyPlaylistGeneratorRequest{ PlaylistID: 972007, GeneratorID: 208334, Item: &operations.Item{ Title: plexgo.Pointer("Jack-Jack Attack"), Type: plexgo.Pointer[int64](42), Location: &operations.ModifyPlaylistGeneratorQueryParamLocation{ URI: plexgo.Pointer("library://82503060-0d68-4603-b594-8b071d54819e/item/%2Flibrary%2Fmetadata%2F146"), }, LocationID: plexgo.Pointer[int64](-1), Policy: &operations.Policy{ Scope: operations.QueryParamScopeAll.ToPointer(), }, Target: plexgo.Pointer(""), TargetTagID: plexgo.Pointer[int64](1), }, }) if err != nil { log.Fatal(err) } if res.MediaContainerWithPlaylistMetadata != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ModifyPlaylistGeneratorRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ModifyPlaylistGeneratorResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Get a playlist generator's items
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.GetPlaylistGeneratorItems(ctx, operations.GetPlaylistGeneratorItemsRequest{ PlaylistID: 77230, GeneratorID: 979714, }) if err != nil { log.Fatal(err) } if res.Object != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetPlaylistGeneratorItemsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetPlaylistGeneratorItemsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Moves an item in a playlist. Only works with dumb playlists.
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("<YOUR_API_KEY_HERE>"), ) res, err := s.LibraryPlaylists.MovePlaylistItem(ctx, operations.MovePlaylistItemRequest{ PlaylistID: 940298, PlaylistItemID: 375626, }) if err != nil { log.Fatal(err) } if res.MediaContainerWithPlaylistMetadata != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.MovePlaylistItemRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.MovePlaylistItemResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Make a generator reprocess (refresh)
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("<YOUR_API_KEY_HERE>"), ) 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 } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.RefreshPlaylistRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.RefreshPlaylistResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |