mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
* `plex-api.libraryPlaylists.addPlaylistItems()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.hubs.getMetadataHubs()`: * `request.onlyTransient` **Changed** * `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryCollections.moveCollectionItem()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryCollections.deleteCollectionItem()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryCollections.addCollectionItems()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.content.getSonicallySimilar()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.butler.stopTask()`: `request` **Changed** **Breaking** ⚠️ * `plex-api.butler.startTask()`: `request` **Changed** **Breaking** ⚠️ * `plex-api.content.getSonicPath()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.downloadQueue.getItemDecision()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.hubs.getAllHubs()`: * `request.onlyTransient` **Changed** * `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.hubs.getContinueWatching()`: `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.hubs.getPromotedHubs()`: `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.content.getAllLeaves()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.hubs.getPostplayHubs()`: * `request.onlyTransient` **Changed** * `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.hubs.getRelatedHubs()`: * `request.onlyTransient` **Changed** * `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.hubs.getSectionHubs()`: * `request.onlyTransient` **Changed** * `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.content.listContent()`: * `request` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.content.getAlbums()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.search.searchHubs()`: `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.search.voiceSearchHubs()`: * `request.type` **Changed** **Breaking** ⚠️ * `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getLibraryItems()`: * `request.mediaQuery` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.ingestTransientItem()`: * `request` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getLibraryMatches()`: * `request` **Changed** **Breaking** ⚠️ * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.content.getMetadataItem()`: * `request` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getSections()`: `response.mediacontainer.directory.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.addSection()`: * `request` **Changed** * `response.mediacontainer.directory.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getTags()`: * `request.type` **Changed** **Breaking** ⚠️ * `plex-api.content.getCollectionItems()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getAllItemLeaves()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.status.listSessions()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.movePlayQueueItem()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getExtras()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.deletePlayQueueItem()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.unshuffle()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.listMatches()`: * `request.manual` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.listSonicallySimilar()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.resetPlayQueue()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getRelatedItems()`: `response.mediacontainer.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.listSimilar()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.clearPlayQueue()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getItemTree()`: `response.mediacontainer.metadataItem.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.addToPlayQueue()`: * `request.next` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.getPlayQueue()`: * `request` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryPlaylists.movePlaylistItem()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getPerson()`: `response.mediacontainer.directory.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.listPersonMedia()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryPlaylists.getPlaylistGeneratorItems()`: `response.mediacontainer.metadata` **Changed** **Breaking** ⚠️ * `plex-api.library.getLibraryDetails()`: * `request.includeDetails` **Changed** * `response.mediacontainer.directory.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryPlaylists.modifyPlaylistGenerator()`: * `request.item` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.autocomplete()`: * `request.mediaQuery` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getCollections()`: * `request.mediaQuery` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.getCommon()`: * `request.mediaQuery` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryPlaylists.deletePlaylistItem()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryPlaylists.clearPlaylistItems()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playQueue.shuffle()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.libraryPlaylists.createPlaylist()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playlist.getPlaylistItems()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playlist.getPlaylist()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.collections.createCollection()`: * `request.type` **Changed** **Breaking** ⚠️ * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.dvRs.tuneChannel()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.liveTv.getSessions()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.liveTv.getLiveTvSession()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.playlist.listPlaylists()`: `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.subscriptions.getAllSubscriptions()`: * `request` **Changed** * `response.mediacontainer.mediaSubscription.[].mediaGrabOperation.[].metadata` **Changed** **Breaking** ⚠️ * `plex-api.subscriptions.createSubscription()`: `response.mediacontainer.mediaSubscription.[].mediaGrabOperation.[].metadata` **Changed** **Breaking** ⚠️ * `plex-api.subscriptions.getScheduledRecordings()`: `response.mediacontainer.mediaGrabOperation.[].metadata` **Changed** **Breaking** ⚠️ * `plex-api.subscriptions.getTemplate()`: `response.mediacontainer.subscriptionTemplate.[].mediaSubscription.[].mediaGrabOperation.[].metadata` **Changed** **Breaking** ⚠️ * `plex-api.subscriptions.getSubscription()`: * `request` **Changed** * `response.mediacontainer.mediaSubscription.[].mediaGrabOperation.[].metadata` **Changed** **Breaking** ⚠️ * `plex-api.subscriptions.editSubscriptionPreferences()`: `response.mediacontainer.mediaSubscription.[].mediaGrabOperation.[].metadata` **Changed** **Breaking** ⚠️ * `plex-api.subscriptions.reorderSubscription()`: `response.mediacontainer.mediaSubscription.[].mediaGrabOperation.[].metadata` **Changed** **Breaking** ⚠️ * `plex-api.transcoder.makeDecision()`: * `request` **Changed** * `response.mediacontainer.metadata.[]` **Changed** **Breaking** ⚠️ * `plex-api.library.refreshItemsMetadata()`: * `request.markUpdated` **Changed** * `plex-api.authentication.postUsersSignInData()`: **Added** * `plex-api.transcoder.startTranscodeSession()`: `request` **Changed** * `plex-api.devices.modifyDevice()`: * `request.enabled` **Changed** * `plex-api.library.getMediaPart()`: * `request.download` **Changed** * `plex-api.library.detectIntros()`: * `request.force` **Changed** * `plex-api.library.refreshSection()`: * `request.force` **Changed** * `plex-api.libraryPlaylists.uploadPlaylist()`: * `request.force` **Changed** * `plex-api.library.deleteMediaItem()`: * `request.proxy` **Changed** * `plex-api.authentication.getTokenDetails()`: **Added** * `plex-api.library.getFirstCharacters()`: * `request.mediaQuery` **Changed** * `plex-api.library.updateItems()`: * `request.field.locked` **Changed** * `plex-api.library.deleteLibrarySection()`: * `request.async` **Changed** * `plex-api.library.setStreamSelection()`: * `request.allParts` **Changed** * `plex-api.playQueue.createPlayQueue()`: `request` **Changed** * `plex-api.library.getAugmentationStatus()`: * `request.wait` **Changed** * `plex-api.library.detectVoiceActivity()`: `request` **Changed** * `plex-api.transcoder.transcodeImage()`: `request` **Changed** * `plex-api.transcoder.transcodeSubtitles()`: `request` **Changed** * `plex-api.library.addSubtitles()`: `request` **Changed** * `plex-api.library.getStream()`: * `request.autoAdjustSubtitle` **Changed** * `plex-api.library.startBifGeneration()`: * `request.force` **Changed** * `plex-api.library.detectCredits()`: `request` **Changed** * `plex-api.ultraBlur.getImage()`: * `request.noise` **Changed** * `plex-api.library.generateThumbs()`: * `request.force` **Changed** * `plex-api.updater.applyUpdates()`: `request` **Changed** * `plex-api.updater.checkUpdates()`: * `request.download` **Changed** * `plex-api.library.deleteMetadataItem()`: * `request.proxy` **Changed** * `plex-api.library.optimizeDatabase()`: * `request.async` **Changed** * `plex-api.hubs.updateHubVisibility()`: `request` **Changed** * `plex-api.hubs.createCustomHub()`: `request` **Changed** * `plex-api.library.getSectionImage()`: * `request.mediaQuery` **Changed** * `plex-api.downloadQueue.addDownloadQueueItems()`: `request` **Changed** * `plex-api.timeline.report()`: `request` **Changed** * `plex-api.general.getSourceConnectionInformation()`: * `request.refresh` **Changed** * `plex-api.plex.getServerResources()`: **Added** * `plex-api.users.getUsers()`: **Added**
951 lines
63 KiB
Markdown
951 lines
63 KiB
Markdown
# Subscriptions
|
|
(*subscriptions*)
|
|
|
|
## Overview
|
|
|
|
Subscriptions determine which media will be recorded and the criteria for selecting an airing when multiple are available
|
|
|
|
|
|
### Available Operations
|
|
|
|
* [getAllSubscriptions](#getallsubscriptions) - Get all subscriptions
|
|
* [createSubscription](#createsubscription) - Create a subscription
|
|
* [processSubscriptions](#processsubscriptions) - Process all subscriptions
|
|
* [getScheduledRecordings](#getscheduledrecordings) - Get all scheduled recordings
|
|
* [getTemplate](#gettemplate) - Get the subscription template
|
|
* [cancelGrab](#cancelgrab) - Cancel an existing grab
|
|
* [deleteSubscription](#deletesubscription) - Delete a subscription
|
|
* [getSubscription](#getsubscription) - Get a single subscription
|
|
* [editSubscriptionPreferences](#editsubscriptionpreferences) - Edit a subscription
|
|
* [reorderSubscription](#reordersubscription) - Re-order a subscription
|
|
|
|
## getAllSubscriptions
|
|
|
|
Get all subscriptions and potentially the grabs too
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="getAllSubscriptions" method="get" path="/media/subscriptions" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/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.subscriptions.getAllSubscriptions({
|
|
includeGrabs: BoolInt.True,
|
|
includeStorage: BoolInt.True,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsGetAllSubscriptions } from "@lukehagar/plexjs/funcs/subscriptionsGetAllSubscriptions.js";
|
|
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/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 subscriptionsGetAllSubscriptions(plexAPI, {
|
|
includeGrabs: BoolInt.True,
|
|
includeStorage: BoolInt.True,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsGetAllSubscriptions failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.GetAllSubscriptionsRequest](../../sdk/models/operations/getallsubscriptionsrequest.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.GetAllSubscriptionsResponse](../../sdk/models/operations/getallsubscriptionsresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## createSubscription
|
|
|
|
Create a subscription. The query parameters should be mostly derived from the [template](#tag/Subscriptions/operation/mediaSubscriptionsGetTemplate)
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="createSubscription" method="post" path="/media/subscriptions" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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.subscriptions.createSubscription({
|
|
targetLibrarySectionID: 1,
|
|
targetSectionLocationID: 3,
|
|
type: 2,
|
|
hints: {},
|
|
prefs: {},
|
|
params: {},
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsCreateSubscription } from "@lukehagar/plexjs/funcs/subscriptionsCreateSubscription.js";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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 subscriptionsCreateSubscription(plexAPI, {
|
|
targetLibrarySectionID: 1,
|
|
targetSectionLocationID: 3,
|
|
type: 2,
|
|
hints: {},
|
|
prefs: {},
|
|
params: {},
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsCreateSubscription failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.CreateSubscriptionRequest](../../sdk/models/operations/createsubscriptionrequest.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.CreateSubscriptionResponse](../../sdk/models/operations/createsubscriptionresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## processSubscriptions
|
|
|
|
Process all subscriptions asynchronously
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="processSubscriptions" method="post" path="/media/subscriptions/process" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.subscriptions.processSubscriptions();
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsProcessSubscriptions } from "@lukehagar/plexjs/funcs/subscriptionsProcessSubscriptions.js";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await subscriptionsProcessSubscriptions(plexAPI);
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsProcessSubscriptions failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `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.ProcessSubscriptionsResponse](../../sdk/models/operations/processsubscriptionsresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## getScheduledRecordings
|
|
|
|
Get all scheduled recordings across all subscriptions
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="getScheduledRecordings" method="get" path="/media/subscriptions/scheduled" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
|
|
const plexAPI = new PlexAPI({
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const result = await plexAPI.subscriptions.getScheduledRecordings();
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsGetScheduledRecordings } from "@lukehagar/plexjs/funcs/subscriptionsGetScheduledRecordings.js";
|
|
|
|
// Use `PlexAPICore` for best tree-shaking performance.
|
|
// You can create one instance of it to use across an application.
|
|
const plexAPI = new PlexAPICore({
|
|
token: "<YOUR_API_KEY_HERE>",
|
|
});
|
|
|
|
async function run() {
|
|
const res = await subscriptionsGetScheduledRecordings(plexAPI);
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsGetScheduledRecordings failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `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.GetScheduledRecordingsResponse](../../sdk/models/operations/getscheduledrecordingsresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## getTemplate
|
|
|
|
Get the templates for a piece of media which could include fetching one airing, season, the whole show, etc.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="getTemplate" method="get" path="/media/subscriptions/template" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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.subscriptions.getTemplate({
|
|
guid: "plex://episode/5fc70265c40548002d539d23",
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsGetTemplate } from "@lukehagar/plexjs/funcs/subscriptionsGetTemplate.js";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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 subscriptionsGetTemplate(plexAPI, {
|
|
guid: "plex://episode/5fc70265c40548002d539d23",
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsGetTemplate failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.GetTemplateRequest](../../sdk/models/operations/gettemplaterequest.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.GetTemplateResponse](../../sdk/models/operations/gettemplateresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## cancelGrab
|
|
|
|
Cancels an existing media grab (recording). It can be used to resolve a conflict which exists for a rolling subscription.
|
|
Note: This cancellation does not persist across a server restart, but neither does a rolling subscription itself.
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="cancelGrab" method="delete" path="/media/grabbers/operations/{operationId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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.subscriptions.cancelGrab({
|
|
operationId: "<id>",
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsCancelGrab } from "@lukehagar/plexjs/funcs/subscriptionsCancelGrab.js";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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 subscriptionsCancelGrab(plexAPI, {
|
|
operationId: "<id>",
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsCancelGrab failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.CancelGrabRequest](../../sdk/models/operations/cancelgrabrequest.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.CancelGrabResponse](../../sdk/models/operations/cancelgrabresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## deleteSubscription
|
|
|
|
Delete a subscription, cancelling all of its grabs as well
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="deleteSubscription" method="delete" path="/media/subscriptions/{subscriptionId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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.subscriptions.deleteSubscription({
|
|
subscriptionId: 974618,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsDeleteSubscription } from "@lukehagar/plexjs/funcs/subscriptionsDeleteSubscription.js";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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 subscriptionsDeleteSubscription(plexAPI, {
|
|
subscriptionId: 974618,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsDeleteSubscription failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.DeleteSubscriptionRequest](../../sdk/models/operations/deletesubscriptionrequest.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.DeleteSubscriptionResponse](../../sdk/models/operations/deletesubscriptionresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## getSubscription
|
|
|
|
Get a single subscription and potentially the grabs too
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="getSubscription" method="get" path="/media/subscriptions/{subscriptionId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/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.subscriptions.getSubscription({
|
|
subscriptionId: 186713,
|
|
includeGrabs: BoolInt.True,
|
|
includeStorage: BoolInt.True,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsGetSubscription } from "@lukehagar/plexjs/funcs/subscriptionsGetSubscription.js";
|
|
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/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 subscriptionsGetSubscription(plexAPI, {
|
|
subscriptionId: 186713,
|
|
includeGrabs: BoolInt.True,
|
|
includeStorage: BoolInt.True,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsGetSubscription failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.GetSubscriptionRequest](../../sdk/models/operations/getsubscriptionrequest.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.GetSubscriptionResponse](../../sdk/models/operations/getsubscriptionresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## editSubscriptionPreferences
|
|
|
|
Edit a subscription's preferences
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="editSubscriptionPreferences" method="put" path="/media/subscriptions/{subscriptionId}" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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.subscriptions.editSubscriptionPreferences({
|
|
subscriptionId: 673918,
|
|
prefs: {},
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsEditSubscriptionPreferences } from "@lukehagar/plexjs/funcs/subscriptionsEditSubscriptionPreferences.js";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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 subscriptionsEditSubscriptionPreferences(plexAPI, {
|
|
subscriptionId: 673918,
|
|
prefs: {},
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsEditSubscriptionPreferences failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.EditSubscriptionPreferencesRequest](../../sdk/models/operations/editsubscriptionpreferencesrequest.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.EditSubscriptionPreferencesResponse](../../sdk/models/operations/editsubscriptionpreferencesresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* |
|
|
|
|
## reorderSubscription
|
|
|
|
Re-order a subscription to change its priority
|
|
|
|
### Example Usage
|
|
|
|
<!-- UsageSnippet language="typescript" operationID="reorderSubscription" method="put" path="/media/subscriptions/{subscriptionId}/move" -->
|
|
```typescript
|
|
import { PlexAPI } from "@lukehagar/plexjs";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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.subscriptions.reorderSubscription({
|
|
subscriptionId: 440634,
|
|
});
|
|
|
|
console.log(result);
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Standalone function
|
|
|
|
The standalone function version of this method:
|
|
|
|
```typescript
|
|
import { PlexAPICore } from "@lukehagar/plexjs/core.js";
|
|
import { subscriptionsReorderSubscription } from "@lukehagar/plexjs/funcs/subscriptionsReorderSubscription.js";
|
|
import { Accepts } from "@lukehagar/plexjs/sdk/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 subscriptionsReorderSubscription(plexAPI, {
|
|
subscriptionId: 440634,
|
|
});
|
|
if (res.ok) {
|
|
const { value: result } = res;
|
|
console.log(result);
|
|
} else {
|
|
console.log("subscriptionsReorderSubscription failed:", res.error);
|
|
}
|
|
}
|
|
|
|
run();
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| `request` | [operations.ReorderSubscriptionRequest](../../sdk/models/operations/reordersubscriptionrequest.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.ReorderSubscriptionResponse](../../sdk/models/operations/reordersubscriptionresponse.md)\>**
|
|
|
|
### Errors
|
|
|
|
| Error Type | Status Code | Content Type |
|
|
| --------------- | --------------- | --------------- |
|
|
| errors.SDKError | 4XX, 5XX | \*/\* | |