# Hubs (*hubs*) ## Overview The hubs within a media provider ### Available Operations * [getAllHubs](#getallhubs) - Get global hubs * [getContinueWatching](#getcontinuewatching) - Get the continue watching hub * [getHubItems](#gethubitems) - Get a hub's items * [getPromotedHubs](#getpromotedhubs) - Get the hubs which are promoted * [getMetadataHubs](#getmetadatahubs) - Get hubs for section by metadata item * [getPostplayHubs](#getpostplayhubs) - Get postplay hubs * [getRelatedHubs](#getrelatedhubs) - Get related hubs * [getSectionHubs](#getsectionhubs) - Get section hubs * [resetSectionDefaults](#resetsectiondefaults) - Reset hubs to defaults * [listHubs](#listhubs) - Get hubs * [createCustomHub](#createcustomhub) - Create a custom hub * [moveHub](#movehub) - Move Hub * [deleteCustomHub](#deletecustomhub) - Delete a custom hub * [updateHubVisibility](#updatehubvisibility) - Change hub visibility ## getAllHubs Get the global hubs in this PMS ### 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.hubs.getAllHubs({ onlyTransient: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetAllHubs } from "@lukehagar/plexjs/funcs/hubsGetAllHubs.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 hubsGetAllHubs(plexAPI, { onlyTransient: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetAllHubs failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetAllHubsRequest](../../sdk/models/operations/getallhubsrequest.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.GetAllHubsResponse](../../sdk/models/operations/getallhubsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getContinueWatching Get the global continue watching hub ### 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.hubs.getContinueWatching({}); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetContinueWatching } from "@lukehagar/plexjs/funcs/hubsGetContinueWatching.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 hubsGetContinueWatching(plexAPI, {}); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetContinueWatching failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetContinueWatchingRequest](../../sdk/models/operations/getcontinuewatchingrequest.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.GetContinueWatchingResponse](../../sdk/models/operations/getcontinuewatchingresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getHubItems Get the items within a single hub specified by identifier ### 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.hubs.getHubItems({ identifier: [ "", "", "", ], }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetHubItems } from "@lukehagar/plexjs/funcs/hubsGetHubItems.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 hubsGetHubItems(plexAPI, { identifier: [ "", "", "", ], }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetHubItems failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetHubItemsRequest](../../sdk/models/operations/gethubitemsrequest.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.GetHubItemsResponse](../../sdk/models/operations/gethubitemsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getPromotedHubs Get the global hubs which are promoted (should be displayed on the home screen) ### 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.hubs.getPromotedHubs({}); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetPromotedHubs } from "@lukehagar/plexjs/funcs/hubsGetPromotedHubs.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 hubsGetPromotedHubs(plexAPI, {}); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetPromotedHubs failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetPromotedHubsRequest](../../sdk/models/operations/getpromotedhubsrequest.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.GetPromotedHubsResponse](../../sdk/models/operations/getpromotedhubsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getMetadataHubs Get the hubs for a section by metadata item. Currently only for music sections ### 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.hubs.getMetadataHubs({ metadataId: 605482, onlyTransient: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetMetadataHubs } from "@lukehagar/plexjs/funcs/hubsGetMetadataHubs.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 hubsGetMetadataHubs(plexAPI, { metadataId: 605482, onlyTransient: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetMetadataHubs failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetMetadataHubsRequest](../../sdk/models/operations/getmetadatahubsrequest.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.GetMetadataHubsResponse](../../sdk/models/operations/getmetadatahubsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getPostplayHubs Get the hubs for a metadata to be displayed in post play ### 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.hubs.getPostplayHubs({ metadataId: 441419, onlyTransient: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetPostplayHubs } from "@lukehagar/plexjs/funcs/hubsGetPostplayHubs.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 hubsGetPostplayHubs(plexAPI, { metadataId: 441419, onlyTransient: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetPostplayHubs failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetPostplayHubsRequest](../../sdk/models/operations/getpostplayhubsrequest.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.GetPostplayHubsResponse](../../sdk/models/operations/getpostplayhubsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getRelatedHubs Get the hubs for a metadata related to the provided metadata item ### 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.hubs.getRelatedHubs({ metadataId: 8858, onlyTransient: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetRelatedHubs } from "@lukehagar/plexjs/funcs/hubsGetRelatedHubs.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 hubsGetRelatedHubs(plexAPI, { metadataId: 8858, onlyTransient: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetRelatedHubs failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetRelatedHubsRequest](../../sdk/models/operations/getrelatedhubsrequest.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.GetRelatedHubsResponse](../../sdk/models/operations/getrelatedhubsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getSectionHubs Get the hubs for a single section ### 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.hubs.getSectionHubs({ sectionId: 336924, onlyTransient: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsGetSectionHubs } from "@lukehagar/plexjs/funcs/hubsGetSectionHubs.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 hubsGetSectionHubs(plexAPI, { sectionId: 336924, onlyTransient: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsGetSectionHubs failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetSectionHubsRequest](../../sdk/models/operations/getsectionhubsrequest.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.GetSectionHubsResponse](../../sdk/models/operations/getsectionhubsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## resetSectionDefaults Reset hubs for this section to defaults and delete custom hubs ### 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.hubs.resetSectionDefaults({ sectionId: 383022, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsResetSectionDefaults } from "@lukehagar/plexjs/funcs/hubsResetSectionDefaults.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 hubsResetSectionDefaults(plexAPI, { sectionId: 383022, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsResetSectionDefaults failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.ResetSectionDefaultsRequest](../../sdk/models/operations/resetsectiondefaultsrequest.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.ResetSectionDefaultsResponse](../../sdk/models/operations/resetsectiondefaultsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## listHubs Get the list of hubs including both built-in and custom ### 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.hubs.listHubs({ sectionId: 442546, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsListHubs } from "@lukehagar/plexjs/funcs/hubsListHubs.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 hubsListHubs(plexAPI, { sectionId: 442546, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsListHubs failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.ListHubsRequest](../../sdk/models/operations/listhubsrequest.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.ListHubsResponse](../../sdk/models/operations/listhubsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## createCustomHub Create a custom hub based on a metadata item ### 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.hubs.createCustomHub({ sectionId: 869922, metadataItemId: 703843, promotedToRecommended: BoolInt.One, promotedToOwnHome: BoolInt.One, promotedToSharedHome: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsCreateCustomHub } from "@lukehagar/plexjs/funcs/hubsCreateCustomHub.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 hubsCreateCustomHub(plexAPI, { sectionId: 869922, metadataItemId: 703843, promotedToRecommended: BoolInt.One, promotedToOwnHome: BoolInt.One, promotedToSharedHome: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsCreateCustomHub failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.CreateCustomHubRequest](../../sdk/models/operations/createcustomhubrequest.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.CreateCustomHubResponse](../../sdk/models/operations/createcustomhubresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## moveHub Changed the ordering of a hub among others hubs ### 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.hubs.moveHub({ sectionId: 755710, identifier: "", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsMoveHub } from "@lukehagar/plexjs/funcs/hubsMoveHub.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 hubsMoveHub(plexAPI, { sectionId: 755710, identifier: "", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsMoveHub failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.MoveHubRequest](../../sdk/models/operations/movehubrequest.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.MoveHubResponse](../../sdk/models/operations/movehubresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## deleteCustomHub Delete a custom hub from 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.hubs.deleteCustomHub({ sectionId: 625677, identifier: "", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsDeleteCustomHub } from "@lukehagar/plexjs/funcs/hubsDeleteCustomHub.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 hubsDeleteCustomHub(plexAPI, { sectionId: 625677, identifier: "", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsDeleteCustomHub failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.DeleteCustomHubRequest](../../sdk/models/operations/deletecustomhubrequest.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.DeleteCustomHubResponse](../../sdk/models/operations/deletecustomhubresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## updateHubVisibility Changed the visibility of a hub for both the admin and shared users ### 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.hubs.updateHubVisibility({ sectionId: 341650, identifier: "", promotedToRecommended: BoolInt.One, promotedToOwnHome: BoolInt.One, promotedToSharedHome: BoolInt.One, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { hubsUpdateHubVisibility } from "@lukehagar/plexjs/funcs/hubsUpdateHubVisibility.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 hubsUpdateHubVisibility(plexAPI, { sectionId: 341650, identifier: "", promotedToRecommended: BoolInt.One, promotedToOwnHome: BoolInt.One, promotedToSharedHome: BoolInt.One, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("hubsUpdateHubVisibility failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.UpdateHubVisibilityRequest](../../sdk/models/operations/updatehubvisibilityrequest.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.UpdateHubVisibilityResponse](../../sdk/models/operations/updatehubvisibilityresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* |