@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.
- package/dist/{api.schemas.ts → api.schemas.d.ts} +2 -3
- package/dist/api.schemas.js +1 -0
- package/dist/auth/auth.d.ts +82 -0
- package/dist/auth/auth.js +71 -0
- package/dist/breed/breed.d.ts +147 -0
- package/dist/breed/breed.js +148 -0
- package/dist/club-documents/club-documents.d.ts +76 -0
- package/dist/club-documents/club-documents.js +78 -0
- package/dist/club-stats/club-stats.d.ts +37 -0
- package/dist/club-stats/club-stats.js +40 -0
- package/dist/content-dictionary/content-dictionary.d.ts +119 -0
- package/dist/content-dictionary/content-dictionary.js +116 -0
- package/dist/dog-references/dog-references.d.ts +360 -0
- package/dist/dog-references/dog-references.js +358 -0
- package/dist/dogs/dogs.d.ts +351 -0
- package/dist/dogs/dogs.js +329 -0
- package/dist/event-reports/event-reports.d.ts +76 -0
- package/dist/event-reports/event-reports.js +78 -0
- package/dist/events/events.d.ts +76 -0
- package/dist/events/events.js +78 -0
- package/dist/galleries/galleries.d.ts +108 -0
- package/dist/galleries/galleries.js +117 -0
- package/dist/home/home.d.ts +37 -0
- package/dist/home/home.js +40 -0
- package/dist/import-breedarchive/import-breedarchive.d.ts +177 -0
- package/dist/import-breedarchive/import-breedarchive.js +140 -0
- package/dist/import-hybrid/import-hybrid.d.ts +134 -0
- package/dist/import-hybrid/import-hybrid.js +107 -0
- package/dist/import-hybrid-full/import-hybrid-full.d.ts +134 -0
- package/dist/import-hybrid-full/import-hybrid-full.js +107 -0
- package/dist/import-zooportal/import-zooportal.d.ts +146 -0
- package/dist/import-zooportal/import-zooportal.js +107 -0
- package/dist/{index.ts → index.d.ts} +0 -1
- package/dist/index.js +31 -0
- package/dist/judges/judges.d.ts +147 -0
- package/dist/judges/judges.js +148 -0
- package/dist/leadership/leadership.d.ts +146 -0
- package/dist/leadership/leadership.js +148 -0
- package/dist/my-achievements/my-achievements.d.ts +87 -0
- package/dist/my-achievements/my-achievements.js +77 -0
- package/dist/my-applications/my-applications.d.ts +290 -0
- package/dist/my-applications/my-applications.js +207 -0
- package/dist/my-dogs/my-dogs.d.ts +329 -0
- package/dist/my-dogs/my-dogs.js +245 -0
- package/dist/my-kennels/my-kennels.d.ts +290 -0
- package/dist/my-kennels/my-kennels.js +207 -0
- package/dist/my-litters/my-litters.d.ts +290 -0
- package/dist/my-litters/my-litters.js +207 -0
- package/dist/news/news.d.ts +76 -0
- package/dist/news/news.js +78 -0
- package/dist/pages/pages.d.ts +76 -0
- package/dist/pages/pages.js +78 -0
- package/dist/profile/profile.d.ts +99 -0
- package/dist/profile/profile.js +72 -0
- package/dist/status-of-import-task/status-of-import-task.d.ts +44 -0
- package/dist/status-of-import-task/status-of-import-task.js +39 -0
- package/package.json +1 -1
- package/dist/.api-sync/incremental-spec.json +0 -71
- package/dist/auth/auth.ts +0 -221
- package/dist/breed/breed.ts +0 -434
- package/dist/club-documents/club-documents.ts +0 -231
- package/dist/club-stats/club-stats.ts +0 -122
- package/dist/content-dictionary/content-dictionary.ts +0 -345
- package/dist/dog-references/dog-references.ts +0 -1043
- package/dist/dogs/dogs.ts +0 -972
- package/dist/event-reports/event-reports.ts +0 -231
- package/dist/events/events.ts +0 -231
- package/dist/galleries/galleries.ts +0 -332
- package/dist/home/home.ts +0 -122
- package/dist/import-breedarchive/import-breedarchive.ts +0 -417
- package/dist/import-hybrid/import-hybrid.ts +0 -320
- package/dist/import-hybrid-full/import-hybrid-full.ts +0 -320
- package/dist/import-zooportal/import-zooportal.ts +0 -335
- package/dist/judges/judges.ts +0 -434
- package/dist/leadership/leadership.ts +0 -433
- package/dist/my-achievements/my-achievements.ts +0 -243
- package/dist/my-applications/my-applications.ts +0 -665
- package/dist/my-dogs/my-dogs.ts +0 -772
- package/dist/my-kennels/my-kennels.ts +0 -665
- package/dist/my-litters/my-litters.ts +0 -665
- package/dist/news/news.ts +0 -231
- package/dist/pages/pages.ts +0 -231
- package/dist/profile/profile.ts +0 -246
- package/dist/status-of-import-task/status-of-import-task.ts +0 -129
package/dist/dogs/dogs.ts
DELETED
|
@@ -1,972 +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
|
-
CalculateCoiRequestRequest,
|
|
24
|
-
CalculateCoiResponse,
|
|
25
|
-
DogDetail,
|
|
26
|
-
DogStatsResponse,
|
|
27
|
-
DogsListParams,
|
|
28
|
-
DogsOffspringListParams,
|
|
29
|
-
DogsPedigreeRetrieveParams,
|
|
30
|
-
DogsSearchListParams,
|
|
31
|
-
DogsSiblingsListParams,
|
|
32
|
-
PaginatedDogListList,
|
|
33
|
-
Pedigree,
|
|
34
|
-
RecalculateAllCoiRequestRequest,
|
|
35
|
-
TaskResponse
|
|
36
|
-
} from '../api.schemas';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
40
|
-
|
|
41
|
-
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Возвращает пагинированный список собак. Поддерживает поиск и фильтрацию.
|
|
48
|
-
* @summary Список собак
|
|
49
|
-
*/
|
|
50
|
-
export type dogsListResponse200 = {
|
|
51
|
-
data: PaginatedDogListList
|
|
52
|
-
status: 200
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type dogsListResponseSuccess = (dogsListResponse200) & {
|
|
56
|
-
headers: Headers;
|
|
57
|
-
};
|
|
58
|
-
;
|
|
59
|
-
|
|
60
|
-
export type dogsListResponse = (dogsListResponseSuccess)
|
|
61
|
-
|
|
62
|
-
export const getDogsListUrl = (params?: DogsListParams,) => {
|
|
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/dogs/?${stringifiedParams}` : `/api/dogs/`
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export const dogsList = async (params?: DogsListParams, options?: RequestInit): Promise<dogsListResponse> => {
|
|
78
|
-
|
|
79
|
-
const res = await fetch(getDogsListUrl(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: dogsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
91
|
-
return { data, status: res.status, headers: res.headers } as dogsListResponse
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
export const getDogsListQueryKey = (params?: DogsListParams,) => {
|
|
99
|
-
return [
|
|
100
|
-
`/api/dogs/`, ...(params ? [params] : [])
|
|
101
|
-
] as const;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
export const getDogsListQueryOptions = <TData = Awaited<ReturnType<typeof dogsList>>, TError = unknown>(params?: DogsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsList>>, TError, TData>, fetch?: RequestInit}
|
|
106
|
-
) => {
|
|
107
|
-
|
|
108
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
109
|
-
|
|
110
|
-
const queryKey = queryOptions?.queryKey ?? getDogsListQueryKey(params);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsList>>> = ({ signal }) => dogsList(params, { signal, ...fetchOptions });
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsList>>, TError, TData> & { queryKey: QueryKey }
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export type DogsListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsList>>>
|
|
124
|
-
export type DogsListQueryError = unknown
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @summary Список собак
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
export function useDogsList<TData = Awaited<ReturnType<typeof dogsList>>, TError = unknown>(
|
|
132
|
-
params?: DogsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsList>>, TError, TData>, fetch?: RequestInit}
|
|
133
|
-
|
|
134
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
135
|
-
|
|
136
|
-
const queryOptions = getDogsListQueryOptions(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
|
-
* Возвращает полную информацию о собаке, включая родителей, заводчиков, титулы и медицинские записи.
|
|
148
|
-
* @summary Детальная информация о собаке
|
|
149
|
-
*/
|
|
150
|
-
export type dogsRetrieveResponse200 = {
|
|
151
|
-
data: DogDetail
|
|
152
|
-
status: 200
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export type dogsRetrieveResponse404 = {
|
|
156
|
-
data: void
|
|
157
|
-
status: 404
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export type dogsRetrieveResponseSuccess = (dogsRetrieveResponse200) & {
|
|
161
|
-
headers: Headers;
|
|
162
|
-
};
|
|
163
|
-
export type dogsRetrieveResponseError = (dogsRetrieveResponse404) & {
|
|
164
|
-
headers: Headers;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export type dogsRetrieveResponse = (dogsRetrieveResponseSuccess | dogsRetrieveResponseError)
|
|
168
|
-
|
|
169
|
-
export const getDogsRetrieveUrl = (id: number,) => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return `/api/dogs/${id}/`
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export const dogsRetrieve = async (id: number, options?: RequestInit): Promise<dogsRetrieveResponse> => {
|
|
178
|
-
|
|
179
|
-
const res = await fetch(getDogsRetrieveUrl(id),
|
|
180
|
-
{
|
|
181
|
-
...options,
|
|
182
|
-
method: 'GET'
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
189
|
-
|
|
190
|
-
const data: dogsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
191
|
-
return { data, status: res.status, headers: res.headers } as dogsRetrieveResponse
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
export const getDogsRetrieveQueryKey = (id: number,) => {
|
|
199
|
-
return [
|
|
200
|
-
`/api/dogs/${id}/`
|
|
201
|
-
] as const;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
export const getDogsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof dogsRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
206
|
-
) => {
|
|
207
|
-
|
|
208
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
209
|
-
|
|
210
|
-
const queryKey = queryOptions?.queryKey ?? getDogsRetrieveQueryKey(id);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsRetrieve>>> = ({ signal }) => dogsRetrieve(id, { signal, ...fetchOptions });
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export type DogsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsRetrieve>>>
|
|
224
|
-
export type DogsRetrieveQueryError = void
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* @summary Детальная информация о собаке
|
|
229
|
-
*/
|
|
230
|
-
|
|
231
|
-
export function useDogsRetrieve<TData = Awaited<ReturnType<typeof dogsRetrieve>>, TError = void>(
|
|
232
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
233
|
-
|
|
234
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
235
|
-
|
|
236
|
-
const queryOptions = getDogsRetrieveQueryOptions(id,options)
|
|
237
|
-
|
|
238
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
239
|
-
|
|
240
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Рассчитывает и сохраняет коэффициент инбридинга (COI) для указанной собаки. Глубина расчёта от 1 до 10 поколений.
|
|
248
|
-
* @summary Рассчитать COI для собаки
|
|
249
|
-
*/
|
|
250
|
-
export type dogsCalculateCoiCreateResponse200 = {
|
|
251
|
-
data: CalculateCoiResponse
|
|
252
|
-
status: 200
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export type dogsCalculateCoiCreateResponse404 = {
|
|
256
|
-
data: void
|
|
257
|
-
status: 404
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export type dogsCalculateCoiCreateResponse422 = {
|
|
261
|
-
data: void
|
|
262
|
-
status: 422
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export type dogsCalculateCoiCreateResponseSuccess = (dogsCalculateCoiCreateResponse200) & {
|
|
266
|
-
headers: Headers;
|
|
267
|
-
};
|
|
268
|
-
export type dogsCalculateCoiCreateResponseError = (dogsCalculateCoiCreateResponse404 | dogsCalculateCoiCreateResponse422) & {
|
|
269
|
-
headers: Headers;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
export type dogsCalculateCoiCreateResponse = (dogsCalculateCoiCreateResponseSuccess | dogsCalculateCoiCreateResponseError)
|
|
273
|
-
|
|
274
|
-
export const getDogsCalculateCoiCreateUrl = (id: number,) => {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return `/api/dogs/${id}/calculate_coi/`
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export const dogsCalculateCoiCreate = async (id: number,
|
|
283
|
-
calculateCoiRequestRequest: CalculateCoiRequestRequest, options?: RequestInit): Promise<dogsCalculateCoiCreateResponse> => {
|
|
284
|
-
|
|
285
|
-
const res = await fetch(getDogsCalculateCoiCreateUrl(id),
|
|
286
|
-
{
|
|
287
|
-
...options,
|
|
288
|
-
method: 'POST',
|
|
289
|
-
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
290
|
-
body: JSON.stringify(
|
|
291
|
-
calculateCoiRequestRequest,)
|
|
292
|
-
}
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
296
|
-
|
|
297
|
-
const data: dogsCalculateCoiCreateResponse['data'] = body ? JSON.parse(body) : {}
|
|
298
|
-
return { data, status: res.status, headers: res.headers } as dogsCalculateCoiCreateResponse
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
export const getDogsCalculateCoiCreateMutationOptions = <TError = void,
|
|
305
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, TError,{id: number;data: CalculateCoiRequestRequest}, TContext>, fetch?: RequestInit}
|
|
306
|
-
): UseMutationOptions<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, TError,{id: number;data: CalculateCoiRequestRequest}, TContext> => {
|
|
307
|
-
|
|
308
|
-
const mutationKey = ['dogsCalculateCoiCreate'];
|
|
309
|
-
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
|
|
310
|
-
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
311
|
-
options
|
|
312
|
-
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
313
|
-
: {mutation: { mutationKey, }, fetch: undefined};
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, {id: number;data: CalculateCoiRequestRequest}> = (props) => {
|
|
319
|
-
const {id,data} = props ?? {};
|
|
320
|
-
|
|
321
|
-
return dogsCalculateCoiCreate(id,data,fetchOptions)
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
return { mutationFn, ...mutationOptions }}
|
|
330
|
-
|
|
331
|
-
export type DogsCalculateCoiCreateMutationResult = NonNullable<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>>
|
|
332
|
-
export type DogsCalculateCoiCreateMutationBody = CalculateCoiRequestRequest
|
|
333
|
-
export type DogsCalculateCoiCreateMutationError = void
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @summary Рассчитать COI для собаки
|
|
337
|
-
*/
|
|
338
|
-
export const useDogsCalculateCoiCreate = <TError = void,
|
|
339
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, TError,{id: number;data: CalculateCoiRequestRequest}, TContext>, fetch?: RequestInit}
|
|
340
|
-
): UseMutationResult<
|
|
341
|
-
Awaited<ReturnType<typeof dogsCalculateCoiCreate>>,
|
|
342
|
-
TError,
|
|
343
|
-
{id: number;data: CalculateCoiRequestRequest},
|
|
344
|
-
TContext
|
|
345
|
-
> => {
|
|
346
|
-
return useMutation(getDogsCalculateCoiCreateMutationOptions(options));
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Возвращает всех потомков собаки (щенков, для которых она является отцом или матерью).
|
|
350
|
-
* @summary Потомки собаки
|
|
351
|
-
*/
|
|
352
|
-
export type dogsOffspringListResponse200 = {
|
|
353
|
-
data: PaginatedDogListList
|
|
354
|
-
status: 200
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
export type dogsOffspringListResponse404 = {
|
|
358
|
-
data: void
|
|
359
|
-
status: 404
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export type dogsOffspringListResponseSuccess = (dogsOffspringListResponse200) & {
|
|
363
|
-
headers: Headers;
|
|
364
|
-
};
|
|
365
|
-
export type dogsOffspringListResponseError = (dogsOffspringListResponse404) & {
|
|
366
|
-
headers: Headers;
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
export type dogsOffspringListResponse = (dogsOffspringListResponseSuccess | dogsOffspringListResponseError)
|
|
370
|
-
|
|
371
|
-
export const getDogsOffspringListUrl = (id: number,
|
|
372
|
-
params?: DogsOffspringListParams,) => {
|
|
373
|
-
const normalizedParams = new URLSearchParams();
|
|
374
|
-
|
|
375
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
376
|
-
|
|
377
|
-
if (value !== undefined) {
|
|
378
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
const stringifiedParams = normalizedParams.toString();
|
|
383
|
-
|
|
384
|
-
return stringifiedParams.length > 0 ? `/api/dogs/${id}/offspring/?${stringifiedParams}` : `/api/dogs/${id}/offspring/`
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export const dogsOffspringList = async (id: number,
|
|
388
|
-
params?: DogsOffspringListParams, options?: RequestInit): Promise<dogsOffspringListResponse> => {
|
|
389
|
-
|
|
390
|
-
const res = await fetch(getDogsOffspringListUrl(id,params),
|
|
391
|
-
{
|
|
392
|
-
...options,
|
|
393
|
-
method: 'GET'
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
)
|
|
398
|
-
|
|
399
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
400
|
-
|
|
401
|
-
const data: dogsOffspringListResponse['data'] = body ? JSON.parse(body) : {}
|
|
402
|
-
return { data, status: res.status, headers: res.headers } as dogsOffspringListResponse
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
export const getDogsOffspringListQueryKey = (id: number,
|
|
410
|
-
params?: DogsOffspringListParams,) => {
|
|
411
|
-
return [
|
|
412
|
-
`/api/dogs/${id}/offspring/`, ...(params ? [params] : [])
|
|
413
|
-
] as const;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
export const getDogsOffspringListQueryOptions = <TData = Awaited<ReturnType<typeof dogsOffspringList>>, TError = void>(id: number,
|
|
418
|
-
params?: DogsOffspringListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsOffspringList>>, TError, TData>, fetch?: RequestInit}
|
|
419
|
-
) => {
|
|
420
|
-
|
|
421
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
422
|
-
|
|
423
|
-
const queryKey = queryOptions?.queryKey ?? getDogsOffspringListQueryKey(id,params);
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsOffspringList>>> = ({ signal }) => dogsOffspringList(id,params, { signal, ...fetchOptions });
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsOffspringList>>, TError, TData> & { queryKey: QueryKey }
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
export type DogsOffspringListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsOffspringList>>>
|
|
437
|
-
export type DogsOffspringListQueryError = void
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* @summary Потомки собаки
|
|
442
|
-
*/
|
|
443
|
-
|
|
444
|
-
export function useDogsOffspringList<TData = Awaited<ReturnType<typeof dogsOffspringList>>, TError = void>(
|
|
445
|
-
id: number,
|
|
446
|
-
params?: DogsOffspringListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsOffspringList>>, TError, TData>, fetch?: RequestInit}
|
|
447
|
-
|
|
448
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
449
|
-
|
|
450
|
-
const queryOptions = getDogsOffspringListQueryOptions(id,params,options)
|
|
451
|
-
|
|
452
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
453
|
-
|
|
454
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Возвращает рекурсивное дерево предков до указанной глубины (1–10 поколений).
|
|
462
|
-
* @summary Родословная собаки
|
|
463
|
-
*/
|
|
464
|
-
export type dogsPedigreeRetrieveResponse200 = {
|
|
465
|
-
data: Pedigree
|
|
466
|
-
status: 200
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
export type dogsPedigreeRetrieveResponse404 = {
|
|
470
|
-
data: void
|
|
471
|
-
status: 404
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
export type dogsPedigreeRetrieveResponseSuccess = (dogsPedigreeRetrieveResponse200) & {
|
|
475
|
-
headers: Headers;
|
|
476
|
-
};
|
|
477
|
-
export type dogsPedigreeRetrieveResponseError = (dogsPedigreeRetrieveResponse404) & {
|
|
478
|
-
headers: Headers;
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
export type dogsPedigreeRetrieveResponse = (dogsPedigreeRetrieveResponseSuccess | dogsPedigreeRetrieveResponseError)
|
|
482
|
-
|
|
483
|
-
export const getDogsPedigreeRetrieveUrl = (id: number,
|
|
484
|
-
params?: DogsPedigreeRetrieveParams,) => {
|
|
485
|
-
const normalizedParams = new URLSearchParams();
|
|
486
|
-
|
|
487
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
488
|
-
|
|
489
|
-
if (value !== undefined) {
|
|
490
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
const stringifiedParams = normalizedParams.toString();
|
|
495
|
-
|
|
496
|
-
return stringifiedParams.length > 0 ? `/api/dogs/${id}/pedigree/?${stringifiedParams}` : `/api/dogs/${id}/pedigree/`
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
export const dogsPedigreeRetrieve = async (id: number,
|
|
500
|
-
params?: DogsPedigreeRetrieveParams, options?: RequestInit): Promise<dogsPedigreeRetrieveResponse> => {
|
|
501
|
-
|
|
502
|
-
const res = await fetch(getDogsPedigreeRetrieveUrl(id,params),
|
|
503
|
-
{
|
|
504
|
-
...options,
|
|
505
|
-
method: 'GET'
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
)
|
|
510
|
-
|
|
511
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
512
|
-
|
|
513
|
-
const data: dogsPedigreeRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
514
|
-
return { data, status: res.status, headers: res.headers } as dogsPedigreeRetrieveResponse
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
export const getDogsPedigreeRetrieveQueryKey = (id: number,
|
|
522
|
-
params?: DogsPedigreeRetrieveParams,) => {
|
|
523
|
-
return [
|
|
524
|
-
`/api/dogs/${id}/pedigree/`, ...(params ? [params] : [])
|
|
525
|
-
] as const;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
export const getDogsPedigreeRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError = void>(id: number,
|
|
530
|
-
params?: DogsPedigreeRetrieveParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
531
|
-
) => {
|
|
532
|
-
|
|
533
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
534
|
-
|
|
535
|
-
const queryKey = queryOptions?.queryKey ?? getDogsPedigreeRetrieveQueryKey(id,params);
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>> = ({ signal }) => dogsPedigreeRetrieve(id,params, { signal, ...fetchOptions });
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
export type DogsPedigreeRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>>
|
|
549
|
-
export type DogsPedigreeRetrieveQueryError = void
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* @summary Родословная собаки
|
|
554
|
-
*/
|
|
555
|
-
|
|
556
|
-
export function useDogsPedigreeRetrieve<TData = Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError = void>(
|
|
557
|
-
id: number,
|
|
558
|
-
params?: DogsPedigreeRetrieveParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
559
|
-
|
|
560
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
561
|
-
|
|
562
|
-
const queryOptions = getDogsPedigreeRetrieveQueryOptions(id,params,options)
|
|
563
|
-
|
|
564
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
565
|
-
|
|
566
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Возвращает братьев и сестёр (однопомётников) собаки.
|
|
574
|
-
* @summary Сиблинги собаки
|
|
575
|
-
*/
|
|
576
|
-
export type dogsSiblingsListResponse200 = {
|
|
577
|
-
data: PaginatedDogListList
|
|
578
|
-
status: 200
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
export type dogsSiblingsListResponse404 = {
|
|
582
|
-
data: void
|
|
583
|
-
status: 404
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
export type dogsSiblingsListResponseSuccess = (dogsSiblingsListResponse200) & {
|
|
587
|
-
headers: Headers;
|
|
588
|
-
};
|
|
589
|
-
export type dogsSiblingsListResponseError = (dogsSiblingsListResponse404) & {
|
|
590
|
-
headers: Headers;
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
export type dogsSiblingsListResponse = (dogsSiblingsListResponseSuccess | dogsSiblingsListResponseError)
|
|
594
|
-
|
|
595
|
-
export const getDogsSiblingsListUrl = (id: number,
|
|
596
|
-
params?: DogsSiblingsListParams,) => {
|
|
597
|
-
const normalizedParams = new URLSearchParams();
|
|
598
|
-
|
|
599
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
600
|
-
|
|
601
|
-
if (value !== undefined) {
|
|
602
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
|
|
606
|
-
const stringifiedParams = normalizedParams.toString();
|
|
607
|
-
|
|
608
|
-
return stringifiedParams.length > 0 ? `/api/dogs/${id}/siblings/?${stringifiedParams}` : `/api/dogs/${id}/siblings/`
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
export const dogsSiblingsList = async (id: number,
|
|
612
|
-
params?: DogsSiblingsListParams, options?: RequestInit): Promise<dogsSiblingsListResponse> => {
|
|
613
|
-
|
|
614
|
-
const res = await fetch(getDogsSiblingsListUrl(id,params),
|
|
615
|
-
{
|
|
616
|
-
...options,
|
|
617
|
-
method: 'GET'
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
)
|
|
622
|
-
|
|
623
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
624
|
-
|
|
625
|
-
const data: dogsSiblingsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
626
|
-
return { data, status: res.status, headers: res.headers } as dogsSiblingsListResponse
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
export const getDogsSiblingsListQueryKey = (id: number,
|
|
634
|
-
params?: DogsSiblingsListParams,) => {
|
|
635
|
-
return [
|
|
636
|
-
`/api/dogs/${id}/siblings/`, ...(params ? [params] : [])
|
|
637
|
-
] as const;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
export const getDogsSiblingsListQueryOptions = <TData = Awaited<ReturnType<typeof dogsSiblingsList>>, TError = void>(id: number,
|
|
642
|
-
params?: DogsSiblingsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsSiblingsList>>, TError, TData>, fetch?: RequestInit}
|
|
643
|
-
) => {
|
|
644
|
-
|
|
645
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
646
|
-
|
|
647
|
-
const queryKey = queryOptions?.queryKey ?? getDogsSiblingsListQueryKey(id,params);
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsSiblingsList>>> = ({ signal }) => dogsSiblingsList(id,params, { signal, ...fetchOptions });
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsSiblingsList>>, TError, TData> & { queryKey: QueryKey }
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
export type DogsSiblingsListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsSiblingsList>>>
|
|
661
|
-
export type DogsSiblingsListQueryError = void
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* @summary Сиблинги собаки
|
|
666
|
-
*/
|
|
667
|
-
|
|
668
|
-
export function useDogsSiblingsList<TData = Awaited<ReturnType<typeof dogsSiblingsList>>, TError = void>(
|
|
669
|
-
id: number,
|
|
670
|
-
params?: DogsSiblingsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsSiblingsList>>, TError, TData>, fetch?: RequestInit}
|
|
671
|
-
|
|
672
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
673
|
-
|
|
674
|
-
const queryOptions = getDogsSiblingsListQueryOptions(id,params,options)
|
|
675
|
-
|
|
676
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
677
|
-
|
|
678
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* Запускает Celery-задачу для пересчёта коэффициента инбридинга (COI) для всех собак в базе. Прогресс можно отслеживать через GET /api/dogs/import/status/{task_id}/.
|
|
686
|
-
* @summary Массовый пересчёт COI
|
|
687
|
-
*/
|
|
688
|
-
export type dogsCoiRecalculateCreateResponse202 = {
|
|
689
|
-
data: TaskResponse
|
|
690
|
-
status: 202
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
export type dogsCoiRecalculateCreateResponseSuccess = (dogsCoiRecalculateCreateResponse202) & {
|
|
694
|
-
headers: Headers;
|
|
695
|
-
};
|
|
696
|
-
;
|
|
697
|
-
|
|
698
|
-
export type dogsCoiRecalculateCreateResponse = (dogsCoiRecalculateCreateResponseSuccess)
|
|
699
|
-
|
|
700
|
-
export const getDogsCoiRecalculateCreateUrl = () => {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
return `/api/dogs/coi/recalculate/`
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
export const dogsCoiRecalculateCreate = async (recalculateAllCoiRequestRequest: RecalculateAllCoiRequestRequest, options?: RequestInit): Promise<dogsCoiRecalculateCreateResponse> => {
|
|
709
|
-
|
|
710
|
-
const res = await fetch(getDogsCoiRecalculateCreateUrl(),
|
|
711
|
-
{
|
|
712
|
-
...options,
|
|
713
|
-
method: 'POST',
|
|
714
|
-
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
715
|
-
body: JSON.stringify(
|
|
716
|
-
recalculateAllCoiRequestRequest,)
|
|
717
|
-
}
|
|
718
|
-
)
|
|
719
|
-
|
|
720
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
721
|
-
|
|
722
|
-
const data: dogsCoiRecalculateCreateResponse['data'] = body ? JSON.parse(body) : {}
|
|
723
|
-
return { data, status: res.status, headers: res.headers } as dogsCoiRecalculateCreateResponse
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
export const getDogsCoiRecalculateCreateMutationOptions = <TError = unknown,
|
|
730
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, TError,{data: RecalculateAllCoiRequestRequest}, TContext>, fetch?: RequestInit}
|
|
731
|
-
): UseMutationOptions<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, TError,{data: RecalculateAllCoiRequestRequest}, TContext> => {
|
|
732
|
-
|
|
733
|
-
const mutationKey = ['dogsCoiRecalculateCreate'];
|
|
734
|
-
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
|
|
735
|
-
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
736
|
-
options
|
|
737
|
-
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
738
|
-
: {mutation: { mutationKey, }, fetch: undefined};
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, {data: RecalculateAllCoiRequestRequest}> = (props) => {
|
|
744
|
-
const {data} = props ?? {};
|
|
745
|
-
|
|
746
|
-
return dogsCoiRecalculateCreate(data,fetchOptions)
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
return { mutationFn, ...mutationOptions }}
|
|
755
|
-
|
|
756
|
-
export type DogsCoiRecalculateCreateMutationResult = NonNullable<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>>
|
|
757
|
-
export type DogsCoiRecalculateCreateMutationBody = RecalculateAllCoiRequestRequest
|
|
758
|
-
export type DogsCoiRecalculateCreateMutationError = unknown
|
|
759
|
-
|
|
760
|
-
/**
|
|
761
|
-
* @summary Массовый пересчёт COI
|
|
762
|
-
*/
|
|
763
|
-
export const useDogsCoiRecalculateCreate = <TError = unknown,
|
|
764
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, TError,{data: RecalculateAllCoiRequestRequest}, TContext>, fetch?: RequestInit}
|
|
765
|
-
): UseMutationResult<
|
|
766
|
-
Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>,
|
|
767
|
-
TError,
|
|
768
|
-
{data: RecalculateAllCoiRequestRequest},
|
|
769
|
-
TContext
|
|
770
|
-
> => {
|
|
771
|
-
return useMutation(getDogsCoiRecalculateCreateMutationOptions(options));
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Возвращает до 20 собак, кличка которых содержит строку поиска.
|
|
775
|
-
* @summary Поиск собак по кличке
|
|
776
|
-
*/
|
|
777
|
-
export type dogsSearchListResponse200 = {
|
|
778
|
-
data: PaginatedDogListList
|
|
779
|
-
status: 200
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
export type dogsSearchListResponse400 = {
|
|
783
|
-
data: void
|
|
784
|
-
status: 400
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
export type dogsSearchListResponseSuccess = (dogsSearchListResponse200) & {
|
|
788
|
-
headers: Headers;
|
|
789
|
-
};
|
|
790
|
-
export type dogsSearchListResponseError = (dogsSearchListResponse400) & {
|
|
791
|
-
headers: Headers;
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
export type dogsSearchListResponse = (dogsSearchListResponseSuccess | dogsSearchListResponseError)
|
|
795
|
-
|
|
796
|
-
export const getDogsSearchListUrl = (params: DogsSearchListParams,) => {
|
|
797
|
-
const normalizedParams = new URLSearchParams();
|
|
798
|
-
|
|
799
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
800
|
-
|
|
801
|
-
if (value !== undefined) {
|
|
802
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
|
|
806
|
-
const stringifiedParams = normalizedParams.toString();
|
|
807
|
-
|
|
808
|
-
return stringifiedParams.length > 0 ? `/api/dogs/search/?${stringifiedParams}` : `/api/dogs/search/`
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
export const dogsSearchList = async (params: DogsSearchListParams, options?: RequestInit): Promise<dogsSearchListResponse> => {
|
|
812
|
-
|
|
813
|
-
const res = await fetch(getDogsSearchListUrl(params),
|
|
814
|
-
{
|
|
815
|
-
...options,
|
|
816
|
-
method: 'GET'
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
)
|
|
821
|
-
|
|
822
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
823
|
-
|
|
824
|
-
const data: dogsSearchListResponse['data'] = body ? JSON.parse(body) : {}
|
|
825
|
-
return { data, status: res.status, headers: res.headers } as dogsSearchListResponse
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
export const getDogsSearchListQueryKey = (params?: DogsSearchListParams,) => {
|
|
833
|
-
return [
|
|
834
|
-
`/api/dogs/search/`, ...(params ? [params] : [])
|
|
835
|
-
] as const;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
export const getDogsSearchListQueryOptions = <TData = Awaited<ReturnType<typeof dogsSearchList>>, TError = void>(params: DogsSearchListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsSearchList>>, TError, TData>, fetch?: RequestInit}
|
|
840
|
-
) => {
|
|
841
|
-
|
|
842
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
843
|
-
|
|
844
|
-
const queryKey = queryOptions?.queryKey ?? getDogsSearchListQueryKey(params);
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsSearchList>>> = ({ signal }) => dogsSearchList(params, { signal, ...fetchOptions });
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsSearchList>>, TError, TData> & { queryKey: QueryKey }
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
export type DogsSearchListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsSearchList>>>
|
|
858
|
-
export type DogsSearchListQueryError = void
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* @summary Поиск собак по кличке
|
|
863
|
-
*/
|
|
864
|
-
|
|
865
|
-
export function useDogsSearchList<TData = Awaited<ReturnType<typeof dogsSearchList>>, TError = void>(
|
|
866
|
-
params: DogsSearchListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsSearchList>>, TError, TData>, fetch?: RequestInit}
|
|
867
|
-
|
|
868
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
869
|
-
|
|
870
|
-
const queryOptions = getDogsSearchListQueryOptions(params,options)
|
|
871
|
-
|
|
872
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
873
|
-
|
|
874
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* Возвращает общую статистику: количество собак, кобелей, сук, заводчиков и т.д.
|
|
882
|
-
* @summary Статистика по базе собак
|
|
883
|
-
*/
|
|
884
|
-
export type dogsStatsRetrieveResponse200 = {
|
|
885
|
-
data: DogStatsResponse
|
|
886
|
-
status: 200
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
export type dogsStatsRetrieveResponseSuccess = (dogsStatsRetrieveResponse200) & {
|
|
890
|
-
headers: Headers;
|
|
891
|
-
};
|
|
892
|
-
;
|
|
893
|
-
|
|
894
|
-
export type dogsStatsRetrieveResponse = (dogsStatsRetrieveResponseSuccess)
|
|
895
|
-
|
|
896
|
-
export const getDogsStatsRetrieveUrl = () => {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
return `/api/dogs/stats/`
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
export const dogsStatsRetrieve = async ( options?: RequestInit): Promise<dogsStatsRetrieveResponse> => {
|
|
905
|
-
|
|
906
|
-
const res = await fetch(getDogsStatsRetrieveUrl(),
|
|
907
|
-
{
|
|
908
|
-
...options,
|
|
909
|
-
method: 'GET'
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
}
|
|
913
|
-
)
|
|
914
|
-
|
|
915
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
916
|
-
|
|
917
|
-
const data: dogsStatsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
918
|
-
return { data, status: res.status, headers: res.headers } as dogsStatsRetrieveResponse
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
export const getDogsStatsRetrieveQueryKey = () => {
|
|
926
|
-
return [
|
|
927
|
-
`/api/dogs/stats/`
|
|
928
|
-
] as const;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
export const getDogsStatsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError = unknown>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
933
|
-
) => {
|
|
934
|
-
|
|
935
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
936
|
-
|
|
937
|
-
const queryKey = queryOptions?.queryKey ?? getDogsStatsRetrieveQueryKey();
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsStatsRetrieve>>> = ({ signal }) => dogsStatsRetrieve({ signal, ...fetchOptions });
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
export type DogsStatsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsStatsRetrieve>>>
|
|
951
|
-
export type DogsStatsRetrieveQueryError = unknown
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* @summary Статистика по базе собак
|
|
956
|
-
*/
|
|
957
|
-
|
|
958
|
-
export function useDogsStatsRetrieve<TData = Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError = unknown>(
|
|
959
|
-
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
960
|
-
|
|
961
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
962
|
-
|
|
963
|
-
const queryOptions = getDogsStatsRetrieveQueryOptions(options)
|
|
964
|
-
|
|
965
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
966
|
-
|
|
967
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|