UNPKG

tibber-api

Version:

Node.js module for connecting to Tibber API and extract data from your connected homes, including realtime data from Tibber Pulse.

52 lines (51 loc) 1.75 kB
import { IConfig } from '../models/IConfig'; import * as url from 'url'; import { RequestOptions } from 'https'; import { HttpMethod } from './models/HttpMethod'; export declare class TibberQueryBase { active: boolean; private _config; private _headerManager; private _requestTimeout; get requestTimeout(): number; set requestTimeout(value: number); get config(): IConfig; set config(value: IConfig); /** * */ constructor(config: IConfig, requestTimeout?: number); /** * Try to parse a string and return a valid JSON object. * If string is not valid JSON, it will return an empty object instead. * @param input Input string to try to parse as a JSON object * @returns Parsed or empty Json object */ protected JsonTryParse(input: string): object; /** * * @param method HTTP method to use * @param uri Uri to use * @returns An object containing request options */ protected getRequestOptions(method: HttpMethod, uri: url.UrlWithParsedQuery): RequestOptions; /** * General GQL query * @param query GQL query. * @param variables Variables used by query parameter. * @return Query result as JSON data */ query(query: string, variables?: object): Promise<any>; /** * Get selected home with some selected properties, including address and owner. * @param homeId Tibber home ID * @return IHome object */ getWebsocketSubscriptionUrl(): Promise<url.URL>; /** * Get selected home with some selected properties, including address and owner. * @param homeId Tibber home ID * @return IHome object */ getRealTimeEnabled(homeId: string): Promise<boolean>; }