Skip to content
This repository was archived by the owner on Oct 26, 2023. It is now read-only.

Commit 6bceda3

Browse files
committed
chore: regenerate api client
1 parent 6f344a3 commit 6bceda3

30 files changed

+672
-221
lines changed

src/api/auth/auth.msw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Generated by orval v6.10.2 🍺
2+
* Generated by orval v6.14.3 🍺
33
* Do not edit manually.
44
* labs-api
55
*

src/api/auth/auth.ts

Lines changed: 179 additions & 77 deletions
Large diffs are not rendered by default.

src/api/default/default.msw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Generated by orval v6.10.2 🍺
2+
* Generated by orval v6.14.3 🍺
33
* Do not edit manually.
44
* labs-api
55
*

src/api/default/default.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Generated by orval v6.10.2 🍺
2+
* Generated by orval v6.14.3 🍺
33
* Do not edit manually.
44
* labs-api
55
*
@@ -43,9 +43,24 @@ export const root = (
4343
}
4444

4545

46-
export const getRootQueryKey = () => [`/`];
46+
export const getRootQueryKey = () => [`/`] as const;
47+
48+
49+
50+
export const getRootQueryOptions = <TData = Awaited<ReturnType<typeof root>>, TError = AxiosError<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof root>>, TError, TData>, axios?: AxiosRequestConfig}
51+
): UseQueryOptions<Awaited<ReturnType<typeof root>>, TError, TData> & { queryKey: QueryKey } => {
52+
const {query: queryOptions, axios: axiosOptions} = options ?? {};
4753

54+
const queryKey = queryOptions?.queryKey ?? getRootQueryKey();
55+
56+
57+
58+
const queryFn: QueryFunction<Awaited<ReturnType<typeof root>>> = ({ signal }) => root({ signal, ...axiosOptions });
4859

60+
61+
62+
return { queryKey, queryFn, ...queryOptions}}
63+
4964
export type RootQueryResult = NonNullable<Awaited<ReturnType<typeof root>>>
5065
export type RootQueryError = AxiosError<unknown>
5166

@@ -54,17 +69,11 @@ export const useRoot = <TData = Awaited<ReturnType<typeof root>>, TError = Axios
5469

5570
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
5671

57-
const {query: queryOptions, axios: axiosOptions} = options ?? {};
58-
59-
const queryKey = queryOptions?.queryKey ?? getRootQueryKey();
60-
61-
62-
63-
const queryFn: QueryFunction<Awaited<ReturnType<typeof root>>> = ({ signal }) => root({ signal, ...axiosOptions });
72+
const queryOptions = getRootQueryOptions(options)
6473

65-
const query = useQuery<Awaited<ReturnType<typeof root>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
74+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
6675

67-
query.queryKey = queryKey;
76+
query.queryKey = queryOptions.queryKey;
6877

6978
return query;
7079
}

src/api/ext/ext.msw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Generated by orval v6.10.2 🍺
2+
* Generated by orval v6.14.3 🍺
33
* Do not edit manually.
44
* labs-api
55
*

src/api/ext/ext.ts

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Generated by orval v6.10.2 🍺
2+
* Generated by orval v6.14.3 🍺
33
* Do not edit manually.
44
* labs-api
55
*
@@ -49,9 +49,24 @@ export const echo = (
4949
}
5050

5151

52-
export const getEchoQueryKey = () => [`/ext/echo`];
52+
export const getEchoQueryKey = () => [`/ext/echo`] as const;
53+
5354

5455

56+
export const getEchoQueryOptions = <TData = Awaited<ReturnType<typeof echo>>, TError = AxiosError<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof echo>>, TError, TData>, axios?: AxiosRequestConfig}
57+
): UseQueryOptions<Awaited<ReturnType<typeof echo>>, TError, TData> & { queryKey: QueryKey } => {
58+
const {query: queryOptions, axios: axiosOptions} = options ?? {};
59+
60+
const queryKey = queryOptions?.queryKey ?? getEchoQueryKey();
61+
62+
63+
64+
const queryFn: QueryFunction<Awaited<ReturnType<typeof echo>>> = ({ signal }) => echo({ signal, ...axiosOptions });
65+
66+
67+
68+
return { queryKey, queryFn, ...queryOptions}}
69+
5570
export type EchoQueryResult = NonNullable<Awaited<ReturnType<typeof echo>>>
5671
export type EchoQueryError = AxiosError<unknown>
5772

@@ -60,17 +75,11 @@ export const useEcho = <TData = Awaited<ReturnType<typeof echo>>, TError = Axios
6075

6176
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
6277

63-
const {query: queryOptions, axios: axiosOptions} = options ?? {};
78+
const queryOptions = getEchoQueryOptions(options)
6479

65-
const queryKey = queryOptions?.queryKey ?? getEchoQueryKey();
66-
67-
80+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
6881

