mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
31 KiB
31 KiB
Server
(server)
Overview
Operations against the Plex Media Server System.
Available Operations
- getServerCapabilities - Server Capabilities
- getServerPreferences - Get Server Preferences
- getAvailableClients - Get Available Clients
- getDevices - Get Devices
- getServerIdentity - Get Server Identity
- getMyPlexAccount - Get MyPlex Account
- getResizedPhoto - Get a Resized Photo
- getServerList - Get Server List
getServerCapabilities
Server Capabilities
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerCapabilities();
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.GetServerCapabilitiesResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetServerCapabilitiesResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
getServerPreferences
Get Server Preferences
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerPreferences();
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.GetServerPreferencesResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetServerPreferencesResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
getAvailableClients
Get Available Clients
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getAvailableClients();
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.GetAvailableClientsResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetAvailableClientsResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
getDevices
Get Devices
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getDevices();
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.GetDevicesResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetDevicesResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
getServerIdentity
Get Server Identity
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerIdentity();
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.GetServerIdentityResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetServerIdentityResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
getMyPlexAccount
Returns MyPlex Account Information
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getMyPlexAccount();
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.GetMyPlexAccountResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetMyPlexAccountResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
getResizedPhoto
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
import { MinSize, Upscale } from "@lukehagar/plexjs/models/operations";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getResizedPhoto({
width: 110,
height: 165,
opacity: 643869,
blur: 4000,
minSize: MinSize.Zero,
upscale: Upscale.Zero,
url: "/library/metadata/49564/thumb/1654258204",
});
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetResizedPhotoRequest | ✔️ | 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. |
Response
Promise<operations.GetResizedPhotoResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetResizedPhotoResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
getServerList
Get Server List
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerList();
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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.GetServerListResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.GetServerListResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |