|
4 | 4 | * Swagger Petstore
|
5 | 5 | * OpenAPI spec version: 1.0.0
|
6 | 6 | */
|
7 |
| -import axios from 'axios' |
8 |
| -import type { |
9 |
| - AxiosRequestConfig, |
10 |
| - AxiosResponse |
11 |
| -} from 'axios' |
| 7 | +import axios from 'axios'; |
| 8 | +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; |
12 | 9 | export type CreatePetsBody = {
|
13 | 10 | name: string;
|
14 | 11 | tag: string;
|
15 | 12 | };
|
16 | 13 |
|
17 | 14 | export type ListPetsParams = {
|
18 |
| -/** |
19 |
| - * How many items to return at one time (max 100) |
20 |
| - */ |
21 |
| -limit?: string; |
| 15 | + /** |
| 16 | + * How many items to return at one time (max 100) |
| 17 | + */ |
| 18 | + limit?: string; |
22 | 19 | };
|
23 | 20 |
|
24 | 21 | export interface Error {
|
@@ -54,46 +51,39 @@ export interface Pet {
|
54 | 51 | */
|
55 | 52 | export type Pets = Pet[];
|
56 | 53 |
|
57 |
| - |
58 |
| - |
59 |
| - |
60 |
| - |
61 |
| - /** |
| 54 | +/** |
62 | 55 | * @summary List all pets
|
63 | 56 | */
|
64 | 57 | export const listPets = <TData = AxiosResponse<Pets>>(
|
65 |
| - params?: ListPetsParams, options?: AxiosRequestConfig |
66 |
| - ): Promise<TData> => { |
67 |
| - return axios.get( |
68 |
| - `/pets`,{ |
| 58 | + params?: ListPetsParams, |
| 59 | + options?: AxiosRequestConfig, |
| 60 | +): Promise<TData> => { |
| 61 | + return axios.get(`/pets`, { |
69 | 62 | ...options,
|
70 |
| - params: {...params, ...options?.params},} |
71 |
| - ); |
72 |
| - } |
| 63 | + params: { ...params, ...options?.params }, |
| 64 | + }); |
| 65 | +}; |
73 | 66 |
|
74 | 67 | /**
|
75 | 68 | * @summary Create a pet
|
76 | 69 | */
|
77 | 70 | export const createPets = <TData = AxiosResponse<void>>(
|
78 |
| - createPetsBody: CreatePetsBody, options?: AxiosRequestConfig |
79 |
| - ): Promise<TData> => { |
80 |
| - return axios.post( |
81 |
| - `/pets`, |
82 |
| - createPetsBody,options |
83 |
| - ); |
84 |
| - } |
| 71 | + createPetsBody: CreatePetsBody, |
| 72 | + options?: AxiosRequestConfig, |
| 73 | +): Promise<TData> => { |
| 74 | + return axios.post(`/pets`, createPetsBody, options); |
| 75 | +}; |
85 | 76 |
|
86 | 77 | /**
|
87 | 78 | * @summary Info for a specific pet
|
88 | 79 | */
|
89 | 80 | export const showPetById = <TData = AxiosResponse<Pet>>(
|
90 |
| - petId: string, options?: AxiosRequestConfig |
91 |
| - ): Promise<TData> => { |
92 |
| - return axios.get( |
93 |
| - `/pets/${petId}`,options |
94 |
| - ); |
95 |
| - } |
| 81 | + petId: string, |
| 82 | + options?: AxiosRequestConfig, |
| 83 | +): Promise<TData> => { |
| 84 | + return axios.get(`/pets/${petId}`, options); |
| 85 | +}; |
96 | 86 |
|
97 |
| -export type ListPetsResult = AxiosResponse<Pets> |
98 |
| -export type CreatePetsResult = AxiosResponse<void> |
99 |
| -export type ShowPetByIdResult = AxiosResponse<Pet> |
| 87 | +export type ListPetsResult = AxiosResponse<Pets>; |
| 88 | +export type CreatePetsResult = AxiosResponse<void>; |
| 89 | +export type ShowPetByIdResult = AxiosResponse<Pet>; |
0 commit comments