69-
const queryFn: QueryFunction<Awaited<ReturnType<typeof echo>>> = ({ signal }) => echo({ signal, ...axiosOptions });
70-
71-
const query = useQuery<Awaited<ReturnType<typeof echo>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
72-
73-
query.queryKey = queryKey;
82+
query.queryKey = queryOptions.queryKey;
7483

7584
return query;
7685
}
@@ -91,9 +100,24 @@ export const getHealth = (
91100
}
92101

93102

94-
export const getGetHealthQueryKey = () => [`/ext/healthcheck`];
103+
export const getGetHealthQueryKey = () => [`/ext/healthcheck`] as const;
104+
105+
106+
107+
export const getGetHealthQueryOptions = <TData = Awaited<ReturnType<typeof getHealth>>, TError = AxiosError<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getHealth>>, TError, TData>, axios?: AxiosRequestConfig}
108+
): UseQueryOptions<Awaited<ReturnType<typeof getHealth>>, TError, TData> & { queryKey: QueryKey } => {
109+
const {query: queryOptions, axios: axiosOptions} = options ?? {};
110+
111+
const queryKey = queryOptions?.queryKey ?? getGetHealthQueryKey();
95112

113+
114+
115+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getHealth>>> = ({ signal }) => getHealth({ signal, ...axiosOptions });
96116

117+
118+
119+
return { queryKey, queryFn, ...queryOptions}}
120+
97121
export type GetHealthQueryResult = NonNullable<Awaited<ReturnType<typeof getHealth>>>
98122
export type GetHealthQueryError = AxiosError<unknown>
99123

@@ -102,17 +126,11 @@ export const useGetHealth = <TData = Awaited<ReturnType<typeof getHealth>>, TErr
102126

103127
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
104128

105-
const {query: queryOptions, axios: axiosOptions} = options ?? {};
106-
107-
const queryKey = queryOptions?.queryKey ?? getGetHealthQueryKey();
108-
109-
110-
111-
const queryFn: QueryFunction<Awaited<ReturnType<typeof getHealth>>> = ({ signal }) => getHealth({ signal, ...axiosOptions });
129+
const queryOptions = getGetHealthQueryOptions(options)
112130

113-
const query = useQuery<Awaited<ReturnType<typeof getHealth>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
131+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
114132

115-
query.queryKey = queryKey;
133+
query.queryKey = queryOptions.queryKey;
116134

117135
return query;
118136
}
@@ -132,9 +150,24 @@ export const testLogger = (
132150
}
133151

134152

135-
export const getTestLoggerQueryKey = () => [`/ext/log`];
153+
export const getTestLoggerQueryKey = () => [`/ext/log`] as const;
154+
155+
156+
157+
export const getTestLoggerQueryOptions = <TData = Awaited<ReturnType<typeof testLogger>>, TError = AxiosError<unknown>>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof testLogger>>, TError, TData>, axios?: AxiosRequestConfig}
158+
): UseQueryOptions<Awaited<ReturnType<typeof testLogger>>, TError, TData> & { queryKey: QueryKey } => {
159+
const {query: queryOptions, axios: axiosOptions} = options ?? {};
160+
161+
const queryKey = queryOptions?.queryKey ?? getTestLoggerQueryKey();
136162

163+
164+
165+
const queryFn: QueryFunction<Awaited<ReturnType<typeof testLogger>>> = ({ signal }) => testLogger({ signal, ...axiosOptions });
137166

167+
168+
169+
return { queryKey, queryFn, ...queryOptions}}
170+
138171
export type TestLoggerQueryResult = NonNullable<Awaited<ReturnType<typeof testLogger>>>
139172
export type TestLoggerQueryError = AxiosError<unknown>
140173

@@ -143,17 +176,11 @@ export const useTestLogger = <TData = Awaited<ReturnType<typeof testLogger>>, TE
143176

144177
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
145178

146-
const {query: queryOptions, axios: axiosOptions} = options ?? {};
147-
148-
const queryKey = queryOptions?.queryKey ?? getTestLoggerQueryKey();
149-
150-
151-
152-
const queryFn: QueryFunction<Awaited<ReturnType<typeof testLogger>>> = ({ signal }) => testLogger({ signal, ...axiosOptions });
179+
const queryOptions = getTestLoggerQueryOptions(options)
153180

