mirror of
https://github.com/LukeHagar/plexgo.git
synced 2025-12-06 04:20:46 +00:00
7.6 KiB
7.6 KiB
Media
(Media)
Overview
API Calls interacting with Plex Media Server Media
Available Operations
- MarkPlayed - Mark Media Played
- MarkUnplayed - Mark Media Unplayed
- UpdatePlayProgress - Update Media Play Progress
MarkPlayed
This will mark the provided media key as Played.
Example Usage
package main
import(
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"context"
"log"
"net/http"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var key float64 = 59398
ctx := context.Background()
res, err := s.Media.MarkPlayed(ctx, key)
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
key |
float64 | ✔️ | The media key to mark as played | 59398 |
Response
*operations.MarkPlayedResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.MarkPlayedResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
MarkUnplayed
This will mark the provided media key as Unplayed.
Example Usage
package main
import(
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"context"
"log"
"net/http"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var key float64 = 59398
ctx := context.Background()
res, err := s.Media.MarkUnplayed(ctx, key)
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. | |
key |
float64 | ✔️ | The media key to mark as Unplayed | 59398 |
Response
*operations.MarkUnplayedResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.MarkUnplayedResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |
UpdatePlayProgress
This API command can be used to update the play progress of a media item.
Example Usage
package main
import(
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"context"
"log"
"net/http"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var key string = "<value>"
var time float64 = 6900.91
var state string = "<value>"
ctx := context.Background()
res, err := s.Media.UpdatePlayProgress(ctx, key, time, state)
if err != nil {
log.Fatal(err)
}
if res.StatusCode == http.StatusOK {
// handle response
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
key |
string | ✔️ | the media key |
time |
float64 | ✔️ | The time, in milliseconds, used to set the media playback progress. |
state |
string | ✔️ | The playback state of the media item. |
Response
*operations.UpdatePlayProgressResponse, error
| Error Object | Status Code | Content Type |
|---|---|---|
| sdkerrors.UpdatePlayProgressResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | / |