@kubb/plugin-client
Version:
API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.
32 lines (28 loc) • 985 B
text/typescript
/* eslint-disable no-alert, no-console */
/**
* Generated by Kubb (https://kubb.dev/).
* Do not edit manually.
*/
import fetch from '@kubb/plugin-client/clients/axios'
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
export function getUpdatePetWithFormUrl(petId: UpdatePetWithFormPathParams['petId']) {
return `/pet/${petId}` as const
}
/**
* @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).toString(),
params,
...requestConfig,
})
return res.data
}