fork of hey-api/openapi-ts because I need some additional things
at main 68 lines 1.8 kB view raw
1// This file is auto-generated by @hey-api/openapi-ts 2 3import type { Client, Options as Options2, TDataShape } from './client'; 4import { client } from './client.gen'; 5import type { 6 CreatePetsData, 7 CreatePetsErrors, 8 CreatePetsResponses, 9 ListPetsData, 10 ListPetsErrors, 11 ListPetsResponses, 12 ShowPetByIdData, 13 ShowPetByIdErrors, 14 ShowPetByIdResponses, 15} from './types.gen'; 16 17export type Options< 18 TData extends TDataShape = TDataShape, 19 ThrowOnError extends boolean = boolean, 20> = Options2<TData, ThrowOnError> & { 21 /** 22 * You can provide a client instance returned by `createClient()` instead of 23 * individual options. This might be also useful if you want to implement a 24 * custom client. 25 */ 26 client?: Client; 27 /** 28 * You can pass arbitrary values through the `meta` object. This can be 29 * used to access values that aren't defined as part of the SDK function. 30 */ 31 meta?: Record<string, unknown>; 32}; 33 34/** 35 * List all pets 36 */ 37export const listPets = <ThrowOnError extends boolean = false>( 38 options?: Options<ListPetsData, ThrowOnError>, 39) => 40 (options?.client ?? client).get< 41 ListPetsResponses, 42 ListPetsErrors, 43 ThrowOnError 44 >({ url: '/pets', ...options }); 45 46/** 47 * Create a pet 48 */ 49export const createPets = <ThrowOnError extends boolean = false>( 50 options?: Options<CreatePetsData, ThrowOnError>, 51) => 52 (options?.client ?? client).post< 53 CreatePetsResponses, 54 CreatePetsErrors, 55 ThrowOnError 56 >({ url: '/pets', ...options }); 57 58/** 59 * Info for a specific pet 60 */ 61export const showPetById = <ThrowOnError extends boolean = false>( 62 options: Options<ShowPetByIdData, ThrowOnError>, 63) => 64 (options.client ?? client).get< 65 ShowPetByIdResponses, 66 ShowPetByIdErrors, 67 ThrowOnError 68 >({ url: '/pets/{petId}', ...options });