Files
plexjs/docs/sdks/media/README.md

146 lines
18 KiB
Markdown

# 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: "<YOUR_API_KEY_HERE>",
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\<[operations.MarkPlayedResponse](../../models/operations/markplayedresponse.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| ----------------------------- | ----------------------------- | ----------------------------- |
| errors.MarkPlayedResponseBody | 401 | application/json |
| errors.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: "<YOUR_API_KEY_HERE>",
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\<[operations.MarkUnplayedResponse](../../models/operations/markunplayedresponse.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| ------------------------------- | ------------------------------- | ------------------------------- |
| errors.MarkUnplayedResponseBody | 401 | application/json |
| errors.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: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.media.updatePlayProgress("<value>", 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\<[operations.UpdatePlayProgressResponse](../../models/operations/updateplayprogressresponse.md)\>**
### Errors
| Error Object | Status Code | Content Type |
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
| errors.UpdatePlayProgressResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | */* |