|
1 | 1 | // This file is auto-generated by @hey-api/openapi-ts |
2 | 2 |
|
3 | | -import { type DefaultError, type MutationOptions, queryOptions } from '@tanstack/angular-query-experimental'; |
| 3 | +import { type DefaultError, type MutationOptions, queryOptions, skipToken } from '@tanstack/angular-query-experimental'; |
4 | 4 | import type { AxiosError } from 'axios'; |
5 | 5 |
|
6 | 6 | import { client } from '../client.gen'; |
@@ -40,19 +40,23 @@ const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions |
40 | 40 | return [params]; |
41 | 41 | }; |
42 | 42 |
|
| 43 | +const resolveOptions = <T>(options: T | typeof skipToken) => options === skipToken ? undefined : options; |
| 44 | + |
| 45 | +const resolveQueryFn = <T>(options: T | typeof skipToken, queryFn: T) => options === skipToken ? skipToken : queryFn; |
| 46 | + |
43 | 47 | export const serviceWithEmptyTagQueryKey = (options?: Options<ServiceWithEmptyTagData>) => createQueryKey('serviceWithEmptyTag', options); |
44 | 48 |
|
45 | | -export const serviceWithEmptyTagOptions = (options?: Options<ServiceWithEmptyTagData>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof serviceWithEmptyTagQueryKey>>({ |
46 | | - queryFn: async ({ queryKey, signal }) => { |
| 49 | +export const serviceWithEmptyTagOptions = (options?: Options<ServiceWithEmptyTagData> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof serviceWithEmptyTagQueryKey>>({ |
| 50 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
47 | 51 | const { data } = await serviceWithEmptyTag({ |
48 | 52 | ...options, |
49 | 53 | ...queryKey[0], |
50 | 54 | signal, |
51 | 55 | throwOnError: true |
52 | 56 | }); |
53 | 57 | return data; |
54 | | - }, |
55 | | - queryKey: serviceWithEmptyTagQueryKey(options) |
| 58 | + }), |
| 59 | + queryKey: serviceWithEmptyTagQueryKey(resolveOptions(options)) |
56 | 60 | }); |
57 | 61 |
|
58 | 62 | export const patchApiVbyApiVersionNoTagMutation = (options?: Partial<Options<PatchApiVbyApiVersionNoTagData>>): MutationOptions<unknown, AxiosError<DefaultError>, Options<PatchApiVbyApiVersionNoTagData>> => { |
@@ -99,17 +103,17 @@ export const deleteCallWithoutParametersAndResponseMutation = (options?: Partial |
99 | 103 |
|
100 | 104 | export const getCallWithoutParametersAndResponseQueryKey = (options?: Options<GetCallWithoutParametersAndResponseData>) => createQueryKey('getCallWithoutParametersAndResponse', options); |
101 | 105 |
|
102 | | -export const getCallWithoutParametersAndResponseOptions = (options?: Options<GetCallWithoutParametersAndResponseData>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof getCallWithoutParametersAndResponseQueryKey>>({ |
103 | | - queryFn: async ({ queryKey, signal }) => { |
| 106 | +export const getCallWithoutParametersAndResponseOptions = (options?: Options<GetCallWithoutParametersAndResponseData> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof getCallWithoutParametersAndResponseQueryKey>>({ |
| 107 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
104 | 108 | const { data } = await getCallWithoutParametersAndResponse({ |
105 | 109 | ...options, |
106 | 110 | ...queryKey[0], |
107 | 111 | signal, |
108 | 112 | throwOnError: true |
109 | 113 | }); |
110 | 114 | return data; |
111 | | - }, |
112 | | - queryKey: getCallWithoutParametersAndResponseQueryKey(options) |
| 115 | + }), |
| 116 | + queryKey: getCallWithoutParametersAndResponseQueryKey(resolveOptions(options)) |
113 | 117 | }); |
114 | 118 |
|
115 | 119 | export const patchCallWithoutParametersAndResponseMutation = (options?: Partial<Options<PatchCallWithoutParametersAndResponseData>>): MutationOptions<unknown, AxiosError<DefaultError>, Options<PatchCallWithoutParametersAndResponseData>> => { |
@@ -198,17 +202,17 @@ export const callWithWeirdParameterNamesMutation = (options?: Partial<Options<Ca |
198 | 202 |
|
199 | 203 | export const callWithDefaultParametersQueryKey = (options: Options<CallWithDefaultParametersData>) => createQueryKey('callWithDefaultParameters', options); |
200 | 204 |
|
201 | | -export const callWithDefaultParametersOptions = (options: Options<CallWithDefaultParametersData>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof callWithDefaultParametersQueryKey>>({ |
202 | | - queryFn: async ({ queryKey, signal }) => { |
| 205 | +export const callWithDefaultParametersOptions = (options: Options<CallWithDefaultParametersData> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof callWithDefaultParametersQueryKey>>({ |
| 206 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
203 | 207 | const { data } = await callWithDefaultParameters({ |
204 | 208 | ...options, |
205 | 209 | ...queryKey[0], |
206 | 210 | signal, |
207 | 211 | throwOnError: true |
208 | 212 | }); |
209 | 213 | return data; |
210 | | - }, |
211 | | - queryKey: callWithDefaultParametersQueryKey(options) |
| 214 | + }), |
| 215 | + queryKey: callWithDefaultParametersQueryKey(resolveOptions(options)) |
212 | 216 | }); |
213 | 217 |
|
214 | 218 | export const callWithDefaultOptionalParametersMutation = (options?: Partial<Options<CallWithDefaultOptionalParametersData>>): MutationOptions<unknown, AxiosError<DefaultError>, Options<CallWithDefaultOptionalParametersData>> => { |
@@ -255,17 +259,17 @@ export const duplicateNameMutation = (options?: Partial<Options<DuplicateNameDat |
255 | 259 |
|
256 | 260 | export const duplicateName2QueryKey = (options?: Options<DuplicateName2Data>) => createQueryKey('duplicateName2', options); |
257 | 261 |
|
258 | | -export const duplicateName2Options = (options?: Options<DuplicateName2Data>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof duplicateName2QueryKey>>({ |
259 | | - queryFn: async ({ queryKey, signal }) => { |
| 262 | +export const duplicateName2Options = (options?: Options<DuplicateName2Data> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof duplicateName2QueryKey>>({ |
| 263 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
260 | 264 | const { data } = await duplicateName2({ |
261 | 265 | ...options, |
262 | 266 | ...queryKey[0], |
263 | 267 | signal, |
264 | 268 | throwOnError: true |
265 | 269 | }); |
266 | 270 | return data; |
267 | | - }, |
268 | | - queryKey: duplicateName2QueryKey(options) |
| 271 | + }), |
| 272 | + queryKey: duplicateName2QueryKey(resolveOptions(options)) |
269 | 273 | }); |
270 | 274 |
|
271 | 275 | export const duplicateName3Mutation = (options?: Partial<Options<DuplicateName3Data>>): MutationOptions<unknown, AxiosError<DefaultError>, Options<DuplicateName3Data>> => { |
@@ -298,77 +302,77 @@ export const duplicateName4Mutation = (options?: Partial<Options<DuplicateName4D |
298 | 302 |
|
299 | 303 | export const callWithNoContentResponseQueryKey = (options?: Options<CallWithNoContentResponseData>) => createQueryKey('callWithNoContentResponse', options); |
300 | 304 |
|
301 | | -export const callWithNoContentResponseOptions = (options?: Options<CallWithNoContentResponseData>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof callWithNoContentResponseQueryKey>>({ |
302 | | - queryFn: async ({ queryKey, signal }) => { |
| 305 | +export const callWithNoContentResponseOptions = (options?: Options<CallWithNoContentResponseData> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof callWithNoContentResponseQueryKey>>({ |
| 306 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
303 | 307 | const { data } = await callWithNoContentResponse({ |
304 | 308 | ...options, |
305 | 309 | ...queryKey[0], |
306 | 310 | signal, |
307 | 311 | throwOnError: true |
308 | 312 | }); |
309 | 313 | return data; |
310 | | - }, |
311 | | - queryKey: callWithNoContentResponseQueryKey(options) |
| 314 | + }), |
| 315 | + queryKey: callWithNoContentResponseQueryKey(resolveOptions(options)) |
312 | 316 | }); |
313 | 317 |
|
314 | 318 | export const callWithResponseAndNoContentResponseQueryKey = (options?: Options<CallWithResponseAndNoContentResponseData>) => createQueryKey('callWithResponseAndNoContentResponse', options); |
315 | 319 |
|
316 | | -export const callWithResponseAndNoContentResponseOptions = (options?: Options<CallWithResponseAndNoContentResponseData>) => queryOptions<CallWithResponseAndNoContentResponseResponse, AxiosError<DefaultError>, CallWithResponseAndNoContentResponseResponse, ReturnType<typeof callWithResponseAndNoContentResponseQueryKey>>({ |
317 | | - queryFn: async ({ queryKey, signal }) => { |
| 320 | +export const callWithResponseAndNoContentResponseOptions = (options?: Options<CallWithResponseAndNoContentResponseData> | typeof skipToken) => queryOptions<CallWithResponseAndNoContentResponseResponse, AxiosError<DefaultError>, CallWithResponseAndNoContentResponseResponse, ReturnType<typeof callWithResponseAndNoContentResponseQueryKey>>({ |
| 321 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
318 | 322 | const { data } = await callWithResponseAndNoContentResponse({ |
319 | 323 | ...options, |
320 | 324 | ...queryKey[0], |
321 | 325 | signal, |
322 | 326 | throwOnError: true |
323 | 327 | }); |
324 | 328 | return data; |
325 | | - }, |
326 | | - queryKey: callWithResponseAndNoContentResponseQueryKey(options) |
| 329 | + }), |
| 330 | + queryKey: callWithResponseAndNoContentResponseQueryKey(resolveOptions(options)) |
327 | 331 | }); |
328 | 332 |
|
329 | 333 | export const dummyAQueryKey = (options?: Options<DummyAData>) => createQueryKey('dummyA', options); |
330 | 334 |
|
331 | | -export const dummyAOptions = (options?: Options<DummyAData>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof dummyAQueryKey>>({ |
332 | | - queryFn: async ({ queryKey, signal }) => { |
| 335 | +export const dummyAOptions = (options?: Options<DummyAData> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof dummyAQueryKey>>({ |
| 336 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
333 | 337 | const { data } = await dummyA({ |
334 | 338 | ...options, |
335 | 339 | ...queryKey[0], |
336 | 340 | signal, |
337 | 341 | throwOnError: true |
338 | 342 | }); |
339 | 343 | return data; |
340 | | - }, |
341 | | - queryKey: dummyAQueryKey(options) |
| 344 | + }), |
| 345 | + queryKey: dummyAQueryKey(resolveOptions(options)) |
342 | 346 | }); |
343 | 347 |
|
344 | 348 | export const dummyBQueryKey = (options?: Options<DummyBData>) => createQueryKey('dummyB', options); |
345 | 349 |
|
346 | | -export const dummyBOptions = (options?: Options<DummyBData>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof dummyBQueryKey>>({ |
347 | | - queryFn: async ({ queryKey, signal }) => { |
| 350 | +export const dummyBOptions = (options?: Options<DummyBData> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof dummyBQueryKey>>({ |
| 351 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
348 | 352 | const { data } = await dummyB({ |
349 | 353 | ...options, |
350 | 354 | ...queryKey[0], |
351 | 355 | signal, |
352 | 356 | throwOnError: true |
353 | 357 | }); |
354 | 358 | return data; |
355 | | - }, |
356 | | - queryKey: dummyBQueryKey(options) |
| 359 | + }), |
| 360 | + queryKey: dummyBQueryKey(resolveOptions(options)) |
357 | 361 | }); |
358 | 362 |
|
359 | 363 | export const callWithResponseQueryKey = (options?: Options<CallWithResponseData>) => createQueryKey('callWithResponse', options); |
360 | 364 |
|
361 | | -export const callWithResponseOptions = (options?: Options<CallWithResponseData>) => queryOptions<CallWithResponseResponse, AxiosError<DefaultError>, CallWithResponseResponse, ReturnType<typeof callWithResponseQueryKey>>({ |
362 | | - queryFn: async ({ queryKey, signal }) => { |
| 365 | +export const callWithResponseOptions = (options?: Options<CallWithResponseData> | typeof skipToken) => queryOptions<CallWithResponseResponse, AxiosError<DefaultError>, CallWithResponseResponse, ReturnType<typeof callWithResponseQueryKey>>({ |
| 366 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
363 | 367 | const { data } = await callWithResponse({ |
364 | 368 | ...options, |
365 | 369 | ...queryKey[0], |
366 | 370 | signal, |
367 | 371 | throwOnError: true |
368 | 372 | }); |
369 | 373 | return data; |
370 | | - }, |
371 | | - queryKey: callWithResponseQueryKey(options) |
| 374 | + }), |
| 375 | + queryKey: callWithResponseQueryKey(resolveOptions(options)) |
372 | 376 | }); |
373 | 377 |
|
374 | 378 | export const callWithDuplicateResponsesMutation = (options?: Partial<Options<CallWithDuplicateResponsesData>>): MutationOptions<CallWithDuplicateResponsesResponse, AxiosError<CallWithDuplicateResponsesError>, Options<CallWithDuplicateResponsesData>> => { |
@@ -401,47 +405,47 @@ export const callWithResponsesMutation = (options?: Partial<Options<CallWithResp |
401 | 405 |
|
402 | 406 | export const collectionFormatQueryKey = (options: Options<CollectionFormatData>) => createQueryKey('collectionFormat', options); |
403 | 407 |
|
404 | | -export const collectionFormatOptions = (options: Options<CollectionFormatData>) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof collectionFormatQueryKey>>({ |
405 | | - queryFn: async ({ queryKey, signal }) => { |
| 408 | +export const collectionFormatOptions = (options: Options<CollectionFormatData> | typeof skipToken) => queryOptions<unknown, AxiosError<DefaultError>, unknown, ReturnType<typeof collectionFormatQueryKey>>({ |
| 409 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
406 | 410 | const { data } = await collectionFormat({ |
407 | 411 | ...options, |
408 | 412 | ...queryKey[0], |
409 | 413 | signal, |
410 | 414 | throwOnError: true |
411 | 415 | }); |
412 | 416 | return data; |
413 | | - }, |
414 | | - queryKey: collectionFormatQueryKey(options) |
| 417 | + }), |
| 418 | + queryKey: collectionFormatQueryKey(resolveOptions(options)) |
415 | 419 | }); |
416 | 420 |
|
417 | 421 | export const typesQueryKey = (options: Options<TypesData>) => createQueryKey('types', options); |
418 | 422 |
|
419 | | -export const typesOptions = (options: Options<TypesData>) => queryOptions<TypesResponse, AxiosError<DefaultError>, TypesResponse, ReturnType<typeof typesQueryKey>>({ |
420 | | - queryFn: async ({ queryKey, signal }) => { |
| 423 | +export const typesOptions = (options: Options<TypesData> | typeof skipToken) => queryOptions<TypesResponse, AxiosError<DefaultError>, TypesResponse, ReturnType<typeof typesQueryKey>>({ |
| 424 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
421 | 425 | const { data } = await types({ |
422 | 426 | ...options, |
423 | 427 | ...queryKey[0], |
424 | 428 | signal, |
425 | 429 | throwOnError: true |
426 | 430 | }); |
427 | 431 | return data; |
428 | | - }, |
429 | | - queryKey: typesQueryKey(options) |
| 432 | + }), |
| 433 | + queryKey: typesQueryKey(resolveOptions(options)) |
430 | 434 | }); |
431 | 435 |
|
432 | 436 | export const complexTypesQueryKey = (options: Options<ComplexTypesData>) => createQueryKey('complexTypes', options); |
433 | 437 |
|
434 | | -export const complexTypesOptions = (options: Options<ComplexTypesData>) => queryOptions<ComplexTypesResponse, AxiosError<DefaultError>, ComplexTypesResponse, ReturnType<typeof complexTypesQueryKey>>({ |
435 | | - queryFn: async ({ queryKey, signal }) => { |
| 438 | +export const complexTypesOptions = (options: Options<ComplexTypesData> | typeof skipToken) => queryOptions<ComplexTypesResponse, AxiosError<DefaultError>, ComplexTypesResponse, ReturnType<typeof complexTypesQueryKey>>({ |
| 439 | + queryFn: resolveQueryFn(options, async ({ queryKey, signal }) => { |
436 | 440 | const { data } = await complexTypes({ |
437 | 441 | ...options, |
438 | 442 | ...queryKey[0], |
439 | 443 | signal, |
440 | 444 | throwOnError: true |
441 | 445 | }); |
442 | 446 | return data; |
443 | | - }, |
444 | | - queryKey: complexTypesQueryKey(options) |
| 447 | + }), |
| 448 | + queryKey: complexTypesQueryKey(resolveOptions(options)) |
445 | 449 | }); |
446 | 450 |
|
447 | 451 | export const callWithResultFromHeaderMutation = (options?: Partial<Options<CallWithResultFromHeaderData>>): MutationOptions<unknown, AxiosError<DefaultError>, Options<CallWithResultFromHeaderData>> => { |
|
0 commit comments