node-hue-api
Version:
Philips Hue API Library for Node.js
45 lines (44 loc) • 1.29 kB
TypeScript
import { HTTPHeaders, RequestConfig } from '../HttpClientFetch';
import { Placeholder } from '../../placeholders/Placeholder';
type ApiEndpointDefinition = {
placeholders: Placeholder[];
headers: HTTPHeaders;
url?: string;
method?: string;
json?: boolean;
postProcessing?: Function;
errorHandler?: Function;
statusCode?: number;
_payloadFn?: Function;
};
export type ApiBodyPayload = {
type: string;
body: object;
};
export declare class ApiEndpoint {
private readonly _data;
constructor();
placeholder(placeholder?: Placeholder): this;
uri(uri: string): this;
get(): this;
post(): this;
put(): this;
delete(): this;
method(method: string): this;
acceptJson(): this;
acceptXml(): this;
pureJson(): this;
postProcess(fn: Function): this;
errorHandler(fn: Function): this;
statusCode(expectedStatusCode: number): this;
setHeader(name: string, value: string): this;
getRequest(parameters: any): RequestConfig;
getPostProcessing(): Function | undefined;
getErrorHandler(): Function | undefined;
payload(fn: Function): this;
requiresJsonConversion(): boolean;
get successCode(): number;
get headers(): object;
_getData(): ApiEndpointDefinition;
}
export {};