unleash-client
Version:
Unleash Client for Node
45 lines • 1.66 kB
TypeScript
import * as http from 'http';
import { URL } from 'url';
import { CustomHeaders } from './headers';
import { HttpOptions } from './http-options';
export interface RequestOptions {
url: string;
timeout?: number;
headers?: CustomHeaders;
}
export interface GetRequestOptions extends RequestOptions {
etag?: string;
appName?: string;
instanceId?: string;
connectionId: string;
supportedSpecVersion?: string;
httpOptions?: HttpOptions;
interval?: number;
}
export interface Data {
[key: string]: any;
}
export interface PostRequestOptions extends RequestOptions {
json: Data;
appName?: string;
instanceId?: string;
connectionId?: string;
interval?: number;
httpOptions?: HttpOptions;
}
export declare const getDefaultAgent: (url: URL) => http.Agent;
type HeaderOptions = {
appName?: string;
instanceId?: string;
etag?: string;
contentType?: string;
custom?: CustomHeaders;
specVersionSupported?: string;
connectionId?: string;
interval?: number;
};
export declare const buildHeaders: ({ appName, instanceId, etag, contentType, custom, specVersionSupported, connectionId, interval, }: HeaderOptions) => Record<string, string>;
export declare const post: ({ url, appName, timeout, instanceId, connectionId, interval, headers, json, httpOptions, }: PostRequestOptions) => Promise<import("node-fetch").Response>;
export declare const get: ({ url, etag, appName, timeout, instanceId, connectionId, interval, headers, httpOptions, supportedSpecVersion, }: GetRequestOptions) => Promise<import("node-fetch").Response>;
export {};
//# sourceMappingURL=request.d.ts.map