import { Commander } from './commander.js'; import { RokuDeviceInfo } from './device-info.js'; import { KeyType } from './key-command.js'; /** The default port a roku device will use for remote commands. */ export declare const ROKU_DEFAULT_PORT = "8060"; /** The ids used by roku to identify an app. */ export type RokuAppId = number | string; /** * The properties associated with a Roku app. */ export interface RokuApp { /** The id, used within the api. */ id: string; /** The display name of the app. */ name: string; /** The app type (menu, tvin, appl, etc). */ type: string; /** The app version. */ version: string; } /** * The response from calling the icon method. */ export interface RokuIcon { /** The mime type of the icon file. */ type?: string; /** The file extension of the icon file. */ extension?: string; /** The fetch response. */ response: Response; } export interface RokuSearchParams { keyword?: string; title?: string; type?: 'movie' | 'tv-show' | 'person' | 'channel' | 'game'; tmsid?: string; season?: number; showUnavailable?: boolean; matchAny?: boolean; provider?: string | number | string[] | number[]; launch?: boolean; } export interface RokuMediaInfo { error: boolean; state: string; plugin?: { bandwidth: string; id: string; name: string; }; format?: { audio: string; captions: string; container: string; drm: string; video: string; videoRes: string; }; buffering?: { current: string; max: string; target: string; }; newStream?: { speed: string; }; position?: string; duration?: string; isLive?: boolean; runtime?: string; streamSegmentBitrate?: { bitrate: string; mediaSequence: string; segmentType: string; time: string; }; } /** * The Roku client class. Contains methods to talk to a roku device. */ export declare class RokuClient { /** The URL of the Roku device, including the port. */ ip: URL; /** * Return a promise resolving to a new `Client` object for the first Roku * device discovered on the network. This method resolves to a single * `Client` object. * @param timeout The time in ms to wait before giving up. * @return A promise resolving to a `Client` object. */ static discover(timeout?: number): Promise; /** * Return a promise resolving to a list of `Client` objects corresponding to * each roku device found on the network. Check the client's ip member to see * which device the client corresponds to. * @param timeout The time in ms to wait before giving up. * @return A promise resolving to a list of `Client` objects. */ static discoverAll(timeout?: number): Promise; /** * Discover Roku devices on the network as they are found. This method invokes * the callback for each device found, allowing you to process devices as they * are discovered rather than waiting for the full timeout. * @param callback The function to call for each device found, receives a `Client` object. * @param timeout The time in ms to wait before giving up. * @return A promise that resolves when the timeout completes. */ static discoverEach(callback: (client: RokuClient) => void, timeout?: number): Promise; /** * Construct a new `Client` object with the given address. * @param ip The address of the Roku device on the network. If no port is * given, then the default roku remote port will be used. */ constructor(ip: string | URL); /** * Get a list of apps installed on this device. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#queryapps-example} */ apps(): Promise; /** * Get the active app, or null if the home screen is displayed. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#queryactive-app-examples} */ active(): Promise; /** * Get the info of this Roku device. Responses vary between devices. * All keys are coerced to camelcase for easier access, so user-device-name * becomes userDeviceName, etc. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#querydevice-info-example} */ info(): Promise; /** * Fetch the given icon from the Roku device and return an object containing * the image type, extension, and the fetch response. The response can be * streamed to a file, turned into a data url, etc. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#queryicon-example} * @param appId The app id to get the icon of. * Should be the id from the id field of the app. * @return An object containing the fetch response. */ icon(appId: RokuAppId): Promise; /** * Launch the given `appId`. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#launch-examples} * @param appId The id of the app to launch. * @return A void promise which resolves when the app is launched. */ launch(appId: RokuAppId): Promise; /** * Launch the DTV tuner, optionally with a channel number. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#launch-parameters-for-the-roku-tv-tuner-app-channel-id-tvinputdtv} * @param channel The channel to launch, or leave blank to launch the DTV * ui to the last open channel. * @return A promise which resolves when DTV is launched. */ launchDtv(channel?: number | string): Promise; /** * Open the Roku search page with the given search params. The query may be a * string, in which case it will be used as the `keyword` in the search. * Othewise, query should be a `RokuSearchParams` object, allowing for a more * customized search. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#search-examples} * @param query The search query. * @return A promise which resolves when the search is complete. */ search(query: string | RokuSearchParams): Promise; /** * Get the media player info of this Roku device. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#querymedia-player-example} */ mediaPlayer(): Promise; /** * Helper used by all keypress methods. Converts single characters * to `Lit_` commands to send the letter to the Roku. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#keypress-key-values} * @param func The name of the Roku endpoint function. * @param key The key to press. */ private keyhelper; /** * Equivalent to pressing and releasing the remote control key given. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#keypress-example} * @param key A key from the keys module. * @return A promise which resolves when the keypress has completed. */ keypress(key: KeyType): Promise; /** * Equivalent to pressing and holding the remote control key given. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#keyupkeydown-example} * @param key A key from the keys module. * @return A promise which resolves when the keydown has completed. */ keydown(key: KeyType): Promise; /** * Equivalent to releasing the remote control key given. Only makes sense * if `keydown` was already called for the same key. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#keyupkeydown-example} * @param key A key from the keys module. * @return A promise which resolves when the keyup has completed. */ keyup(key: KeyType): Promise; /** * Send the given string to the Roku device. * A shorthand for calling `keypress` for each letter in the given string. * @see {@link https://developer.roku.com/docs/developer-program/debugging/external-control-api.md#keypress-key-values} * @param text The message to send. * @return A promise which resolves when the text has successfully been sent. */ text(text: string): Promise; /** * Chain multiple remote commands together in one convenient api. * Each value in the `keys` module is available as a command in * camelcase form, and can take an optional number to indicate how many * times the button should be pressed. A `text` method is also available * to send a full string. After composing the command, `send` should * be called to perform the scripted commands. The result of calling * `.command()` can be stored in a variable and modified before calling send. * * @example * client.command() * .volumeUp(10) * .up(2) * .select() * .text('Breaking Bad') * .enter() * .send(); * * @return A commander instance. */ command(): Commander; private _get; private _getXml; private _post; }