154-
const query = useQuery<Awaited<ReturnType<typeof testLogger>>, TError, TData>(queryKey, queryFn, queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
181+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
155182

156-
query.queryKey = queryKey;
183+
query.queryKey = queryOptions.queryKey;
157184

158185
return query;
159186
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Generated by orval v6.14.3 🍺
3+
* Do not edit manually.
4+
* labs-api
5+
*
6+
This project provides a reference Python API built using FastAPI, the
7+
aim of the project is:
8+
9+
- To maintain a good know source of habits
10+
- Demonstrate how applications are meant to be put together at Anomaly
11+
- Democratize design of robust API
12+
13+
14+
* OpenAPI spec version: 0.1.0
15+
*/
16+
import {
17+
rest
18+
} from 'msw'
19+
import {
20+
faker
21+
} from '@faker-js/faker'
22+
23+
export const getGetUploadUrlMock = () => ({presignedUploadUrl: faker.random.word(), expires: faker.datatype.number({min: undefined, max: undefined})})
24+
25+
export const getFileUploadsMSW = () => [
26+
rest.post('*/upload', (_req, res, ctx) => {
27+
return res(
28+
ctx.delay(1000),
29+
ctx.status(200, 'Mocked status'),
30+
ctx.json(getGetUploadUrlMock()),
31+
)
32+
}),]

src/api/file-uploads/file-uploads.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
* Generated by orval v6.14.3 🍺
3+
* Do not edit manually.
4+
* labs-api
5+
*
6+
This project provides a reference Python API built using FastAPI, the
7+
aim of the project is:
8+
9+
- To maintain a good know source of habits
10+
- Demonstrate how applications are meant to be put together at Anomaly
11+
- Democratize design of robust API
12+
13+
14+
* OpenAPI spec version: 0.1.0
15+
*/
16+
import axios from 'axios'
17+
import type {
18+
AxiosRequestConfig,
19+
AxiosResponse,
20+
AxiosError
21+
} from 'axios'
22+
import {
23+
useMutation
24+
} from 'react-query'
25+
import type {
26+
UseMutationOptions,
27+
MutationFunction
28+
} from 'react-query'
29+
import type {
30+
FileUploadResponse,
31+
HTTPValidationError,
32+
FileUploadRequest
33+
} from '.././models'
34+
35+
36+
/**
37+
* @summary Get Upload Url
38+
*/
39+
export const getUploadUrl = (
40+
fileUploadRequest: FileUploadRequest, options?: AxiosRequestConfig
41+
): Promise<AxiosResponse<FileUploadResponse>> => {
42+
return axios.post(
43+
`/upload`,
44+
fileUploadRequest,options
45+
);
46+
}
47+
48+
49+
50+
export const getGetUploadUrlMutationOptions = <TError = AxiosError<HTTPValidationError>,
51+
52+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof getUploadUrl>>, TError,{data: FileUploadRequest}, TContext>, axios?: AxiosRequestConfig}
53+
): UseMutationOptions<Awaited<ReturnType<typeof getUploadUrl>>, TError,{data: FileUploadRequest}, TContext> => {
54+
const {mutation: mutationOptions, axios: axiosOptions} = options ?? {};
55+
56+
57+
58+
59+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof getUploadUrl>>, {data: FileUploadRequest}> = (props) => {
60+
const {data} = props ?? {};
61+
62+
return getUploadUrl(data,axiosOptions)
63+
}
64+
65+
66+
67+
68+
return { mutationFn, ...mutationOptions }}
69+
70+
export type GetUploadUrlMutationResult = NonNullable<Awaited<ReturnType<typeof getUploadUrl>>>
71+
export type GetUploadUrlMutationBody = FileUploadRequest
72+
export type GetUploadUrlMutationError = AxiosError<HTTPValidationError>
73+
74+
export const useGetUploadUrl = <TError = AxiosError<HTTPValidationError>,
75+
76+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof getUploadUrl>>, TError,{data: FileUploadRequest}, TContext>, axios?: AxiosRequestConfig}
77+
) => {
78+
79+
const mutationOptions = getGetUploadUrlMutationOptions(options);
80+
81+
return useMutation(mutationOptions);
82+
}
83+

src/api/models/bodyLoginForAuthTokenTokenPost.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Generated by orval v6.10.2 🍺
2+
* Generated by orval v6.14.3 🍺
33
* Do not edit manually.
44
* labs-api
55
*

src/api/models/fileUploadRequest.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Generated by orval v6.14.3 🍺
3+
* Do not edit manually.
4+
* labs-api
5+
*
6+
This project provides a reference Python API built using FastAPI, the
7+
aim of the project is:
8+
9+
- To maintain a good know source of habits
10+
- Demonstrate how applications are meant to be put together at Anomaly
11+
- Democratize design of robust API
12+
13+
14+
* OpenAPI spec version: 0.1.0
15+
*/
16+
17+
/**
18+
* Pydantic base model for applications
19+
20+
This class is used to define the base model for all schema
21+
that we use in the Application, it configures pydantic to
22+
translate between camcelCase and snake_case for the JSON
23+
amongst other default settings.
24+
25+
ORM mode will allow pydantic to translate SQLAlchemy results
26+
into serializable models.
27+
28+
For a full set of options, see:
29+
https://pydantic-docs.helpmanual.io/usage/model_config/
30+
*/
31+
export interface FileUploadRequest {
32+
fileName: string;
33+
fileSize: number;
34+
mimeType: string;
35+
}

0 commit comments

Comments
 (0)