UNPKG

@thisisagile/easy

Version:

Straightforward library for building domain-driven microservice architectures

23 lines (22 loc) 1.48 kB
import { RequestOptions } from '../http/RequestOptions'; import { FetchOptions } from '../types/Gateway'; import { RequestProvider } from '../http/RequestProvider'; import { Store } from '../types/Cache'; import { Uri } from '../types/Uri'; import { HttpVerb } from '../http/HttpVerb'; import { Request } from '../http/Request'; import { Response } from '../http/Response'; export type RouteOptions = RequestOptions | FetchOptions; export declare class Api { readonly provider: RequestProvider; protected store?: Store<Response, Request> | undefined; constructor(provider?: RequestProvider, store?: Store<Response, Request> | undefined); get(uri: Uri, options?: RouteOptions, transform?: (r: any) => any, transformError?: (r: any) => any): Promise<Response>; post(uri: Uri, body?: unknown, options?: RouteOptions, transform?: (r: any) => any, transformError?: (r: any) => any): Promise<Response>; put(uri: Uri, body?: unknown, options?: RouteOptions, transform?: (r: any) => any, transformError?: (r: any) => any): Promise<Response>; patch(uri: Uri, body?: unknown, options?: RouteOptions, transform?: (r: any) => any, transformError?: (r: any) => any): Promise<Response>; delete(uri: Uri, options?: RouteOptions, transform?: (b: any) => any, transformError?: (r: any) => any): Promise<Response>; options(verb: HttpVerb, options?: RouteOptions): RequestOptions; execute(req: Request): Promise<Response>; } export declare const api: Api;