@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
package/dist/news/news.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
|
-
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
|
-
|
package/dist/pages/pages.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
|
-
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
|
-
|
package/dist/profile/profile.ts
DELETED
|
@@ -1,246 +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
|
-
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
|
-
|