UNPKG

@sethub/sdk

Version:

<div align="center"> <h1> SetHub SDK </h1>

40 lines (39 loc) 1.52 kB
export declare namespace HttpClientProtocols { export type RequestInterceptor = (config: HttpRequestInit) => Promise<HttpRequestInit>; export type ResponseInterceptor<Body = unknown> = (config: HttpRequestInit, response: HttpResponse<Body>) => Promise<HttpResponse<Body>>; export type HttpClientOptions = { baseURL?: string; requestInterceptors?: RequestInterceptor[]; responseInterceptors?: ResponseInterceptor[]; }; export type HttpRequestInit = Omit<RequestInit, 'headers'> & { url: string; headers: Headers; queryParams?: Record<string, string | number | boolean>; }; type BaseRequestOptions = { headers?: Headers; queryParams?: Record<string, string | number | boolean>; abortSignal?: AbortSignal; }; export type GetOptions = BaseRequestOptions; export type PostOptions = BaseRequestOptions; export type PutOptions = BaseRequestOptions; export type PatchOptions = BaseRequestOptions; export type DeleteOptions = BaseRequestOptions; export type HttpRequest<Body = unknown> = { method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; url: string; queryParams?: Record<string, string | number | boolean>; headers?: Headers; body?: Body; abortSignal?: AbortSignal; }; export type HttpResponse<Body = unknown> = { ok: boolean; statusCode: number; headers: Headers; body?: Body | null; }; export {}; }