UNPKG

api

Version:

Magical SDK generation from an OpenAPI definition 🪄

22 lines (21 loc) • 826 B
/// <reference types="node" /> import type { Operation } from 'oas'; /** * With potentially supplied body and/or metadata we need to run through them against a given API * operation to see what's what and prepare any available parameters to be used in an API request * with `@readme/oas-to-har`. * */ export default function prepareParams(operation: Operation, body?: unknown, metadata?: Record<string, unknown>): Promise<{ body?: any; cookie?: Record<string, string | number | boolean>; files?: Record<string, Buffer>; formData?: any; header?: Record<string, string | number | boolean>; path?: Record<string, string | number | boolean>; query?: Record<string, string | number | boolean>; server?: { selected: number; variables: Record<string, string | number>; }; }>;