@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,221 @@
|
|
|
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
|
+
} from '@tanstack/react-query';
|
|
11
|
+
import type {
|
|
12
|
+
MutationFunction,
|
|
13
|
+
UseMutationOptions,
|
|
14
|
+
UseMutationResult
|
|
15
|
+
} from '@tanstack/react-query';
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
LoginRequestRequest,
|
|
19
|
+
LoginSuccess
|
|
20
|
+
} from '../api.schemas';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
24
|
+
|
|
25
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Аутентификация пользователя по email и паролю. Устанавливает сессионный cookie.
|
|
32
|
+
* @summary Вход в систему
|
|
33
|
+
*/
|
|
34
|
+
export type authLoginCreateResponse200 = {
|
|
35
|
+
data: LoginSuccess
|
|
36
|
+
status: 200
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type authLoginCreateResponse401 = {
|
|
40
|
+
data: void
|
|
41
|
+
status: 401
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type authLoginCreateResponseSuccess = (authLoginCreateResponse200) & {
|
|
45
|
+
headers: Headers;
|
|
46
|
+
};
|
|
47
|
+
export type authLoginCreateResponseError = (authLoginCreateResponse401) & {
|
|
48
|
+
headers: Headers;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type authLoginCreateResponse = (authLoginCreateResponseSuccess | authLoginCreateResponseError)
|
|
52
|
+
|
|
53
|
+
export const getAuthLoginCreateUrl = () => {
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
return `/api/auth/login/`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const authLoginCreate = async (loginRequestRequest: LoginRequestRequest, options?: RequestInit): Promise<authLoginCreateResponse> => {
|
|
62
|
+
|
|
63
|
+
const res = await fetch(getAuthLoginCreateUrl(),
|
|
64
|
+
{
|
|
65
|
+
...options,
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
68
|
+
body: JSON.stringify(
|
|
69
|
+
loginRequestRequest,)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
74
|
+
|
|
75
|
+
const data: authLoginCreateResponse['data'] = body ? JSON.parse(body) : {}
|
|
76
|
+
return { data, status: res.status, headers: res.headers } as authLoginCreateResponse
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
export const getAuthLoginCreateMutationOptions = <TError = void,
|
|
83
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authLoginCreate>>, TError,{data: LoginRequestRequest}, TContext>, fetch?: RequestInit}
|
|
84
|
+
): UseMutationOptions<Awaited<ReturnType<typeof authLoginCreate>>, TError,{data: LoginRequestRequest}, TContext> => {
|
|
85
|
+
|
|
86
|
+
const mutationKey = ['authLoginCreate'];
|
|
87
|
+
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
|
|
88
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
89
|
+
options
|
|
90
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
91
|
+
: {mutation: { mutationKey, }, fetch: undefined};
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof authLoginCreate>>, {data: LoginRequestRequest}> = (props) => {
|
|
97
|
+
const {data} = props ?? {};
|
|
98
|
+
|
|
99
|
+
return authLoginCreate(data,fetchOptions)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
return { mutationFn, ...mutationOptions }}
|
|
108
|
+
|
|
109
|
+
export type AuthLoginCreateMutationResult = NonNullable<Awaited<ReturnType<typeof authLoginCreate>>>
|
|
110
|
+
export type AuthLoginCreateMutationBody = LoginRequestRequest
|
|
111
|
+
export type AuthLoginCreateMutationError = void
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @summary Вход в систему
|
|
115
|
+
*/
|
|
116
|
+
export const useAuthLoginCreate = <TError = void,
|
|
117
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authLoginCreate>>, TError,{data: LoginRequestRequest}, TContext>, fetch?: RequestInit}
|
|
118
|
+
): UseMutationResult<
|
|
119
|
+
Awaited<ReturnType<typeof authLoginCreate>>,
|
|
120
|
+
TError,
|
|
121
|
+
{data: LoginRequestRequest},
|
|
122
|
+
TContext
|
|
123
|
+
> => {
|
|
124
|
+
return useMutation(getAuthLoginCreateMutationOptions(options));
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Завершает текущую сессию пользователя.
|
|
128
|
+
* @summary Выход из системы
|
|
129
|
+
*/
|
|
130
|
+
export type authLogoutCreateResponse200 = {
|
|
131
|
+
data: void
|
|
132
|
+
status: 200
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type authLogoutCreateResponse401 = {
|
|
136
|
+
data: void
|
|
137
|
+
status: 401
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type authLogoutCreateResponseSuccess = (authLogoutCreateResponse200) & {
|
|
141
|
+
headers: Headers;
|
|
142
|
+
};
|
|
143
|
+
export type authLogoutCreateResponseError = (authLogoutCreateResponse401) & {
|
|
144
|
+
headers: Headers;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export type authLogoutCreateResponse = (authLogoutCreateResponseSuccess | authLogoutCreateResponseError)
|
|
148
|
+
|
|
149
|
+
export const getAuthLogoutCreateUrl = () => {
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
return `/api/auth/logout/`
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const authLogoutCreate = async ( options?: RequestInit): Promise<authLogoutCreateResponse> => {
|
|
158
|
+
|
|
159
|
+
const res = await fetch(getAuthLogoutCreateUrl(),
|
|
160
|
+
{
|
|
161
|
+
...options,
|
|
162
|
+
method: 'POST'
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
169
|
+
|
|
170
|
+
const data: authLogoutCreateResponse['data'] = body ? JSON.parse(body) : {}
|
|
171
|
+
return { data, status: res.status, headers: res.headers } as authLogoutCreateResponse
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
export const getAuthLogoutCreateMutationOptions = <TError = void,
|
|
178
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authLogoutCreate>>, TError,void, TContext>, fetch?: RequestInit}
|
|
179
|
+
): UseMutationOptions<Awaited<ReturnType<typeof authLogoutCreate>>, TError,void, TContext> => {
|
|
180
|
+
|
|
181
|
+
const mutationKey = ['authLogoutCreate'];
|
|
182
|
+
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
|
|
183
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
184
|
+
options
|
|
185
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
186
|
+
: {mutation: { mutationKey, }, fetch: undefined};
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof authLogoutCreate>>, void> = () => {
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
return authLogoutCreate(fetchOptions)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
return { mutationFn, ...mutationOptions }}
|
|
203
|
+
|
|
204
|
+
export type AuthLogoutCreateMutationResult = NonNullable<Awaited<ReturnType<typeof authLogoutCreate>>>
|
|
205
|
+
|
|
206
|
+
export type AuthLogoutCreateMutationError = void
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @summary Выход из системы
|
|
210
|
+
*/
|
|
211
|
+
export const useAuthLogoutCreate = <TError = void,
|
|
212
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof authLogoutCreate>>, TError,void, TContext>, fetch?: RequestInit}
|
|
213
|
+
): UseMutationResult<
|
|
214
|
+
Awaited<ReturnType<typeof authLogoutCreate>>,
|
|
215
|
+
TError,
|
|
216
|
+
void,
|
|
217
|
+
TContext
|
|
218
|
+
> => {
|
|
219
|
+
return useMutation(getAuthLogoutCreateMutationOptions(options));
|
|
220
|
+
}
|
|
221
|
+
|
|
@@ -0,0 +1,434 @@
|
|
|
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
|
+
BreedArticle,
|
|
20
|
+
BreedArticlesListParams,
|
|
21
|
+
BreedStandard,
|
|
22
|
+
BreedStandardsListParams,
|
|
23
|
+
PaginatedBreedArticleList,
|
|
24
|
+
PaginatedBreedStandardList
|
|
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 breedArticlesListResponse200 = {
|
|
40
|
+
data: PaginatedBreedArticleList
|
|
41
|
+
status: 200
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type breedArticlesListResponseSuccess = (breedArticlesListResponse200) & {
|
|
45
|
+
headers: Headers;
|
|
46
|
+
};
|
|
47
|
+
;
|
|
48
|
+
|
|
49
|
+
export type breedArticlesListResponse = (breedArticlesListResponseSuccess)
|
|
50
|
+
|
|
51
|
+
export const getBreedArticlesListUrl = (params?: BreedArticlesListParams,) => {
|
|
52
|
+
const normalizedParams = new URLSearchParams();
|
|
53
|
+
|
|
54
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
55
|
+
|
|
56
|
+
if (value !== undefined) {
|
|
57
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const stringifiedParams = normalizedParams.toString();
|
|
62
|
+
|
|
63
|
+
return stringifiedParams.length > 0 ? `/api/breed/articles/?${stringifiedParams}` : `/api/breed/articles/`
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const breedArticlesList = async (params?: BreedArticlesListParams, options?: RequestInit): Promise<breedArticlesListResponse> => {
|
|
67
|
+
|
|
68
|
+
const res = await fetch(getBreedArticlesListUrl(params),
|
|
69
|
+
{
|
|
70
|
+
...options,
|
|
71
|
+
method: 'GET'
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
78
|
+
|
|
79
|
+
const data: breedArticlesListResponse['data'] = body ? JSON.parse(body) : {}
|
|
80
|
+
return { data, status: res.status, headers: res.headers } as breedArticlesListResponse
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
export const getBreedArticlesListQueryKey = (params?: BreedArticlesListParams,) => {
|
|
88
|
+
return [
|
|
89
|
+
`/api/breed/articles/`, ...(params ? [params] : [])
|
|
90
|
+
] as const;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
export const getBreedArticlesListQueryOptions = <TData = Awaited<ReturnType<typeof breedArticlesList>>, TError = unknown>(params?: BreedArticlesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedArticlesList>>, TError, TData>, fetch?: RequestInit}
|
|
95
|
+
) => {
|
|
96
|
+
|
|
97
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
98
|
+
|
|
99
|
+
const queryKey = queryOptions?.queryKey ?? getBreedArticlesListQueryKey(params);
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof breedArticlesList>>> = ({ signal }) => breedArticlesList(params, { signal, ...fetchOptions });
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof breedArticlesList>>, TError, TData> & { queryKey: QueryKey }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type BreedArticlesListQueryResult = NonNullable<Awaited<ReturnType<typeof breedArticlesList>>>
|
|
113
|
+
export type BreedArticlesListQueryError = unknown
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @summary Список статей о породе
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
export function useBreedArticlesList<TData = Awaited<ReturnType<typeof breedArticlesList>>, TError = unknown>(
|
|
121
|
+
params?: BreedArticlesListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedArticlesList>>, TError, TData>, fetch?: RequestInit}
|
|
122
|
+
|
|
123
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
124
|
+
|
|
125
|
+
const queryOptions = getBreedArticlesListQueryOptions(params,options)
|
|
126
|
+
|
|
127
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
128
|
+
|
|
129
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* API статей о породе
|
|
137
|
+
* @summary Получить статью о породе по ID
|
|
138
|
+
*/
|
|
139
|
+
export type breedArticlesRetrieveResponse200 = {
|
|
140
|
+
data: BreedArticle
|
|
141
|
+
status: 200
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type breedArticlesRetrieveResponse404 = {
|
|
145
|
+
data: void
|
|
146
|
+
status: 404
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export type breedArticlesRetrieveResponseSuccess = (breedArticlesRetrieveResponse200) & {
|
|
150
|
+
headers: Headers;
|
|
151
|
+
};
|
|
152
|
+
export type breedArticlesRetrieveResponseError = (breedArticlesRetrieveResponse404) & {
|
|
153
|
+
headers: Headers;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export type breedArticlesRetrieveResponse = (breedArticlesRetrieveResponseSuccess | breedArticlesRetrieveResponseError)
|
|
157
|
+
|
|
158
|
+
export const getBreedArticlesRetrieveUrl = (id: number,) => {
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
return `/api/breed/articles/${id}/`
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const breedArticlesRetrieve = async (id: number, options?: RequestInit): Promise<breedArticlesRetrieveResponse> => {
|
|
167
|
+
|
|
168
|
+
const res = await fetch(getBreedArticlesRetrieveUrl(id),
|
|
169
|
+
{
|
|
170
|
+
...options,
|
|
171
|
+
method: 'GET'
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
178
|
+
|
|
179
|
+
const data: breedArticlesRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
180
|
+
return { data, status: res.status, headers: res.headers } as breedArticlesRetrieveResponse
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
export const getBreedArticlesRetrieveQueryKey = (id: number,) => {
|
|
188
|
+
return [
|
|
189
|
+
`/api/breed/articles/${id}/`
|
|
190
|
+
] as const;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
export const getBreedArticlesRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof breedArticlesRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedArticlesRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
195
|
+
) => {
|
|
196
|
+
|
|
197
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
198
|
+
|
|
199
|
+
const queryKey = queryOptions?.queryKey ?? getBreedArticlesRetrieveQueryKey(id);
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof breedArticlesRetrieve>>> = ({ signal }) => breedArticlesRetrieve(id, { signal, ...fetchOptions });
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof breedArticlesRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export type BreedArticlesRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof breedArticlesRetrieve>>>
|
|
213
|
+
export type BreedArticlesRetrieveQueryError = void
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @summary Получить статью о породе по ID
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
export function useBreedArticlesRetrieve<TData = Awaited<ReturnType<typeof breedArticlesRetrieve>>, TError = void>(
|
|
221
|
+
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedArticlesRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
222
|
+
|
|
223
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
224
|
+
|
|
225
|
+
const queryOptions = getBreedArticlesRetrieveQueryOptions(id,options)
|
|
226
|
+
|
|
227
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
228
|
+
|
|
229
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* API стандартов породы
|
|
237
|
+
* @summary Список стандартов породы
|
|
238
|
+
*/
|
|
239
|
+
export type breedStandardsListResponse200 = {
|
|
240
|
+
data: PaginatedBreedStandardList
|
|
241
|
+
status: 200
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export type breedStandardsListResponseSuccess = (breedStandardsListResponse200) & {
|
|
245
|
+
headers: Headers;
|
|
246
|
+
};
|
|
247
|
+
;
|
|
248
|
+
|
|
249
|
+
export type breedStandardsListResponse = (breedStandardsListResponseSuccess)
|
|
250
|
+
|
|
251
|
+
export const getBreedStandardsListUrl = (params?: BreedStandardsListParams,) => {
|
|
252
|
+
const normalizedParams = new URLSearchParams();
|
|
253
|
+
|
|
254
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
255
|
+
|
|
256
|
+
if (value !== undefined) {
|
|
257
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
const stringifiedParams = normalizedParams.toString();
|
|
262
|
+
|
|
263
|
+
return stringifiedParams.length > 0 ? `/api/breed/standards/?${stringifiedParams}` : `/api/breed/standards/`
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export const breedStandardsList = async (params?: BreedStandardsListParams, options?: RequestInit): Promise<breedStandardsListResponse> => {
|
|
267
|
+
|
|
268
|
+
const res = await fetch(getBreedStandardsListUrl(params),
|
|
269
|
+
{
|
|
270
|
+
...options,
|
|
271
|
+
method: 'GET'
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
278
|
+
|
|
279
|
+
const data: breedStandardsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
280
|
+
return { data, status: res.status, headers: res.headers } as breedStandardsListResponse
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
export const getBreedStandardsListQueryKey = (params?: BreedStandardsListParams,) => {
|
|
288
|
+
return [
|
|
289
|
+
`/api/breed/standards/`, ...(params ? [params] : [])
|
|
290
|
+
] as const;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
export const getBreedStandardsListQueryOptions = <TData = Awaited<ReturnType<typeof breedStandardsList>>, TError = unknown>(params?: BreedStandardsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedStandardsList>>, TError, TData>, fetch?: RequestInit}
|
|
295
|
+
) => {
|
|
296
|
+
|
|
297
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
298
|
+
|
|
299
|
+
const queryKey = queryOptions?.queryKey ?? getBreedStandardsListQueryKey(params);
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof breedStandardsList>>> = ({ signal }) => breedStandardsList(params, { signal, ...fetchOptions });
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof breedStandardsList>>, TError, TData> & { queryKey: QueryKey }
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export type BreedStandardsListQueryResult = NonNullable<Awaited<ReturnType<typeof breedStandardsList>>>
|
|
313
|
+
export type BreedStandardsListQueryError = unknown
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @summary Список стандартов породы
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
export function useBreedStandardsList<TData = Awaited<ReturnType<typeof breedStandardsList>>, TError = unknown>(
|
|
321
|
+
params?: BreedStandardsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedStandardsList>>, TError, TData>, fetch?: RequestInit}
|
|
322
|
+
|
|
323
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
324
|
+
|
|
325
|
+
const queryOptions = getBreedStandardsListQueryOptions(params,options)
|
|
326
|
+
|
|
327
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
328
|
+
|
|
329
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* API стандартов породы
|
|
337
|
+
* @summary Получить стандарт породы по ID
|
|
338
|
+
*/
|
|
339
|
+
export type breedStandardsRetrieveResponse200 = {
|
|
340
|
+
data: BreedStandard
|
|
341
|
+
status: 200
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export type breedStandardsRetrieveResponse404 = {
|
|
345
|
+
data: void
|
|
346
|
+
status: 404
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export type breedStandardsRetrieveResponseSuccess = (breedStandardsRetrieveResponse200) & {
|
|
350
|
+
headers: Headers;
|
|
351
|
+
};
|
|
352
|
+
export type breedStandardsRetrieveResponseError = (breedStandardsRetrieveResponse404) & {
|
|
353
|
+
headers: Headers;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export type breedStandardsRetrieveResponse = (breedStandardsRetrieveResponseSuccess | breedStandardsRetrieveResponseError)
|
|
357
|
+
|
|
358
|
+
export const getBreedStandardsRetrieveUrl = (id: number,) => {
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
return `/api/breed/standards/${id}/`
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export const breedStandardsRetrieve = async (id: number, options?: RequestInit): Promise<breedStandardsRetrieveResponse> => {
|
|
367
|
+
|
|
368
|
+
const res = await fetch(getBreedStandardsRetrieveUrl(id),
|
|
369
|
+
{
|
|
370
|
+
...options,
|
|
371
|
+
method: 'GET'
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
378
|
+
|
|
379
|
+
const data: breedStandardsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
380
|
+
return { data, status: res.status, headers: res.headers } as breedStandardsRetrieveResponse
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
export const getBreedStandardsRetrieveQueryKey = (id: number,) => {
|
|
388
|
+
return [
|
|
389
|
+
`/api/breed/standards/${id}/`
|
|
390
|
+
] as const;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
export const getBreedStandardsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof breedStandardsRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedStandardsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
395
|
+
) => {
|
|
396
|
+
|
|
397
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
398
|
+
|
|
399
|
+
const queryKey = queryOptions?.queryKey ?? getBreedStandardsRetrieveQueryKey(id);
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof breedStandardsRetrieve>>> = ({ signal }) => breedStandardsRetrieve(id, { signal, ...fetchOptions });
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof breedStandardsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export type BreedStandardsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof breedStandardsRetrieve>>>
|
|
413
|
+
export type BreedStandardsRetrieveQueryError = void
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @summary Получить стандарт породы по ID
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
export function useBreedStandardsRetrieve<TData = Awaited<ReturnType<typeof breedStandardsRetrieve>>, TError = void>(
|
|
421
|
+
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof breedStandardsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
422
|
+
|
|
423
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
424
|
+
|
|
425
|
+
const queryOptions = getBreedStandardsRetrieveQueryOptions(id,options)
|
|
426
|
+
|
|
427
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
428
|
+
|
|
429
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|