@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
|
+
News,
|
|
20
|
+
NewsListParams,
|
|
21
|
+
PaginatedNewsList
|
|
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 newsListResponse200 = {
|
|
37
|
+
data: PaginatedNewsList
|
|
38
|
+
status: 200
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type newsListResponseSuccess = (newsListResponse200) & {
|
|
42
|
+
headers: Headers;
|
|
43
|
+
};
|
|
44
|
+
;
|
|
45
|
+
|
|
46
|
+
export type newsListResponse = (newsListResponseSuccess)
|
|
47
|
+
|
|
48
|
+
export const getNewsListUrl = (params?: NewsListParams,) => {
|
|
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/news/?${stringifiedParams}` : `/api/news/`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const newsList = async (params?: NewsListParams, options?: RequestInit): Promise<newsListResponse> => {
|
|
64
|
+
|
|
65
|
+
const res = await fetch(getNewsListUrl(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: newsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
77
|
+
return { data, status: res.status, headers: res.headers } as newsListResponse
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export const getNewsListQueryKey = (params?: NewsListParams,) => {
|
|
85
|
+
return [
|
|
86
|
+
`/api/news/`, ...(params ? [params] : [])
|
|
87
|
+
] as const;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export const getNewsListQueryOptions = <TData = Awaited<ReturnType<typeof newsList>>, TError = unknown>(params?: NewsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof newsList>>, TError, TData>, fetch?: RequestInit}
|
|
92
|
+
) => {
|
|
93
|
+
|
|
94
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
95
|
+
|
|
96
|
+
const queryKey = queryOptions?.queryKey ?? getNewsListQueryKey(params);
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof newsList>>> = ({ signal }) => newsList(params, { signal, ...fetchOptions });
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof newsList>>, TError, TData> & { queryKey: QueryKey }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type NewsListQueryResult = NonNullable<Awaited<ReturnType<typeof newsList>>>
|
|
110
|
+
export type NewsListQueryError = unknown
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @summary Π‘ΠΏΠΈΡΠΎΠΊ Π½ΠΎΠ²ΠΎΡΡΠ΅ΠΉ
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
export function useNewsList<TData = Awaited<ReturnType<typeof newsList>>, TError = unknown>(
|
|
118
|
+
params?: NewsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof newsList>>, TError, TData>, fetch?: RequestInit}
|
|
119
|
+
|
|
120
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
121
|
+
|
|
122
|
+
const queryOptions = getNewsListQueryOptions(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 newsRetrieveResponse200 = {
|
|
137
|
+
data: News
|
|
138
|
+
status: 200
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type newsRetrieveResponse404 = {
|
|
142
|
+
data: void
|
|
143
|
+
status: 404
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type newsRetrieveResponseSuccess = (newsRetrieveResponse200) & {
|
|
147
|
+
headers: Headers;
|
|
148
|
+
};
|
|
149
|
+
export type newsRetrieveResponseError = (newsRetrieveResponse404) & {
|
|
150
|
+
headers: Headers;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type newsRetrieveResponse = (newsRetrieveResponseSuccess | newsRetrieveResponseError)
|
|
154
|
+
|
|
155
|
+
export const getNewsRetrieveUrl = (id: number,) => {
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
return `/api/news/${id}/`
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const newsRetrieve = async (id: number, options?: RequestInit): Promise<newsRetrieveResponse> => {
|
|
164
|
+
|
|
165
|
+
const res = await fetch(getNewsRetrieveUrl(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: newsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
177
|
+
return { data, status: res.status, headers: res.headers } as newsRetrieveResponse
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
export const getNewsRetrieveQueryKey = (id: number,) => {
|
|
185
|
+
return [
|
|
186
|
+
`/api/news/${id}/`
|
|
187
|
+
] as const;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
export const getNewsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof newsRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof newsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
192
|
+
) => {
|
|
193
|
+
|
|
194
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
195
|
+
|
|
196
|
+
const queryKey = queryOptions?.queryKey ?? getNewsRetrieveQueryKey(id);
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof newsRetrieve>>> = ({ signal }) => newsRetrieve(id, { signal, ...fetchOptions });
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof newsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export type NewsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof newsRetrieve>>>
|
|
210
|
+
export type NewsRetrieveQueryError = void
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ Π½ΠΎΠ²ΠΎΡΡΡ ΠΏΠΎ ID
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
export function useNewsRetrieve<TData = Awaited<ReturnType<typeof newsRetrieve>>, TError = void>(
|
|
218
|
+
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof newsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
219
|
+
|
|
220
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
221
|
+
|
|
222
|
+
const queryOptions = getNewsRetrieveQueryOptions(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
|
+
Page,
|
|
20
|
+
PagesListParams,
|
|
21
|
+
PaginatedPageList
|
|
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 CMS ΡΡΡΠ°Π½ΠΈΡ
|
|
34
|
+
* @summary Π‘ΠΏΠΈΡΠΎΠΊ CMS-ΡΡΡΠ°Π½ΠΈΡ
|
|
35
|
+
*/
|
|
36
|
+
export type pagesListResponse200 = {
|
|
37
|
+
data: PaginatedPageList
|
|
38
|
+
status: 200
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type pagesListResponseSuccess = (pagesListResponse200) & {
|
|
42
|
+
headers: Headers;
|
|
43
|
+
};
|
|
44
|
+
;
|
|
45
|
+
|
|
46
|
+
export type pagesListResponse = (pagesListResponseSuccess)
|
|
47
|
+
|
|
48
|
+
export const getPagesListUrl = (params?: PagesListParams,) => {
|
|
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/pages/?${stringifiedParams}` : `/api/pages/`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const pagesList = async (params?: PagesListParams, options?: RequestInit): Promise<pagesListResponse> => {
|
|
64
|
+
|
|
65
|
+
const res = await fetch(getPagesListUrl(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: pagesListResponse['data'] = body ? JSON.parse(body) : {}
|
|
77
|
+
return { data, status: res.status, headers: res.headers } as pagesListResponse
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export const getPagesListQueryKey = (params?: PagesListParams,) => {
|
|
85
|
+
return [
|
|
86
|
+
`/api/pages/`, ...(params ? [params] : [])
|
|
87
|
+
] as const;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export const getPagesListQueryOptions = <TData = Awaited<ReturnType<typeof pagesList>>, TError = unknown>(params?: PagesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof pagesList>>, TError, TData>, fetch?: RequestInit}
|
|
92
|
+
) => {
|
|
93
|
+
|
|
94
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
95
|
+
|
|
96
|
+
const queryKey = queryOptions?.queryKey ?? getPagesListQueryKey(params);
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof pagesList>>> = ({ signal }) => pagesList(params, { signal, ...fetchOptions });
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof pagesList>>, TError, TData> & { queryKey: QueryKey }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type PagesListQueryResult = NonNullable<Awaited<ReturnType<typeof pagesList>>>
|
|
110
|
+
export type PagesListQueryError = unknown
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @summary Π‘ΠΏΠΈΡΠΎΠΊ CMS-ΡΡΡΠ°Π½ΠΈΡ
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
export function usePagesList<TData = Awaited<ReturnType<typeof pagesList>>, TError = unknown>(
|
|
118
|
+
params?: PagesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof pagesList>>, TError, TData>, fetch?: RequestInit}
|
|
119
|
+
|
|
120
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
121
|
+
|
|
122
|
+
const queryOptions = getPagesListQueryOptions(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 CMS ΡΡΡΠ°Π½ΠΈΡ
|
|
134
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ CMS-ΡΡΡΠ°Π½ΠΈΡΡ ΠΏΠΎ slug
|
|
135
|
+
*/
|
|
136
|
+
export type pagesRetrieveResponse200 = {
|
|
137
|
+
data: Page
|
|
138
|
+
status: 200
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type pagesRetrieveResponse404 = {
|
|
142
|
+
data: void
|
|
143
|
+
status: 404
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type pagesRetrieveResponseSuccess = (pagesRetrieveResponse200) & {
|
|
147
|
+
headers: Headers;
|
|
148
|
+
};
|
|
149
|
+
export type pagesRetrieveResponseError = (pagesRetrieveResponse404) & {
|
|
150
|
+
headers: Headers;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type pagesRetrieveResponse = (pagesRetrieveResponseSuccess | pagesRetrieveResponseError)
|
|
154
|
+
|
|
155
|
+
export const getPagesRetrieveUrl = (slug: string,) => {
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
return `/api/pages/${slug}/`
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const pagesRetrieve = async (slug: string, options?: RequestInit): Promise<pagesRetrieveResponse> => {
|
|
164
|
+
|
|
165
|
+
const res = await fetch(getPagesRetrieveUrl(slug),
|
|
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: pagesRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
177
|
+
return { data, status: res.status, headers: res.headers } as pagesRetrieveResponse
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
export const getPagesRetrieveQueryKey = (slug: string,) => {
|
|
185
|
+
return [
|
|
186
|
+
`/api/pages/${slug}/`
|
|
187
|
+
] as const;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
export const getPagesRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof pagesRetrieve>>, TError = void>(slug: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof pagesRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
192
|
+
) => {
|
|
193
|
+
|
|
194
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
195
|
+
|
|
196
|
+
const queryKey = queryOptions?.queryKey ?? getPagesRetrieveQueryKey(slug);
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof pagesRetrieve>>> = ({ signal }) => pagesRetrieve(slug, { signal, ...fetchOptions });
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
return { queryKey, queryFn, enabled: !!(slug), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof pagesRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export type PagesRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof pagesRetrieve>>>
|
|
210
|
+
export type PagesRetrieveQueryError = void
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ CMS-ΡΡΡΠ°Π½ΠΈΡΡ ΠΏΠΎ slug
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
export function usePagesRetrieve<TData = Awaited<ReturnType<typeof pagesRetrieve>>, TError = void>(
|
|
218
|
+
slug: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof pagesRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
219
|
+
|
|
220
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
221
|
+
|
|
222
|
+
const queryOptions = getPagesRetrieveQueryOptions(slug,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,246 @@
|
|
|
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
|
+
useMutation,
|
|
10
|
+
useQuery
|
|
11
|
+
} from '@tanstack/react-query';
|
|
12
|
+
import type {
|
|
13
|
+
MutationFunction,
|
|
14
|
+
QueryFunction,
|
|
15
|
+
QueryKey,
|
|
16
|
+
UseMutationOptions,
|
|
17
|
+
UseMutationResult,
|
|
18
|
+
UseQueryOptions,
|
|
19
|
+
UseQueryResult
|
|
20
|
+
} from '@tanstack/react-query';
|
|
21
|
+
|
|
22
|
+
import type {
|
|
23
|
+
UserProfile,
|
|
24
|
+
UserProfileRequest
|
|
25
|
+
} from '../api.schemas';
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
29
|
+
|
|
30
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΏΡΠΎΡΠΈΠ»Ρ ΡΠ΅ΠΊΡΡΠ΅Π³ΠΎ Π°Π²ΡΠΎΡΠΈΠ·ΠΎΠ²Π°Π½Π½ΠΎΠ³ΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ.
|
|
37
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ ΡΠ²ΠΎΠΉ ΠΏΡΠΎΡΠΈΠ»Ρ
|
|
38
|
+
*/
|
|
39
|
+
export type meRetrieveResponse200 = {
|
|
40
|
+
data: UserProfile
|
|
41
|
+
status: 200
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type meRetrieveResponse401 = {
|
|
45
|
+
data: void
|
|
46
|
+
status: 401
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type meRetrieveResponse404 = {
|
|
50
|
+
data: void
|
|
51
|
+
status: 404
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type meRetrieveResponseSuccess = (meRetrieveResponse200) & {
|
|
55
|
+
headers: Headers;
|
|
56
|
+
};
|
|
57
|
+
export type meRetrieveResponseError = (meRetrieveResponse401 | meRetrieveResponse404) & {
|
|
58
|
+
headers: Headers;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type meRetrieveResponse = (meRetrieveResponseSuccess | meRetrieveResponseError)
|
|
62
|
+
|
|
63
|
+
export const getMeRetrieveUrl = () => {
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
return `/api/me/`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const meRetrieve = async ( options?: RequestInit): Promise<meRetrieveResponse> => {
|
|
72
|
+
|
|
73
|
+
const res = await fetch(getMeRetrieveUrl(),
|
|
74
|
+
{
|
|
75
|
+
...options,
|
|
76
|
+
method: 'GET'
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
83
|
+
|
|
84
|
+
const data: meRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
85
|
+
return { data, status: res.status, headers: res.headers } as meRetrieveResponse
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
export const getMeRetrieveQueryKey = () => {
|
|
93
|
+
return [
|
|
94
|
+
`/api/me/`
|
|
95
|
+
] as const;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
export const getMeRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof meRetrieve>>, TError = void>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
100
|
+
) => {
|
|
101
|
+
|
|
102
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
103
|
+
|
|
104
|
+
const queryKey = queryOptions?.queryKey ?? getMeRetrieveQueryKey();
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof meRetrieve>>> = ({ signal }) => meRetrieve({ signal, ...fetchOptions });
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof meRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type MeRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof meRetrieve>>>
|
|
118
|
+
export type MeRetrieveQueryError = void
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ ΡΠ²ΠΎΠΉ ΠΏΡΠΎΡΠΈΠ»Ρ
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
export function useMeRetrieve<TData = Awaited<ReturnType<typeof meRetrieve>>, TError = void>(
|
|
126
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof meRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
127
|
+
|
|
128
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
129
|
+
|
|
130
|
+
const queryOptions = getMeRetrieveQueryOptions(options)
|
|
131
|
+
|
|
132
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
133
|
+
|
|
134
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Π§Π°ΡΡΠΈΡΠ½ΠΎΠ΅ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΏΡΠΎΡΠΈΠ»Ρ ΡΠ΅ΠΊΡΡΠ΅Π³ΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ.
|
|
142
|
+
* @summary ΠΠ±Π½ΠΎΠ²ΠΈΡΡ ΡΠ²ΠΎΠΉ ΠΏΡΠΎΡΠΈΠ»Ρ
|
|
143
|
+
*/
|
|
144
|
+
export type meProfileUpdateResponse200 = {
|
|
145
|
+
data: UserProfile
|
|
146
|
+
status: 200
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export type meProfileUpdateResponse400 = {
|
|
150
|
+
data: void
|
|
151
|
+
status: 400
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type meProfileUpdateResponse401 = {
|
|
155
|
+
data: void
|
|
156
|
+
status: 401
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type meProfileUpdateResponse404 = {
|
|
160
|
+
data: void
|
|
161
|
+
status: 404
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export type meProfileUpdateResponseSuccess = (meProfileUpdateResponse200) & {
|
|
165
|
+
headers: Headers;
|
|
166
|
+
};
|
|
167
|
+
export type meProfileUpdateResponseError = (meProfileUpdateResponse400 | meProfileUpdateResponse401 | meProfileUpdateResponse404) & {
|
|
168
|
+
headers: Headers;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type meProfileUpdateResponse = (meProfileUpdateResponseSuccess | meProfileUpdateResponseError)
|
|
172
|
+
|
|
173
|
+
export const getMeProfileUpdateUrl = () => {
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
return `/api/me/profile/`
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const meProfileUpdate = async (userProfileRequest: UserProfileRequest, options?: RequestInit): Promise<meProfileUpdateResponse> => {
|
|
182
|
+
|
|
183
|
+
const res = await fetch(getMeProfileUpdateUrl(),
|
|
184
|
+
{
|
|
185
|
+
...options,
|
|
186
|
+
method: 'PUT',
|
|
187
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
188
|
+
body: JSON.stringify(
|
|
189
|
+
userProfileRequest,)
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
194
|
+
|
|
195
|
+
const data: meProfileUpdateResponse['data'] = body ? JSON.parse(body) : {}
|
|
196
|
+
return { data, status: res.status, headers: res.headers } as meProfileUpdateResponse
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
export const getMeProfileUpdateMutationOptions = <TError = void,
|
|
203
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meProfileUpdate>>, TError,{data: UserProfileRequest}, TContext>, fetch?: RequestInit}
|
|
204
|
+
): UseMutationOptions<Awaited<ReturnType<typeof meProfileUpdate>>, TError,{data: UserProfileRequest}, TContext> => {
|
|
205
|
+
|
|
206
|
+
const mutationKey = ['meProfileUpdate'];
|
|
207
|
+
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
|
|
208
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
209
|
+
options
|
|
210
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
211
|
+
: {mutation: { mutationKey, }, fetch: undefined};
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof meProfileUpdate>>, {data: UserProfileRequest}> = (props) => {
|
|
217
|
+
const {data} = props ?? {};
|
|
218
|
+
|
|
219
|
+
return meProfileUpdate(data,fetchOptions)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
return { mutationFn, ...mutationOptions }}
|
|
228
|
+
|
|
229
|
+
export type MeProfileUpdateMutationResult = NonNullable<Awaited<ReturnType<typeof meProfileUpdate>>>
|
|
230
|
+
export type MeProfileUpdateMutationBody = UserProfileRequest
|
|
231
|
+
export type MeProfileUpdateMutationError = void
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @summary ΠΠ±Π½ΠΎΠ²ΠΈΡΡ ΡΠ²ΠΎΠΉ ΠΏΡΠΎΡΠΈΠ»Ρ
|
|
235
|
+
*/
|
|
236
|
+
export const useMeProfileUpdate = <TError = void,
|
|
237
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof meProfileUpdate>>, TError,{data: UserProfileRequest}, TContext>, fetch?: RequestInit}
|
|
238
|
+
): UseMutationResult<
|
|
239
|
+
Awaited<ReturnType<typeof meProfileUpdate>>,
|
|
240
|
+
TError,
|
|
241
|
+
{data: UserProfileRequest},
|
|
242
|
+
TContext
|
|
243
|
+
> => {
|
|
244
|
+
return useMutation(getMeProfileUpdateMutationOptions(options));
|
|
245
|
+
}
|
|
246
|
+
|