Skip to content

Latest commit

 

History

History
1384 lines (1120 loc) · 86.7 KB

File metadata and controls

1384 lines (1120 loc) · 86.7 KB

Content

Overview

The actual content of the media provider

Available Operations

getCollectionItems

Get items in a collection. Note if this collection contains more than 100 items, paging must be used.

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getCollectionItems({
    collectionId: 314585,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetCollectionItems } from "@parke.dev/plexjs/funcs/contentGetCollectionItems.js";
import { Accepts } from "@parke.dev/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 contentGetCollectionItems(plexAPI, {
    collectionId: 314585,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetCollectionItems failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetCollectionItemsRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithMetadata>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

getMetadataItem

Get one or more metadata items.

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts, BoolInt } from "@parke.dev/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.content.getMetadataItem({
    ids: [],
    asyncCheckFiles: BoolInt.True,
    asyncRefreshLocalMediaAgent: BoolInt.True,
    asyncRefreshAnalysis: BoolInt.True,
    checkFiles: BoolInt.True,
    skipRefresh: BoolInt.True,
    checkFileAvailability: BoolInt.True,
    asyncAugmentMetadata: BoolInt.True,
    augmentCount: BoolInt.True,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetMetadataItem } from "@parke.dev/plexjs/funcs/contentGetMetadataItem.js";
import { Accepts, BoolInt } from "@parke.dev/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 contentGetMetadataItem(plexAPI, {
    ids: [],
    asyncCheckFiles: BoolInt.True,
    asyncRefreshLocalMediaAgent: BoolInt.True,
    asyncRefreshAnalysis: BoolInt.True,
    checkFiles: BoolInt.True,
    skipRefresh: BoolInt.True,
    checkFileAvailability: BoolInt.True,
    asyncAugmentMetadata: BoolInt.True,
    augmentCount: BoolInt.True,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetMetadataItem failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetMetadataItemRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetMetadataItemResponse>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getAlbums

Get all albums in a music section

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getAlbums({
    sectionId: 817133,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetAlbums } from "@parke.dev/plexjs/funcs/contentGetAlbums.js";
import { Accepts } from "@parke.dev/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 contentGetAlbums(plexAPI, {
    sectionId: 817133,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetAlbums failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetAlbumsRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithMetadata>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

listContent

Get the items in a section, potentially filtering them. When includeCollections=1 is passed, the response may also contain Collection items.

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts, BoolInt, MediaType } from "@parke.dev/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.content.listContent({
    mediaQuery: {
      type: MediaType.Episode,
      sort: "duration:desc,index",
      sourceType: 2,
    },
    sectionId: 813218,
    includeMeta: BoolInt.True,
    includeGuids: BoolInt.True,
    includeCollections: BoolInt.True,
    includeExternalMedia: BoolInt.True,
    includeAdvanced: BoolInt.True,
    checkFiles: BoolInt.True,
    includeRelated: BoolInt.True,
    includeExtras: BoolInt.True,
    includePopularLeaves: BoolInt.True,
    includeConcerts: BoolInt.True,
    includeOnDeck: BoolInt.True,
    includeChapters: BoolInt.True,
    includePreferences: BoolInt.True,
    includeBandwidths: BoolInt.True,
    includeLoudnessRamps: BoolInt.True,
    includeStations: BoolInt.True,
    includeExternalIds: BoolInt.True,
    includeReviews: BoolInt.True,
    includeCredits: BoolInt.True,
    includeArt: BoolInt.True,
    includeThumb: BoolInt.True,
    includeBanner: BoolInt.True,
    includeTheme: BoolInt.True,
    asyncAugmentMetadata: BoolInt.True,
    asyncRefreshLocalMediaAgent: BoolInt.True,
    nocache: BoolInt.True,
    skipRefresh: BoolInt.True,
    unwatched: BoolInt.True,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentListContent } from "@parke.dev/plexjs/funcs/contentListContent.js";
import { Accepts, BoolInt, MediaType } from "@parke.dev/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 contentListContent(plexAPI, {
    mediaQuery: {
      type: MediaType.Episode,
      sort: "duration:desc,index",
      sourceType: 2,
    },
    sectionId: 813218,
    includeMeta: BoolInt.True,
    includeGuids: BoolInt.True,
    includeCollections: BoolInt.True,
    includeExternalMedia: BoolInt.True,
    includeAdvanced: BoolInt.True,
    checkFiles: BoolInt.True,
    includeRelated: BoolInt.True,
    includeExtras: BoolInt.True,
    includePopularLeaves: BoolInt.True,
    includeConcerts: BoolInt.True,
    includeOnDeck: BoolInt.True,
    includeChapters: BoolInt.True,
    includePreferences: BoolInt.True,
    includeBandwidths: BoolInt.True,
    includeLoudnessRamps: BoolInt.True,
    includeStations: BoolInt.True,
    includeExternalIds: BoolInt.True,
    includeReviews: BoolInt.True,
    includeCredits: BoolInt.True,
    includeArt: BoolInt.True,
    includeThumb: BoolInt.True,
    includeBanner: BoolInt.True,
    includeTheme: BoolInt.True,
    asyncAugmentMetadata: BoolInt.True,
    asyncRefreshLocalMediaAgent: BoolInt.True,
    nocache: BoolInt.True,
    skipRefresh: BoolInt.True,
    unwatched: BoolInt.True,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentListContent failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListContentRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.ListContentResponse>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getAllLeaves

