UNPKG

@thisisagile/easy

Version:

Straightforward library for building domain-driven microservice architectures

41 lines (40 loc) 1.65 kB
import { ContentType } from './ContentType'; import { PageOptions } from '../types/PageList'; import { Optional } from '../types/Types'; import { Text } from '../types/Text'; import { Enum } from '../types/Enum'; import { CacheAge } from '../types/CacheAge'; import { Id } from '../types/Id'; export declare const toPageOptions: (options?: RequestOptions | PageOptions) => Optional<PageOptions>; export declare class RequestOptions extends Enum { readonly type: ContentType; readonly headers: { [key: string]: any; }; pageOptions?: PageOptions | undefined; requestOptions: { maxRedirects?: number; validateStatus?: (status: number) => boolean; timeout?: CacheAge; }; constructor(type?: ContentType, headers?: { [key: string]: any; }, pageOptions?: PageOptions | undefined); static get Form(): RequestOptions; static get Json(): RequestOptions; static get Stream(): RequestOptions; static get Text(): RequestOptions; static get Xml(): RequestOptions; page: (options: PageOptions) => this; authorization: (auth: string) => this; apiKey: (apiKey: string) => this; setHeader: (key: Text, value: Id | boolean) => this; setHeaderUnlessPresent: (key: string, value?: Id | boolean) => this; accept: (type: ContentType) => this; bearer: (jwt: Text) => this; basic: (username: Text, password: Text) => this; maxRedirects: (max?: number) => this; validateStatus: (validate?: (status: number) => boolean) => this; timeout: (t?: CacheAge) => this; } export declare const isRequestOptions: (o?: unknown) => o is RequestOptions;