The actions feature within a media provider
- MarkPlayed - Mark an item as played
- Report - Report media timeline
- Unscrobble - Mark an item as unplayed
- GetConversionQueue - Get Conversion Queue
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
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.Timeline.MarkPlayed(ctx, operations.MarkPlayedRequest{ Identifier: "<value>", Key: plexgo.Pointer("59398"), URI: "https://mad-dredger.name", }) 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.MarkPlayedRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.MarkPlayedResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
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).
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.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.BoolIntTrue.ToPointer(), Updated: plexgo.Pointer[int64](14200000), Offline: components.BoolIntTrue.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 } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ReportRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ReportResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
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
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.Timeline.Unscrobble(ctx, operations.UnscrobbleRequest{ Identifier: "<value>", URI: "https://qualified-order.org", }) 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.UnscrobbleRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UnscrobbleResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Get the conversion/optimization queue.
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.Timeline.GetConversionQueue(ctx, operations.GetConversionQueueRequest{}) if err != nil { log.Fatal(err) } if res.MediaContainerWithPlayQueue != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetConversionQueueRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetConversionQueueResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.Error | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | */* |