@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 kB
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 getDeletePetUrl({ petId }: { petId: DeletePetPathParams['petId'] }) {
return `/pet/${petId}` as const
}
/**
* @description delete a pet
* @summary Deletes a pet
* {@link /pet/:petId}
*/
export async function deletePet(
{ petId }: { petId: DeletePetPathParams['petId'] },
headers?: DeletePetHeaderParams,
config: Partial<RequestConfig> & { client?: typeof fetch } = {},
) {
const { client: request = fetch, ...requestConfig } = config
const res = await request<DeletePetMutationResponse, ResponseErrorConfig<DeletePet400>, unknown>({
method: 'DELETE',
url: getDeletePetUrl({ petId }).toString(),
...requestConfig,
headers: { ...headers, ...requestConfig.headers },
})
return res.data
}