@omerikanec/api-client-demo 0.0.1
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/CHANGELOG.md +895 -0
- package/dist/api.schemas.ts +1923 -0
- package/dist/auth/auth.ts +221 -0
- package/dist/breed/breed.ts +434 -0
- package/dist/club-documents/club-documents.ts +231 -0
- package/dist/club-stats/club-stats.ts +122 -0
- package/dist/content-dictionary/content-dictionary.ts +345 -0
- package/dist/dog-references/dog-references.ts +1043 -0
- package/dist/dogs/dogs.ts +972 -0
- package/dist/event-reports/event-reports.ts +231 -0
- package/dist/events/events.ts +231 -0
- package/dist/galleries/galleries.ts +332 -0
- package/dist/home/home.ts +216 -0
- package/dist/import-breedarchive/import-breedarchive.ts +417 -0
- package/dist/import-hybrid/import-hybrid.ts +320 -0
- package/dist/import-hybrid-full/import-hybrid-full.ts +320 -0
- package/dist/import-zooportal/import-zooportal.ts +335 -0
- package/dist/index.ts +32 -0
- package/dist/judges/judges.ts +434 -0
- package/dist/leadership/leadership.ts +433 -0
- package/dist/my-achievements/my-achievements.ts +243 -0
- package/dist/my-applications/my-applications.ts +665 -0
- package/dist/my-dogs/my-dogs.ts +772 -0
- package/dist/my-kennels/my-kennels.ts +665 -0
- package/dist/my-litters/my-litters.ts +665 -0
- package/dist/news/news.ts +231 -0
- package/dist/pages/pages.ts +231 -0
- package/dist/profile/profile.ts +246 -0
- package/dist/status-of-import-task/status-of-import-task.ts +129 -0
- package/package.json +37 -0
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
|