@omerikanec/api-client-demo 2.0.2 → 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,231 +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
|
-
EventReport,
|
|
20
|
-
EventReportsListParams,
|
|
21
|
-
PaginatedEventReportList
|
|
22
|
-
} from '../api.schemas';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
26
|
-
|
|
27
|
-
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* API отчетов о мероприятиях
|
|
34
|
-
* @summary Список отчётов о мероприятиях
|
|
35
|
-
*/
|
|
36
|
-
export type eventReportsListResponse200 = {
|
|
37
|
-
data: PaginatedEventReportList
|
|
38
|
-
status: 200
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type eventReportsListResponseSuccess = (eventReportsListResponse200) & {
|
|
42
|
-
headers: Headers;
|
|
43
|
-
};
|
|
44
|
-
;
|
|
45
|
-
|
|
46
|
-
export type eventReportsListResponse = (eventReportsListResponseSuccess)
|
|
47
|
-
|
|
48
|
-
export const getEventReportsListUrl = (params?: EventReportsListParams,) => {
|
|
49
|
-
const normalizedParams = new URLSearchParams();
|
|
50
|
-
|
|
51
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
52
|
-
|
|
53
|
-
if (value !== undefined) {
|
|
54
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const stringifiedParams = normalizedParams.toString();
|
|
59
|
-
|
|
60
|
-
return stringifiedParams.length > 0 ? `/api/event-reports/?${stringifiedParams}` : `/api/event-reports/`
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export const eventReportsList = async (params?: EventReportsListParams, options?: RequestInit): Promise<eventReportsListResponse> => {
|
|
64
|
-
|
|
65
|
-
const res = await fetch(getEventReportsListUrl(params),
|
|
66
|
-
{
|
|
67
|
-
...options,
|
|
68
|
-
method: 'GET'
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
75
|
-
|
|
76
|
-
const data: eventReportsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
77
|
-
return { data, status: res.status, headers: res.headers } as eventReportsListResponse
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
export const getEventReportsListQueryKey = (params?: EventReportsListParams,) => {
|
|
85
|
-
return [
|
|
86
|
-
`/api/event-reports/`, ...(params ? [params] : [])
|
|
87
|
-
] as const;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
export const getEventReportsListQueryOptions = <TData = Awaited<ReturnType<typeof eventReportsList>>, TError = unknown>(params?: EventReportsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventReportsList>>, TError, TData>, fetch?: RequestInit}
|
|
92
|
-
) => {
|
|
93
|
-
|
|
94
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
95
|
-
|
|
96
|
-
const queryKey = queryOptions?.queryKey ?? getEventReportsListQueryKey(params);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof eventReportsList>>> = ({ signal }) => eventReportsList(params, { signal, ...fetchOptions });
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof eventReportsList>>, TError, TData> & { queryKey: QueryKey }
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export type EventReportsListQueryResult = NonNullable<Awaited<ReturnType<typeof eventReportsList>>>
|
|
110
|
-
export type EventReportsListQueryError = unknown
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @summary Список отчётов о мероприятиях
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
export function useEventReportsList<TData = Awaited<ReturnType<typeof eventReportsList>>, TError = unknown>(
|
|
118
|
-
params?: EventReportsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventReportsList>>, TError, TData>, fetch?: RequestInit}
|
|
119
|
-
|
|
120
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
121
|
-
|
|
122
|
-
const queryOptions = getEventReportsListQueryOptions(params,options)
|
|
123
|
-
|
|
124
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
125
|
-
|
|
126
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* API отчетов о мероприятиях
|
|
134
|
-
* @summary Получить отчёт о мероприятии по ID
|
|
135
|
-
*/
|
|
136
|
-
export type eventReportsRetrieveResponse200 = {
|
|
137
|
-
data: EventReport
|
|
138
|
-
status: 200
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export type eventReportsRetrieveResponse404 = {
|
|
142
|
-
data: void
|
|
143
|
-
status: 404
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type eventReportsRetrieveResponseSuccess = (eventReportsRetrieveResponse200) & {
|
|
147
|
-
headers: Headers;
|
|
148
|
-
};
|
|
149
|
-
export type eventReportsRetrieveResponseError = (eventReportsRetrieveResponse404) & {
|
|
150
|
-
headers: Headers;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export type eventReportsRetrieveResponse = (eventReportsRetrieveResponseSuccess | eventReportsRetrieveResponseError)
|
|
154
|
-
|
|
155
|
-
export const getEventReportsRetrieveUrl = (id: number,) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return `/api/event-reports/${id}/`
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export const eventReportsRetrieve = async (id: number, options?: RequestInit): Promise<eventReportsRetrieveResponse> => {
|
|
164
|
-
|
|
165
|
-
const res = await fetch(getEventReportsRetrieveUrl(id),
|
|
166
|
-
{
|
|
167
|
-
...options,
|
|
168
|
-
method: 'GET'
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
175
|
-
|
|
176
|
-
const data: eventReportsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
177
|
-
return { data, status: res.status, headers: res.headers } as eventReportsRetrieveResponse
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
export const getEventReportsRetrieveQueryKey = (id: number,) => {
|
|
185
|
-
return [
|
|
186
|
-
`/api/event-reports/${id}/`
|
|
187
|
-
] as const;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
export const getEventReportsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof eventReportsRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventReportsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
192
|
-
) => {
|
|
193
|
-
|
|
194
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
195
|
-
|
|
196
|
-
const queryKey = queryOptions?.queryKey ?? getEventReportsRetrieveQueryKey(id);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof eventReportsRetrieve>>> = ({ signal }) => eventReportsRetrieve(id, { signal, ...fetchOptions });
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof eventReportsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export type EventReportsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof eventReportsRetrieve>>>
|
|
210
|
-
export type EventReportsRetrieveQueryError = void
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* @summary Получить отчёт о мероприятии по ID
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
export function useEventReportsRetrieve<TData = Awaited<ReturnType<typeof eventReportsRetrieve>>, TError = void>(
|
|
218
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventReportsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
219
|
-
|
|
220
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
221
|
-
|
|
222
|
-
const queryOptions = getEventReportsRetrieveQueryOptions(id,options)
|
|
223
|
-
|
|
224
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
225
|
-
|
|
226
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
package/dist/events/events.ts
DELETED
|
@@ -1,231 +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
|
-
Event,
|
|
20
|
-
EventsListParams,
|
|
21
|
-
PaginatedEventList
|
|
22
|
-
} from '../api.schemas';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
26
|
-
|
|
27
|
-
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Возвращает список мероприятий. Поддерживает фильтрацию по датам и типу.
|
|
34
|
-
* @summary Список мероприятий
|
|
35
|
-
*/
|
|
36
|
-
export type eventsListResponse200 = {
|
|
37
|
-
data: PaginatedEventList
|
|
38
|
-
status: 200
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type eventsListResponseSuccess = (eventsListResponse200) & {
|
|
42
|
-
headers: Headers;
|
|
43
|
-
};
|
|
44
|
-
;
|
|
45
|
-
|
|
46
|
-
export type eventsListResponse = (eventsListResponseSuccess)
|
|
47
|
-
|
|
48
|
-
export const getEventsListUrl = (params?: EventsListParams,) => {
|
|
49
|
-
const normalizedParams = new URLSearchParams();
|
|
50
|
-
|
|
51
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
52
|
-
|
|
53
|
-
if (value !== undefined) {
|
|
54
|
-
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const stringifiedParams = normalizedParams.toString();
|
|
59
|
-
|
|
60
|
-
return stringifiedParams.length > 0 ? `/api/events/?${stringifiedParams}` : `/api/events/`
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export const eventsList = async (params?: EventsListParams, options?: RequestInit): Promise<eventsListResponse> => {
|
|
64
|
-
|
|
65
|
-
const res = await fetch(getEventsListUrl(params),
|
|
66
|
-
{
|
|
67
|
-
...options,
|
|
68
|
-
method: 'GET'
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
75
|
-
|
|
76
|
-
const data: eventsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
77
|
-
return { data, status: res.status, headers: res.headers } as eventsListResponse
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
export const getEventsListQueryKey = (params?: EventsListParams,) => {
|
|
85
|
-
return [
|
|
86
|
-
`/api/events/`, ...(params ? [params] : [])
|
|
87
|
-
] as const;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
export const getEventsListQueryOptions = <TData = Awaited<ReturnType<typeof eventsList>>, TError = unknown>(params?: EventsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventsList>>, TError, TData>, fetch?: RequestInit}
|
|
92
|
-
) => {
|
|
93
|
-
|
|
94
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
95
|
-
|
|
96
|
-
const queryKey = queryOptions?.queryKey ?? getEventsListQueryKey(params);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof eventsList>>> = ({ signal }) => eventsList(params, { signal, ...fetchOptions });
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof eventsList>>, TError, TData> & { queryKey: QueryKey }
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export type EventsListQueryResult = NonNullable<Awaited<ReturnType<typeof eventsList>>>
|
|
110
|
-
export type EventsListQueryError = unknown
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @summary Список мероприятий
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
export function useEventsList<TData = Awaited<ReturnType<typeof eventsList>>, TError = unknown>(
|
|
118
|
-
params?: EventsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventsList>>, TError, TData>, fetch?: RequestInit}
|
|
119
|
-
|
|
120
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
121
|
-
|
|
122
|
-
const queryOptions = getEventsListQueryOptions(params,options)
|
|
123
|
-
|
|
124
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
125
|
-
|
|
126
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* API мероприятий
|
|
134
|
-
* @summary Получить мероприятие по ID
|
|
135
|
-
*/
|
|
136
|
-
export type eventsRetrieveResponse200 = {
|
|
137
|
-
data: Event
|
|
138
|
-
status: 200
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export type eventsRetrieveResponse404 = {
|
|
142
|
-
data: void
|
|
143
|
-
status: 404
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type eventsRetrieveResponseSuccess = (eventsRetrieveResponse200) & {
|
|
147
|
-
headers: Headers;
|
|
148
|
-
};
|
|
149
|
-
export type eventsRetrieveResponseError = (eventsRetrieveResponse404) & {
|
|
150
|
-
headers: Headers;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export type eventsRetrieveResponse = (eventsRetrieveResponseSuccess | eventsRetrieveResponseError)
|
|
154
|
-
|
|
155
|
-
export const getEventsRetrieveUrl = (id: number,) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return `/api/events/${id}/`
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export const eventsRetrieve = async (id: number, options?: RequestInit): Promise<eventsRetrieveResponse> => {
|
|
164
|
-
|
|
165
|
-
const res = await fetch(getEventsRetrieveUrl(id),
|
|
166
|
-
{
|
|
167
|
-
...options,
|
|
168
|
-
method: 'GET'
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
175
|
-
|
|
176
|
-
const data: eventsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
177
|
-
return { data, status: res.status, headers: res.headers } as eventsRetrieveResponse
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
export const getEventsRetrieveQueryKey = (id: number,) => {
|
|
185
|
-
return [
|
|
186
|
-
`/api/events/${id}/`
|
|
187
|
-
] as const;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
export const getEventsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof eventsRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
192
|
-
) => {
|
|
193
|
-
|
|
194
|
-
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
195
|
-
|
|
196
|
-
const queryKey = queryOptions?.queryKey ?? getEventsRetrieveQueryKey(id);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof eventsRetrieve>>> = ({ signal }) => eventsRetrieve(id, { signal, ...fetchOptions });
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof eventsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export type EventsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof eventsRetrieve>>>
|
|
210
|
-
export type EventsRetrieveQueryError = void
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* @summary Получить мероприятие по ID
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
export function useEventsRetrieve<TData = Awaited<ReturnType<typeof eventsRetrieve>>, TError = void>(
|
|
218
|
-
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof eventsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
219
|
-
|
|
220
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
221
|
-
|
|
222
|
-
const queryOptions = getEventsRetrieveQueryOptions(id,options)
|
|
223
|
-
|
|
224
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
225
|
-
|
|
226
|
-
return { ...query, queryKey: queryOptions.queryKey };
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|