Browse documentation

RequestInterface

Type. Callable Request client with its published return contract.

Table of contents

Category

Type

Type import

ts
import type { RequestInterface } from "valyrian.js/request";

Public signature

ts
interface RequestInterface { (method: string, url: string, data?: Record<string, any> | null, options?: Partial<SendOptions>): any | Response; new: (baseUrl: string, options?: RequestOptions) => RequestInterface; use: (plugin: RequestPlugin) => number; eject: (pluginId: number) => void; setOption: (key: string, value: any) => RequestOptions; setOptions: (values: Record<string, any>) => RequestOptions; getOption: (key: string) => any; getOptions: (key?: string) => RequestOptions | void; get: (url: string, data?: Record<string, any> | null, options?: Record<string, any>) => any | Response; post: (url: string, data?: Record<string, any> | null, options?: Record<string, any>) => any | Response; put: (url: string, data?: Record<string, any> | null, options?: Record<string, any>) => any | Response; patch: (url: string, data?: Record<string, any> | null, options?: Record<string, any>) => any | Response; delete: (url: string, data?: Record<string, any> | null, options?: Record<string, any>) => any | Response; head: (url: string, data?: Record<string, any> | null, options?: Record<string, any>) => any | Response; options: (url: string, data?: Record<string, any> | null, options?: Record<string, any>) => any | Response; [key: string | number | symbol]: any; }

Published type

RequestInterface is the callable client type returned by request and request.new(...). Its installed .d.ts declares any | Response for calls and generated method helpers.

Runtime async behavior

The runtime implementation is async. Use every call with await even though the published TypeScript return omits Promise.