@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
|
@@ -1,1043 +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
|
-
useQuery
|
|
10
|
-
} from '@tanstack/react-query';
|
|
11
|
-
import type {
|
|
12
|
-
QueryFunction,
|
|
13
|
-
QueryKey,
|
|
14
|
-
UseQueryOptions,
|
|
15
|
-
UseQueryResult
|
|
16
|
-
} from '@tanstack/react-query';
|
|
17
|
-
|
|
18
|
-
import type {
|
|
19
|
-
Breeder,
|
|
20
|
-
BreedersListParams,
|
|
21
|
-
Litter,
|
|
22
|
-
LittersListParams,
|
|
23
|
-
MedicalRecord,
|
|
24
|
-
MedicalRecordsListParams,
|
|
25
|
-
Owner,
|
|
26
|
-
OwnersListParams,
|
|
27
|
-
PaginatedBreederList,
|
|
28
|
-
PaginatedLitterList,
|
|
29
|
-
PaginatedMedicalRecordList,
|
|
30
|
-
PaginatedOwnerList,
|
|
31
|
-
PaginatedTitleList,
|
|
32
|
-
Title,
|
|
33
|
-
TitlesListParams
|
|
34
|
-
} from '../api.schemas';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
38
|
-
|
|
39
|
-
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* ViewSet для заводчиков
|
|
46
|
-
* @summary Список заводчиков
|
|
47
|
-
*/
|
|
48
|
-
export type breedersListResponse200 = {
|
|
49
|
-
data: PaginatedBreederList
|
|
50
|
-
status: 200
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type breedersListResponseSuccess = (breedersListResponse200) & {
|
|
54
|
-
headers: Headers;
|
|
55
|
-
};
|
|
56
|
-
;
|
|
57
|
-
|
|
58
|
-
export type breedersListResponse = (breedersListResponseSuccess)
|
|
59
|
-
|
|
60
|
-
export const getBreedersListUrl = (params?: BreedersListParams,) => {
|
|
61
|
-
const normalizedParams = new URLSearchParams();
|
|
62
|
-
|
|
63
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
64
|
-
|
|
65
|
-
if (value !== undefined) {
|
|
66
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const stringifiedParams = normalizedParams.toString();
|
|
71
|
-
|
|
72
|
-
return stringifiedParams.length > 0 ? `/api/breeders/?${stringifiedParams}` : `/api/breeders/`
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export const breedersList = async (params?: BreedersListParams, options?: RequestInit): Promise<breedersListResponse> => {
|
|
76
|
-
|
|
77
|
-
const res = await fetch(getBreedersListUrl(params),
|
|
78
|
-
{
|
|
79
|
-
...options,
|
|
80
|
-
method: 'GET'
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
87
|
-
|
|
88
|
-
const data: breedersListResponse['data'] = body ? JSON.parse(body) : {}
|
|
89
|
-
return { data, status: res.status, headers: res.headers } as breedersListResponse
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
export const getBreedersListQueryKey = (params?: BreedersListParams,) => {
|
|
97
|
-
return [
|
|
98
|
-
`/api/breeders/`, ...(params ? [params] : [])
|
|
99
|
-
] as const;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export const getBreedersListQueryOptions = <TData = Awaited<ReturnType<typeof breedersList>>, TError = unknown>(params?: BreedersListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedersList>>, TError, TData>, fetch?: RequestInit}
|
|
104
|
-
) => {
|
|
105
|
-
|
|
106
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
107
|
-
|
|
108
|
-
const queryKey = queryOptions?.queryKey ?? getBreedersListQueryKey(params);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof breedersList>>> = ({ signal }) => breedersList(params, { signal, ...fetchOptions });
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof breedersList>>, TError, TData> & { queryKey: QueryKey }
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export type BreedersListQueryResult = NonNullable<Awaited<ReturnType<typeof breedersList>>>
|
|
122
|
-
export type BreedersListQueryError = unknown
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @summary Список заводчиков
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
export function useBreedersList<TData = Awaited<ReturnType<typeof breedersList>>, TError = unknown>(
|
|
130
|
-
params?: BreedersListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedersList>>, TError, TData>, fetch?: RequestInit}
|
|
131
|
-
|
|
132
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
133
|
-
|
|
134
|
-
const queryOptions = getBreedersListQueryOptions(params,options)
|
|
135
|
-
|
|
136
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
137
|
-
|
|
138
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* ViewSet для заводчиков
|
|
146
|
-
* @summary Получить заводчика по ID
|
|
147
|
-
*/
|
|
148
|
-
export type breedersRetrieveResponse200 = {
|
|
149
|
-
data: Breeder
|
|
150
|
-
status: 200
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export type breedersRetrieveResponse404 = {
|
|
154
|
-
data: void
|
|
155
|
-
status: 404
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export type breedersRetrieveResponseSuccess = (breedersRetrieveResponse200) & {
|
|
159
|
-
headers: Headers;
|
|
160
|
-
};
|
|
161
|
-
export type breedersRetrieveResponseError = (breedersRetrieveResponse404) & {
|
|
162
|
-
headers: Headers;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export type breedersRetrieveResponse = (breedersRetrieveResponseSuccess | breedersRetrieveResponseError)
|
|
166
|
-
|
|
167
|
-
export const getBreedersRetrieveUrl = (id: number,) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return `/api/breeders/${id}/`
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export const breedersRetrieve = async (id: number, options?: RequestInit): Promise<breedersRetrieveResponse> => {
|
|
176
|
-
|
|
177
|
-
const res = await fetch(getBreedersRetrieveUrl(id),
|
|
178
|
-
{
|
|
179
|
-
...options,
|
|
180
|
-
method: 'GET'
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
187
|
-
|
|
188
|
-
const data: breedersRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
189
|
-
return { data, status: res.status, headers: res.headers } as breedersRetrieveResponse
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
export const getBreedersRetrieveQueryKey = (id: number,) => {
|
|
197
|
-
return [
|
|
198
|
-
`/api/breeders/${id}/`
|
|
199
|
-
] as const;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
export const getBreedersRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof breedersRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedersRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
204
|
-
) => {
|
|
205
|
-
|
|
206
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
207
|
-
|
|
208
|
-
const queryKey = queryOptions?.queryKey ?? getBreedersRetrieveQueryKey(id);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof breedersRetrieve>>> = ({ signal }) => breedersRetrieve(id, { signal, ...fetchOptions });
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof breedersRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export type BreedersRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof breedersRetrieve>>>
|
|
222
|
-
export type BreedersRetrieveQueryError = void
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* @summary Получить заводчика по ID
|
|
227
|
-
*/
|
|
228
|
-
|
|
229
|
-
export function useBreedersRetrieve<TData = Awaited<ReturnType<typeof breedersRetrieve>>, TError = void>(
|
|
230
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedersRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
231
|
-
|
|
232
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
233
|
-
|
|
234
|
-
const queryOptions = getBreedersRetrieveQueryOptions(id,options)
|
|
235
|
-
|
|
236
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
237
|
-
|
|
238
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* ViewSet для помётов
|
|
246
|
-
* @summary Список помётов
|
|
247
|
-
*/
|
|
248
|
-
export type littersListResponse200 = {
|
|
249
|
-
data: PaginatedLitterList
|
|
250
|
-
status: 200
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export type littersListResponseSuccess = (littersListResponse200) & {
|
|
254
|
-
headers: Headers;
|
|
255
|
-
};
|
|
256
|
-
;
|
|
257
|
-
|
|
258
|
-
export type littersListResponse = (littersListResponseSuccess)
|
|
259
|
-
|
|
260
|
-
export const getLittersListUrl = (params?: LittersListParams,) => {
|
|
261
|
-
const normalizedParams = new URLSearchParams();
|
|
262
|
-
|
|
263
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
264
|
-
|
|
265
|
-
if (value !== undefined) {
|
|
266
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
const stringifiedParams = normalizedParams.toString();
|
|
271
|
-
|
|
272
|
-
return stringifiedParams.length > 0 ? `/api/litters/?${stringifiedParams}` : `/api/litters/`
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export const littersList = async (params?: LittersListParams, options?: RequestInit): Promise<littersListResponse> => {
|
|
276
|
-
|
|
277
|
-
const res = await fetch(getLittersListUrl(params),
|
|
278
|
-
{
|
|
279
|
-
...options,
|
|
280
|
-
method: 'GET'
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
287
|
-
|
|
288
|
-
const data: littersListResponse['data'] = body ? JSON.parse(body) : {}
|
|
289
|
-
return { data, status: res.status, headers: res.headers } as littersListResponse
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
export const getLittersListQueryKey = (params?: LittersListParams,) => {
|
|
297
|
-
return [
|
|
298
|
-
`/api/litters/`, ...(params ? [params] : [])
|
|
299
|
-
] as const;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
export const getLittersListQueryOptions = <TData = Awaited<ReturnType<typeof littersList>>, TError = unknown>(params?: LittersListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof littersList>>, TError, TData>, fetch?: RequestInit}
|
|
304
|
-
) => {
|
|
305
|
-
|
|
306
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
307
|
-
|
|
308
|
-
const queryKey = queryOptions?.queryKey ?? getLittersListQueryKey(params);
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof littersList>>> = ({ signal }) => littersList(params, { signal, ...fetchOptions });
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof littersList>>, TError, TData> & { queryKey: QueryKey }
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export type LittersListQueryResult = NonNullable<Awaited<ReturnType<typeof littersList>>>
|
|
322
|
-
export type LittersListQueryError = unknown
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* @summary Список помётов
|
|
327
|
-
*/
|
|
328
|
-
|
|
329
|
-
export function useLittersList<TData = Awaited<ReturnType<typeof littersList>>, TError = unknown>(
|
|
330
|
-
params?: LittersListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof littersList>>, TError, TData>, fetch?: RequestInit}
|
|
331
|
-
|
|
332
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
333
|
-
|
|
334
|
-
const queryOptions = getLittersListQueryOptions(params,options)
|
|
335
|
-
|
|
336
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
337
|
-
|
|
338
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* ViewSet для помётов
|
|
346
|
-
* @summary Получить помёт по ID
|
|
347
|
-
*/
|
|
348
|
-
export type littersRetrieveResponse200 = {
|
|
349
|
-
data: Litter
|
|
350
|
-
status: 200
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
export type littersRetrieveResponse404 = {
|
|
354
|
-
data: void
|
|
355
|
-
status: 404
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export type littersRetrieveResponseSuccess = (littersRetrieveResponse200) & {
|
|
359
|
-
headers: Headers;
|
|
360
|
-
};
|
|
361
|
-
export type littersRetrieveResponseError = (littersRetrieveResponse404) & {
|
|
362
|
-
headers: Headers;
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
export type littersRetrieveResponse = (littersRetrieveResponseSuccess | littersRetrieveResponseError)
|
|
366
|
-
|
|
367
|
-
export const getLittersRetrieveUrl = (id: number,) => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
return `/api/litters/${id}/`
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
export const littersRetrieve = async (id: number, options?: RequestInit): Promise<littersRetrieveResponse> => {
|
|
376
|
-
|
|
377
|
-
const res = await fetch(getLittersRetrieveUrl(id),
|
|
378
|
-
{
|
|
379
|
-
...options,
|
|
380
|
-
method: 'GET'
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
)
|
|
385
|
-
|
|
386
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
387
|
-
|
|
388
|
-
const data: littersRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
389
|
-
return { data, status: res.status, headers: res.headers } as littersRetrieveResponse
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
export const getLittersRetrieveQueryKey = (id: number,) => {
|
|
397
|
-
return [
|
|
398
|
-
`/api/litters/${id}/`
|
|
399
|
-
] as const;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
export const getLittersRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof littersRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof littersRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
404
|
-
) => {
|
|
405
|
-
|
|
406
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
407
|
-
|
|
408
|
-
const queryKey = queryOptions?.queryKey ?? getLittersRetrieveQueryKey(id);
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof littersRetrieve>>> = ({ signal }) => littersRetrieve(id, { signal, ...fetchOptions });
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof littersRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
export type LittersRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof littersRetrieve>>>
|
|
422
|
-
export type LittersRetrieveQueryError = void
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* @summary Получить помёт по ID
|
|
427
|
-
*/
|
|
428
|
-
|
|
429
|
-
export function useLittersRetrieve<TData = Awaited<ReturnType<typeof littersRetrieve>>, TError = void>(
|
|
430
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof littersRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
431
|
-
|
|
432
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
433
|
-
|
|
434
|
-
const queryOptions = getLittersRetrieveQueryOptions(id,options)
|
|
435
|
-
|
|
436
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
437
|
-
|
|
438
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* ViewSet для медицинских записей
|
|
446
|
-
* @summary Список медицинских записей
|
|
447
|
-
*/
|
|
448
|
-
export type medicalRecordsListResponse200 = {
|
|
449
|
-
data: PaginatedMedicalRecordList
|
|
450
|
-
status: 200
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
export type medicalRecordsListResponseSuccess = (medicalRecordsListResponse200) & {
|
|
454
|
-
headers: Headers;
|
|
455
|
-
};
|
|
456
|
-
;
|
|
457
|
-
|
|
458
|
-
export type medicalRecordsListResponse = (medicalRecordsListResponseSuccess)
|
|
459
|
-
|
|
460
|
-
export const getMedicalRecordsListUrl = (params?: MedicalRecordsListParams,) => {
|
|
461
|
-
const normalizedParams = new URLSearchParams();
|
|
462
|
-
|
|
463
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
464
|
-
|
|
465
|
-
if (value !== undefined) {
|
|
466
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
const stringifiedParams = normalizedParams.toString();
|
|
471
|
-
|
|
472
|
-
return stringifiedParams.length > 0 ? `/api/medical-records/?${stringifiedParams}` : `/api/medical-records/`
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
export const medicalRecordsList = async (params?: MedicalRecordsListParams, options?: RequestInit): Promise<medicalRecordsListResponse> => {
|
|
476
|
-
|
|
477
|
-
const res = await fetch(getMedicalRecordsListUrl(params),
|
|
478
|
-
{
|
|
479
|
-
...options,
|
|
480
|
-
method: 'GET'
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
)
|
|
485
|
-
|
|
486
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
487
|
-
|
|
488
|
-
const data: medicalRecordsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
489
|
-
return { data, status: res.status, headers: res.headers } as medicalRecordsListResponse
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
export const getMedicalRecordsListQueryKey = (params?: MedicalRecordsListParams,) => {
|
|
497
|
-
return [
|
|
498
|
-
`/api/medical-records/`, ...(params ? [params] : [])
|
|
499
|
-
] as const;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
export const getMedicalRecordsListQueryOptions = <TData = Awaited<ReturnType<typeof medicalRecordsList>>, TError = unknown>(params?: MedicalRecordsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof medicalRecordsList>>, TError, TData>, fetch?: RequestInit}
|
|
504
|
-
) => {
|
|
505
|
-
|
|
506
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
507
|
-
|
|
508
|
-
const queryKey = queryOptions?.queryKey ?? getMedicalRecordsListQueryKey(params);
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof medicalRecordsList>>> = ({ signal }) => medicalRecordsList(params, { signal, ...fetchOptions });
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof medicalRecordsList>>, TError, TData> & { queryKey: QueryKey }
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
export type MedicalRecordsListQueryResult = NonNullable<Awaited<ReturnType<typeof medicalRecordsList>>>
|
|
522
|
-
export type MedicalRecordsListQueryError = unknown
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* @summary Список медицинских записей
|
|
527
|
-
*/
|
|
528
|
-
|
|
529
|
-
export function useMedicalRecordsList<TData = Awaited<ReturnType<typeof medicalRecordsList>>, TError = unknown>(
|
|
530
|
-
params?: MedicalRecordsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof medicalRecordsList>>, TError, TData>, fetch?: RequestInit}
|
|
531
|
-
|
|
532
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
533
|
-
|
|
534
|
-
const queryOptions = getMedicalRecordsListQueryOptions(params,options)
|
|
535
|
-
|
|
536
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
537
|
-
|
|
538
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* ViewSet для медицинских записей
|
|
546
|
-
* @summary Получить медицинскую запись по ID
|
|
547
|
-
*/
|
|
548
|
-
export type medicalRecordsRetrieveResponse200 = {
|
|
549
|
-
data: MedicalRecord
|
|
550
|
-
status: 200
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
export type medicalRecordsRetrieveResponse404 = {
|
|
554
|
-
data: void
|
|
555
|
-
status: 404
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
export type medicalRecordsRetrieveResponseSuccess = (medicalRecordsRetrieveResponse200) & {
|
|
559
|
-
headers: Headers;
|
|
560
|
-
};
|
|
561
|
-
export type medicalRecordsRetrieveResponseError = (medicalRecordsRetrieveResponse404) & {
|
|
562
|
-
headers: Headers;
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
export type medicalRecordsRetrieveResponse = (medicalRecordsRetrieveResponseSuccess | medicalRecordsRetrieveResponseError)
|
|
566
|
-
|
|
567
|
-
export const getMedicalRecordsRetrieveUrl = (id: number,) => {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
return `/api/medical-records/${id}/`
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
export const medicalRecordsRetrieve = async (id: number, options?: RequestInit): Promise<medicalRecordsRetrieveResponse> => {
|
|
576
|
-
|
|
577
|
-
const res = await fetch(getMedicalRecordsRetrieveUrl(id),
|
|
578
|
-
{
|
|
579
|
-
...options,
|
|
580
|
-
method: 'GET'
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
)
|
|
585
|
-
|
|
586
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
587
|
-
|
|
588
|
-
const data: medicalRecordsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
589
|
-
return { data, status: res.status, headers: res.headers } as medicalRecordsRetrieveResponse
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
export const getMedicalRecordsRetrieveQueryKey = (id: number,) => {
|
|
597
|
-
return [
|
|
598
|
-
`/api/medical-records/${id}/`
|
|
599
|
-
] as const;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
export const getMedicalRecordsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof medicalRecordsRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof medicalRecordsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
604
|
-
) => {
|
|
605
|
-
|
|
606
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
607
|
-
|
|
608
|
-
const queryKey = queryOptions?.queryKey ?? getMedicalRecordsRetrieveQueryKey(id);
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof medicalRecordsRetrieve>>> = ({ signal }) => medicalRecordsRetrieve(id, { signal, ...fetchOptions });
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof medicalRecordsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
export type MedicalRecordsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof medicalRecordsRetrieve>>>
|
|
622
|
-
export type MedicalRecordsRetrieveQueryError = void
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* @summary Получить медицинскую запись по ID
|
|
627
|
-
*/
|
|
628
|
-
|
|
629
|
-
export function useMedicalRecordsRetrieve<TData = Awaited<ReturnType<typeof medicalRecordsRetrieve>>, TError = void>(
|
|
630
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof medicalRecordsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
631
|
-
|
|
632
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
633
|
-
|
|
634
|
-
const queryOptions = getMedicalRecordsRetrieveQueryOptions(id,options)
|
|
635
|
-
|
|
636
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
637
|
-
|
|
638
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* ViewSet для владельцев
|
|
646
|
-
* @summary Список владельцев
|
|
647
|
-
*/
|
|
648
|
-
export type ownersListResponse200 = {
|
|
649
|
-
data: PaginatedOwnerList
|
|
650
|
-
status: 200
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
export type ownersListResponseSuccess = (ownersListResponse200) & {
|
|
654
|
-
headers: Headers;
|
|
655
|
-
};
|
|
656
|
-
;
|
|
657
|
-
|
|
658
|
-
export type ownersListResponse = (ownersListResponseSuccess)
|
|
659
|
-
|
|
660
|
-
export const getOwnersListUrl = (params?: OwnersListParams,) => {
|
|
661
|
-
const normalizedParams = new URLSearchParams();
|
|
662
|
-
|
|
663
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
664
|
-
|
|
665
|
-
if (value !== undefined) {
|
|
666
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
667
|
-
}
|
|
668
|
-
});
|
|
669
|
-
|
|
670
|
-
const stringifiedParams = normalizedParams.toString();
|
|
671
|
-
|
|
672
|
-
return stringifiedParams.length > 0 ? `/api/owners/?${stringifiedParams}` : `/api/owners/`
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
export const ownersList = async (params?: OwnersListParams, options?: RequestInit): Promise<ownersListResponse> => {
|
|
676
|
-
|
|
677
|
-
const res = await fetch(getOwnersListUrl(params),
|
|
678
|
-
{
|
|
679
|
-
...options,
|
|
680
|
-
method: 'GET'
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
)
|
|
685
|
-
|
|
686
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
687
|
-
|
|
688
|
-
const data: ownersListResponse['data'] = body ? JSON.parse(body) : {}
|
|
689
|
-
return { data, status: res.status, headers: res.headers } as ownersListResponse
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
export const getOwnersListQueryKey = (params?: OwnersListParams,) => {
|
|
697
|
-
return [
|
|
698
|
-
`/api/owners/`, ...(params ? [params] : [])
|
|
699
|
-
] as const;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
export const getOwnersListQueryOptions = <TData = Awaited<ReturnType<typeof ownersList>>, TError = unknown>(params?: OwnersListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof ownersList>>, TError, TData>, fetch?: RequestInit}
|
|
704
|
-
) => {
|
|
705
|
-
|
|
706
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
707
|
-
|
|
708
|
-
const queryKey = queryOptions?.queryKey ?? getOwnersListQueryKey(params);
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof ownersList>>> = ({ signal }) => ownersList(params, { signal, ...fetchOptions });
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof ownersList>>, TError, TData> & { queryKey: QueryKey }
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
export type OwnersListQueryResult = NonNullable<Awaited<ReturnType<typeof ownersList>>>
|
|
722
|
-
export type OwnersListQueryError = unknown
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
* @summary Список владельцев
|
|
727
|
-
*/
|
|
728
|
-
|
|
729
|
-
export function useOwnersList<TData = Awaited<ReturnType<typeof ownersList>>, TError = unknown>(
|
|
730
|
-
params?: OwnersListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof ownersList>>, TError, TData>, fetch?: RequestInit}
|
|
731
|
-
|
|
732
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
733
|
-
|
|
734
|
-
const queryOptions = getOwnersListQueryOptions(params,options)
|
|
735
|
-
|
|
736
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
737
|
-
|
|
738
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* ViewSet для владельцев
|
|
746
|
-
* @summary Получить владельца по ID
|
|
747
|
-
*/
|
|
748
|
-
export type ownersRetrieveResponse200 = {
|
|
749
|
-
data: Owner
|
|
750
|
-
status: 200
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
export type ownersRetrieveResponse404 = {
|
|
754
|
-
data: void
|
|
755
|
-
status: 404
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
export type ownersRetrieveResponseSuccess = (ownersRetrieveResponse200) & {
|
|
759
|
-
headers: Headers;
|
|
760
|
-
};
|
|
761
|
-
export type ownersRetrieveResponseError = (ownersRetrieveResponse404) & {
|
|
762
|
-
headers: Headers;
|
|
763
|
-
};
|
|
764
|
-
|
|
765
|
-
export type ownersRetrieveResponse = (ownersRetrieveResponseSuccess | ownersRetrieveResponseError)
|
|
766
|
-
|
|
767
|
-
export const getOwnersRetrieveUrl = (id: number,) => {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
return `/api/owners/${id}/`
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
export const ownersRetrieve = async (id: number, options?: RequestInit): Promise<ownersRetrieveResponse> => {
|
|
776
|
-
|
|
777
|
-
const res = await fetch(getOwnersRetrieveUrl(id),
|
|
778
|
-
{
|
|
779
|
-
...options,
|
|
780
|
-
method: 'GET'
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
)
|
|
785
|
-
|
|
786
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
787
|
-
|
|
788
|
-
const data: ownersRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
789
|
-
return { data, status: res.status, headers: res.headers } as ownersRetrieveResponse
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
export const getOwnersRetrieveQueryKey = (id: number,) => {
|
|
797
|
-
return [
|
|
798
|
-
`/api/owners/${id}/`
|
|
799
|
-
] as const;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
export const getOwnersRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof ownersRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof ownersRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
804
|
-
) => {
|
|
805
|
-
|
|
806
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
807
|
-
|
|
808
|
-
const queryKey = queryOptions?.queryKey ?? getOwnersRetrieveQueryKey(id);
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof ownersRetrieve>>> = ({ signal }) => ownersRetrieve(id, { signal, ...fetchOptions });
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof ownersRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
export type OwnersRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof ownersRetrieve>>>
|
|
822
|
-
export type OwnersRetrieveQueryError = void
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
* @summary Получить владельца по ID
|
|
827
|
-
*/
|
|
828
|
-
|
|
829
|
-
export function useOwnersRetrieve<TData = Awaited<ReturnType<typeof ownersRetrieve>>, TError = void>(
|
|
830
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof ownersRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
831
|
-
|
|
832
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
833
|
-
|
|
834
|
-
const queryOptions = getOwnersRetrieveQueryOptions(id,options)
|
|
835
|
-
|
|
836
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
837
|
-
|
|
838
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* ViewSet для титулов
|
|
846
|
-
* @summary Список титулов
|
|
847
|
-
*/
|
|
848
|
-
export type titlesListResponse200 = {
|
|
849
|
-
data: PaginatedTitleList
|
|
850
|
-
status: 200
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
export type titlesListResponseSuccess = (titlesListResponse200) & {
|
|
854
|
-
headers: Headers;
|
|
855
|
-
};
|
|
856
|
-
;
|
|
857
|
-
|
|
858
|
-
export type titlesListResponse = (titlesListResponseSuccess)
|
|
859
|
-
|
|
860
|
-
export const getTitlesListUrl = (params?: TitlesListParams,) => {
|
|
861
|
-
const normalizedParams = new URLSearchParams();
|
|
862
|
-
|
|
863
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
864
|
-
|
|
865
|
-
if (value !== undefined) {
|
|
866
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
|
|
870
|
-
const stringifiedParams = normalizedParams.toString();
|
|
871
|
-
|
|
872
|
-
return stringifiedParams.length > 0 ? `/api/titles/?${stringifiedParams}` : `/api/titles/`
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
export const titlesList = async (params?: TitlesListParams, options?: RequestInit): Promise<titlesListResponse> => {
|
|
876
|
-
|
|
877
|
-
const res = await fetch(getTitlesListUrl(params),
|
|
878
|
-
{
|
|
879
|
-
...options,
|
|
880
|
-
method: 'GET'
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
}
|
|
884
|
-
)
|
|
885
|
-
|
|
886
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
887
|
-
|
|
888
|
-
const data: titlesListResponse['data'] = body ? JSON.parse(body) : {}
|
|
889
|
-
return { data, status: res.status, headers: res.headers } as titlesListResponse
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
export const getTitlesListQueryKey = (params?: TitlesListParams,) => {
|
|
897
|
-
return [
|
|
898
|
-
`/api/titles/`, ...(params ? [params] : [])
|
|
899
|
-
] as const;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
export const getTitlesListQueryOptions = <TData = Awaited<ReturnType<typeof titlesList>>, TError = unknown>(params?: TitlesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof titlesList>>, TError, TData>, fetch?: RequestInit}
|
|
904
|
-
) => {
|
|
905
|
-
|
|
906
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
907
|
-
|
|
908
|
-
const queryKey = queryOptions?.queryKey ?? getTitlesListQueryKey(params);
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof titlesList>>> = ({ signal }) => titlesList(params, { signal, ...fetchOptions });
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof titlesList>>, TError, TData> & { queryKey: QueryKey }
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
export type TitlesListQueryResult = NonNullable<Awaited<ReturnType<typeof titlesList>>>
|
|
922
|
-
export type TitlesListQueryError = unknown
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* @summary Список титулов
|
|
927
|
-
*/
|
|
928
|
-
|
|
929
|
-
export function useTitlesList<TData = Awaited<ReturnType<typeof titlesList>>, TError = unknown>(
|
|
930
|
-
params?: TitlesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof titlesList>>, TError, TData>, fetch?: RequestInit}
|
|
931
|
-
|
|
932
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
933
|
-
|
|
934
|
-
const queryOptions = getTitlesListQueryOptions(params,options)
|
|
935
|
-
|
|
936
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
937
|
-
|
|
938
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* ViewSet для титулов
|
|
946
|
-
* @summary Получить титул по ID
|
|
947
|
-
*/
|
|
948
|
-
export type titlesRetrieveResponse200 = {
|
|
949
|
-
data: Title
|
|
950
|
-
status: 200
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
export type titlesRetrieveResponse404 = {
|
|
954
|
-
data: void
|
|
955
|
-
status: 404
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
export type titlesRetrieveResponseSuccess = (titlesRetrieveResponse200) & {
|
|
959
|
-
headers: Headers;
|
|
960
|
-
};
|
|
961
|
-
export type titlesRetrieveResponseError = (titlesRetrieveResponse404) & {
|
|
962
|
-
headers: Headers;
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
export type titlesRetrieveResponse = (titlesRetrieveResponseSuccess | titlesRetrieveResponseError)
|
|
966
|
-
|
|
967
|
-
export const getTitlesRetrieveUrl = (id: number,) => {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
return `/api/titles/${id}/`
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
export const titlesRetrieve = async (id: number, options?: RequestInit): Promise<titlesRetrieveResponse> => {
|
|
976
|
-
|
|
977
|
-
const res = await fetch(getTitlesRetrieveUrl(id),
|
|
978
|
-
{
|
|
979
|
-
...options,
|
|
980
|
-
method: 'GET'
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
}
|
|
984
|
-
)
|
|
985
|
-
|
|
986
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
987
|
-
|
|
988
|
-
const data: titlesRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
989
|
-
return { data, status: res.status, headers: res.headers } as titlesRetrieveResponse
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
export const getTitlesRetrieveQueryKey = (id: number,) => {
|
|
997
|
-
return [
|
|
998
|
-
`/api/titles/${id}/`
|
|
999
|
-
] as const;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
export const getTitlesRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof titlesRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof titlesRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
1004
|
-
) => {
|
|
1005
|
-
|
|
1006
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
1007
|
-
|
|
1008
|
-
const queryKey = queryOptions?.queryKey ?? getTitlesRetrieveQueryKey(id);
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof titlesRetrieve>>> = ({ signal }) => titlesRetrieve(id, { signal, ...fetchOptions });
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof titlesRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
export type TitlesRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof titlesRetrieve>>>
|
|
1022
|
-
export type TitlesRetrieveQueryError = void
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
/**
|
|
1026
|
-
* @summary Получить титул по ID
|
|
1027
|
-
*/
|
|
1028
|
-
|
|
1029
|
-
export function useTitlesRetrieve<TData = Awaited<ReturnType<typeof titlesRetrieve>>, TError = void>(
|
|
1030
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof titlesRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
1031
|
-
|
|
1032
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
1033
|
-
|
|
1034
|
-
const queryOptions = getTitlesRetrieveQueryOptions(id,options)
|
|
1035
|
-
|
|
1036
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
1037
|
-
|
|
1038
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|