@typed/fp
Version:
Data Structures and Resources for fp-ts
50 lines • 1.23 kB
TypeScript
/**
* @typed/fp/http is a basic abstraction over HTTP using Env
* @since 0.9.4
*/
import * as Ei from 'fp-ts/Either';
import * as E from './Env';
/**
* @category Model
* @since 0.9.4
*/
export declare type HttpHeaders = Readonly<Record<string, string | undefined>>;
/**
* @category Model
* @since 0.9.4
*/
export declare type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'PATCH' | 'HEAD';
/**
* @category Model
* @since 0.9.4
*/
export interface HttpResponse {
readonly body: unknown;
readonly status: number;
readonly headers: HttpHeaders;
}
/**
* @category Options
* @since 0.9.4
*/
export declare type HttpOptions = {
readonly method?: HttpMethod;
readonly headers?: HttpHeaders;
readonly body?: string;
};
/**
* @category Constructor
* @since 0.9.4
*/
export declare const http: {
(url: string, options?: HttpOptions | undefined): E.Env<{
readonly http: (url: string, options?: HttpOptions | undefined) => E.Of<Ei.Either<Error, HttpResponse>>;
}, Ei.Either<Error, HttpResponse>>;
readonly key: "http";
};
/**
* @category Environment
* @since 0.9.4
*/
export declare type HttpEnv = E.RequirementsOf<typeof http>;
//# sourceMappingURL=http.d.ts.map