-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPetstore.ts
69 lines (59 loc) · 1.42 KB
/
Petstore.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* Generated by orval v6.11.0-alpha.5 🍺
* Do not edit manually.
* Swagger Petstore
* OpenAPI spec version: 1.0.0
*/
import axios from "axios";
import type { AxiosRequestConfig, AxiosResponse } from "axios";
export type Size = string;
export type Name = string;
export type CreatePetsBody = {
name: string;
tag: string;
};
export type ListPetsParams = { limit?: string };
export interface Error {
code: number;
message: string;
}
export interface Pet {
id: number;
name: string;
tag?: string;
breed?: Breed;
}
export type Pets = Pet[];
/**
* @summary List all pets
*/
export const listPets = <TData = AxiosResponse<Pets>>(
params?: ListPetsParams,
options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(`/pets`, {
...options,
params: { ...params, ...options?.params },
});
};
/**
* @summary Create a pet
*/
export const createPets = <TData = AxiosResponse<void>>(
createPetsBody: CreatePetsBody,
options?: AxiosRequestConfig
): Promise<TData> => {
return axios.post(`/pets`, createPetsBody, options);
};
/**
* @summary Info for a specific pet
*/
export const showPetById = <TData = AxiosResponse<Pet>>(
petId: string,
options?: AxiosRequestConfig
): Promise<TData> => {
return axios.get(`/pets/${petId}`, options);
};
export type ListPetsResult = AxiosResponse<Pets>;
export type CreatePetsResult = AxiosResponse<void>;
export type ShowPetByIdResult = AxiosResponse<Pet>;