UNPKG

node-hue-api

Version:
41 lines (40 loc) 2.39 kB
import { Api } from '../Api'; import { HueApiRateLimits } from '../HueApiRateLimits'; export declare class RemoteBootstrap { private readonly clientId; private readonly clientSecret; private remoteApi; private readonly rateLimits; constructor(clientId: string, clientSecret: string, rateLimits: HueApiRateLimits); /** * Obtains the AuthCode URL that can be used to request OAuth tokens for your user/application details * @param deviceId The device ID of the remote application. * @param appId The application ID of the remote application. * @param state A unique state value that will be provided back to you in the reponse payload to prevent against cross-site forgeries. * @returns The URL that can be used to start the exchange for OAuth tokens. */ getAuthCodeUrl(deviceId: string, appId: string, state: string): string; /** * Connects to the Remote API using the provided access code, exchanging it for valid OAuth tokens that can be used * to connect again in the future. * * This function is used to bootstrap the first connection to the remote API for a new application. * * @param code The authorization code obtained from the callback made by the remote portal to your application * @param username The username for the remote application. * @param timeout The timeout for the access token request to the remote API, defaults to 12 seconds * @param deviceType The device type for the application connection. * @param remoteBridgeId The id of the bridge in the remote portal, defaults to 0. */ connectWithCode(code: string, username?: string, timeout?: number, deviceType?: string, remoteBridgeId?: number): Promise<Api>; /** * Connects to the Remote API using the provided OAuth tokens that were previously obtained. * @param accessToken The OAuth access token. * @param refreshToken The OAuth refresh token. * @param username The remote username used to connect with hue bridge * @param timeout The timeout for the access token request to the remote API, defaults to 12 seconds * @param deviceType The device type for the application connection. */ connectWithTokens(accessToken: string, refreshToken: string, username?: string, timeout?: number, deviceType?: string): Promise<Api>; private _getRemoteApi; }