@omerikanec/api-client-demo 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/{api.schemas.ts → api.schemas.d.ts} +2 -3
  2. package/dist/api.schemas.js +1 -0
  3. package/dist/auth/auth.d.ts +82 -0
  4. package/dist/auth/auth.js +71 -0
  5. package/dist/breed/breed.d.ts +147 -0
  6. package/dist/breed/breed.js +148 -0
  7. package/dist/club-documents/club-documents.d.ts +76 -0
  8. package/dist/club-documents/club-documents.js +78 -0
  9. package/dist/club-stats/club-stats.d.ts +37 -0
  10. package/dist/club-stats/club-stats.js +40 -0
  11. package/dist/content-dictionary/content-dictionary.d.ts +119 -0
  12. package/dist/content-dictionary/content-dictionary.js +116 -0
  13. package/dist/dog-references/dog-references.d.ts +360 -0
  14. package/dist/dog-references/dog-references.js +358 -0
  15. package/dist/dogs/dogs.d.ts +351 -0
  16. package/dist/dogs/dogs.js +329 -0
  17. package/dist/event-reports/event-reports.d.ts +76 -0
  18. package/dist/event-reports/event-reports.js +78 -0
  19. package/dist/events/events.d.ts +76 -0
  20. package/dist/events/events.js +78 -0
  21. package/dist/galleries/galleries.d.ts +108 -0
  22. package/dist/galleries/galleries.js +117 -0
  23. package/dist/home/home.d.ts +37 -0
  24. package/dist/home/home.js +40 -0
  25. package/dist/import-breedarchive/import-breedarchive.d.ts +177 -0
  26. package/dist/import-breedarchive/import-breedarchive.js +140 -0
  27. package/dist/import-hybrid/import-hybrid.d.ts +134 -0
  28. package/dist/import-hybrid/import-hybrid.js +107 -0
  29. package/dist/import-hybrid-full/import-hybrid-full.d.ts +134 -0
  30. package/dist/import-hybrid-full/import-hybrid-full.js +107 -0
  31. package/dist/import-zooportal/import-zooportal.d.ts +146 -0
  32. package/dist/import-zooportal/import-zooportal.js +107 -0
  33. package/dist/{index.ts → index.d.ts} +0 -1
  34. package/dist/index.js +31 -0
  35. package/dist/judges/judges.d.ts +147 -0
  36. package/dist/judges/judges.js +148 -0
  37. package/dist/leadership/leadership.d.ts +146 -0
  38. package/dist/leadership/leadership.js +148 -0
  39. package/dist/my-achievements/my-achievements.d.ts +87 -0
  40. package/dist/my-achievements/my-achievements.js +77 -0
  41. package/dist/my-applications/my-applications.d.ts +290 -0
  42. package/dist/my-applications/my-applications.js +207 -0
  43. package/dist/my-dogs/my-dogs.d.ts +329 -0
  44. package/dist/my-dogs/my-dogs.js +245 -0
  45. package/dist/my-kennels/my-kennels.d.ts +290 -0
  46. package/dist/my-kennels/my-kennels.js +207 -0
  47. package/dist/my-litters/my-litters.d.ts +290 -0
  48. package/dist/my-litters/my-litters.js +207 -0
  49. package/dist/news/news.d.ts +76 -0
  50. package/dist/news/news.js +78 -0
  51. package/dist/pages/pages.d.ts +76 -0
  52. package/dist/pages/pages.js +78 -0
  53. package/dist/profile/profile.d.ts +99 -0
  54. package/dist/profile/profile.js +72 -0
  55. package/dist/status-of-import-task/status-of-import-task.d.ts +44 -0
  56. package/dist/status-of-import-task/status-of-import-task.js +39 -0
  57. package/package.json +1 -1
  58. package/dist/.api-sync/incremental-spec.json +0 -71
  59. package/dist/auth/auth.ts +0 -221
  60. package/dist/breed/breed.ts +0 -434
  61. package/dist/club-documents/club-documents.ts +0 -231
  62. package/dist/club-stats/club-stats.ts +0 -122
  63. package/dist/content-dictionary/content-dictionary.ts +0 -345
  64. package/dist/dog-references/dog-references.ts +0 -1043
  65. package/dist/dogs/dogs.ts +0 -972
  66. package/dist/event-reports/event-reports.ts +0 -231
  67. package/dist/events/events.ts +0 -231
  68. package/dist/galleries/galleries.ts +0 -332
  69. package/dist/home/home.ts +0 -122
  70. package/dist/import-breedarchive/import-breedarchive.ts +0 -417
  71. package/dist/import-hybrid/import-hybrid.ts +0 -320
  72. package/dist/import-hybrid-full/import-hybrid-full.ts +0 -320
  73. package/dist/import-zooportal/import-zooportal.ts +0 -335
  74. package/dist/judges/judges.ts +0 -434
  75. package/dist/leadership/leadership.ts +0 -433
  76. package/dist/my-achievements/my-achievements.ts +0 -243
  77. package/dist/my-applications/my-applications.ts +0 -665
  78. package/dist/my-dogs/my-dogs.ts +0 -772
  79. package/dist/my-kennels/my-kennels.ts +0 -665
  80. package/dist/my-litters/my-litters.ts +0 -665
  81. package/dist/news/news.ts +0 -231
  82. package/dist/pages/pages.ts +0 -231
  83. package/dist/profile/profile.ts +0 -246
  84. package/dist/status-of-import-task/status-of-import-task.ts +0 -129
