payload-rest-client
Version:
A typesafe rest api client for the payload cms.
16 lines (15 loc) • 667 B
TypeScript
import { FetchMethod } from "./fetch";
import { ClientOptions } from "./types";
export type CEInput<P = Record<string, string>, Q = Record<string, any>, B = any> = {
params?: P;
query?: Q;
body?: B;
};
export type CustomEndpoint<Input extends CEInput, Output> = (input: Input) => Output;
export type CustomEndpoints = Record<string, CustomEndpoint<any, any>>;
export type CustomEndpointFactory<Params> = {
method: FetchMethod;
path: (params: Params) => string;
};
export type CustomEndpointFactories = Record<string, CustomEndpointFactory<any>>;
export declare const createCustomEndpoints: (options: ClientOptions) => CustomEndpoints | undefined;