@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.
@@ -0,0 +1,332 @@
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
+ GalleriesHighlightsListParams,
20
+ GalleriesListParams,
21
+ Gallery,
22
+ PaginatedGalleryList
23
+ } from '../api.schemas';
24
+
25
+
26
+ type AwaitedInput<T> = PromiseLike<T> | T;
27
+
28
+ type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
29
+
30
+
31
+
32
+
33
+ /**
34
+ * API Π³Π°Π»Π΅Ρ€Π΅ΠΉ
35
+ * @summary Бписок Π³Π°Π»Π΅Ρ€Π΅ΠΉ
36
+ */
37
+ export type galleriesListResponse200 = {
38
+ data: PaginatedGalleryList
39
+ status: 200
40
+ }
41
+
42
+ export type galleriesListResponseSuccess = (galleriesListResponse200) & {
43
+ headers: Headers;
44
+ };
45
+ ;
46
+
47
+ export type galleriesListResponse = (galleriesListResponseSuccess)
48
+
49
+ export const getGalleriesListUrl = (params?: GalleriesListParams,) => {
50
+ const normalizedParams = new URLSearchParams();
51
+
52
+ Object.entries(params || {}).forEach(([key, value]) => {
53
+
54
+ if (value !== undefined) {
55
+ normalizedParams.append(key, value === null ? 'null' : value.toString())
56
+ }
57
+ });
58
+
59
+ const stringifiedParams = normalizedParams.toString();
60
+
61
+ return stringifiedParams.length > 0 ? `/api/galleries/?${stringifiedParams}` : `/api/galleries/`
62
+ }
63
+
64
+ export const galleriesList = async (params?: GalleriesListParams, options?: RequestInit): Promise<galleriesListResponse> => {
65
+
66
+ const res = await fetch(getGalleriesListUrl(params),
67
+ {
68
+ ...options,
69
+ method: 'GET'
70
+
71
+
72
+ }
73
+ )
74
+
75
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
76
+
77
+ const data: galleriesListResponse['data'] = body ? JSON.parse(body) : {}
78
+ return { data, status: res.status, headers: res.headers } as galleriesListResponse
79
+ }
80
+
81
+
82
+
83
+
84
+
85
+ export const getGalleriesListQueryKey = (params?: GalleriesListParams,) => {
86
+ return [
87
+ `/api/galleries/`, ...(params ? [params] : [])
88
+ ] as const;
89
+ }
90
+
91
+
92
+ export const getGalleriesListQueryOptions = <TData = Awaited<ReturnType<typeof galleriesList>>, TError = unknown>(params?: GalleriesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof galleriesList>>, TError, TData>, fetch?: RequestInit}
93
+ ) => {
94
+
95
+ const {query: queryOptions, fetch: fetchOptions} = options ?? {};
96
+
97
+ const queryKey = queryOptions?.queryKey ?? getGalleriesListQueryKey(params);
98
+
99
+
100
+
101
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof galleriesList>>> = ({ signal }) => galleriesList(params, { signal, ...fetchOptions });
102
+
103
+
104
+
105
+
106
+
107
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof galleriesList>>, TError, TData> & { queryKey: QueryKey }
108
+ }
109
+
110
+ export type GalleriesListQueryResult = NonNullable<Awaited<ReturnType<typeof galleriesList>>>
111
+ export type GalleriesListQueryError = unknown
112
+
113
+
114
+ /**
115
+ * @summary Бписок Π³Π°Π»Π΅Ρ€Π΅ΠΉ
116
+ */
117
+
118
+ export function useGalleriesList<TData = Awaited<ReturnType<typeof galleriesList>>, TError = unknown>(
119
+ params?: GalleriesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof galleriesList>>, TError, TData>, fetch?: RequestInit}
120
+
121
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
122
+
123
+ const queryOptions = getGalleriesListQueryOptions(params,options)
124
+
125
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
126
+
127
+ return { ...query, queryKey: queryOptions.queryKey };
128
+ }
129
+
130
+
131
+
132
+
133
+ /**
134
+ * API Π³Π°Π»Π΅Ρ€Π΅ΠΉ
135
+ * @summary ΠŸΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ Π³Π°Π»Π΅Ρ€Π΅ΡŽ ΠΏΠΎ ID
136
+ */
137
+ export type galleriesRetrieveResponse200 = {
138
+ data: Gallery
139
+ status: 200
140
+ }
141
+
142
+ export type galleriesRetrieveResponse404 = {
143
+ data: void
144
+ status: 404
145
+ }
146
+
147
+ export type galleriesRetrieveResponseSuccess = (galleriesRetrieveResponse200) & {
148
+ headers: Headers;
149
+ };
150
+ export type galleriesRetrieveResponseError = (galleriesRetrieveResponse404) & {
151
+ headers: Headers;
152
+ };
153
+
154
+ export type galleriesRetrieveResponse = (galleriesRetrieveResponseSuccess | galleriesRetrieveResponseError)
155
+
156
+ export const getGalleriesRetrieveUrl = (id: number,) => {
157
+
158
+
159
+
160
+
161
+ return `/api/galleries/${id}/`
162
+ }
163
+
164
+ export const galleriesRetrieve = async (id: number, options?: RequestInit): Promise<galleriesRetrieveResponse> => {
165
+
166
+ const res = await fetch(getGalleriesRetrieveUrl(id),
167
+ {
168
+ ...options,
169
+ method: 'GET'
170
+
171
+
172
+ }
173
+ )
174
+
175
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
176
+
177
+ const data: galleriesRetrieveResponse['data'] = body ? JSON.parse(body) : {}
178
+ return { data, status: res.status, headers: res.headers } as galleriesRetrieveResponse
179
+ }
180
+
181
+
182
+
183
+
184
+
185
+ export const getGalleriesRetrieveQueryKey = (id: number,) => {
186
+ return [
187
+ `/api/galleries/${id}/`
188
+ ] as const;
189
+ }
190
+
191
+
192
+ export const getGalleriesRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof galleriesRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof galleriesRetrieve>>, TError, TData>, fetch?: RequestInit}
193
+ ) => {
194
+
195
+ const {query: queryOptions, fetch: fetchOptions} = options ?? {};
196
+
197
+ const queryKey = queryOptions?.queryKey ?? getGalleriesRetrieveQueryKey(id);
198
+
199
+
200
+
201
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof galleriesRetrieve>>> = ({ signal }) => galleriesRetrieve(id, { signal, ...fetchOptions });
202
+
203
+
204
+
205
+
206
+
207
+ return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof galleriesRetrieve>>, TError, TData> & { queryKey: QueryKey }
208
+ }
209
+
210
+ export type GalleriesRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof galleriesRetrieve>>>
211
+ export type GalleriesRetrieveQueryError = void
212
+
213
+
214
+ /**
215
+ * @summary ΠŸΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ Π³Π°Π»Π΅Ρ€Π΅ΡŽ ΠΏΠΎ ID
216
+ */
217
+
218
+ export function useGalleriesRetrieve<TData = Awaited<ReturnType<typeof galleriesRetrieve>>, TError = void>(
219
+ id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof galleriesRetrieve>>, TError, TData>, fetch?: RequestInit}
220
+
221
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
222
+
223
+ const queryOptions = getGalleriesRetrieveQueryOptions(id,options)
224
+
225
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
226
+
227
+ return { ...query, queryKey: queryOptions.queryKey };
228
+ }
229
+
230
+
231
+
232
+
233
+ /**
234
+ * Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ Π³Π°Π»Π΅Ρ€Π΅ΠΈ, ΠΎΡ‚ΠΌΠ΅Ρ‡Π΅Π½Π½Ρ‹Π΅ ΠΊΠ°ΠΊ ΠΈΠ·Π±Ρ€Π°Π½Π½Ρ‹Π΅ (для Π³Π»Π°Π²Π½ΠΎΠΉ страницы).
235
+ * @summary Π˜Π·Π±Ρ€Π°Π½Π½Ρ‹Π΅ Π³Π°Π»Π΅Ρ€Π΅ΠΈ
236
+ */
237
+ export type galleriesHighlightsListResponse200 = {
238
+ data: PaginatedGalleryList
239
+ status: 200
240
+ }
241
+
242
+ export type galleriesHighlightsListResponseSuccess = (galleriesHighlightsListResponse200) & {
243
+ headers: Headers;
244
+ };
245
+ ;
246
+
247
+ export type galleriesHighlightsListResponse = (galleriesHighlightsListResponseSuccess)
248
+
249
+ export const getGalleriesHighlightsListUrl = (params?: GalleriesHighlightsListParams,) => {
250
+ const normalizedParams = new URLSearchParams();
251
+
252
+ Object.entries(params || {}).forEach(([key, value]) => {
253
+
254
+ if (value !== undefined) {
255
+ normalizedParams.append(key, value === null ? 'null' : value.toString())
256
+ }
257
+ });
258
+
259
+ const stringifiedParams = normalizedParams.toString();
260
+
261
+ return stringifiedParams.length > 0 ? `/api/galleries/highlights/?${stringifiedParams}` : `/api/galleries/highlights/`
262
+ }
263
+
264
+ export const galleriesHighlightsList = async (params?: GalleriesHighlightsListParams, options?: RequestInit): Promise<galleriesHighlightsListResponse> => {
265
+
266
+ const res = await fetch(getGalleriesHighlightsListUrl(params),
267
+ {
268
+ ...options,
269
+ method: 'GET'
270
+
271
+
272
+ }
273
+ )
274
+
275
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
276
+
277
+ const data: galleriesHighlightsListResponse['data'] = body ? JSON.parse(body) : {}
278
+ return { data, status: res.status, headers: res.headers } as galleriesHighlightsListResponse
279
+ }
280
+
281
+
282
+
283
+
284
+
285
+ export const getGalleriesHighlightsListQueryKey = (params?: GalleriesHighlightsListParams,) => {
286
+ return [
287
+ `/api/galleries/highlights/`, ...(params ? [params] : [])
288
+ ] as const;
289
+ }
290
+
291
+
292
+ export const getGalleriesHighlightsListQueryOptions = <TData = Awaited<ReturnType<typeof galleriesHighlightsList>>, TError = unknown>(params?: GalleriesHighlightsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof galleriesHighlightsList>>, TError, TData>, fetch?: RequestInit}
293
+ ) => {
294
+
295
+ const {query: queryOptions, fetch: fetchOptions} = options ?? {};
296
+
297
+ const queryKey = queryOptions?.queryKey ?? getGalleriesHighlightsListQueryKey(params);
298
+
299
+
300
+
301
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof galleriesHighlightsList>>> = ({ signal }) => galleriesHighlightsList(params, { signal, ...fetchOptions });
302
+
303
+
304
+
305
+
306
+
307
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof galleriesHighlightsList>>, TError, TData> & { queryKey: QueryKey }
308
+ }
309
+
310
+ export type GalleriesHighlightsListQueryResult = NonNullable<Awaited<ReturnType<typeof galleriesHighlightsList>>>
311
+ export type GalleriesHighlightsListQueryError = unknown
312
+
313
+
314
+ /**
315
+ * @summary Π˜Π·Π±Ρ€Π°Π½Π½Ρ‹Π΅ Π³Π°Π»Π΅Ρ€Π΅ΠΈ
316
+ */
317
+
318
+ export function useGalleriesHighlightsList<TData = Awaited<ReturnType<typeof galleriesHighlightsList>>, TError = unknown>(
319
+ params?: GalleriesHighlightsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof galleriesHighlightsList>>, TError, TData>, fetch?: RequestInit}
320
+
321
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
322
+
323
+ const queryOptions = getGalleriesHighlightsListQueryOptions(params,options)
324
+
325
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
326
+
327
+ return { ...query, queryKey: queryOptions.queryKey };
328
+ }
329
+
330
+
331
+
332
+
@@ -0,0 +1,216 @@
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
+ ActivityFeedResponse,
20
+ HomeResponse
21
+ } from '../api.schemas';
22
+
23
+
24
+ type AwaitedInput<T> = PromiseLike<T> | T;
25
+
26
+ type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
27
+
28
+
29
+
30
+
31
+ /**
32
+ * Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ послСдниС сообщСния ΠΈΠ· Telegram-ΠΊΠ°Π½Π°Π»Π° ΠΊΠ»ΡƒΠ±Π° (ΠΊΠ΅ΡˆΠΈΡ€ΡƒΠ΅Ρ‚ΡΡ Π½Π° 1 ΠΌΠΈΠ½ΡƒΡ‚Ρƒ).
33
+ * @summary Π›Π΅Π½Ρ‚Π° активности
34
+ */
35
+ export type activityFeedRetrieveResponse200 = {
36
+ data: ActivityFeedResponse
37
+ status: 200
38
+ }
39
+
40
+ export type activityFeedRetrieveResponseSuccess = (activityFeedRetrieveResponse200) & {
41
+ headers: Headers;
42
+ };
43
+ ;
44
+
45
+ export type activityFeedRetrieveResponse = (activityFeedRetrieveResponseSuccess)
46
+
47
+ export const getActivityFeedRetrieveUrl = () => {
48
+
49
+
50
+
51
+
52
+ return `/api/activity-feed/`
53
+ }
54
+
55
+ export const activityFeedRetrieve = async ( options?: RequestInit): Promise<activityFeedRetrieveResponse> => {
56
+
57
+ const res = await fetch(getActivityFeedRetrieveUrl(),
58
+ {
59
+ ...options,
60
+ method: 'GET'
61
+
62
+
63
+ }
64
+ )
65
+
66
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
67
+
68
+ const data: activityFeedRetrieveResponse['data'] = body ? JSON.parse(body) : {}
69
+ return { data, status: res.status, headers: res.headers } as activityFeedRetrieveResponse
70
+ }
71
+
72
+
73
+
74
+
75
+
76
+ export const getActivityFeedRetrieveQueryKey = () => {
77
+ return [
78
+ `/api/activity-feed/`
79
+ ] as const;
80
+ }
81
+
82
+
83
+ export const getActivityFeedRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof activityFeedRetrieve>>, TError = unknown>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof activityFeedRetrieve>>, TError, TData>, fetch?: RequestInit}
84
+ ) => {
85
+
86
+ const {query: queryOptions, fetch: fetchOptions} = options ?? {};
87
+
88
+ const queryKey = queryOptions?.queryKey ?? getActivityFeedRetrieveQueryKey();
89
+
90
+
91
+
92
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof activityFeedRetrieve>>> = ({ signal }) => activityFeedRetrieve({ signal, ...fetchOptions });
93
+
94
+
95
+
96
+
97
+
98
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof activityFeedRetrieve>>, TError, TData> & { queryKey: QueryKey }
99
+ }
100
+
101
+ export type ActivityFeedRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof activityFeedRetrieve>>>
102
+ export type ActivityFeedRetrieveQueryError = unknown
103
+
104
+
105
+ /**
106
+ * @summary Π›Π΅Π½Ρ‚Π° активности
107
+ */
108
+
109
+ export function useActivityFeedRetrieve<TData = Awaited<ReturnType<typeof activityFeedRetrieve>>, TError = unknown>(
110
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof activityFeedRetrieve>>, TError, TData>, fetch?: RequestInit}
111
+
112
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
113
+
114
+ const queryOptions = getActivityFeedRetrieveQueryOptions(options)
115
+
116
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
117
+
118
+ return { ...query, queryKey: queryOptions.queryKey };
119
+ }
120
+
121
+
122
+
123
+
124
+ /**
125
+ * Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ ΠΈΠ·Π±Ρ€Π°Π½Π½Ρ‹Π΅ новости (Π΄ΠΎ 3), блиТайшиС мСроприятия (Π΄ΠΎ 5) ΠΈ ΠΈΠ·Π±Ρ€Π°Π½Π½Ρ‹Π΅ Π³Π°Π»Π΅Ρ€Π΅ΠΈ (Π΄ΠΎ 2).
126
+ * @summary Π”Π°Π½Π½Ρ‹Π΅ для Π³Π»Π°Π²Π½ΠΎΠΉ страницы
127
+ */
128
+ export type homeRetrieveResponse200 = {
129
+ data: HomeResponse
130
+ status: 200
131
+ }
132
+
133
+ export type homeRetrieveResponseSuccess = (homeRetrieveResponse200) & {
134
+ headers: Headers;
135
+ };
136
+ ;
137
+
138
+ export type homeRetrieveResponse = (homeRetrieveResponseSuccess)
139
+
140
+ export const getHomeRetrieveUrl = () => {
141
+
142
+
143
+
144
+
145
+ return `/api/home/`
146
+ }
147
+
148
+ export const homeRetrieve = async ( options?: RequestInit): Promise<homeRetrieveResponse> => {
149
+
150
+ const res = await fetch(getHomeRetrieveUrl(),
151
+ {
152
+ ...options,
153
+ method: 'GET'
154
+
155
+
156
+ }
157
+ )
158
+
159
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
160
+
161
+ const data: homeRetrieveResponse['data'] = body ? JSON.parse(body) : {}
162
+ return { data, status: res.status, headers: res.headers } as homeRetrieveResponse
163
+ }
164
+
165
+
166
+
167
+
168
+
169
+ export const getHomeRetrieveQueryKey = () => {
170
+ return [
171
+ `/api/home/`
172
+ ] as const;
173
+ }
174
+
175
+
176
+ export const getHomeRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof homeRetrieve>>, TError = unknown>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof homeRetrieve>>, TError, TData>, fetch?: RequestInit}
177
+ ) => {
178
+
179
+ const {query: queryOptions, fetch: fetchOptions} = options ?? {};
180
+
181
+ const queryKey = queryOptions?.queryKey ?? getHomeRetrieveQueryKey();
182
+
183
+
184
+
185
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof homeRetrieve>>> = ({ signal }) => homeRetrieve({ signal, ...fetchOptions });
186
+
187
+
188
+
189
+
190
+
191
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof homeRetrieve>>, TError, TData> & { queryKey: QueryKey }
192
+ }
193
+
194
+ export type HomeRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof homeRetrieve>>>
195
+ export type HomeRetrieveQueryError = unknown
196
+
197
+
198
+ /**
199
+ * @summary Π”Π°Π½Π½Ρ‹Π΅ для Π³Π»Π°Π²Π½ΠΎΠΉ страницы
200
+ */
201
+
202
+ export function useHomeRetrieve<TData = Awaited<ReturnType<typeof homeRetrieve>>, TError = unknown>(
203
+ options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof homeRetrieve>>, TError, TData>, fetch?: RequestInit}
204
+
205
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
206
+
207
+ const queryOptions = getHomeRetrieveQueryOptions(options)
208
+
209
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
210
+
211
+ return { ...query, queryKey: queryOptions.queryKey };
212
+ }
213
+
214
+
215
+
216
+