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 AddPetData,
7 AddPetErrors,
8 AddPetResponses,
9 CreateUserData,
10 CreateUserErrors,
11 CreateUserResponses,
12 CreateUsersWithListInputData,
13 CreateUsersWithListInputErrors,
14 CreateUsersWithListInputResponses,
15 DeleteOrderData,
16 DeleteOrderErrors,
17 DeleteOrderResponses,
18 DeletePetData,
19 DeletePetErrors,
20 DeletePetResponses,
21 DeleteUserData,
22 DeleteUserErrors,
23 DeleteUserResponses,
24 FindPetsByStatusData,
25 FindPetsByStatusErrors,
26 FindPetsByStatusResponses,
27 FindPetsByTagsData,
28 FindPetsByTagsErrors,
29 FindPetsByTagsResponses,
30 GetInventoryData,
31 GetInventoryErrors,
32 GetInventoryResponses,
33 GetOrderByIdData,
34 GetOrderByIdErrors,
35 GetOrderByIdResponses,
36 GetPetByIdData,
37 GetPetByIdErrors,
38 GetPetByIdResponses,
39 GetUserByNameData,
40 GetUserByNameErrors,
41 GetUserByNameResponses,
42 LoginUserData,
43 LoginUserErrors,
44 LoginUserResponses,
45 LogoutUserData,
46 LogoutUserErrors,
47 LogoutUserResponses,
48 PlaceOrderData,
49 PlaceOrderErrors,
50 PlaceOrderResponses,
51 UpdatePetData,
52 UpdatePetErrors,
53 UpdatePetResponses,
54 UpdatePetWithFormData,
55 UpdatePetWithFormErrors,
56 UpdatePetWithFormResponses,
57 UpdateUserData,
58 UpdateUserErrors,
59 UpdateUserResponses,
60 UploadFileData,
61 UploadFileErrors,
62 UploadFileResponses,
63} from './types.gen';
64
65export type Options<
66 TData extends TDataShape = TDataShape,
67 ThrowOnError extends boolean = boolean,
68 TResponse = unknown,
69> = Options2<TData, ThrowOnError, TResponse> & {
70 /**
71 * You can provide a client instance returned by `createClient()` instead of
72 * individual options. This might be also useful if you want to implement a
73 * custom client.
74 */
75 client?: Client;
76 /**
77 * You can pass arbitrary values through the `meta` object. This can be
78 * used to access values that aren't defined as part of the SDK function.
79 */
80 meta?: Record<string, unknown>;
81};
82
83/**
84 * Add a new pet to the store.
85 *
86 * Add a new pet to the store.
87 */
88export const addPet = <ThrowOnError extends boolean = false>(
89 options: Options<AddPetData, ThrowOnError>,
90) =>
91 (options.client ?? client).post<AddPetResponses, AddPetErrors, ThrowOnError>({
92 security: [{ scheme: 'bearer', type: 'http' }],
93 url: '/pet',
94 ...options,
95 headers: {
96 'Content-Type': 'application/json',
97 ...options.headers,
98 },
99 });
100
101/**
102 * Update an existing pet.
103 *
104 * Update an existing pet by Id.
105 */
106export const updatePet = <ThrowOnError extends boolean = false>(
107 options: Options<UpdatePetData, ThrowOnError>,
108) =>
109 (options.client ?? client).put<UpdatePetResponses, UpdatePetErrors, ThrowOnError>({
110 security: [{ scheme: 'bearer', type: 'http' }],
111 url: '/pet',
112 ...options,
113 headers: {
114 'Content-Type': 'application/json',
115 ...options.headers,
116 },
117 });
118
119/**
120 * Finds Pets by status.
121 *
122 * Multiple status values can be provided with comma separated strings.
123 */
124export const findPetsByStatus = <ThrowOnError extends boolean = false>(
125 options: Options<FindPetsByStatusData, ThrowOnError>,
126) =>
127 (options.client ?? client).get<FindPetsByStatusResponses, FindPetsByStatusErrors, ThrowOnError>({
128 security: [{ scheme: 'bearer', type: 'http' }],
129 url: '/pet/findByStatus',
130 ...options,
131 });
132
133/**
134 * Finds Pets by tags.
135 *
136 * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
137 */
138export const findPetsByTags = <ThrowOnError extends boolean = false>(
139 options: Options<FindPetsByTagsData, ThrowOnError>,
140) =>
141 (options.client ?? client).get<FindPetsByTagsResponses, FindPetsByTagsErrors, ThrowOnError>({
142 security: [{ scheme: 'bearer', type: 'http' }],
143 url: '/pet/findByTags',
144 ...options,
145 });
146
147/**
148 * Deletes a pet.
149 *
150 * Delete a pet.
151 */
152export const deletePet = <ThrowOnError extends boolean = false>(
153 options: Options<DeletePetData, ThrowOnError>,
154) =>
155 (options.client ?? client).delete<DeletePetResponses, DeletePetErrors, ThrowOnError>({
156 security: [{ scheme: 'bearer', type: 'http' }],
157 url: '/pet/{petId}',
158 ...options,
159 });
160
161/**
162 * Find pet by ID.
163 *
164 * Returns a single pet.
165 */
166export const getPetById = <ThrowOnError extends boolean = false>(
167 options: Options<GetPetByIdData, ThrowOnError>,
168) =>
169 (options.client ?? client).get<GetPetByIdResponses, GetPetByIdErrors, ThrowOnError>({
170 security: [
171 { name: 'api_key', type: 'apiKey' },
172 { scheme: 'bearer', type: 'http' },
173 ],
174 url: '/pet/{petId}',
175 ...options,
176 });
177
178/**
179 * Updates a pet in the store with form data.
180 *
181 * Updates a pet resource based on the form data.
182 */
183export const updatePetWithForm = <ThrowOnError extends boolean = false>(
184 options: Options<UpdatePetWithFormData, ThrowOnError>,
185) =>
186 (options.client ?? client).post<
187 UpdatePetWithFormResponses,
188 UpdatePetWithFormErrors,
189 ThrowOnError
190 >({
191 security: [{ scheme: 'bearer', type: 'http' }],
192 url: '/pet/{petId}',
193 ...options,
194 });
195
196/**
197 * Uploads an image.
198 *
199 * Upload image of the pet.
200 */
201export const uploadFile = <ThrowOnError extends boolean = false>(
202 options: Options<UploadFileData, ThrowOnError>,
203) =>
204 (options.client ?? client).post<UploadFileResponses, UploadFileErrors, ThrowOnError>({
205 bodySerializer: null,
206 security: [{ scheme: 'bearer', type: 'http' }],
207 url: '/pet/{petId}/uploadImage',
208 ...options,
209 headers: {
210 'Content-Type': 'application/octet-stream',
211 ...options.headers,
212 },
213 });
214
215/**
216 * Returns pet inventories by status.
217 *
218 * Returns a map of status codes to quantities.
219 */
220export const getInventory = <ThrowOnError extends boolean = false>(
221 options?: Options<GetInventoryData, ThrowOnError>,
222) =>
223 (options?.client ?? client).get<GetInventoryResponses, GetInventoryErrors, ThrowOnError>({
224 security: [{ name: 'api_key', type: 'apiKey' }],
225 url: '/store/inventory',
226 ...options,
227 });
228
229/**
230 * Place an order for a pet.
231 *
232 * Place a new order in the store.
233 */
234export const placeOrder = <ThrowOnError extends boolean = false>(
235 options?: Options<PlaceOrderData, ThrowOnError>,
236) =>
237 (options?.client ?? client).post<PlaceOrderResponses, PlaceOrderErrors, ThrowOnError>({
238 url: '/store/order',
239 ...options,
240 headers: {
241 'Content-Type': 'application/json',
242 ...options?.headers,
243 },
244 });
245
246/**
247 * Delete purchase order by identifier.
248 *
249 * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
250 */
251export const deleteOrder = <ThrowOnError extends boolean = false>(
252 options: Options<DeleteOrderData, ThrowOnError>,
253) =>
254 (options.client ?? client).delete<DeleteOrderResponses, DeleteOrderErrors, ThrowOnError>({
255 url: '/store/order/{orderId}',
256 ...options,
257 });
258
259/**
260 * Find purchase order by ID.
261 *
262 * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
263 */
264export const getOrderById = <ThrowOnError extends boolean = false>(
265 options: Options<GetOrderByIdData, ThrowOnError>,
266) =>
267 (options.client ?? client).get<GetOrderByIdResponses, GetOrderByIdErrors, ThrowOnError>({
268 url: '/store/order/{orderId}',
269 ...options,
270 });
271
272/**
273 * Create user.
274 *
275 * This can only be done by the logged in user.
276 */
277export const createUser = <ThrowOnError extends boolean = false>(
278 options?: Options<CreateUserData, ThrowOnError>,
279) =>
280 (options?.client ?? client).post<CreateUserResponses, CreateUserErrors, ThrowOnError>({
281 url: '/user',
282 ...options,
283 headers: {
284 'Content-Type': 'application/json',
285 ...options?.headers,
286 },
287 });
288
289/**
290 * Creates list of users with given input array.
291 *
292 * Creates list of users with given input array.
293 */
294export const createUsersWithListInput = <ThrowOnError extends boolean = false>(
295 options?: Options<CreateUsersWithListInputData, ThrowOnError>,
296) =>
297 (options?.client ?? client).post<
298 CreateUsersWithListInputResponses,
299 CreateUsersWithListInputErrors,
300 ThrowOnError
301 >({
302 url: '/user/createWithList',
303 ...options,
304 headers: {
305 'Content-Type': 'application/json',
306 ...options?.headers,
307 },
308 });
309
310/**
311 * Logs user into the system.
312 *
313 * Log into the system.
314 */
315export const loginUser = <ThrowOnError extends boolean = false>(
316 options?: Options<LoginUserData, ThrowOnError>,
317) =>
318 (options?.client ?? client).get<LoginUserResponses, LoginUserErrors, ThrowOnError>({
319 url: '/user/login',
320 ...options,
321 });
322
323/**
324 * Logs out current logged in user session.
325 *
326 * Log user out of the system.
327 */
328export const logoutUser = <ThrowOnError extends boolean = false>(
329 options?: Options<LogoutUserData, ThrowOnError>,
330) =>
331 (options?.client ?? client).get<LogoutUserResponses, LogoutUserErrors, ThrowOnError>({
332 url: '/user/logout',
333 ...options,
334 });
335
336/**
337 * Delete user resource.
338 *
339 * This can only be done by the logged in user.
340 */
341export const deleteUser = <ThrowOnError extends boolean = false>(
342 options: Options<DeleteUserData, ThrowOnError>,
343) =>
344 (options.client ?? client).delete<DeleteUserResponses, DeleteUserErrors, ThrowOnError>({
345 url: '/user/{username}',
346 ...options,
347 });
348
349/**
350 * Get user by user name.
351 *
352 * Get user detail based on username.
353 */
354export const getUserByName = <ThrowOnError extends boolean = false>(
355 options: Options<GetUserByNameData, ThrowOnError>,
356) =>
357 (options.client ?? client).get<GetUserByNameResponses, GetUserByNameErrors, ThrowOnError>({
358 url: '/user/{username}',
359 ...options,
360 });
361
362/**
363 * Update user resource.
364 *
365 * This can only be done by the logged in user.
366 */
367export const updateUser = <ThrowOnError extends boolean = false>(
368 options: Options<UpdateUserData, ThrowOnError>,
369) =>
370 (options.client ?? client).put<UpdateUserResponses, UpdateUserErrors, ThrowOnError>({
371 url: '/user/{username}',
372 ...options,
373 headers: {
374 'Content-Type': 'application/json',
375 ...options.headers,
376 },
377 });