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 TResponse = unknown,
21> = Options2<TData, ThrowOnError, TResponse> & {
22 /**
23 * You can provide a client instance returned by `createClient()` instead of
24 * individual options. This might be also useful if you want to implement a
25 * custom client.
26 */
27 client?: Client;
28 /**
29 * You can pass arbitrary values through the `meta` object. This can be
30 * used to access values that aren't defined as part of the SDK function.
31 */
32 meta?: Record<string, unknown>;
33};
34
35/**
36 * List all pets
37 */
38export const listPets = <ThrowOnError extends boolean = false>(
39 options?: Options<ListPetsData, ThrowOnError>,
40) =>
41 (options?.client ?? client).get<ListPetsResponses, ListPetsErrors, ThrowOnError>({
42 url: '/pets',
43 ...options,
44 });
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<CreatePetsResponses, CreatePetsErrors, ThrowOnError>({
53 url: '/pets',
54 ...options,
55 });
56
57/**
58 * Info for a specific pet
59 */
60export const showPetById = <ThrowOnError extends boolean = false>(
61 options: Options<ShowPetByIdData, ThrowOnError>,
62) =>
63 (options.client ?? client).get<ShowPetByIdResponses, ShowPetByIdErrors, ThrowOnError>({
64 url: '/pets/{petId}',
65 ...options,
66 });