Get all leaves in a section (such as episodes in a show section)

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getAllLeaves({
    sectionId: 633197,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetAllLeaves } from "@parke.dev/plexjs/funcs/contentGetAllLeaves.js";
import { Accepts } from "@parke.dev/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 contentGetAllLeaves(plexAPI, {
    sectionId: 633197,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetAllLeaves failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetAllLeavesRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithMetadata>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getArts

Get artwork for a library section

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getArts({
    sectionId: 859200,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetArts } from "@parke.dev/plexjs/funcs/contentGetArts.js";
import { Accepts } from "@parke.dev/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 contentGetArts(plexAPI, {
    sectionId: 859200,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetArts failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetArtsRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithArtwork>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getCategories

Get categories in a library section

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getCategories({
    sectionId: 21841,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetCategories } from "@parke.dev/plexjs/funcs/contentGetCategories.js";
import { Accepts } from "@parke.dev/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 contentGetCategories(plexAPI, {
    sectionId: 21841,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetCategories failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetCategoriesRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithArtwork>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getCluster

Get clusters in a library section (typically for photos)

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getCluster({
    sectionId: 138560,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetCluster } from "@parke.dev/plexjs/funcs/contentGetCluster.js";
import { Accepts } from "@parke.dev/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 contentGetCluster(plexAPI, {
    sectionId: 138560,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetCluster failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetClusterRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithArtwork>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getSonicPath

Get a list of audio tracks starting at one and ending at another which are similar across the path

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getSonicPath({
    sectionId: 914549,
    startID: 629990,
    endID: 687740,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetSonicPath } from "@parke.dev/plexjs/funcs/contentGetSonicPath.js";
import { Accepts } from "@parke.dev/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 contentGetSonicPath(plexAPI, {
    sectionId: 914549,
    startID: 629990,
    endID: 687740,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetSonicPath failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetSonicPathRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithMetadata>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getFolders

Get all folder locations of the media in a section

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getFolders({
    sectionId: 892532,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetFolders } from "@parke.dev/plexjs/funcs/contentGetFolders.js";
import { Accepts } from "@parke.dev/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 contentGetFolders(plexAPI, {
    sectionId: 892532,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetFolders failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetFoldersRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetFoldersResponse>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

listMoments

Get moments in a library section (typically for photos)

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.listMoments({
    sectionId: 403239,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentListMoments } from "@parke.dev/plexjs/funcs/contentListMoments.js";
import { Accepts } from "@parke.dev/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 contentListMoments(plexAPI, {
    sectionId: 403239,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentListMoments failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.ListMomentsRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithArtwork>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getSonicallySimilar

Get the nearest audio tracks to a particular analysis

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getSonicallySimilar({
    sectionId: 525956,
    values: [],
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetSonicallySimilar } from "@parke.dev/plexjs/funcs/contentGetSonicallySimilar.js";
import { Accepts } from "@parke.dev/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 contentGetSonicallySimilar(plexAPI, {
    sectionId: 525956,
    values: [],
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetSonicallySimilar failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetSonicallySimilarRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.MediaContainerWithMetadata>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.SDKError 4XX, 5XX */*

getCollectionImage

Get an image for the collection based on the items within

Example Usage

import { PlexAPI } from "@parke.dev/plexjs";
import { Accepts } from "@parke.dev/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.content.getCollectionImage({
    collectionId: 474227,
    updatedAt: 759379,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PlexAPICore } from "@parke.dev/plexjs/core.js";
import { contentGetCollectionImage } from "@parke.dev/plexjs/funcs/contentGetCollectionImage.js";
import { Accepts } from "@parke.dev/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 contentGetCollectionImage(plexAPI, {
    collectionId: 474227,
    updatedAt: 759379,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("contentGetCollectionImage failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetCollectionImageRequest ✔️ The request object to use for the request.
options RequestOptions ➖ Used to set various options for making HTTP requests.
options.fetchOptions RequestInit ➖ 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 ➖ Enables retrying HTTP requests under certain failure conditions.

Response

Promise<ReadableStream>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*