# Devices (*devices*) ## Overview Media grabbers provide ways for media to be obtained for a given protocol. The simplest ones are `stream` and `download`. More complex grabbers can have associated devices Network tuners can present themselves on the network using the Simple Service Discovery Protocol and Plex Media Server will discover them. The following XML is an example of the data returned from SSDP. The `deviceType`, `serviceType`, and `serviceId` values must remain as they are in the example in order for PMS to properly discover the device. Other less-obvious fields are described in the parameters section below. Example SSDP output ``` 1 0 urn:plex-tv:device:Media:1 Turing Hopper 3000 Plex, Inc. https://plex.tv/ Turing Hopper 3000 Media Grabber Plex Media Grabber 1 https://plex.tv uuid:42fde8e4-93b6-41e5-8a63-12d848655811 http://10.0.0.5:8088 urn:plex-tv:service:MediaGrabber:1 urn:plex-tv:serviceId:MediaGrabber ``` - UDN: (string) A UUID for the device. This should be unique across models of a device at minimum. - URLBase: (string) The base HTTP URL for the device from which all of the other endpoints are hosted. ### Available Operations * [getAvailableGrabbers](#getavailablegrabbers) - Get available grabbers * [listDevices](#listdevices) - Get all devices * [addDevice](#adddevice) - Add a device * [discoverDevices](#discoverdevices) - Tell grabbers to discover devices * [removeDevice](#removedevice) - Remove a device * [getDeviceDetails](#getdevicedetails) - Get device details * [modifyDevice](#modifydevice) - Enable or disable a device * [setChannelmap](#setchannelmap) - Set a device's channel mapping * [getDevicesChannels](#getdeviceschannels) - Get a device's channels * [setDevicePreferences](#setdevicepreferences) - Set device preferences * [stopScan](#stopscan) - Tell a device to stop scanning for channels * [scan](#scan) - Tell a device to scan for channels * [getThumb](#getthumb) - Get device thumb ## getAvailableGrabbers Get available grabbers visible to the server ### 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.devices.getAvailableGrabbers({ protocol: "livetv", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesGetAvailableGrabbers } from "@lukehagar/plexjs/funcs/devicesGetAvailableGrabbers.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 devicesGetAvailableGrabbers(plexAPI, { protocol: "livetv", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesGetAvailableGrabbers failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetAvailableGrabbersRequest](../../sdk/models/operations/getavailablegrabbersrequest.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.GetAvailableGrabbersResponse](../../sdk/models/operations/getavailablegrabbersresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## listDevices Get the list of all devices present ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { const result = await plexAPI.devices.listDevices(); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesListDevices } from "@lukehagar/plexjs/funcs/devicesListDevices.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 devicesListDevices(plexAPI); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesListDevices 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.ListDevicesResponse](../../sdk/models/operations/listdevicesresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## addDevice This endpoint adds a device to an existing grabber. The device is identified, and added to the correct grabber. ### 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.devices.addDevice({ uri: "http://10.0.0.5", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesAddDevice } from "@lukehagar/plexjs/funcs/devicesAddDevice.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 devicesAddDevice(plexAPI, { uri: "http://10.0.0.5", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesAddDevice failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.AddDeviceRequest](../../sdk/models/operations/adddevicerequest.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.AddDeviceResponse](../../sdk/models/operations/adddeviceresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## discoverDevices Tell grabbers to discover devices ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; const plexAPI = new PlexAPI(); async function run() { const result = await plexAPI.devices.discoverDevices(); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesDiscoverDevices } from "@lukehagar/plexjs/funcs/devicesDiscoverDevices.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 devicesDiscoverDevices(plexAPI); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesDiscoverDevices 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.DiscoverDevicesResponse](../../sdk/models/operations/discoverdevicesresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## removeDevice Remove a devices by its id along with its channel mappings ### 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.devices.removeDevice({ deviceId: 685908, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesRemoveDevice } from "@lukehagar/plexjs/funcs/devicesRemoveDevice.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 devicesRemoveDevice(plexAPI, { deviceId: 685908, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesRemoveDevice failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.RemoveDeviceRequest](../../sdk/models/operations/removedevicerequest.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.RemoveDeviceResponse](../../sdk/models/operations/removedeviceresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getDeviceDetails Get a device's details by its id ### 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.devices.getDeviceDetails({ deviceId: 170949, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesGetDeviceDetails } from "@lukehagar/plexjs/funcs/devicesGetDeviceDetails.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 devicesGetDeviceDetails(plexAPI, { deviceId: 170949, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesGetDeviceDetails failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetDeviceDetailsRequest](../../sdk/models/operations/getdevicedetailsrequest.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.GetDeviceDetailsResponse](../../sdk/models/operations/getdevicedetailsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## modifyDevice Enable or disable a device by its id ### 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.devices.modifyDevice({ deviceId: 879135, enabled: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesModifyDevice } from "@lukehagar/plexjs/funcs/devicesModifyDevice.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 devicesModifyDevice(plexAPI, { deviceId: 879135, enabled: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesModifyDevice failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.ModifyDeviceRequest](../../sdk/models/operations/modifydevicerequest.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.ModifyDeviceResponse](../../sdk/models/operations/modifydeviceresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## setChannelmap Set a device's channel mapping ### 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.devices.setChannelmap({ deviceId: 937661, channelMapping: {}, channelMappingByKey: {}, channelsEnabled: [ "4", "6", ".", "1", ",", "4", "4", ".", "1", ",", "4", "5", ".", "1", ], }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesSetChannelmap } from "@lukehagar/plexjs/funcs/devicesSetChannelmap.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 devicesSetChannelmap(plexAPI, { deviceId: 937661, channelMapping: {}, channelMappingByKey: {}, channelsEnabled: [ "4", "6", ".", "1", ",", "4", "4", ".", "1", ",", "4", "5", ".", "1", ], }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesSetChannelmap failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.SetChannelmapRequest](../../sdk/models/operations/setchannelmaprequest.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.SetChannelmapResponse](../../sdk/models/operations/setchannelmapresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getDevicesChannels Get a device's channels by its id ### 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.devices.getDevicesChannels({ deviceId: 517209, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesGetDevicesChannels } from "@lukehagar/plexjs/funcs/devicesGetDevicesChannels.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 devicesGetDevicesChannels(plexAPI, { deviceId: 517209, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesGetDevicesChannels failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetDevicesChannelsRequest](../../sdk/models/operations/getdeviceschannelsrequest.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.GetDevicesChannelsResponse](../../sdk/models/operations/getdeviceschannelsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## setDevicePreferences Set device preferences by its id ### 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.devices.setDevicePreferences({ deviceId: 420973, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesSetDevicePreferences } from "@lukehagar/plexjs/funcs/devicesSetDevicePreferences.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 devicesSetDevicePreferences(plexAPI, { deviceId: 420973, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesSetDevicePreferences failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.SetDevicePreferencesRequest](../../sdk/models/operations/setdevicepreferencesrequest.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.SetDevicePreferencesResponse](../../sdk/models/operations/setdevicepreferencesresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## stopScan Tell a device to stop scanning for channels ### 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.devices.stopScan({ deviceId: 576494, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesStopScan } from "@lukehagar/plexjs/funcs/devicesStopScan.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 devicesStopScan(plexAPI, { deviceId: 576494, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesStopScan failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.StopScanRequest](../../sdk/models/operations/stopscanrequest.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.StopScanResponse](../../sdk/models/operations/stopscanresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## scan Tell a device to scan for channels ### 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.devices.scan({ deviceId: 57391, source: "Cable", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesScan } from "@lukehagar/plexjs/funcs/devicesScan.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 devicesScan(plexAPI, { deviceId: 57391, source: "Cable", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesScan failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.ScanRequest](../../sdk/models/operations/scanrequest.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.ScanResponse](../../sdk/models/operations/scanresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getThumb Get a device's thumb for display to the user ### 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.devices.getThumb({ deviceId: 960617, version: 1025, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { devicesGetThumb } from "@lukehagar/plexjs/funcs/devicesGetThumb.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 devicesGetThumb(plexAPI, { deviceId: 960617, version: 1025, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("devicesGetThumb failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetThumbRequest](../../sdk/models/operations/getthumbrequest.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.GetThumbResponse](../../sdk/models/operations/getthumbresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* |