mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
1331 lines
86 KiB
Markdown
1331 lines
86 KiB
Markdown
# LibraryPlaylists
|
|
(*libraryPlaylists*)
|
|
|
|
## Overview
|
|
|
|
Endpoints for manipulating playlists.
|
|
|
|
### Available Operations
|
|
|
|
* [createPlaylist](#createplaylist) - Create a Playlist
|
|
* [uploadPlaylist](#uploadplaylist) - Upload
|
|
* [deletePlaylist](#deleteplaylist) - Delete a Playlist
|
|
* [updatePlaylist](#updateplaylist) - Editing a Playlist
|
|
* [getPlaylistGenerators](#getplaylistgenerators) - Get a playlist's generators
|
|
* [clearPlaylistItems](#clearplaylistitems) - Clearing a playlist
|
|
* [addPlaylistItems](#addplaylistitems) - Adding to a Playlist
|
|
* [deletePlaylistItem](#deleteplaylistitem) - Delete a Generator
|
|
* [getPlaylistGenerator](#getplaylistgenerator) - Get a playlist generator
|
|
* [modifyPlaylistGenerator](#modifyplaylistgenerator) - Modify a Generator
|
|
* [getPlaylistGeneratorItems](#getplaylistgeneratoritems) - Get a playlist generator's items
|
|
* [movePlaylistItem](#moveplaylistitem) - Moving items in a playlist
|
|
* [refreshPlaylist](#refreshplaylist) - Reprocess a generator
|
|
|
|
## createPlaylist
|
|
|
|
Create a new playlist. By default the playlist is blank.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="createPlaylist" method="post" path="/playlists" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.createPlaylist({
|
|
uri: "https://short-term-disconnection.name/",
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsCreatePlaylist } from "@lukehagar/plexjs/funcs/libraryPlaylistsCreatePlaylist.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsCreatePlaylist(plexAPI, {
|
|
uri: "https://short-term-disconnection.name/",
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsCreatePlaylist failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.CreatePlaylistRequest](../../models/operations/createplaylistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[shared.MediaContainerWithPlaylistMetadata](../../models/shared/mediacontainerwithplaylistmetadata.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## uploadPlaylist
|
|
|
|
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.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="uploadPlaylist" method="post" path="/playlists/upload" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts, BoolInt } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
await plexAPI.libraryPlaylists.uploadPlaylist({
|
|
path: "/home/barkley/playlist.m3u",
|
|
force: BoolInt.True,
|
|
});
|
|
|
|
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsUploadPlaylist } from "@lukehagar/plexjs/funcs/libraryPlaylistsUploadPlaylist.js";
|
|
import { Accepts, BoolInt } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsUploadPlaylist(plexAPI, {
|
|
path: "/home/barkley/playlist.m3u",
|
|
force: BoolInt.True,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
|
|
} else {
|
|
console.log("libraryPlaylistsUploadPlaylist failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.UploadPlaylistRequest](../../models/operations/uploadplaylistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<void\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## deletePlaylist
|
|
|
|
Deletes a playlist by provided id
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="deletePlaylist" method="delete" path="/playlists/{playlistId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
await plexAPI.libraryPlaylists.deletePlaylist({
|
|
playlistId: 343293,
|
|
});
|
|
|
|
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsDeletePlaylist } from "@lukehagar/plexjs/funcs/libraryPlaylistsDeletePlaylist.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsDeletePlaylist(plexAPI, {
|
|
playlistId: 343293,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
|
|
} else {
|
|
console.log("libraryPlaylistsDeletePlaylist failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.DeletePlaylistRequest](../../models/operations/deleteplaylistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<void\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## updatePlaylist
|
|
|
|
Edits a playlist in the same manner as [editing metadata](#tag/Provider/operation/metadataPutItem)
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="updatePlaylist" method="put" path="/playlists/{playlistId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
await plexAPI.libraryPlaylists.updatePlaylist({
|
|
playlistId: 157966,
|
|
});
|
|
|
|
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsUpdatePlaylist } from "@lukehagar/plexjs/funcs/libraryPlaylistsUpdatePlaylist.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsUpdatePlaylist(plexAPI, {
|
|
playlistId: 157966,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
|
|
} else {
|
|
console.log("libraryPlaylistsUpdatePlaylist failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.UpdatePlaylistRequest](../../models/operations/updateplaylistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<void\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## getPlaylistGenerators
|
|
|
|
Get all the generators in a playlist
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="getPlaylistGenerators" method="get" path="/playlists/{playlistId}/generators" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.getPlaylistGenerators({
|
|
playlistId: 162342,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsGetPlaylistGenerators } from "@lukehagar/plexjs/funcs/libraryPlaylistsGetPlaylistGenerators.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsGetPlaylistGenerators(plexAPI, {
|
|
playlistId: 162342,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsGetPlaylistGenerators failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.GetPlaylistGeneratorsRequest](../../models/operations/getplaylistgeneratorsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[operations.GetPlaylistGeneratorsResponse](../../models/operations/getplaylistgeneratorsresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## clearPlaylistItems
|
|
|
|
Clears a playlist, only works with dumb playlists. Returns the playlist.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="clearPlaylistItems" method="delete" path="/playlists/{playlistId}/items" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.clearPlaylistItems({
|
|
playlistId: 552140,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsClearPlaylistItems } from "@lukehagar/plexjs/funcs/libraryPlaylistsClearPlaylistItems.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsClearPlaylistItems(plexAPI, {
|
|
playlistId: 552140,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsClearPlaylistItems failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.ClearPlaylistItemsRequest](../../models/operations/clearplaylistitemsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[shared.MediaContainerWithPlaylistMetadata](../../models/shared/mediacontainerwithplaylistmetadata.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## addPlaylistItems
|
|
|
|
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.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="addPlaylistItems" method="put" path="/playlists/{playlistId}/items" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.addPlaylistItems({
|
|
playlistId: 533723,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsAddPlaylistItems } from "@lukehagar/plexjs/funcs/libraryPlaylistsAddPlaylistItems.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsAddPlaylistItems(plexAPI, {
|
|
playlistId: 533723,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsAddPlaylistItems failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.AddPlaylistItemsRequest](../../models/operations/addplaylistitemsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[shared.MediaContainerWithPlaylistMetadata](../../models/shared/mediacontainerwithplaylistmetadata.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## deletePlaylistItem
|
|
|
|
Deletes an item from a playlist. Only works with dumb playlists.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="deletePlaylistItem" method="delete" path="/playlists/{playlistId}/items/{generatorId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.deletePlaylistItem({
|
|
playlistId: 981646,
|
|
generatorId: 194010,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsDeletePlaylistItem } from "@lukehagar/plexjs/funcs/libraryPlaylistsDeletePlaylistItem.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsDeletePlaylistItem(plexAPI, {
|
|
playlistId: 981646,
|
|
generatorId: 194010,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsDeletePlaylistItem failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.DeletePlaylistItemRequest](../../models/operations/deleteplaylistitemrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[shared.MediaContainerWithPlaylistMetadata](../../models/shared/mediacontainerwithplaylistmetadata.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## getPlaylistGenerator
|
|
|
|
Get a playlist's generator. Only used for optimized versions
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="getPlaylistGenerator" method="get" path="/playlists/{playlistId}/items/{generatorId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.getPlaylistGenerator({
|
|
playlistId: 744880,
|
|
generatorId: 322168,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsGetPlaylistGenerator } from "@lukehagar/plexjs/funcs/libraryPlaylistsGetPlaylistGenerator.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsGetPlaylistGenerator(plexAPI, {
|
|
playlistId: 744880,
|
|
generatorId: 322168,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsGetPlaylistGenerator failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.GetPlaylistGeneratorRequest](../../models/operations/getplaylistgeneratorrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[operations.GetPlaylistGeneratorResponse](../../models/operations/getplaylistgeneratorresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## modifyPlaylistGenerator
|
|
|
|
Modify a playlist generator. Only used for optimizer
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="modifyPlaylistGenerator" method="put" path="/playlists/{playlistId}/items/{generatorId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { ModifyPlaylistGeneratorScope } from "@lukehagar/plexjs/models/operations";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.modifyPlaylistGenerator({
|
|
playlistId: 972007,
|
|
generatorId: 208334,
|
|
item: {
|
|
location: {
|
|
uri: "library://82503060-0d68-4603-b594-8b071d54819e/item/%2Flibrary%2Fmetadata%2F146",
|
|
},
|
|
locationID: -1,
|
|
policy: {
|
|
scope: ModifyPlaylistGeneratorScope.All,
|
|
},
|
|
target: "",
|
|
targetTagID: 1,
|
|
title: "Jack-Jack Attack",
|
|
type: 42,
|
|
},
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsModifyPlaylistGenerator } from "@lukehagar/plexjs/funcs/libraryPlaylistsModifyPlaylistGenerator.js";
|
|
import { ModifyPlaylistGeneratorScope } from "@lukehagar/plexjs/models/operations";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsModifyPlaylistGenerator(plexAPI, {
|
|
playlistId: 972007,
|
|
generatorId: 208334,
|
|
item: {
|
|
location: {
|
|
uri: "library://82503060-0d68-4603-b594-8b071d54819e/item/%2Flibrary%2Fmetadata%2F146",
|
|
},
|
|
locationID: -1,
|
|
policy: {
|
|
scope: ModifyPlaylistGeneratorScope.All,
|
|
},
|
|
target: "",
|
|
targetTagID: 1,
|
|
title: "Jack-Jack Attack",
|
|
type: 42,
|
|
},
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsModifyPlaylistGenerator failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.ModifyPlaylistGeneratorRequest](../../models/operations/modifyplaylistgeneratorrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[shared.MediaContainerWithPlaylistMetadata](../../models/shared/mediacontainerwithplaylistmetadata.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## getPlaylistGeneratorItems
|
|
|
|
Get a playlist generator's items
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="getPlaylistGeneratorItems" method="get" path="/playlists/{playlistId}/items/{generatorId}/items" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.getPlaylistGeneratorItems({
|
|
playlistId: 77230,
|
|
generatorId: 979714,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsGetPlaylistGeneratorItems } from "@lukehagar/plexjs/funcs/libraryPlaylistsGetPlaylistGeneratorItems.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsGetPlaylistGeneratorItems(plexAPI, {
|
|
playlistId: 77230,
|
|
generatorId: 979714,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsGetPlaylistGeneratorItems failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.GetPlaylistGeneratorItemsRequest](../../models/operations/getplaylistgeneratoritemsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[operations.GetPlaylistGeneratorItemsResponse](../../models/operations/getplaylistgeneratoritemsresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## movePlaylistItem
|
|
|
|
Moves an item in a playlist. Only works with dumb playlists.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="movePlaylistItem" method="put" path="/playlists/{playlistId}/items/{playlistItemId}/move" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.libraryPlaylists.movePlaylistItem({
|
|
playlistId: 940298,
|
|
playlistItemId: 375626,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsMovePlaylistItem } from "@lukehagar/plexjs/funcs/libraryPlaylistsMovePlaylistItem.js";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsMovePlaylistItem(plexAPI, {
|
|
playlistId: 940298,
|
|
playlistItemId: 375626,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("libraryPlaylistsMovePlaylistItem failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.MovePlaylistItemRequest](../../models/operations/moveplaylistitemrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<[shared.MediaContainerWithPlaylistMetadata](../../models/shared/mediacontainerwithplaylistmetadata.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## refreshPlaylist
|
|
|
|
Make a generator reprocess (refresh)
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="refreshPlaylist" method="put" path="/playlists/{playlistId}/items/{generatorId}/{metadataId}/{action}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Action } from "@lukehagar/plexjs/models/operations";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
await plexAPI.libraryPlaylists.refreshPlaylist({
|
|
playlistId: 895314,
|
|
generatorId: 629742,
|
|
metadataId: 724422,
|
|
action: Action.Disable,
|
|
});
|
|
|
|
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { libraryPlaylistsRefreshPlaylist } from "@lukehagar/plexjs/funcs/libraryPlaylistsRefreshPlaylist.js";
|
|
import { Action } from "@lukehagar/plexjs/models/operations";
|
|
import { Accepts } from "@lukehagar/plexjs/models/shared";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
accepts: Accepts.ApplicationXml,
|
|
clientIdentifier: "abc123",
|
|
product: "Plex for Roku",
|
|
version: "2.4.1",
|
|
platform: "Roku",
|
|
platformVersion: "4.3 build 1057",
|
|
device: "Roku 3",
|
|
model: "4200X",
|
|
deviceVendor: "Roku",
|
|
deviceName: "Living Room TV",
|
|
marketplace: "googlePlay",
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await libraryPlaylistsRefreshPlaylist(plexAPI, {
|
|
playlistId: 895314,
|
|
generatorId: 629742,
|
|
metadataId: 724422,
|
|
action: Action.Disable,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
|
|
} else {
|
|
console.log("libraryPlaylistsRefreshPlaylist failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.RefreshPlaylistRequest](../../models/operations/refreshplaylistrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
| `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. |
|
|
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
|
|
### Response
|
|
|
|
**Promise\<void\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* | |