UNPKG

1.38 kBTypeScriptView Raw
1import { Domain, DomainModule, SearchFilter, SearchOptions as BfSearchOptions } from 'bf-types';
2import { Nullable } from '../common';
3import type { HeadersType, ObjectType } from '../system/Types';
4import { RequestMethod } from './Consts';
5export declare type SearchOptions<H extends HeadersType = HeadersType> = Omit<BfSearchOptions, 'filters'> & {
6 headers?: H;
7 withFormData?: boolean;
8};
9export interface Api {
10 <R = any, P = ObjectType, H extends HeadersType = HeadersType>(method: RequestMethod, uri: string, data?: P, headers?: H): Promise<Nullable<R>>;
11 get: <R = any, P = ObjectType, H extends HeadersType = HeadersType>(uri: string, params?: P, headers?: H, customBaseUrl?: string) => Promise<Nullable<R>>;
12 delete: <R = any, P = ObjectType, H extends HeadersType = HeadersType>(uri: string, params?: P, headers?: H, customBaseUrl?: string) => Promise<Nullable<R>>;
13 post: <R = any, P = ObjectType, H extends HeadersType = HeadersType>(uri: string, payload?: P, headers?: H, customBaseUrl?: string) => Promise<Nullable<R>>;
14 put: <R = any, P = ObjectType, H extends HeadersType = HeadersType>(uri: string, payload?: P, headers?: H, customBaseUrl?: string) => Promise<Nullable<R>>;
15 search: <T = any, H extends HeadersType = HeadersType>(domain: Domain, module: DomainModule, filters: SearchFilter[], options?: SearchOptions<H>) => Promise<T[]>;
16}