@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
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import type { QueryKey, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { CalculateCoiRequestRequest, CalculateCoiResponse, DogDetail, DogStatsResponse, DogsListParams, DogsOffspringListParams, DogsPedigreeRetrieveParams, DogsSearchListParams, DogsSiblingsListParams, PaginatedDogListList, Pedigree, RecalculateAllCoiRequestRequest, TaskResponse } from '../api.schemas';
|
|
3
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
4
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
5
|
+
/**
|
|
6
|
+
* Возвращает пагинированный список собак. Поддерживает поиск и фильтрацию.
|
|
7
|
+
* @summary Список собак
|
|
8
|
+
*/
|
|
9
|
+
export type dogsListResponse200 = {
|
|
10
|
+
data: PaginatedDogListList;
|
|
11
|
+
status: 200;
|
|
12
|
+
};
|
|
13
|
+
export type dogsListResponseSuccess = (dogsListResponse200) & {
|
|
14
|
+
headers: Headers;
|
|
15
|
+
};
|
|
16
|
+
export type dogsListResponse = (dogsListResponseSuccess);
|
|
17
|
+
export declare const getDogsListUrl: (params?: DogsListParams) => string;
|
|
18
|
+
export declare const dogsList: (params?: DogsListParams, options?: RequestInit) => Promise<dogsListResponse>;
|
|
19
|
+
export declare const getDogsListQueryKey: (params?: DogsListParams) => readonly ["/api/dogs/", ...DogsListParams[]];
|
|
20
|
+
export declare const getDogsListQueryOptions: <TData = Awaited<ReturnType<typeof dogsList>>, TError = unknown>(params?: DogsListParams, options?: {
|
|
21
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsList>>, TError, TData>;
|
|
22
|
+
fetch?: RequestInit;
|
|
23
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsList>>, TError, TData> & {
|
|
24
|
+
queryKey: QueryKey;
|
|
25
|
+
};
|
|
26
|
+
export type DogsListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsList>>>;
|
|
27
|
+
export type DogsListQueryError = unknown;
|
|
28
|
+
/**
|
|
29
|
+
* @summary Список собак
|
|
30
|
+
*/
|
|
31
|
+
export declare function useDogsList<TData = Awaited<ReturnType<typeof dogsList>>, TError = unknown>(params?: DogsListParams, options?: {
|
|
32
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsList>>, TError, TData>;
|
|
33
|
+
fetch?: RequestInit;
|
|
34
|
+
}): UseQueryResult<TData, TError> & {
|
|
35
|
+
queryKey: QueryKey;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Возвращает полную информацию о собаке, включая родителей, заводчиков, титулы и медицинские записи.
|
|
39
|
+
* @summary Детальная информация о собаке
|
|
40
|
+
*/
|
|
41
|
+
export type dogsRetrieveResponse200 = {
|
|
42
|
+
data: DogDetail;
|
|
43
|
+
status: 200;
|
|
44
|
+
};
|
|
45
|
+
export type dogsRetrieveResponse404 = {
|
|
46
|
+
data: void;
|
|
47
|
+
status: 404;
|
|
48
|
+
};
|
|
49
|
+
export type dogsRetrieveResponseSuccess = (dogsRetrieveResponse200) & {
|
|
50
|
+
headers: Headers;
|
|
51
|
+
};
|
|
52
|
+
export type dogsRetrieveResponseError = (dogsRetrieveResponse404) & {
|
|
53
|
+
headers: Headers;
|
|
54
|
+
};
|
|
55
|
+
export type dogsRetrieveResponse = (dogsRetrieveResponseSuccess | dogsRetrieveResponseError);
|
|
56
|
+
export declare const getDogsRetrieveUrl: (id: number) => string;
|
|
57
|
+
export declare const dogsRetrieve: (id: number, options?: RequestInit) => Promise<dogsRetrieveResponse>;
|
|
58
|
+
export declare const getDogsRetrieveQueryKey: (id: number) => readonly [`/api/dogs/${number}/`];
|
|
59
|
+
export declare const getDogsRetrieveQueryOptions: <TData = Awaited<ReturnType<typeof dogsRetrieve>>, TError = void>(id: number, options?: {
|
|
60
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsRetrieve>>, TError, TData>;
|
|
61
|
+
fetch?: RequestInit;
|
|
62
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsRetrieve>>, TError, TData> & {
|
|
63
|
+
queryKey: QueryKey;
|
|
64
|
+
};
|
|
65
|
+
export type DogsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsRetrieve>>>;
|
|
66
|
+
export type DogsRetrieveQueryError = void;
|
|
67
|
+
/**
|
|
68
|
+
* @summary Детальная информация о собаке
|
|
69
|
+
*/
|
|
70
|
+
export declare function useDogsRetrieve<TData = Awaited<ReturnType<typeof dogsRetrieve>>, TError = void>(id: number, options?: {
|
|
71
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsRetrieve>>, TError, TData>;
|
|
72
|
+
fetch?: RequestInit;
|
|
73
|
+
}): UseQueryResult<TData, TError> & {
|
|
74
|
+
queryKey: QueryKey;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Рассчитывает и сохраняет коэффициент инбридинга (COI) для указанной собаки. Глубина расчёта от 1 до 10 поколений.
|
|
78
|
+
* @summary Рассчитать COI для собаки
|
|
79
|
+
*/
|
|
80
|
+
export type dogsCalculateCoiCreateResponse200 = {
|
|
81
|
+
data: CalculateCoiResponse;
|
|
82
|
+
status: 200;
|
|
83
|
+
};
|
|
84
|
+
export type dogsCalculateCoiCreateResponse404 = {
|
|
85
|
+
data: void;
|
|
86
|
+
status: 404;
|
|
87
|
+
};
|
|
88
|
+
export type dogsCalculateCoiCreateResponse422 = {
|
|
89
|
+
data: void;
|
|
90
|
+
status: 422;
|
|
91
|
+
};
|
|
92
|
+
export type dogsCalculateCoiCreateResponseSuccess = (dogsCalculateCoiCreateResponse200) & {
|
|
93
|
+
headers: Headers;
|
|
94
|
+
};
|
|
95
|
+
export type dogsCalculateCoiCreateResponseError = (dogsCalculateCoiCreateResponse404 | dogsCalculateCoiCreateResponse422) & {
|
|
96
|
+
headers: Headers;
|
|
97
|
+
};
|
|
98
|
+
export type dogsCalculateCoiCreateResponse = (dogsCalculateCoiCreateResponseSuccess | dogsCalculateCoiCreateResponseError);
|
|
99
|
+
export declare const getDogsCalculateCoiCreateUrl: (id: number) => string;
|
|
100
|
+
export declare const dogsCalculateCoiCreate: (id: number, calculateCoiRequestRequest: CalculateCoiRequestRequest, options?: RequestInit) => Promise<dogsCalculateCoiCreateResponse>;
|
|
101
|
+
export declare const getDogsCalculateCoiCreateMutationOptions: <TError = void, TContext = unknown>(options?: {
|
|
102
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, TError, {
|
|
103
|
+
id: number;
|
|
104
|
+
data: CalculateCoiRequestRequest;
|
|
105
|
+
}, TContext>;
|
|
106
|
+
fetch?: RequestInit;
|
|
107
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, TError, {
|
|
108
|
+
id: number;
|
|
109
|
+
data: CalculateCoiRequestRequest;
|
|
110
|
+
}, TContext>;
|
|
111
|
+
export type DogsCalculateCoiCreateMutationResult = NonNullable<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>>;
|
|
112
|
+
export type DogsCalculateCoiCreateMutationBody = CalculateCoiRequestRequest;
|
|
113
|
+
export type DogsCalculateCoiCreateMutationError = void;
|
|
114
|
+
/**
|
|
115
|
+
* @summary Рассчитать COI для собаки
|
|
116
|
+
*/
|
|
117
|
+
export declare const useDogsCalculateCoiCreate: <TError = void, TContext = unknown>(options?: {
|
|
118
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, TError, {
|
|
119
|
+
id: number;
|
|
120
|
+
data: CalculateCoiRequestRequest;
|
|
121
|
+
}, TContext>;
|
|
122
|
+
fetch?: RequestInit;
|
|
123
|
+
}) => UseMutationResult<Awaited<ReturnType<typeof dogsCalculateCoiCreate>>, TError, {
|
|
124
|
+
id: number;
|
|
125
|
+
data: CalculateCoiRequestRequest;
|
|
126
|
+
}, TContext>;
|
|
127
|
+
/**
|
|
128
|
+
* Возвращает всех потомков собаки (щенков, для которых она является отцом или матерью).
|
|
129
|
+
* @summary Потомки собаки
|
|
130
|
+
*/
|
|
131
|
+
export type dogsOffspringListResponse200 = {
|
|
132
|
+
data: PaginatedDogListList;
|
|
133
|
+
status: 200;
|
|
134
|
+
};
|
|
135
|
+
export type dogsOffspringListResponse404 = {
|
|
136
|
+
data: void;
|
|
137
|
+
status: 404;
|
|
138
|
+
};
|
|
139
|
+
export type dogsOffspringListResponseSuccess = (dogsOffspringListResponse200) & {
|
|
140
|
+
headers: Headers;
|
|
141
|
+
};
|
|
142
|
+
export type dogsOffspringListResponseError = (dogsOffspringListResponse404) & {
|
|
143
|
+
headers: Headers;
|
|
144
|
+
};
|
|
145
|
+
export type dogsOffspringListResponse = (dogsOffspringListResponseSuccess | dogsOffspringListResponseError);
|
|
146
|
+
export declare const getDogsOffspringListUrl: (id: number, params?: DogsOffspringListParams) => string;
|
|
147
|
+
export declare const dogsOffspringList: (id: number, params?: DogsOffspringListParams, options?: RequestInit) => Promise<dogsOffspringListResponse>;
|
|
148
|
+
export declare const getDogsOffspringListQueryKey: (id: number, params?: DogsOffspringListParams) => readonly [`/api/dogs/${number}/offspring/`, ...DogsOffspringListParams[]];
|
|
149
|
+
export declare const getDogsOffspringListQueryOptions: <TData = Awaited<ReturnType<typeof dogsOffspringList>>, TError = void>(id: number, params?: DogsOffspringListParams, options?: {
|
|
150
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsOffspringList>>, TError, TData>;
|
|
151
|
+
fetch?: RequestInit;
|
|
152
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsOffspringList>>, TError, TData> & {
|
|
153
|
+
queryKey: QueryKey;
|
|
154
|
+
};
|
|
155
|
+
export type DogsOffspringListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsOffspringList>>>;
|
|
156
|
+
export type DogsOffspringListQueryError = void;
|
|
157
|
+
/**
|
|
158
|
+
* @summary Потомки собаки
|
|
159
|
+
*/
|
|
160
|
+
export declare function useDogsOffspringList<TData = Awaited<ReturnType<typeof dogsOffspringList>>, TError = void>(id: number, params?: DogsOffspringListParams, options?: {
|
|
161
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsOffspringList>>, TError, TData>;
|
|
162
|
+
fetch?: RequestInit;
|
|
163
|
+
}): UseQueryResult<TData, TError> & {
|
|
164
|
+
queryKey: QueryKey;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Возвращает рекурсивное дерево предков до указанной глубины (1–10 поколений).
|
|
168
|
+
* @summary Родословная собаки
|
|
169
|
+
*/
|
|
170
|
+
export type dogsPedigreeRetrieveResponse200 = {
|
|
171
|
+
data: Pedigree;
|
|
172
|
+
status: 200;
|
|
173
|
+
};
|
|
174
|
+
export type dogsPedigreeRetrieveResponse404 = {
|
|
175
|
+
data: void;
|
|
176
|
+
status: 404;
|
|
177
|
+
};
|
|
178
|
+
export type dogsPedigreeRetrieveResponseSuccess = (dogsPedigreeRetrieveResponse200) & {
|
|
179
|
+
headers: Headers;
|
|
180
|
+
};
|
|
181
|
+
export type dogsPedigreeRetrieveResponseError = (dogsPedigreeRetrieveResponse404) & {
|
|
182
|
+
headers: Headers;
|
|
183
|
+
};
|
|
184
|
+
export type dogsPedigreeRetrieveResponse = (dogsPedigreeRetrieveResponseSuccess | dogsPedigreeRetrieveResponseError);
|
|
185
|
+
export declare const getDogsPedigreeRetrieveUrl: (id: number, params?: DogsPedigreeRetrieveParams) => string;
|
|
186
|
+
export declare const dogsPedigreeRetrieve: (id: number, params?: DogsPedigreeRetrieveParams, options?: RequestInit) => Promise<dogsPedigreeRetrieveResponse>;
|
|
187
|
+
export declare const getDogsPedigreeRetrieveQueryKey: (id: number, params?: DogsPedigreeRetrieveParams) => readonly [`/api/dogs/${number}/pedigree/`, ...DogsPedigreeRetrieveParams[]];
|
|
188
|
+
export declare const getDogsPedigreeRetrieveQueryOptions: <TData = Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError = void>(id: number, params?: DogsPedigreeRetrieveParams, options?: {
|
|
189
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError, TData>;
|
|
190
|
+
fetch?: RequestInit;
|
|
191
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError, TData> & {
|
|
192
|
+
queryKey: QueryKey;
|
|
193
|
+
};
|
|
194
|
+
export type DogsPedigreeRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>>;
|
|
195
|
+
export type DogsPedigreeRetrieveQueryError = void;
|
|
196
|
+
/**
|
|
197
|
+
* @summary Родословная собаки
|
|
198
|
+
*/
|
|
199
|
+
export declare function useDogsPedigreeRetrieve<TData = Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError = void>(id: number, params?: DogsPedigreeRetrieveParams, options?: {
|
|
200
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsPedigreeRetrieve>>, TError, TData>;
|
|
201
|
+
fetch?: RequestInit;
|
|
202
|
+
}): UseQueryResult<TData, TError> & {
|
|
203
|
+
queryKey: QueryKey;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Возвращает братьев и сестёр (однопомётников) собаки.
|
|
207
|
+
* @summary Сиблинги собаки
|
|
208
|
+
*/
|
|
209
|
+
export type dogsSiblingsListResponse200 = {
|
|
210
|
+
data: PaginatedDogListList;
|
|
211
|
+
status: 200;
|
|
212
|
+
};
|
|
213
|
+
export type dogsSiblingsListResponse404 = {
|
|
214
|
+
data: void;
|
|
215
|
+
status: 404;
|
|
216
|
+
};
|
|
217
|
+
export type dogsSiblingsListResponseSuccess = (dogsSiblingsListResponse200) & {
|
|
218
|
+
headers: Headers;
|
|
219
|
+
};
|
|
220
|
+
export type dogsSiblingsListResponseError = (dogsSiblingsListResponse404) & {
|
|
221
|
+
headers: Headers;
|
|
222
|
+
};
|
|
223
|
+
export type dogsSiblingsListResponse = (dogsSiblingsListResponseSuccess | dogsSiblingsListResponseError);
|
|
224
|
+
export declare const getDogsSiblingsListUrl: (id: number, params?: DogsSiblingsListParams) => string;
|
|
225
|
+
export declare const dogsSiblingsList: (id: number, params?: DogsSiblingsListParams, options?: RequestInit) => Promise<dogsSiblingsListResponse>;
|
|
226
|
+
export declare const getDogsSiblingsListQueryKey: (id: number, params?: DogsSiblingsListParams) => readonly [`/api/dogs/${number}/siblings/`, ...DogsSiblingsListParams[]];
|
|
227
|
+
export declare const getDogsSiblingsListQueryOptions: <TData = Awaited<ReturnType<typeof dogsSiblingsList>>, TError = void>(id: number, params?: DogsSiblingsListParams, options?: {
|
|
228
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsSiblingsList>>, TError, TData>;
|
|
229
|
+
fetch?: RequestInit;
|
|
230
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsSiblingsList>>, TError, TData> & {
|
|
231
|
+
queryKey: QueryKey;
|
|
232
|
+
};
|
|
233
|
+
export type DogsSiblingsListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsSiblingsList>>>;
|
|
234
|
+
export type DogsSiblingsListQueryError = void;
|
|
235
|
+
/**
|
|
236
|
+
* @summary Сиблинги собаки
|
|
237
|
+
*/
|
|
238
|
+
export declare function useDogsSiblingsList<TData = Awaited<ReturnType<typeof dogsSiblingsList>>, TError = void>(id: number, params?: DogsSiblingsListParams, options?: {
|
|
239
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsSiblingsList>>, TError, TData>;
|
|
240
|
+
fetch?: RequestInit;
|
|
241
|
+
}): UseQueryResult<TData, TError> & {
|
|
242
|
+
queryKey: QueryKey;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Запускает Celery-задачу для пересчёта коэффициента инбридинга (COI) для всех собак в базе. Прогресс можно отслеживать через GET /api/dogs/import/status/{task_id}/.
|
|
246
|
+
* @summary Массовый пересчёт COI
|
|
247
|
+
*/
|
|
248
|
+
export type dogsCoiRecalculateCreateResponse202 = {
|
|
249
|
+
data: TaskResponse;
|
|
250
|
+
status: 202;
|
|
251
|
+
};
|
|
252
|
+
export type dogsCoiRecalculateCreateResponseSuccess = (dogsCoiRecalculateCreateResponse202) & {
|
|
253
|
+
headers: Headers;
|
|
254
|
+
};
|
|
255
|
+
export type dogsCoiRecalculateCreateResponse = (dogsCoiRecalculateCreateResponseSuccess);
|
|
256
|
+
export declare const getDogsCoiRecalculateCreateUrl: () => string;
|
|
257
|
+
export declare const dogsCoiRecalculateCreate: (recalculateAllCoiRequestRequest: RecalculateAllCoiRequestRequest, options?: RequestInit) => Promise<dogsCoiRecalculateCreateResponse>;
|
|
258
|
+
export declare const getDogsCoiRecalculateCreateMutationOptions: <TError = unknown, TContext = unknown>(options?: {
|
|
259
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, TError, {
|
|
260
|
+
data: RecalculateAllCoiRequestRequest;
|
|
261
|
+
}, TContext>;
|
|
262
|
+
fetch?: RequestInit;
|
|
263
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, TError, {
|
|
264
|
+
data: RecalculateAllCoiRequestRequest;
|
|
265
|
+
}, TContext>;
|
|
266
|
+
export type DogsCoiRecalculateCreateMutationResult = NonNullable<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>>;
|
|
267
|
+
export type DogsCoiRecalculateCreateMutationBody = RecalculateAllCoiRequestRequest;
|
|
268
|
+
export type DogsCoiRecalculateCreateMutationError = unknown;
|
|
269
|
+
/**
|
|
270
|
+
* @summary Массовый пересчёт COI
|
|
271
|
+
*/
|
|
272
|
+
export declare const useDogsCoiRecalculateCreate: <TError = unknown, TContext = unknown>(options?: {
|
|
273
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, TError, {
|
|
274
|
+
data: RecalculateAllCoiRequestRequest;
|
|
275
|
+
}, TContext>;
|
|
276
|
+
fetch?: RequestInit;
|
|
277
|
+
}) => UseMutationResult<Awaited<ReturnType<typeof dogsCoiRecalculateCreate>>, TError, {
|
|
278
|
+
data: RecalculateAllCoiRequestRequest;
|
|
279
|
+
}, TContext>;
|
|
280
|
+
/**
|
|
281
|
+
* Возвращает до 20 собак, кличка которых содержит строку поиска.
|
|
282
|
+
* @summary Поиск собак по кличке
|
|
283
|
+
*/
|
|
284
|
+
export type dogsSearchListResponse200 = {
|
|
285
|
+
data: PaginatedDogListList;
|
|
286
|
+
status: 200;
|
|
287
|
+
};
|
|
288
|
+
export type dogsSearchListResponse400 = {
|
|
289
|
+
data: void;
|
|
290
|
+
status: 400;
|
|
291
|
+
};
|
|
292
|
+
export type dogsSearchListResponseSuccess = (dogsSearchListResponse200) & {
|
|
293
|
+
headers: Headers;
|
|
294
|
+
};
|
|
295
|
+
export type dogsSearchListResponseError = (dogsSearchListResponse400) & {
|
|
296
|
+
headers: Headers;
|
|
297
|
+
};
|
|
298
|
+
export type dogsSearchListResponse = (dogsSearchListResponseSuccess | dogsSearchListResponseError);
|
|
299
|
+
export declare const getDogsSearchListUrl: (params: DogsSearchListParams) => string;
|
|
300
|
+
export declare const dogsSearchList: (params: DogsSearchListParams, options?: RequestInit) => Promise<dogsSearchListResponse>;
|
|
301
|
+
export declare const getDogsSearchListQueryKey: (params?: DogsSearchListParams) => readonly ["/api/dogs/search/", ...DogsSearchListParams[]];
|
|
302
|
+
export declare const getDogsSearchListQueryOptions: <TData = Awaited<ReturnType<typeof dogsSearchList>>, TError = void>(params: DogsSearchListParams, options?: {
|
|
303
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsSearchList>>, TError, TData>;
|
|
304
|
+
fetch?: RequestInit;
|
|
305
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsSearchList>>, TError, TData> & {
|
|
306
|
+
queryKey: QueryKey;
|
|
307
|
+
};
|
|
308
|
+
export type DogsSearchListQueryResult = NonNullable<Awaited<ReturnType<typeof dogsSearchList>>>;
|
|
309
|
+
export type DogsSearchListQueryError = void;
|
|
310
|
+
/**
|
|
311
|
+
* @summary Поиск собак по кличке
|
|
312
|
+
*/
|
|
313
|
+
export declare function useDogsSearchList<TData = Awaited<ReturnType<typeof dogsSearchList>>, TError = void>(params: DogsSearchListParams, options?: {
|
|
314
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsSearchList>>, TError, TData>;
|
|
315
|
+
fetch?: RequestInit;
|
|
316
|
+
}): UseQueryResult<TData, TError> & {
|
|
317
|
+
queryKey: QueryKey;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Возвращает общую статистику: количество собак, кобелей, сук, заводчиков и т.д.
|
|
321
|
+
* @summary Статистика по базе собак
|
|
322
|
+
*/
|
|
323
|
+
export type dogsStatsRetrieveResponse200 = {
|
|
324
|
+
data: DogStatsResponse;
|
|
325
|
+
status: 200;
|
|
326
|
+
};
|
|
327
|
+
export type dogsStatsRetrieveResponseSuccess = (dogsStatsRetrieveResponse200) & {
|
|
328
|
+
headers: Headers;
|
|
329
|
+
};
|
|
330
|
+
export type dogsStatsRetrieveResponse = (dogsStatsRetrieveResponseSuccess);
|
|
331
|
+
export declare const getDogsStatsRetrieveUrl: () => string;
|
|
332
|
+
export declare const dogsStatsRetrieve: (options?: RequestInit) => Promise<dogsStatsRetrieveResponse>;
|
|
333
|
+
export declare const getDogsStatsRetrieveQueryKey: () => readonly ["/api/dogs/stats/"];
|
|
334
|
+
export declare const getDogsStatsRetrieveQueryOptions: <TData = Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError = unknown>(options?: {
|
|
335
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError, TData>;
|
|
336
|
+
fetch?: RequestInit;
|
|
337
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError, TData> & {
|
|
338
|
+
queryKey: QueryKey;
|
|
339
|
+
};
|
|
340
|
+
export type DogsStatsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsStatsRetrieve>>>;
|
|
341
|
+
export type DogsStatsRetrieveQueryError = unknown;
|
|
342
|
+
/**
|
|
343
|
+
* @summary Статистика по базе собак
|
|
344
|
+
*/
|
|
345
|
+
export declare function useDogsStatsRetrieve<TData = Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError = unknown>(options?: {
|
|
346
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsStatsRetrieve>>, TError, TData>;
|
|
347
|
+
fetch?: RequestInit;
|
|
348
|
+
}): UseQueryResult<TData, TError> & {
|
|
349
|
+
queryKey: QueryKey;
|
|
350
|
+
};
|
|
351
|
+
export {};
|
|
@@ -0,0 +1,329 @@
|
|
|
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 { useMutation, useQuery } from '@tanstack/react-query';
|
|
9
|
+
;
|
|
10
|
+
export const getDogsListUrl = (params) => {
|
|
11
|
+
const normalizedParams = new URLSearchParams();
|
|
12
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
13
|
+
if (value !== undefined) {
|
|
14
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const stringifiedParams = normalizedParams.toString();
|
|
18
|
+
return stringifiedParams.length > 0 ? `/api/dogs/?${stringifiedParams}` : `/api/dogs/`;
|
|
19
|
+
};
|
|
20
|
+
export const dogsList = async (params, options) => {
|
|
21
|
+
const res = await fetch(getDogsListUrl(params), {
|
|
22
|
+
...options,
|
|
23
|
+
method: 'GET'
|
|
24
|
+
});
|
|
25
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
26
|
+
const data = body ? JSON.parse(body) : {};
|
|
27
|
+
return { data, status: res.status, headers: res.headers };
|
|
28
|
+
};
|
|
29
|
+
export const getDogsListQueryKey = (params) => {
|
|
30
|
+
return [
|
|
31
|
+
`/api/dogs/`, ...(params ? [params] : [])
|
|
32
|
+
];
|
|
33
|
+
};
|
|
34
|
+
export const getDogsListQueryOptions = (params, options) => {
|
|
35
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
36
|
+
const queryKey = queryOptions?.queryKey ?? getDogsListQueryKey(params);
|
|
37
|
+
const queryFn = ({ signal }) => dogsList(params, { signal, ...fetchOptions });
|
|
38
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @summary Список собак
|
|
42
|
+
*/
|
|
43
|
+
export function useDogsList(params, options) {
|
|
44
|
+
const queryOptions = getDogsListQueryOptions(params, options);
|
|
45
|
+
const query = useQuery(queryOptions);
|
|
46
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
47
|
+
}
|
|
48
|
+
export const getDogsRetrieveUrl = (id) => {
|
|
49
|
+
return `/api/dogs/${id}/`;
|
|
50
|
+
};
|
|
51
|
+
export const dogsRetrieve = async (id, options) => {
|
|
52
|
+
const res = await fetch(getDogsRetrieveUrl(id), {
|
|
53
|
+
...options,
|
|
54
|
+
method: 'GET'
|
|
55
|
+
});
|
|
56
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
57
|
+
const data = body ? JSON.parse(body) : {};
|
|
58
|
+
return { data, status: res.status, headers: res.headers };
|
|
59
|
+
};
|
|
60
|
+
export const getDogsRetrieveQueryKey = (id) => {
|
|
61
|
+
return [
|
|
62
|
+
`/api/dogs/${id}/`
|
|
63
|
+
];
|
|
64
|
+
};
|
|
65
|
+
export const getDogsRetrieveQueryOptions = (id, options) => {
|
|
66
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
67
|
+
const queryKey = queryOptions?.queryKey ?? getDogsRetrieveQueryKey(id);
|
|
68
|
+
const queryFn = ({ signal }) => dogsRetrieve(id, { signal, ...fetchOptions });
|
|
69
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @summary Детальная информация о собаке
|
|
73
|
+
*/
|
|
74
|
+
export function useDogsRetrieve(id, options) {
|
|
75
|
+
const queryOptions = getDogsRetrieveQueryOptions(id, options);
|
|
76
|
+
const query = useQuery(queryOptions);
|
|
77
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
78
|
+
}
|
|
79
|
+
export const getDogsCalculateCoiCreateUrl = (id) => {
|
|
80
|
+
return `/api/dogs/${id}/calculate_coi/`;
|
|
81
|
+
};
|
|
82
|
+
export const dogsCalculateCoiCreate = async (id, calculateCoiRequestRequest, options) => {
|
|
83
|
+
const res = await fetch(getDogsCalculateCoiCreateUrl(id), {
|
|
84
|
+
...options,
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
87
|
+
body: JSON.stringify(calculateCoiRequestRequest)
|
|
88
|
+
});
|
|
89
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
90
|
+
const data = body ? JSON.parse(body) : {};
|
|
91
|
+
return { data, status: res.status, headers: res.headers };
|
|
92
|
+
};
|
|
93
|
+
export const getDogsCalculateCoiCreateMutationOptions = (options) => {
|
|
94
|
+
const mutationKey = ['dogsCalculateCoiCreate'];
|
|
95
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ?
|
|
96
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
97
|
+
options
|
|
98
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
99
|
+
: { mutation: { mutationKey, }, fetch: undefined };
|
|
100
|
+
const mutationFn = (props) => {
|
|
101
|
+
const { id, data } = props ?? {};
|
|
102
|
+
return dogsCalculateCoiCreate(id, data, fetchOptions);
|
|
103
|
+
};
|
|
104
|
+
return { mutationFn, ...mutationOptions };
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* @summary Рассчитать COI для собаки
|
|
108
|
+
*/
|
|
109
|
+
export const useDogsCalculateCoiCreate = (options) => {
|
|
110
|
+
return useMutation(getDogsCalculateCoiCreateMutationOptions(options));
|
|
111
|
+
};
|
|
112
|
+
export const getDogsOffspringListUrl = (id, params) => {
|
|
113
|
+
const normalizedParams = new URLSearchParams();
|
|
114
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
115
|
+
if (value !== undefined) {
|
|
116
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const stringifiedParams = normalizedParams.toString();
|
|
120
|
+
return stringifiedParams.length > 0 ? `/api/dogs/${id}/offspring/?${stringifiedParams}` : `/api/dogs/${id}/offspring/`;
|
|
121
|
+
};
|
|
122
|
+
export const dogsOffspringList = async (id, params, options) => {
|
|
123
|
+
const res = await fetch(getDogsOffspringListUrl(id, params), {
|
|
124
|
+
...options,
|
|
125
|
+
method: 'GET'
|
|
126
|
+
});
|
|
127
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
128
|
+
const data = body ? JSON.parse(body) : {};
|
|
129
|
+
return { data, status: res.status, headers: res.headers };
|
|
130
|
+
};
|
|
131
|
+
export const getDogsOffspringListQueryKey = (id, params) => {
|
|
132
|
+
return [
|
|
133
|
+
`/api/dogs/${id}/offspring/`, ...(params ? [params] : [])
|
|
134
|
+
];
|
|
135
|
+
};
|
|
136
|
+
export const getDogsOffspringListQueryOptions = (id, params, options) => {
|
|
137
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
138
|
+
const queryKey = queryOptions?.queryKey ?? getDogsOffspringListQueryKey(id, params);
|
|
139
|
+
const queryFn = ({ signal }) => dogsOffspringList(id, params, { signal, ...fetchOptions });
|
|
140
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* @summary Потомки собаки
|
|
144
|
+
*/
|
|
145
|
+
export function useDogsOffspringList(id, params, options) {
|
|
146
|
+
const queryOptions = getDogsOffspringListQueryOptions(id, params, options);
|
|
147
|
+
const query = useQuery(queryOptions);
|
|
148
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
149
|
+
}
|
|
150
|
+
export const getDogsPedigreeRetrieveUrl = (id, params) => {
|
|
151
|
+
const normalizedParams = new URLSearchParams();
|
|
152
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
153
|
+
if (value !== undefined) {
|
|
154
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const stringifiedParams = normalizedParams.toString();
|
|
158
|
+
return stringifiedParams.length > 0 ? `/api/dogs/${id}/pedigree/?${stringifiedParams}` : `/api/dogs/${id}/pedigree/`;
|
|
159
|
+
};
|
|
160
|
+
export const dogsPedigreeRetrieve = async (id, params, options) => {
|
|
161
|
+
const res = await fetch(getDogsPedigreeRetrieveUrl(id, params), {
|
|
162
|
+
...options,
|
|
163
|
+
method: 'GET'
|
|
164
|
+
});
|
|
165
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
166
|
+
const data = body ? JSON.parse(body) : {};
|
|
167
|
+
return { data, status: res.status, headers: res.headers };
|
|
168
|
+
};
|
|
169
|
+
export const getDogsPedigreeRetrieveQueryKey = (id, params) => {
|
|
170
|
+
return [
|
|
171
|
+
`/api/dogs/${id}/pedigree/`, ...(params ? [params] : [])
|
|
172
|
+
];
|
|
173
|
+
};
|
|
174
|
+
export const getDogsPedigreeRetrieveQueryOptions = (id, params, options) => {
|
|
175
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
176
|
+
const queryKey = queryOptions?.queryKey ?? getDogsPedigreeRetrieveQueryKey(id, params);
|
|
177
|
+
const queryFn = ({ signal }) => dogsPedigreeRetrieve(id, params, { signal, ...fetchOptions });
|
|
178
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* @summary Родословная собаки
|
|
182
|
+
*/
|
|
183
|
+
export function useDogsPedigreeRetrieve(id, params, options) {
|
|
184
|
+
const queryOptions = getDogsPedigreeRetrieveQueryOptions(id, params, options);
|
|
185
|
+
const query = useQuery(queryOptions);
|
|
186
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
187
|
+
}
|
|
188
|
+
export const getDogsSiblingsListUrl = (id, params) => {
|
|
189
|
+
const normalizedParams = new URLSearchParams();
|
|
190
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
191
|
+
if (value !== undefined) {
|
|
192
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const stringifiedParams = normalizedParams.toString();
|
|
196
|
+
return stringifiedParams.length > 0 ? `/api/dogs/${id}/siblings/?${stringifiedParams}` : `/api/dogs/${id}/siblings/`;
|
|
197
|
+
};
|
|
198
|
+
export const dogsSiblingsList = async (id, params, options) => {
|
|
199
|
+
const res = await fetch(getDogsSiblingsListUrl(id, params), {
|
|
200
|
+
...options,
|
|
201
|
+
method: 'GET'
|
|
202
|
+
});
|
|
203
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
204
|
+
const data = body ? JSON.parse(body) : {};
|
|
205
|
+
return { data, status: res.status, headers: res.headers };
|
|
206
|
+
};
|
|
207
|
+
export const getDogsSiblingsListQueryKey = (id, params) => {
|
|
208
|
+
return [
|
|
209
|
+
`/api/dogs/${id}/siblings/`, ...(params ? [params] : [])
|
|
210
|
+
];
|
|
211
|
+
};
|
|
212
|
+
export const getDogsSiblingsListQueryOptions = (id, params, options) => {
|
|
213
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
214
|
+
const queryKey = queryOptions?.queryKey ?? getDogsSiblingsListQueryKey(id, params);
|
|
215
|
+
const queryFn = ({ signal }) => dogsSiblingsList(id, params, { signal, ...fetchOptions });
|
|
216
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* @summary Сиблинги собаки
|
|
220
|
+
*/
|
|
221
|
+
export function useDogsSiblingsList(id, params, options) {
|
|
222
|
+
const queryOptions = getDogsSiblingsListQueryOptions(id, params, options);
|
|
223
|
+
const query = useQuery(queryOptions);
|
|
224
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
225
|
+
}
|
|
226
|
+
;
|
|
227
|
+
export const getDogsCoiRecalculateCreateUrl = () => {
|
|
228
|
+
return `/api/dogs/coi/recalculate/`;
|
|
229
|
+
};
|
|
230
|
+
export const dogsCoiRecalculateCreate = async (recalculateAllCoiRequestRequest, options) => {
|
|
231
|
+
const res = await fetch(getDogsCoiRecalculateCreateUrl(), {
|
|
232
|
+
...options,
|
|
233
|
+
method: 'POST',
|
|
234
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
235
|
+
body: JSON.stringify(recalculateAllCoiRequestRequest)
|
|
236
|
+
});
|
|
237
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
238
|
+
const data = body ? JSON.parse(body) : {};
|
|
239
|
+
return { data, status: res.status, headers: res.headers };
|
|
240
|
+
};
|
|
241
|
+
export const getDogsCoiRecalculateCreateMutationOptions = (options) => {
|
|
242
|
+
const mutationKey = ['dogsCoiRecalculateCreate'];
|
|
243
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ?
|
|
244
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
245
|
+
options
|
|
246
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
247
|
+
: { mutation: { mutationKey, }, fetch: undefined };
|
|
248
|
+
const mutationFn = (props) => {
|
|
249
|
+
const { data } = props ?? {};
|
|
250
|
+
return dogsCoiRecalculateCreate(data, fetchOptions);
|
|
251
|
+
};
|
|
252
|
+
return { mutationFn, ...mutationOptions };
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* @summary Массовый пересчёт COI
|
|
256
|
+
*/
|
|
257
|
+
export const useDogsCoiRecalculateCreate = (options) => {
|
|
258
|
+
return useMutation(getDogsCoiRecalculateCreateMutationOptions(options));
|
|
259
|
+
};
|
|
260
|
+
export const getDogsSearchListUrl = (params) => {
|
|
261
|
+
const normalizedParams = new URLSearchParams();
|
|
262
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
263
|
+
if (value !== undefined) {
|
|
264
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
const stringifiedParams = normalizedParams.toString();
|
|
268
|
+
return stringifiedParams.length > 0 ? `/api/dogs/search/?${stringifiedParams}` : `/api/dogs/search/`;
|
|
269
|
+
};
|
|
270
|
+
export const dogsSearchList = async (params, options) => {
|
|
271
|
+
const res = await fetch(getDogsSearchListUrl(params), {
|
|
272
|
+
...options,
|
|
273
|
+
method: 'GET'
|
|
274
|
+
});
|
|
275
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
276
|
+
const data = body ? JSON.parse(body) : {};
|
|
277
|
+
return { data, status: res.status, headers: res.headers };
|
|
278
|
+
};
|
|
279
|
+
export const getDogsSearchListQueryKey = (params) => {
|
|
280
|
+
return [
|
|
281
|
+
`/api/dogs/search/`, ...(params ? [params] : [])
|
|
282
|
+
];
|
|
283
|
+
};
|
|
284
|
+
export const getDogsSearchListQueryOptions = (params, options) => {
|
|
285
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
286
|
+
const queryKey = queryOptions?.queryKey ?? getDogsSearchListQueryKey(params);
|
|
287
|
+
const queryFn = ({ signal }) => dogsSearchList(params, { signal, ...fetchOptions });
|
|
288
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* @summary Поиск собак по кличке
|
|
292
|
+
*/
|
|
293
|
+
export function useDogsSearchList(params, options) {
|
|
294
|
+
const queryOptions = getDogsSearchListQueryOptions(params, options);
|
|
295
|
+
const query = useQuery(queryOptions);
|
|
296
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
297
|
+
}
|
|
298
|
+
;
|
|
299
|
+
export const getDogsStatsRetrieveUrl = () => {
|
|
300
|
+
return `/api/dogs/stats/`;
|
|
301
|
+
};
|
|
302
|
+
export const dogsStatsRetrieve = async (options) => {
|
|
303
|
+
const res = await fetch(getDogsStatsRetrieveUrl(), {
|
|
304
|
+
...options,
|
|
305
|
+
method: 'GET'
|
|
306
|
+
});
|
|
307
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
308
|
+
const data = body ? JSON.parse(body) : {};
|
|
309
|
+
return { data, status: res.status, headers: res.headers };
|
|
310
|
+
};
|
|
311
|
+
export const getDogsStatsRetrieveQueryKey = () => {
|
|
312
|
+
return [
|
|
313
|
+
`/api/dogs/stats/`
|
|
314
|
+
];
|
|
315
|
+
};
|
|
316
|
+
export const getDogsStatsRetrieveQueryOptions = (options) => {
|
|
317
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
318
|
+
const queryKey = queryOptions?.queryKey ?? getDogsStatsRetrieveQueryKey();
|
|
319
|
+
const queryFn = ({ signal }) => dogsStatsRetrieve({ signal, ...fetchOptions });
|
|
320
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* @summary Статистика по базе собак
|
|
324
|
+
*/
|
|
325
|
+
export function useDogsStatsRetrieve(options) {
|
|
326
|
+
const queryOptions = getDogsStatsRetrieveQueryOptions(options);
|
|
327
|
+
const query = useQuery(queryOptions);
|
|
328
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
329
|
+
}
|