# Media (*media*) ## Overview API Calls interacting with Plex Media Server Media ### Available Operations * [markPlayed](#markplayed) - Mark Media Played * [markUnplayed](#markunplayed) - Mark Media Unplayed * [updatePlayProgress](#updateplayprogress) - Update Media Play Progress ## markPlayed This will mark the provided media key as Played. ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", xPlexClientIdentifier: "Postman", }); async function run() { const result = await plexAPI.media.markPlayed(59398); // Handle the result console.log(result) } run(); ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `key` | *number* | :heavy_check_mark: | The media key to mark as played | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | ### Response **Promise\<[models.MarkPlayedResponse](../../models/markplayedresponse.md)\>** ### Errors | Error Object | Status Code | Content Type | | ----------------------------- | ----------------------------- | ----------------------------- | | models.MarkPlayedResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | ## markUnplayed This will mark the provided media key as Unplayed. ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", xPlexClientIdentifier: "Postman", }); async function run() { const result = await plexAPI.media.markUnplayed(59398); // Handle the result console.log(result) } run(); ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `key` | *number* | :heavy_check_mark: | The media key to mark as Unplayed | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | ### Response **Promise\<[models.MarkUnplayedResponse](../../models/markunplayedresponse.md)\>** ### Errors | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | models.MarkUnplayedResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* | ## updatePlayProgress This API command can be used to update the play progress of a media item. ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ accessToken: "", xPlexClientIdentifier: "Postman", }); async function run() { const result = await plexAPI.media.updatePlayProgress("", 90000, "played"); // Handle the result console.log(result) } run(); ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `key` | *string* | :heavy_check_mark: | the media key | | | `time` | *number* | :heavy_check_mark: | The time, in milliseconds, used to set the media playback progress. | [object Object] | | `state` | *string* | :heavy_check_mark: | The playback state of the media item. | [object Object] | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | ### Response **Promise\<[models.UpdatePlayProgressResponse](../../models/updateplayprogressresponse.md)\>** ### Errors | Error Object | Status Code | Content Type | | ------------------------------------- | ------------------------------------- | ------------------------------------- | | models.UpdatePlayProgressResponseBody | 401 | application/json | | models.SDKError | 4xx-5xx | */* |