# UltraBlur (*ultraBlur*) ## Overview Service provided to compute UltraBlur colors and images. ### Available Operations * [getColors](#getcolors) - Get UltraBlur Colors * [getImage](#getimage) - Get UltraBlur Image ## getColors Retrieves the four colors extracted from an image for clients to use to generate an ultrablur image. ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; import { Accepts } from "@lukehagar/plexjs/models/shared"; const plexAPI = new PlexAPI({ accepts: Accepts.ApplicationXml, clientIdentifier: "abc123", product: "Plex for Roku", version: "2.4.1", platform: "Roku", platformVersion: "4.3 build 1057", device: "Roku 3", model: "4200X", deviceVendor: "Roku", deviceName: "Living Room TV", marketplace: "googlePlay", token: "", }); async function run() { const result = await plexAPI.ultraBlur.getColors({ url: "/library/metadata/217745/art/1718931408", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { ultraBlurGetColors } from "@lukehagar/plexjs/funcs/ultraBlurGetColors.js"; import { Accepts } from "@lukehagar/plexjs/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({ accepts: Accepts.ApplicationXml, clientIdentifier: "abc123", product: "Plex for Roku", version: "2.4.1", platform: "Roku", platformVersion: "4.3 build 1057", device: "Roku 3", model: "4200X", deviceVendor: "Roku", deviceName: "Living Room TV", marketplace: "googlePlay", token: "", }); async function run() { const res = await ultraBlurGetColors(plexAPI, { url: "/library/metadata/217745/art/1718931408", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("ultraBlurGetColors failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetColorsRequest](../../models/operations/getcolorsrequest.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.GetColorsResponse](../../models/operations/getcolorsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getImage Retrieves a server-side generated UltraBlur image based on the provided color inputs. Clients should always call this via the photo transcoder endpoint. ### Example Usage ```typescript import { PlexAPI } from "@lukehagar/plexjs"; import { Accepts, BoolInt } from "@lukehagar/plexjs/models/shared"; const plexAPI = new PlexAPI({ accepts: Accepts.ApplicationXml, clientIdentifier: "abc123", product: "Plex for Roku", version: "2.4.1", platform: "Roku", platformVersion: "4.3 build 1057", device: "Roku 3", model: "4200X", deviceVendor: "Roku", deviceName: "Living Room TV", marketplace: "googlePlay", token: "", }); async function run() { const result = await plexAPI.ultraBlur.getImage({ topLeft: "3f280a", topRight: "6b4713", bottomRight: "0f2a43", bottomLeft: "1c425d", width: 1920, height: 1080, noise: BoolInt.True, }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { PlexAPICore } from "@lukehagar/plexjs/core.js"; import { ultraBlurGetImage } from "@lukehagar/plexjs/funcs/ultraBlurGetImage.js"; import { Accepts, BoolInt } from "@lukehagar/plexjs/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({ accepts: Accepts.ApplicationXml, clientIdentifier: "abc123", product: "Plex for Roku", version: "2.4.1", platform: "Roku", platformVersion: "4.3 build 1057", device: "Roku 3", model: "4200X", deviceVendor: "Roku", deviceName: "Living Room TV", marketplace: "googlePlay", token: "", }); async function run() { const res = await ultraBlurGetImage(plexAPI, { topLeft: "3f280a", topRight: "6b4713", bottomRight: "0f2a43", bottomLeft: "1c425d", width: 1920, height: 1080, noise: BoolInt.True, }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("ultraBlurGetImage failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [operations.GetImageRequest](../../models/operations/getimagerequest.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\<[ReadableStream](../../models/.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* |