@@ -1,772 +0,0 @@
1
- /**
2
- * Generated by orval v8.5.3 🍺
3
- * Do not edit manually.
4
- * НКП Сибирский Хаски API
5
- * API для Национального клуба породы Сибирский хаски
6
- * OpenAPI spec version: 1.0.0
7
- */
8
- import {
9
- useMutation,
10
- useQuery
11
- } from '@tanstack/react-query';
12
- import type {
13
- MutationFunction,
14
- QueryFunction,
15
- QueryKey,
16
- UseMutationOptions,
17
- UseMutationResult,
18
- UseQueryOptions,
19
- UseQueryResult
20
- } from '@tanstack/react-query';
21
-
22
- import type {
23
- Dog,
24
- DogRequest,
25
- MeDogsChampionsListParams,
26
- MeDogsListParams,
27
- PaginatedDogList,
28
- PatchedDogRequest
29
- } from '../api.schemas';
30
-
31
-
32
- type AwaitedInput<T> = PromiseLike<T> | T;
33
-
34
- type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
35
-
36
-
37
-
38
-
39
- /**
40
- * API собак пользователя
41
- * @summary Список моих собак
42
- */
43
- export type meDogsListResponse200 = {
44
- data: PaginatedDogList
45
- status: 200
46
- }
47
-
48
- export type meDogsListResponse401 = {
49
- data: void
50
- status: 401
51
- }
52
-
53
- export type meDogsListResponseSuccess = (meDogsListResponse200) & {
54
- headers: Headers;
55
- };
56
- export type meDogsListResponseError = (meDogsListResponse401) & {
57
- headers: Headers;
58
- };
59
-
60
- export type meDogsListResponse = (meDogsListResponseSuccess | meDogsListResponseError)
61
-
62
- export const getMeDogsListUrl = (params?: MeDogsListParams,) => {
63
- const normalizedParams = new URLSearchParams();
64
-
65
- Object.entries(params || {}).forEach(([key, value]) => {
66
-
67
- if (value !== undefined) {
68
- normalizedParams.append(key, value === null ? 'null' : value.toString())
69
- }
70
- });
71
-
72
- const stringifiedParams = normalizedParams.toString();
73
-
74
- return stringifiedParams.length > 0 ? `/api/me/dogs/?${stringifiedParams}` : `/api/me/dogs/`
75
- }
76
-
77
- export const meDogsList = async (params?: MeDogsListParams, options?: RequestInit): Promise<meDogsListResponse> => {
78
-
79
- const res = await fetch(getMeDogsListUrl(params),
80
- {
81
- ...options,
82
- method: 'GET'
83
-
84
-
85
- }
86
- )
87
-
88
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
89
-
90
- const data: meDogsListResponse['data'] = body ? JSON.parse(body) : {}
91
- return { data, status: res.status, headers: res.headers } as meDogsListResponse
92
- }
93
-
94
-
95
-
96
-
97
-
98
- export const getMeDogsListQueryKey = (params?: MeDogsListParams,) => {
99
- return [
100
- `/api/me/dogs/`, ...(params ? [params] : [])
101
- ] as const;
102
- }
103
-
104
-
105
- export const getMeDogsListQueryOptions = <TData = Awaited<ReturnType<typeof meDogsList>>, TError = void>(params?: MeDogsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meDogsList>>, TError, TData>, fetch?: RequestInit}
106
- ) => {
107
-
108
- const {query: queryOptions, fetch: fetchOptions} = options ?? {};
109
-
110
- const queryKey = queryOptions?.queryKey ?? getMeDogsListQueryKey(params);
111
-
112
-
113
-
114
- const queryFn: QueryFunction<Awaited<ReturnType<typeof meDogsList>>> = ({ signal }) => meDogsList(params, { signal, ...fetchOptions });
115
-
116
-
117
-
118
-
119
-
120
- return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof meDogsList>>, TError, TData> & { queryKey: QueryKey }
121
- }
122
-
123
- export type MeDogsListQueryResult = NonNullable<Awaited<ReturnType<typeof meDogsList>>>
124
- export type MeDogsListQueryError = void
125
-
126
-
127
- /**
128
- * @summary Список моих собак
129
- */
130
-
131
- export function useMeDogsList<TData = Awaited<ReturnType<typeof meDogsList>>, TError = void>(
132
- params?: MeDogsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meDogsList>>, TError, TData>, fetch?: RequestInit}
133
-
134
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
135
-
136
- const queryOptions = getMeDogsListQueryOptions(params,options)
137
-
138
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
139
-
140
- return { ...query, queryKey: queryOptions.queryKey };
141
- }
142
-
143
-
144
-
145
-
146
- /**
147
- * API собак пользователя
148
- * @summary Добавить собаку
149
- */
150
- export type meDogsCreateResponse201 = {
151
- data: Dog
152
- status: 201
153
- }
154
-
155
- export type meDogsCreateResponse400 = {
156
- data: void
157
- status: 400
158
- }
159
-
160
- export type meDogsCreateResponse401 = {
161
- data: void
162
- status: 401
163
- }
164
-
165
- export type meDogsCreateResponseSuccess = (meDogsCreateResponse201) & {
166
- headers: Headers;
167
- };
168
- export type meDogsCreateResponseError = (meDogsCreateResponse400 | meDogsCreateResponse401) & {
169
- headers: Headers;
170
- };
171
-
172
- export type meDogsCreateResponse = (meDogsCreateResponseSuccess | meDogsCreateResponseError)
173
-
174
- export const getMeDogsCreateUrl = () => {
175
-
176
-
177
-
178
-
179
- return `/api/me/dogs/`
180
- }
181
-
182
- export const meDogsCreate = async (dogRequest: DogRequest, options?: RequestInit): Promise<meDogsCreateResponse> => {
183
-
184
- const res = await fetch(getMeDogsCreateUrl(),
185
- {
186
- ...options,
187
- method: 'POST',
188
- headers: { 'Content-Type': 'application/json', ...options?.headers },
189
- body: JSON.stringify(
190
- dogRequest,)
191
- }
192
- )
193
-
194
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
195
-
196
- const data: meDogsCreateResponse['data'] = body ? JSON.parse(body) : {}
197
- return { data, status: res.status, headers: res.headers } as meDogsCreateResponse
198
- }
199
-
200
-
201
-
202
-
203
- export const getMeDogsCreateMutationOptions = <TError = void,
204
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsCreate>>, TError,{data: DogRequest}, TContext>, fetch?: RequestInit}
205
- ): UseMutationOptions<Awaited<ReturnType<typeof meDogsCreate>>, TError,{data: DogRequest}, TContext> => {
206
-
207
- const mutationKey = ['meDogsCreate'];
208
- const {mutation: mutationOptions, fetch: fetchOptions} = options ?
209
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
210
- options
211
- : {...options, mutation: {...options.mutation, mutationKey}}
212
- : {mutation: { mutationKey, }, fetch: undefined};
213
-
214
-
215
-
216
-
217
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof meDogsCreate>>, {data: DogRequest}> = (props) => {
218
- const {data} = props ?? {};
219
-
220
- return meDogsCreate(data,fetchOptions)
221
- }
222
-
223
-
224
-
225
-
226
-
227
-
228
- return { mutationFn, ...mutationOptions }}
229
-
230
- export type MeDogsCreateMutationResult = NonNullable<Awaited<ReturnType<typeof meDogsCreate>>>
231
- export type MeDogsCreateMutationBody = DogRequest
232
- export type MeDogsCreateMutationError = void
233
-
234
- /**
235
- * @summary Добавить собаку
236
- */
237
- export const useMeDogsCreate = <TError = void,
238
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsCreate>>, TError,{data: DogRequest}, TContext>, fetch?: RequestInit}
239
- ): UseMutationResult<
240
- Awaited<ReturnType<typeof meDogsCreate>>,
241
- TError,
242
- {data: DogRequest},
243
- TContext
244
- > => {
245
- return useMutation(getMeDogsCreateMutationOptions(options));
246
- }
247
- /**
248
- * API собак пользователя
249
- * @summary Получить мою собаку по ID
250
- */
251
- export type meDogsRetrieveResponse200 = {
252
- data: Dog
253
- status: 200
254
- }
255
-
256
- export type meDogsRetrieveResponse401 = {
257
- data: void
258
- status: 401
259
- }
260
-
261
- export type meDogsRetrieveResponse404 = {
262
- data: void
263
- status: 404
264
- }
265
-
266
- export type meDogsRetrieveResponseSuccess = (meDogsRetrieveResponse200) & {
267
- headers: Headers;
268
- };
269
- export type meDogsRetrieveResponseError = (meDogsRetrieveResponse401 | meDogsRetrieveResponse404) & {
270
- headers: Headers;
271
- };
272
-
273
- export type meDogsRetrieveResponse = (meDogsRetrieveResponseSuccess | meDogsRetrieveResponseError)
274
-
275
- export const getMeDogsRetrieveUrl = (id: string,) => {
276
-
277
-
278
-
279
-
280
- return `/api/me/dogs/${id}/`
281
- }
282
-
283
- export const meDogsRetrieve = async (id: string, options?: RequestInit): Promise<meDogsRetrieveResponse> => {
284
-
285
- const res = await fetch(getMeDogsRetrieveUrl(id),
286
- {
287
- ...options,
288
- method: 'GET'
289
-
290
-
291
- }
292
- )
293
-
294
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
295
-
296
- const data: meDogsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
297
- return { data, status: res.status, headers: res.headers } as meDogsRetrieveResponse
298
- }
299
-
300
-
301
-
302
-
303
-
304
- export const getMeDogsRetrieveQueryKey = (id: string,) => {
305
- return [
306
- `/api/me/dogs/${id}/`
307
- ] as const;
308
- }
309
-
310
-
311
- export const getMeDogsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof meDogsRetrieve>>, TError = void>(id: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meDogsRetrieve>>, TError, TData>, fetch?: RequestInit}
312
- ) => {
313
-
314
- const {query: queryOptions, fetch: fetchOptions} = options ?? {};
315
-
316
- const queryKey = queryOptions?.queryKey ?? getMeDogsRetrieveQueryKey(id);
317
-
318
-
319
-
320
- const queryFn: QueryFunction<Awaited<ReturnType<typeof meDogsRetrieve>>> = ({ signal }) => meDogsRetrieve(id, { signal, ...fetchOptions });
321
-
322
-
323
-
324
-
325
-
326
- return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof meDogsRetrieve>>, TError, TData> & { queryKey: QueryKey }
327
- }
328
-
329
- export type MeDogsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof meDogsRetrieve>>>
330
- export type MeDogsRetrieveQueryError = void
331
-
332
-
333
- /**
334
- * @summary Получить мою собаку по ID
335
- */
336
-
337
- export function useMeDogsRetrieve<TData = Awaited<ReturnType<typeof meDogsRetrieve>>, TError = void>(
338
- id: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meDogsRetrieve>>, TError, TData>, fetch?: RequestInit}
339
-
340
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
341
-
342
- const queryOptions = getMeDogsRetrieveQueryOptions(id,options)
343
-
344
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
345
-
346
- return { ...query, queryKey: queryOptions.queryKey };
347
- }
348
-
349
-
350
-
351
-
352
- /**
353
- * API собак пользователя
354
- * @summary Обновить данные собаки
355
- */
356
- export type meDogsUpdateResponse200 = {
357
- data: Dog
358
- status: 200
359
- }
360
-
361
- export type meDogsUpdateResponse400 = {
362
- data: void
363
- status: 400
364
- }
365
-
366
- export type meDogsUpdateResponse401 = {
367
- data: void
368
- status: 401
369
- }
370
-
371
- export type meDogsUpdateResponse404 = {
372
- data: void
373
- status: 404
374
- }
375
-
376
- export type meDogsUpdateResponseSuccess = (meDogsUpdateResponse200) & {
377
- headers: Headers;
378
- };
379
- export type meDogsUpdateResponseError = (meDogsUpdateResponse400 | meDogsUpdateResponse401 | meDogsUpdateResponse404) & {
380
- headers: Headers;
381
- };
382
-
383
- export type meDogsUpdateResponse = (meDogsUpdateResponseSuccess | meDogsUpdateResponseError)
384
-
385
- export const getMeDogsUpdateUrl = (id: string,) => {
386
-
387
-
388
-
389
-
390
- return `/api/me/dogs/${id}/`
391
- }
392
-
393
- export const meDogsUpdate = async (id: string,
394
- dogRequest: DogRequest, options?: RequestInit): Promise<meDogsUpdateResponse> => {
395
-
396
- const res = await fetch(getMeDogsUpdateUrl(id),
397
- {
398
- ...options,
399
- method: 'PUT',
400
- headers: { 'Content-Type': 'application/json', ...options?.headers },
401
- body: JSON.stringify(
402
- dogRequest,)
403
- }
404
- )
405
-
406
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
407
-
408
- const data: meDogsUpdateResponse['data'] = body ? JSON.parse(body) : {}
409
- return { data, status: res.status, headers: res.headers } as meDogsUpdateResponse
410
- }
411
-
412
-
413
-
414
-
415
- export const getMeDogsUpdateMutationOptions = <TError = void,
416
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsUpdate>>, TError,{id: string;data: DogRequest}, TContext>, fetch?: RequestInit}
417
- ): UseMutationOptions<Awaited<ReturnType<typeof meDogsUpdate>>, TError,{id: string;data: DogRequest}, TContext> => {
418
-
419
- const mutationKey = ['meDogsUpdate'];
420
- const {mutation: mutationOptions, fetch: fetchOptions} = options ?
421
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
422
- options
423
- : {...options, mutation: {...options.mutation, mutationKey}}
424
- : {mutation: { mutationKey, }, fetch: undefined};
425
-
426
-
427
-
428
-
429
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof meDogsUpdate>>, {id: string;data: DogRequest}> = (props) => {
430
- const {id,data} = props ?? {};
431
-
432
- return meDogsUpdate(id,data,fetchOptions)
433
- }
434
-
435
-
436
-
437
-
438
-
439
-
440
- return { mutationFn, ...mutationOptions }}
441
-
442
- export type MeDogsUpdateMutationResult = NonNullable<Awaited<ReturnType<typeof meDogsUpdate>>>
443
- export type MeDogsUpdateMutationBody = DogRequest
444
- export type MeDogsUpdateMutationError = void
445
-
446
- /**
447
- * @summary Обновить данные собаки
448
- */
449
- export const useMeDogsUpdate = <TError = void,
450
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsUpdate>>, TError,{id: string;data: DogRequest}, TContext>, fetch?: RequestInit}
451
- ): UseMutationResult<
452
- Awaited<ReturnType<typeof meDogsUpdate>>,
453
- TError,
454
- {id: string;data: DogRequest},
455
- TContext
456
- > => {
457
- return useMutation(getMeDogsUpdateMutationOptions(options));
458
- }
459
- /**
460
- * API собак пользователя
461
- * @summary Частично обновить данные собаки
462
- */
463
- export type meDogsPartialUpdateResponse200 = {
464
- data: Dog
465
- status: 200
466
- }
467
-
468
- export type meDogsPartialUpdateResponse400 = {
469
- data: void
470
- status: 400
471
- }
472
-
473
- export type meDogsPartialUpdateResponse401 = {
474
- data: void
475
- status: 401
476
- }
477
-
478
- export type meDogsPartialUpdateResponse404 = {
479
- data: void
480
- status: 404
481
- }
482
-
483
- export type meDogsPartialUpdateResponseSuccess = (meDogsPartialUpdateResponse200) & {
484
- headers: Headers;
485
- };
486
- export type meDogsPartialUpdateResponseError = (meDogsPartialUpdateResponse400 | meDogsPartialUpdateResponse401 | meDogsPartialUpdateResponse404) & {
487
- headers: Headers;
488
- };
489
-
490
- export type meDogsPartialUpdateResponse = (meDogsPartialUpdateResponseSuccess | meDogsPartialUpdateResponseError)
491
-
492
- export const getMeDogsPartialUpdateUrl = (id: string,) => {
493
-
494
-
495
-
496
-
497
- return `/api/me/dogs/${id}/`
498
- }
499
-
500
- export const meDogsPartialUpdate = async (id: string,
501
- patchedDogRequest: PatchedDogRequest, options?: RequestInit): Promise<meDogsPartialUpdateResponse> => {
502
-
503
- const res = await fetch(getMeDogsPartialUpdateUrl(id),
504
- {
505
- ...options,
506
- method: 'PATCH',
507
- headers: { 'Content-Type': 'application/json', ...options?.headers },
508
- body: JSON.stringify(
509
- patchedDogRequest,)
510
- }
511
- )
512
-
513
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
514
-
515
- const data: meDogsPartialUpdateResponse['data'] = body ? JSON.parse(body) : {}
516
- return { data, status: res.status, headers: res.headers } as meDogsPartialUpdateResponse
517
- }
518
-
519
-
520
-
521
-
522
- export const getMeDogsPartialUpdateMutationOptions = <TError = void,
523
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsPartialUpdate>>, TError,{id: string;data: PatchedDogRequest}, TContext>, fetch?: RequestInit}
524
- ): UseMutationOptions<Awaited<ReturnType<typeof meDogsPartialUpdate>>, TError,{id: string;data: PatchedDogRequest}, TContext> => {
525
-
526
- const mutationKey = ['meDogsPartialUpdate'];
527
- const {mutation: mutationOptions, fetch: fetchOptions} = options ?
528
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
529
- options
530
- : {...options, mutation: {...options.mutation, mutationKey}}
531
- : {mutation: { mutationKey, }, fetch: undefined};
532
-
533
-
534
-
535
-
536
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof meDogsPartialUpdate>>, {id: string;data: PatchedDogRequest}> = (props) => {
537
- const {id,data} = props ?? {};
538
-
539
- return meDogsPartialUpdate(id,data,fetchOptions)
540
- }
541
-
542
-
543
-
544
-
545
-
546
-
547
- return { mutationFn, ...mutationOptions }}
548
-
549
- export type MeDogsPartialUpdateMutationResult = NonNullable<Awaited<ReturnType<typeof meDogsPartialUpdate>>>
550
- export type MeDogsPartialUpdateMutationBody = PatchedDogRequest
551
- export type MeDogsPartialUpdateMutationError = void
552
-
553
- /**
554
- * @summary Частично обновить данные собаки
555
- */
556
- export const useMeDogsPartialUpdate = <TError = void,
557
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsPartialUpdate>>, TError,{id: string;data: PatchedDogRequest}, TContext>, fetch?: RequestInit}
558
- ): UseMutationResult<
559
- Awaited<ReturnType<typeof meDogsPartialUpdate>>,
560
- TError,
561
- {id: string;data: PatchedDogRequest},
562
- TContext
563
- > => {
564
- return useMutation(getMeDogsPartialUpdateMutationOptions(options));
565
- }
566
- /**
567
- * API собак пользователя
568
- * @summary Удалить собаку
569
- */
570
- export type meDogsDestroyResponse204 = {
571
- data: void
572
- status: 204
573
- }
574
-
575
- export type meDogsDestroyResponse401 = {
576
- data: void
577
- status: 401
578
- }
579
-
580
- export type meDogsDestroyResponse404 = {
581
- data: void
582
- status: 404
583
- }
584
-
585
- export type meDogsDestroyResponseSuccess = (meDogsDestroyResponse204) & {
586
- headers: Headers;
587
- };
588
- export type meDogsDestroyResponseError = (meDogsDestroyResponse401 | meDogsDestroyResponse404) & {
589
- headers: Headers;
590
- };
591
-
592
- export type meDogsDestroyResponse = (meDogsDestroyResponseSuccess | meDogsDestroyResponseError)
593
-
594
- export const getMeDogsDestroyUrl = (id: string,) => {
595
-
596
-
597
-
598
-
599
- return `/api/me/dogs/${id}/`
600
- }
601
-
602
- export const meDogsDestroy = async (id: string, options?: RequestInit): Promise<meDogsDestroyResponse> => {
603
-
604
- const res = await fetch(getMeDogsDestroyUrl(id),
605
- {
606
- ...options,
607
- method: 'DELETE'
608
-
609
-
610
- }
611
- )
612
-
613
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
614
-
615
- const data: meDogsDestroyResponse['data'] = body ? JSON.parse(body) : {}
616
- return { data, status: res.status, headers: res.headers } as meDogsDestroyResponse
617
- }
618
-
619
-
620
-
621
-
622
- export const getMeDogsDestroyMutationOptions = <TError = void,
623
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsDestroy>>, TError,{id: string}, TContext>, fetch?: RequestInit}
624
- ): UseMutationOptions<Awaited<ReturnType<typeof meDogsDestroy>>, TError,{id: string}, TContext> => {
625
-
626
- const mutationKey = ['meDogsDestroy'];
627
- const {mutation: mutationOptions, fetch: fetchOptions} = options ?
628
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
629
- options
630
- : {...options, mutation: {...options.mutation, mutationKey}}
631
- : {mutation: { mutationKey, }, fetch: undefined};
632
-
633
-
634
-
635
-
636
- const mutationFn: MutationFunction<Awaited<ReturnType<typeof meDogsDestroy>>, {id: string}> = (props) => {
637
- const {id} = props ?? {};
638
-
639
- return meDogsDestroy(id,fetchOptions)
640
- }
641
-
642
-
643
-
644
-
645
-
646
-
647
- return { mutationFn, ...mutationOptions }}
648
-
649
- export type MeDogsDestroyMutationResult = NonNullable<Awaited<ReturnType<typeof meDogsDestroy>>>
650
-
651
- export type MeDogsDestroyMutationError = void
652
-
653
- /**
654
- * @summary Удалить собаку
655
- */
656
- export const useMeDogsDestroy = <TError = void,
657
- TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meDogsDestroy>>, TError,{id: string}, TContext>, fetch?: RequestInit}
658
- ): UseMutationResult<
659
- Awaited<ReturnType<typeof meDogsDestroy>>,
660
- TError,
661
- {id: string},
662
- TContext
663
- > => {
664
- return useMutation(getMeDogsDestroyMutationOptions(options));
665
- }
666
- /**
667
- * Возвращает только собак с титулом чемпиона.
668
- * @summary Список моих чемпионов
669
- */
670
- export type meDogsChampionsListResponse200 = {
671
- data: PaginatedDogList
672
- status: 200
673
- }
674
-
675
- export type meDogsChampionsListResponse401 = {
676
- data: void
677
- status: 401
678
- }
679
-
680
- export type meDogsChampionsListResponseSuccess = (meDogsChampionsListResponse200) & {
681
- headers: Headers;
682
- };
683
- export type meDogsChampionsListResponseError = (meDogsChampionsListResponse401) & {
684
- headers: Headers;
685
- };
686
-
687
- export type meDogsChampionsListResponse = (meDogsChampionsListResponseSuccess | meDogsChampionsListResponseError)
688
-
689
- export const getMeDogsChampionsListUrl = (params?: MeDogsChampionsListParams,) => {
690
- const normalizedParams = new URLSearchParams();
691
-
692
- Object.entries(params || {}).forEach(([key, value]) => {
693
-
694
- if (value !== undefined) {
695
- normalizedParams.append(key, value === null ? 'null' : value.toString())
696
- }
697
- });
698
-
699
- const stringifiedParams = normalizedParams.toString();
700
-
701
- return stringifiedParams.length > 0 ? `/api/me/dogs/champions/?${stringifiedParams}` : `/api/me/dogs/champions/`
702
- }
703
-
704
- export const meDogsChampionsList = async (params?: MeDogsChampionsListParams, options?: RequestInit): Promise<meDogsChampionsListResponse> => {
705
-
706
- const res = await fetch(getMeDogsChampionsListUrl(params),
707
- {
708
- ...options,
709
- method: 'GET'
710
-
711
-
712
- }
713
- )
714
-
715
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
716
-
717
- const data: meDogsChampionsListResponse['data'] = body ? JSON.parse(body) : {}
718
- return { data, status: res.status, headers: res.headers } as meDogsChampionsListResponse
719
- }
720
-
721
-
722
-
723
-
724
-
725
- export const getMeDogsChampionsListQueryKey = (params?: MeDogsChampionsListParams,) => {
726
- return [
727
- `/api/me/dogs/champions/`, ...(params ? [params] : [])
728
- ] as const;
729
- }
730
-
731
-
732
- export const getMeDogsChampionsListQueryOptions = <TData = Awaited<ReturnType<typeof meDogsChampionsList>>, TError = void>(params?: MeDogsChampionsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meDogsChampionsList>>, TError, TData>, fetch?: RequestInit}
733
- ) => {
734
-
735
- const {query: queryOptions, fetch: fetchOptions} = options ?? {};
736
-
737
- const queryKey = queryOptions?.queryKey ?? getMeDogsChampionsListQueryKey(params);
738
-
739
-
740
-
741
- const queryFn: QueryFunction<Awaited<ReturnType<typeof meDogsChampionsList>>> = ({ signal }) => meDogsChampionsList(params, { signal, ...fetchOptions });
742
-
743
-
744
-
745
-
746
-
747
- return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof meDogsChampionsList>>, TError, TData> & { queryKey: QueryKey }
748
- }
749
-
750
- export type MeDogsChampionsListQueryResult = NonNullable<Awaited<ReturnType<typeof meDogsChampionsList>>>
751
- export type MeDogsChampionsListQueryError = void
752
-
753
-
754
- /**
755
- * @summary Список моих чемпионов
756
- */
757
-
758
- export function useMeDogsChampionsList<TData = Awaited<ReturnType<typeof meDogsChampionsList>>, TError = void>(
759
- params?: MeDogsChampionsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meDogsChampionsList>>, TError, TData>, fetch?: RequestInit}
760
-
761
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
762
-
763
- const queryOptions = getMeDogsChampionsListQueryOptions(params,options)
764
-
765
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
766
-
767
- return { ...query, queryKey: queryOptions.queryKey };
768
- }
769
-
770
-
771
-
772
-