Skip to content

Latest commit

 

History

History
145 lines (97 loc) · 17.9 KB

README.md

File metadata and controls

145 lines (97 loc) · 17.9 KB

Media

(media)

Overview

API Calls interacting with Plex Media Server Media

Available Operations

markPlayed

This will mark the provided media key as Played.

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.media.markPlayed(59398);

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
key number ✔️ The media key to mark as played [object Object]
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.

Response

Promise<operations.MarkPlayedResponse>

Errors

Error Object Status Code Content Type
errors.MarkPlayedResponseBody 401 application/json
errors.SDKError 4xx-5xx /

markUnplayed

This will mark the provided media key as Unplayed.

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.media.markUnplayed(59398);

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
key number ✔️ The media key to mark as Unplayed [object Object]
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.

Response

Promise<operations.MarkUnplayedResponse>

Errors

Error Object Status Code Content Type
errors.MarkUnplayedResponseBody 401 application/json
errors.SDKError 4xx-5xx /

updatePlayProgress

This API command can be used to update the play progress of a media item.

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.media.updatePlayProgress("<value>", 90000, "played");

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description Example
key string ✔️ the media key
time number ✔️ The time, in milliseconds, used to set the media playback progress. [object Object]
state string ✔️ The playback state of the media item. [object Object]
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.

Response

Promise<operations.UpdatePlayProgressResponse>

Errors

Error Object Status Code Content Type
errors.UpdatePlayProgressResponseBody 401 application/json
errors.SDKError 4xx-5xx /