@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,358 @@
|
|
|
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 { useQuery } from '@tanstack/react-query';
|
|
9
|
+
;
|
|
10
|
+
export const getBreedersListUrl = (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/breeders/?${stringifiedParams}` : `/api/breeders/`;
|
|
19
|
+
};
|
|
20
|
+
export const breedersList = async (params, options) => {
|
|
21
|
+
const res = await fetch(getBreedersListUrl(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 getBreedersListQueryKey = (params) => {
|
|
30
|
+
return [
|
|
31
|
+
`/api/breeders/`, ...(params ? [params] : [])
|
|
32
|
+
];
|
|
33
|
+
};
|
|
34
|
+
export const getBreedersListQueryOptions = (params, options) => {
|
|
35
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
36
|
+
const queryKey = queryOptions?.queryKey ?? getBreedersListQueryKey(params);
|
|
37
|
+
const queryFn = ({ signal }) => breedersList(params, { signal, ...fetchOptions });
|
|
38
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @summary Список заводчиков
|
|
42
|
+
*/
|
|
43
|
+
export function useBreedersList(params, options) {
|
|
44
|
+
const queryOptions = getBreedersListQueryOptions(params, options);
|
|
45
|
+
const query = useQuery(queryOptions);
|
|
46
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
47
|
+
}
|
|
48
|
+
export const getBreedersRetrieveUrl = (id) => {
|
|
49
|
+
return `/api/breeders/${id}/`;
|
|
50
|
+
};
|
|
51
|
+
export const breedersRetrieve = async (id, options) => {
|
|
52
|
+
const res = await fetch(getBreedersRetrieveUrl(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 getBreedersRetrieveQueryKey = (id) => {
|
|
61
|
+
return [
|
|
62
|
+
`/api/breeders/${id}/`
|
|
63
|
+
];
|
|
64
|
+
};
|
|
65
|
+
export const getBreedersRetrieveQueryOptions = (id, options) => {
|
|
66
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
67
|
+
const queryKey = queryOptions?.queryKey ?? getBreedersRetrieveQueryKey(id);
|
|
68
|
+
const queryFn = ({ signal }) => breedersRetrieve(id, { signal, ...fetchOptions });
|
|
69
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @summary Получить заводчика по ID
|
|
73
|
+
*/
|
|
74
|
+
export function useBreedersRetrieve(id, options) {
|
|
75
|
+
const queryOptions = getBreedersRetrieveQueryOptions(id, options);
|
|
76
|
+
const query = useQuery(queryOptions);
|
|
77
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
78
|
+
}
|
|
79
|
+
;
|
|
80
|
+
export const getLittersListUrl = (params) => {
|
|
81
|
+
const normalizedParams = new URLSearchParams();
|
|
82
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
83
|
+
if (value !== undefined) {
|
|
84
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const stringifiedParams = normalizedParams.toString();
|
|
88
|
+
return stringifiedParams.length > 0 ? `/api/litters/?${stringifiedParams}` : `/api/litters/`;
|
|
89
|
+
};
|
|
90
|
+
export const littersList = async (params, options) => {
|
|
91
|
+
const res = await fetch(getLittersListUrl(params), {
|
|
92
|
+
...options,
|
|
93
|
+
method: 'GET'
|
|
94
|
+
});
|
|
95
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
96
|
+
const data = body ? JSON.parse(body) : {};
|
|
97
|
+
return { data, status: res.status, headers: res.headers };
|
|
98
|
+
};
|
|
99
|
+
export const getLittersListQueryKey = (params) => {
|
|
100
|
+
return [
|
|
101
|
+
`/api/litters/`, ...(params ? [params] : [])
|
|
102
|
+
];
|
|
103
|
+
};
|
|
104
|
+
export const getLittersListQueryOptions = (params, options) => {
|
|
105
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
106
|
+
const queryKey = queryOptions?.queryKey ?? getLittersListQueryKey(params);
|
|
107
|
+
const queryFn = ({ signal }) => littersList(params, { signal, ...fetchOptions });
|
|
108
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* @summary Список помётов
|
|
112
|
+
*/
|
|
113
|
+
export function useLittersList(params, options) {
|
|
114
|
+
const queryOptions = getLittersListQueryOptions(params, options);
|
|
115
|
+
const query = useQuery(queryOptions);
|
|
116
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
117
|
+
}
|
|
118
|
+
export const getLittersRetrieveUrl = (id) => {
|
|
119
|
+
return `/api/litters/${id}/`;
|
|
120
|
+
};
|
|
121
|
+
export const littersRetrieve = async (id, options) => {
|
|
122
|
+
const res = await fetch(getLittersRetrieveUrl(id), {
|
|
123
|
+
...options,
|
|
124
|
+
method: 'GET'
|
|
125
|
+
});
|
|
126
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
127
|
+
const data = body ? JSON.parse(body) : {};
|
|
128
|
+
return { data, status: res.status, headers: res.headers };
|
|
129
|
+
};
|
|
130
|
+
export const getLittersRetrieveQueryKey = (id) => {
|
|
131
|
+
return [
|
|
132
|
+
`/api/litters/${id}/`
|
|
133
|
+
];
|
|
134
|
+
};
|
|
135
|
+
export const getLittersRetrieveQueryOptions = (id, options) => {
|
|
136
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
137
|
+
const queryKey = queryOptions?.queryKey ?? getLittersRetrieveQueryKey(id);
|
|
138
|
+
const queryFn = ({ signal }) => littersRetrieve(id, { signal, ...fetchOptions });
|
|
139
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* @summary Получить помёт по ID
|
|
143
|
+
*/
|
|
144
|
+
export function useLittersRetrieve(id, options) {
|
|
145
|
+
const queryOptions = getLittersRetrieveQueryOptions(id, options);
|
|
146
|
+
const query = useQuery(queryOptions);
|
|
147
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
148
|
+
}
|
|
149
|
+
;
|
|
150
|
+
export const getMedicalRecordsListUrl = (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/medical-records/?${stringifiedParams}` : `/api/medical-records/`;
|
|
159
|
+
};
|
|
160
|
+
export const medicalRecordsList = async (params, options) => {
|
|
161
|
+
const res = await fetch(getMedicalRecordsListUrl(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 getMedicalRecordsListQueryKey = (params) => {
|
|
170
|
+
return [
|
|
171
|
+
`/api/medical-records/`, ...(params ? [params] : [])
|
|
172
|
+
];
|
|
173
|
+
};
|
|
174
|
+
export const getMedicalRecordsListQueryOptions = (params, options) => {
|
|
175
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
176
|
+
const queryKey = queryOptions?.queryKey ?? getMedicalRecordsListQueryKey(params);
|
|
177
|
+
const queryFn = ({ signal }) => medicalRecordsList(params, { signal, ...fetchOptions });
|
|
178
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* @summary Список медицинских записей
|
|
182
|
+
*/
|
|
183
|
+
export function useMedicalRecordsList(params, options) {
|
|
184
|
+
const queryOptions = getMedicalRecordsListQueryOptions(params, options);
|
|
185
|
+
const query = useQuery(queryOptions);
|
|
186
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
187
|
+
}
|
|
188
|
+
export const getMedicalRecordsRetrieveUrl = (id) => {
|
|
189
|
+
return `/api/medical-records/${id}/`;
|
|
190
|
+
};
|
|
191
|
+
export const medicalRecordsRetrieve = async (id, options) => {
|
|
192
|
+
const res = await fetch(getMedicalRecordsRetrieveUrl(id), {
|
|
193
|
+
...options,
|
|
194
|
+
method: 'GET'
|
|
195
|
+
});
|
|
196
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
197
|
+
const data = body ? JSON.parse(body) : {};
|
|
198
|
+
return { data, status: res.status, headers: res.headers };
|
|
199
|
+
};
|
|
200
|
+
export const getMedicalRecordsRetrieveQueryKey = (id) => {
|
|
201
|
+
return [
|
|
202
|
+
`/api/medical-records/${id}/`
|
|
203
|
+
];
|
|
204
|
+
};
|
|
205
|
+
export const getMedicalRecordsRetrieveQueryOptions = (id, options) => {
|
|
206
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
207
|
+
const queryKey = queryOptions?.queryKey ?? getMedicalRecordsRetrieveQueryKey(id);
|
|
208
|
+
const queryFn = ({ signal }) => medicalRecordsRetrieve(id, { signal, ...fetchOptions });
|
|
209
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* @summary Получить медицинскую запись по ID
|
|
213
|
+
*/
|
|
214
|
+
export function useMedicalRecordsRetrieve(id, options) {
|
|
215
|
+
const queryOptions = getMedicalRecordsRetrieveQueryOptions(id, options);
|
|
216
|
+
const query = useQuery(queryOptions);
|
|
217
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
218
|
+
}
|
|
219
|
+
;
|
|
220
|
+
export const getOwnersListUrl = (params) => {
|
|
221
|
+
const normalizedParams = new URLSearchParams();
|
|
222
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
223
|
+
if (value !== undefined) {
|
|
224
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
const stringifiedParams = normalizedParams.toString();
|
|
228
|
+
return stringifiedParams.length > 0 ? `/api/owners/?${stringifiedParams}` : `/api/owners/`;
|
|
229
|
+
};
|
|
230
|
+
export const ownersList = async (params, options) => {
|
|
231
|
+
const res = await fetch(getOwnersListUrl(params), {
|
|
232
|
+
...options,
|
|
233
|
+
method: 'GET'
|
|
234
|
+
});
|
|
235
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
236
|
+
const data = body ? JSON.parse(body) : {};
|
|
237
|
+
return { data, status: res.status, headers: res.headers };
|
|
238
|
+
};
|
|
239
|
+
export const getOwnersListQueryKey = (params) => {
|
|
240
|
+
return [
|
|
241
|
+
`/api/owners/`, ...(params ? [params] : [])
|
|
242
|
+
];
|
|
243
|
+
};
|
|
244
|
+
export const getOwnersListQueryOptions = (params, options) => {
|
|
245
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
246
|
+
const queryKey = queryOptions?.queryKey ?? getOwnersListQueryKey(params);
|
|
247
|
+
const queryFn = ({ signal }) => ownersList(params, { signal, ...fetchOptions });
|
|
248
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* @summary Список владельцев
|
|
252
|
+
*/
|
|
253
|
+
export function useOwnersList(params, options) {
|
|
254
|
+
const queryOptions = getOwnersListQueryOptions(params, options);
|
|
255
|
+
const query = useQuery(queryOptions);
|
|
256
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
257
|
+
}
|
|
258
|
+
export const getOwnersRetrieveUrl = (id) => {
|
|
259
|
+
return `/api/owners/${id}/`;
|
|
260
|
+
};
|
|
261
|
+
export const ownersRetrieve = async (id, options) => {
|
|
262
|
+
const res = await fetch(getOwnersRetrieveUrl(id), {
|
|
263
|
+
...options,
|
|
264
|
+
method: 'GET'
|
|
265
|
+
});
|
|
266
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
267
|
+
const data = body ? JSON.parse(body) : {};
|
|
268
|
+
return { data, status: res.status, headers: res.headers };
|
|
269
|
+
};
|
|
270
|
+
export const getOwnersRetrieveQueryKey = (id) => {
|
|
271
|
+
return [
|
|
272
|
+
`/api/owners/${id}/`
|
|
273
|
+
];
|
|
274
|
+
};
|
|
275
|
+
export const getOwnersRetrieveQueryOptions = (id, options) => {
|
|
276
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
277
|
+
const queryKey = queryOptions?.queryKey ?? getOwnersRetrieveQueryKey(id);
|
|
278
|
+
const queryFn = ({ signal }) => ownersRetrieve(id, { signal, ...fetchOptions });
|
|
279
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* @summary Получить владельца по ID
|
|
283
|
+
*/
|
|
284
|
+
export function useOwnersRetrieve(id, options) {
|
|
285
|
+
const queryOptions = getOwnersRetrieveQueryOptions(id, options);
|
|
286
|
+
const query = useQuery(queryOptions);
|
|
287
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
288
|
+
}
|
|
289
|
+
;
|
|
290
|
+
export const getTitlesListUrl = (params) => {
|
|
291
|
+
const normalizedParams = new URLSearchParams();
|
|
292
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
293
|
+
if (value !== undefined) {
|
|
294
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const stringifiedParams = normalizedParams.toString();
|
|
298
|
+
return stringifiedParams.length > 0 ? `/api/titles/?${stringifiedParams}` : `/api/titles/`;
|
|
299
|
+
};
|
|
300
|
+
export const titlesList = async (params, options) => {
|
|
301
|
+
const res = await fetch(getTitlesListUrl(params), {
|
|
302
|
+
...options,
|
|
303
|
+
method: 'GET'
|
|
304
|
+
});
|
|
305
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
306
|
+
const data = body ? JSON.parse(body) : {};
|
|
307
|
+
return { data, status: res.status, headers: res.headers };
|
|
308
|
+
};
|
|
309
|
+
export const getTitlesListQueryKey = (params) => {
|
|
310
|
+
return [
|
|
311
|
+
`/api/titles/`, ...(params ? [params] : [])
|
|
312
|
+
];
|
|
313
|
+
};
|
|
314
|
+
export const getTitlesListQueryOptions = (params, options) => {
|
|
315
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
316
|
+
const queryKey = queryOptions?.queryKey ?? getTitlesListQueryKey(params);
|
|
317
|
+
const queryFn = ({ signal }) => titlesList(params, { signal, ...fetchOptions });
|
|
318
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* @summary Список титулов
|
|
322
|
+
*/
|
|
323
|
+
export function useTitlesList(params, options) {
|
|
324
|
+
const queryOptions = getTitlesListQueryOptions(params, options);
|
|
325
|
+
const query = useQuery(queryOptions);
|
|
326
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
327
|
+
}
|
|
328
|
+
export const getTitlesRetrieveUrl = (id) => {
|
|
329
|
+
return `/api/titles/${id}/`;
|
|
330
|
+
};
|
|
331
|
+
export const titlesRetrieve = async (id, options) => {
|
|
332
|
+
const res = await fetch(getTitlesRetrieveUrl(id), {
|
|
333
|
+
...options,
|
|
334
|
+
method: 'GET'
|
|
335
|
+
});
|
|
336
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
337
|
+
const data = body ? JSON.parse(body) : {};
|
|
338
|
+
return { data, status: res.status, headers: res.headers };
|
|
339
|
+
};
|
|
340
|
+
export const getTitlesRetrieveQueryKey = (id) => {
|
|
341
|
+
return [
|
|
342
|
+
`/api/titles/${id}/`
|
|
343
|
+
];
|
|
344
|
+
};
|
|
345
|
+
export const getTitlesRetrieveQueryOptions = (id, options) => {
|
|
346
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
347
|
+
const queryKey = queryOptions?.queryKey ?? getTitlesRetrieveQueryKey(id);
|
|
348
|
+
const queryFn = ({ signal }) => titlesRetrieve(id, { signal, ...fetchOptions });
|
|
349
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions };
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* @summary Получить титул по ID
|
|
353
|
+
*/
|
|
354
|
+
export function useTitlesRetrieve(id, options) {
|
|
355
|
+
const queryOptions = getTitlesRetrieveQueryOptions(id, options);
|
|
356
|
+
const query = useQuery(queryOptions);
|
|
357
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
358
|
+
}
|