UNPKG

@nekofar/warpcast

Version:

TypeScript client for interacting with Warpcast APIs

35 lines (33 loc) 963 B
type Slot = "body" | "headers" | "path" | "query"; type Field = { in: Exclude<Slot, "body">; /** * Field name. This is the name we want the user to see and use. */ key: string; /** * Field mapped name. This is the name we want to use in the request. * If omitted, we use the same value as `key`. */ map?: string; } | { in: Extract<Slot, "body">; /** * Key isn't required for bodies. */ key?: string; map?: string; }; interface Fields { allowExtra?: Partial<Record<Slot, boolean>>; args?: ReadonlyArray<Field>; } type FieldsConfig = ReadonlyArray<Field | Fields>; interface Params { body: unknown; headers: Record<string, unknown>; path: Record<string, unknown>; query: Record<string, unknown>; } declare const buildClientParams: (args: ReadonlyArray<unknown>, fields: FieldsConfig) => Params; export { type Field, type Fields, type FieldsConfig, buildClientParams };