fork of hey-api/openapi-ts because I need some additional things
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<ListPetsResponses, ListPetsErrors, ThrowOnError>({
41 url: '/pets',
42 ...options,
43 });
44
45/**
46 * Create a pet
47 */
48export const createPets = <ThrowOnError extends boolean = false>(
49 options?: Options<CreatePetsData, ThrowOnError>,
50) =>
51 (options?.client ?? client).post<CreatePetsResponses, CreatePetsErrors, ThrowOnError>({
52 url: '/pets',
53 ...options,
54 });
55
56/**
57 * Info for a specific pet
58 */
59export const showPetById = <ThrowOnError extends boolean = false>(
60 options: Options<ShowPetByIdData, ThrowOnError>,
61) =>
62 (options.client ?? client).get<ShowPetByIdResponses, ShowPetByIdErrors, ThrowOnError>({
63 url: '/pets/{petId}',
64 ...options,
65 });