# General (*general*) ## Overview General endpoints for basic PMS operation not specific to any media provider ### Available Operations * [getServerInfo](#getserverinfo) - Get PMS info * [getIdentity](#getidentity) - Get PMS identity * [getSourceConnectionInformation](#getsourceconnectioninformation) - Get Source Connection Information * [getTransientToken](#gettransienttoken) - Get Transient Tokens ## getServerInfo Information about this PMS setup and configuration ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI({ xPlexClientIdentifier: "abc123", xPlexProduct: "Plex for Roku", xPlexVersion: "2.4.1", xPlexPlatform: "Roku", xPlexPlatformVersion: "4.3 build 1057", xPlexDevice: "Roku 3", xPlexModel: "4200X", xPlexDeviceVendor: "Roku", xPlexDeviceName: "Living Room TV", xPlexMarketplace: "googlePlay", }); async function run() { const result = await plexAPI.general.getServerInfo({}); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { generalGetServerInfo } from "@lukehagar/plexjs/funcs/generalGetServerInfo.js"; // Use `PlexAPICore` for best tree-shaking performance. // You can create one instance of it to use across an application. const plexAPI = new PlexAPICore({ xPlexClientIdentifier: "abc123", xPlexProduct: "Plex for Roku", xPlexVersion: "2.4.1", xPlexPlatform: "Roku", xPlexPlatformVersion: "4.3 build 1057", xPlexDevice: "Roku 3", xPlexModel: "4200X", xPlexDeviceVendor: "Roku", xPlexDeviceName: "Living Room TV", xPlexMarketplace: "googlePlay", }); async function run() { const res = await generalGetServerInfo(plexAPI, {}); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("generalGetServerInfo failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetServerInfoRequest](../../sdk/models/operations/getserverinforequest.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.GetServerInfoResponse](../../sdk/models/operations/getserverinforesponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getIdentity Get details about this PMS's identity ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { const result = await plexAPI.general.getIdentity(); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { generalGetIdentity } from "@lukehagar/plexjs/funcs/generalGetIdentity.js"; // Use `PlexAPICore` for best tree-shaking performance. // You can create one instance of it to use across an application. const plexAPI = new PlexAPICore(); async function run() { const res = await generalGetIdentity(plexAPI); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("generalGetIdentity 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.GetIdentityResponse](../../sdk/models/operations/getidentityresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getSourceConnectionInformation If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token. ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; import { BoolInt } from "@lukehagar/plexjs/sdk/models/shared"; const plexAPI = new PlexAPI({ xPlexClientIdentifier: "abc123", xPlexProduct: "Plex for Roku", xPlexVersion: "2.4.1", xPlexPlatform: "Roku", xPlexPlatformVersion: "4.3 build 1057", xPlexDevice: "Roku 3", xPlexModel: "4200X", xPlexDeviceVendor: "Roku", xPlexDeviceName: "Living Room TV", xPlexMarketplace: "googlePlay", }); async function run() { const result = await plexAPI.general.getSourceConnectionInformation({ source: "server://client-identifier", refresh: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { generalGetSourceConnectionInformation } from "@lukehagar/plexjs/funcs/generalGetSourceConnectionInformation.js"; import { 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({ xPlexClientIdentifier: "abc123", xPlexProduct: "Plex for Roku", xPlexVersion: "2.4.1", xPlexPlatform: "Roku", xPlexPlatformVersion: "4.3 build 1057", xPlexDevice: "Roku 3", xPlexModel: "4200X", xPlexDeviceVendor: "Roku", xPlexDeviceName: "Living Room TV", xPlexMarketplace: "googlePlay", }); async function run() { const res = await generalGetSourceConnectionInformation(plexAPI, { source: "server://client-identifier", refresh: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("generalGetSourceConnectionInformation failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetSourceConnectionInformationRequest](../../sdk/models/operations/getsourceconnectioninformationrequest.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.GetSourceConnectionInformationResponse](../../sdk/models/operations/getsourceconnectioninformationresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getTransientToken This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted. Note: This endpoint responds to all HTTP verbs but POST in preferred ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; import { GetTransientTokenScope, GetTransientTokenType } from "@lukehagar/plexjs/sdk/models/operations"; const plexAPI = new PlexAPI({ xPlexClientIdentifier: "abc123", xPlexProduct: "Plex for Roku", xPlexVersion: "2.4.1", xPlexPlatform: "Roku", xPlexPlatformVersion: "4.3 build 1057", xPlexDevice: "Roku 3", xPlexModel: "4200X", xPlexDeviceVendor: "Roku", xPlexDeviceName: "Living Room TV", xPlexMarketplace: "googlePlay", }); async function run() { const result = await plexAPI.general.getTransientToken({ type: GetTransientTokenType.Delegation, scope: GetTransientTokenScope.All, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { generalGetTransientToken } from "@lukehagar/plexjs/funcs/generalGetTransientToken.js"; import { GetTransientTokenScope, GetTransientTokenType } from "@lukehagar/plexjs/sdk/models/operations"; // Use `PlexAPICore` for best tree-shaking performance. // You can create one instance of it to use across an application. const plexAPI = new PlexAPICore({ xPlexClientIdentifier: "abc123", xPlexProduct: "Plex for Roku", xPlexVersion: "2.4.1", xPlexPlatform: "Roku", xPlexPlatformVersion: "4.3 build 1057", xPlexDevice: "Roku 3", xPlexModel: "4200X", xPlexDeviceVendor: "Roku", xPlexDeviceName: "Living Room TV", xPlexMarketplace: "googlePlay", }); async function run() { const res = await generalGetTransientToken(plexAPI, { type: GetTransientTokenType.Delegation, scope: GetTransientTokenScope.All, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("generalGetTransientToken failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetTransientTokenRequest](../../sdk/models/operations/gettransienttokenrequest.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.GetTransientTokenResponse](../../sdk/models/operations/gettransienttokenresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* |