UNPKG

@kubb/plugin-client

Version:

API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.

33 lines (29 loc) 1.01 kB
/* eslint-disable no-alert, no-console */ /** * Generated by Kubb (https://kubb.dev/). * Do not edit manually. */ import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch' import { fetch } from './test/.kubb/fetch' export function getUpdatePetWithFormUrl(petId: UpdatePetWithFormPathParams['petId']) { const res = { method: 'POST', url: `/pet/${petId}` as const } return res } /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} */ export async function updatePetWithForm( petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}, ) { const { client: request = fetch, ...requestConfig } = config const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({ method: 'POST', url: getUpdatePetWithFormUrl(petId).url.toString(), params, ...requestConfig, }) return res.data }