UNPKG

@forklaunch/universal-sdk

Version:

Cross runtime fetch library for forklaunch router sdks

38 lines (31 loc) 1.13 kB
import { OpenAPIObject } from 'openapi3-ts/oas31'; type ResponseContentParserType = 'json' | 'file' | 'text' | 'stream'; /** * @typedef {Object} RequestType * @property {Record<string, string | number | boolean>} [params] - URL parameters. * @property {Record<string, unknown>} [body] - Request body. * @property {Record<string, string | number | boolean>} [query] - Query parameters. * @property {Record<string, string>} [headers] - Request headers. */ type RegistryOptions = { path: string; static?: boolean; } | { url: string; static?: boolean; } | { raw: OpenAPIObject | Record<string, OpenAPIObject>; }; /** * Initializes the Forklaunch SDK with HTTP methods proxied. * * @template TypedController * @param {string} host - The host URL for the SDK. * @returns {TypedController} - The SDK proxy with methods for HTTP requests. */ declare const universalSdk: <TypedController>(options: { host: string; registryOptions: RegistryOptions; contentTypeParserMap?: Record<string, ResponseContentParserType>; }) => Promise<TypedController>; export { type RegistryOptions, universalSdk };