-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuseGetPetByIdQuery.ts
53 lines (45 loc) · 1.3 KB
/
useGetPetByIdQuery.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
/* This is a sample header */
/* eslint-disable */
// This code is autogenerated using @harnessio/oats-cli.
// Please do not modify this code directly.
import { useQuery, UseQueryOptions } from '@tanstack/react-query';
import type { Pet } from '../schemas/Pet';
import { fetcher, FetcherOptions } from './fetcher';
export interface GetPetByIdQueryPathParams {
/**
* @format int64
*/
petId: number;
}
export type GetPetByIdOkResponse = Pet;
export type GetPetByIdErrorResponse = unknown;
export interface GetPetByIdProps
extends GetPetByIdQueryPathParams,
Omit<FetcherOptions<unknown, unknown>, 'url'> {}
export interface GetPetByIdResponseContainer {
content: GetPetByIdOkResponse;
headers: HeadersInit;
}
export function getPetById(props: GetPetByIdProps): Promise<GetPetByIdResponseContainer> {
return fetcher<GetPetByIdOkResponse, unknown, unknown>({
url: `/pet/${props.petId}`,
method: 'GET',
...props,
});
}
/**
* Returns a single pet
*/
export function useGetPetByIdQuery(
props: GetPetByIdProps,
options?: Omit<
UseQueryOptions<GetPetByIdResponseContainer, GetPetByIdErrorResponse>,
'queryKey' | 'queryFn'
>,
) {
return useQuery<GetPetByIdResponseContainer, GetPetByIdErrorResponse>(
['getPetById', props.petId],
({ signal }) => getPetById({ ...props, signal }),
options,
);
}