@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
|
+
ClubDocument,
|
|
20
|
+
ClubDocumentsListParams,
|
|
21
|
+
PaginatedClubDocumentList
|
|
22
|
+
} from '../api.schemas';
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
26
|
+
|
|
27
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* API Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠΎΠ² ΠΊΠ»ΡΠ±Π°
|
|
34
|
+
* @summary Π‘ΠΏΠΈΡΠΎΠΊ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠΎΠ² ΠΊΠ»ΡΠ±Π°
|
|
35
|
+
*/
|
|
36
|
+
export type clubDocumentsListResponse200 = {
|
|
37
|
+
data: PaginatedClubDocumentList
|
|
38
|
+
status: 200
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type clubDocumentsListResponseSuccess = (clubDocumentsListResponse200) & {
|
|
42
|
+
headers: Headers;
|
|
43
|
+
};
|
|
44
|
+
;
|
|
45
|
+
|
|
46
|
+
export type clubDocumentsListResponse = (clubDocumentsListResponseSuccess)
|
|
47
|
+
|
|
48
|
+
export const getClubDocumentsListUrl = (params?: ClubDocumentsListParams,) => {
|
|
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/club/documents/?${stringifiedParams}` : `/api/club/documents/`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const clubDocumentsList = async (params?: ClubDocumentsListParams, options?: RequestInit): Promise<clubDocumentsListResponse> => {
|
|
64
|
+
|
|
65
|
+
const res = await fetch(getClubDocumentsListUrl(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: clubDocumentsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
77
|
+
return { data, status: res.status, headers: res.headers } as clubDocumentsListResponse
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export const getClubDocumentsListQueryKey = (params?: ClubDocumentsListParams,) => {
|
|
85
|
+
return [
|
|
86
|
+
`/api/club/documents/`, ...(params ? [params] : [])
|
|
87
|
+
] as const;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export const getClubDocumentsListQueryOptions = <TData = Awaited<ReturnType<typeof clubDocumentsList>>, TError = unknown>(params?: ClubDocumentsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof clubDocumentsList>>, TError, TData>, fetch?: RequestInit}
|
|
92
|
+
) => {
|
|
93
|
+
|
|
94
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
95
|
+
|
|
96
|
+
const queryKey = queryOptions?.queryKey ?? getClubDocumentsListQueryKey(params);
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof clubDocumentsList>>> = ({ signal }) => clubDocumentsList(params, { signal, ...fetchOptions });
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof clubDocumentsList>>, TError, TData> & { queryKey: QueryKey }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type ClubDocumentsListQueryResult = NonNullable<Awaited<ReturnType<typeof clubDocumentsList>>>
|
|
110
|
+
export type ClubDocumentsListQueryError = unknown
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @summary Π‘ΠΏΠΈΡΠΎΠΊ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠΎΠ² ΠΊΠ»ΡΠ±Π°
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
export function useClubDocumentsList<TData = Awaited<ReturnType<typeof clubDocumentsList>>, TError = unknown>(
|
|
118
|
+
params?: ClubDocumentsListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof clubDocumentsList>>, TError, TData>, fetch?: RequestInit}
|
|
119
|
+
|
|
120
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
121
|
+
|
|
122
|
+
const queryOptions = getClubDocumentsListQueryOptions(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 clubDocumentsRetrieveResponse200 = {
|
|
137
|
+
data: ClubDocument
|
|
138
|
+
status: 200
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type clubDocumentsRetrieveResponse404 = {
|
|
142
|
+
data: void
|
|
143
|
+
status: 404
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type clubDocumentsRetrieveResponseSuccess = (clubDocumentsRetrieveResponse200) & {
|
|
147
|
+
headers: Headers;
|
|
148
|
+
};
|
|
149
|
+
export type clubDocumentsRetrieveResponseError = (clubDocumentsRetrieveResponse404) & {
|
|
150
|
+
headers: Headers;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type clubDocumentsRetrieveResponse = (clubDocumentsRetrieveResponseSuccess | clubDocumentsRetrieveResponseError)
|
|
154
|
+
|
|
155
|
+
export const getClubDocumentsRetrieveUrl = (id: number,) => {
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
return `/api/club/documents/${id}/`
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const clubDocumentsRetrieve = async (id: number, options?: RequestInit): Promise<clubDocumentsRetrieveResponse> => {
|
|
164
|
+
|
|
165
|
+
const res = await fetch(getClubDocumentsRetrieveUrl(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: clubDocumentsRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
177
|
+
return { data, status: res.status, headers: res.headers } as clubDocumentsRetrieveResponse
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
export const getClubDocumentsRetrieveQueryKey = (id: number,) => {
|
|
185
|
+
return [
|
|
186
|
+
`/api/club/documents/${id}/`
|
|
187
|
+
] as const;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
export const getClubDocumentsRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof clubDocumentsRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof clubDocumentsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
192
|
+
) => {
|
|
193
|
+
|
|
194
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
195
|
+
|
|
196
|
+
const queryKey = queryOptions?.queryKey ?? getClubDocumentsRetrieveQueryKey(id);
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof clubDocumentsRetrieve>>> = ({ signal }) => clubDocumentsRetrieve(id, { signal, ...fetchOptions });
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof clubDocumentsRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export type ClubDocumentsRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof clubDocumentsRetrieve>>>
|
|
210
|
+
export type ClubDocumentsRetrieveQueryError = void
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ Π΄ΠΎΠΊΡΠΌΠ΅Π½Ρ ΠΊΠ»ΡΠ±Π° ΠΏΠΎ ID
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
export function useClubDocumentsRetrieve<TData = Awaited<ReturnType<typeof clubDocumentsRetrieve>>, TError = void>(
|
|
218
|
+
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof clubDocumentsRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
219
|
+
|
|
220
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
221
|
+
|
|
222
|
+
const queryOptions = getClubDocumentsRetrieveQueryOptions(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,122 @@
|
|
|
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
|
+
ClubStats
|
|
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
|
+
* ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΏΠΎΡΠ»Π΅Π΄Π½ΡΡ Π·Π°ΠΏΠΈΡΡ ΡΡΠ°ΡΠΈΡΡΠΈΠΊΠΈ ΠΊΠ»ΡΠ±Π°. ΠΡΠ»ΠΈ Π΄Π°Π½Π½ΡΡ
Π΅ΡΡ Π½Π΅Ρ β Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π½ΡΠ»Π΅Π²ΡΠ΅ Π·Π½Π°ΡΠ΅Π½ΠΈΡ.
|
|
32
|
+
* @summary Π‘ΡΠ°ΡΠΈΡΡΠΈΠΊΠ° ΠΊΠ»ΡΠ±Π°
|
|
33
|
+
*/
|
|
34
|
+
export type clubStatsListResponse200 = {
|
|
35
|
+
data: ClubStats[]
|
|
36
|
+
status: 200
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type clubStatsListResponseSuccess = (clubStatsListResponse200) & {
|
|
40
|
+
headers: Headers;
|
|
41
|
+
};
|
|
42
|
+
;
|
|
43
|
+
|
|
44
|
+
export type clubStatsListResponse = (clubStatsListResponseSuccess)
|
|
45
|
+
|
|
46
|
+
export const getClubStatsListUrl = () => {
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
return `/api/club/stats/`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const clubStatsList = async ( options?: RequestInit): Promise<clubStatsListResponse> => {
|
|
55
|
+
|
|
56
|
+
const res = await fetch(getClubStatsListUrl(),
|
|
57
|
+
{
|
|
58
|
+
...options,
|
|
59
|
+
method: 'GET'
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
66
|
+
|
|
67
|
+
const data: clubStatsListResponse['data'] = body ? JSON.parse(body) : {}
|
|
68
|
+
return { data, status: res.status, headers: res.headers } as clubStatsListResponse
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
export const getClubStatsListQueryKey = () => {
|
|
76
|
+
return [
|
|
77
|
+
`/api/club/stats/`
|
|
78
|
+
] as const;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
export const getClubStatsListQueryOptions = <TData = Awaited<ReturnType<typeof clubStatsList>>, TError = unknown>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof clubStatsList>>, TError, TData>, fetch?: RequestInit}
|
|
83
|
+
) => {
|
|
84
|
+
|
|
85
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
86
|
+
|
|
87
|
+
const queryKey = queryOptions?.queryKey ?? getClubStatsListQueryKey();
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof clubStatsList>>> = ({ signal }) => clubStatsList({ signal, ...fetchOptions });
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof clubStatsList>>, TError, TData> & { queryKey: QueryKey }
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type ClubStatsListQueryResult = NonNullable<Awaited<ReturnType<typeof clubStatsList>>>
|
|
101
|
+
export type ClubStatsListQueryError = unknown
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @summary Π‘ΡΠ°ΡΠΈΡΡΠΈΠΊΠ° ΠΊΠ»ΡΠ±Π°
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
export function useClubStatsList<TData = Awaited<ReturnType<typeof clubStatsList>>, TError = unknown>(
|
|
109
|
+
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof clubStatsList>>, TError, TData>, fetch?: RequestInit}
|
|
110
|
+
|
|
111
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
112
|
+
|
|
113
|
+
const queryOptions = getClubStatsListQueryOptions(options)
|
|
114
|
+
|
|
115
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
116
|
+
|
|
117
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
@@ -0,0 +1,345 @@
|
|
|
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
|
+
ContentByKeyResponse,
|
|
20
|
+
ContentDictionary,
|
|
21
|
+
DictByKeyRetrieveParams,
|
|
22
|
+
DictListParams,
|
|
23
|
+
PaginatedContentDictionaryList
|
|
24
|
+
} from '../api.schemas';
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
28
|
+
|
|
29
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π²ΡΠ΅ Π·Π°ΠΏΠΈΡΠΈ ΠΊΠΎΠ½ΡΠ΅Π½Ρ-ΡΠΏΡΠ°Π²ΠΎΡΠ½ΠΈΠΊΠ°. ΠΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°Π΅Ρ ΡΠΈΠ»ΡΡΡΠ°ΡΠΈΡ ΠΏΠΎ ΡΡΡΠ°Π½ΠΈΡΠ΅ ΠΈ ΠΊΠ»ΡΡΡ.
|
|
36
|
+
* @summary Π‘ΠΏΠΈΡΠΎΠΊ ΠΊΠΎΠ½ΡΠ΅Π½Ρ-Π·Π°ΠΏΠΈΡΠ΅ΠΉ
|
|
37
|
+
*/
|
|
38
|
+
export type dictListResponse200 = {
|
|
39
|
+
data: PaginatedContentDictionaryList
|
|
40
|
+
status: 200
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type dictListResponseSuccess = (dictListResponse200) & {
|
|
44
|
+
headers: Headers;
|
|
45
|
+
};
|
|
46
|
+
;
|
|
47
|
+
|
|
48
|
+
export type dictListResponse = (dictListResponseSuccess)
|
|
49
|
+
|
|
50
|
+
export const getDictListUrl = (params?: DictListParams,) => {
|
|
51
|
+
const normalizedParams = new URLSearchParams();
|
|
52
|
+
|
|
53
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
54
|
+
|
|
55
|
+
if (value !== undefined) {
|
|
56
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const stringifiedParams = normalizedParams.toString();
|
|
61
|
+
|
|
62
|
+
return stringifiedParams.length > 0 ? `/api/dict/?${stringifiedParams}` : `/api/dict/`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const dictList = async (params?: DictListParams, options?: RequestInit): Promise<dictListResponse> => {
|
|
66
|
+
|
|
67
|
+
const res = await fetch(getDictListUrl(params),
|
|
68
|
+
{
|
|
69
|
+
...options,
|
|
70
|
+
method: 'GET'
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
77
|
+
|
|
78
|
+
const data: dictListResponse['data'] = body ? JSON.parse(body) : {}
|
|
79
|
+
return { data, status: res.status, headers: res.headers } as dictListResponse
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
export const getDictListQueryKey = (params?: DictListParams,) => {
|
|
87
|
+
return [
|
|
88
|
+
`/api/dict/`, ...(params ? [params] : [])
|
|
89
|
+
] as const;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export const getDictListQueryOptions = <TData = Awaited<ReturnType<typeof dictList>>, TError = unknown>(params?: DictListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dictList>>, TError, TData>, fetch?: RequestInit}
|
|
94
|
+
) => {
|
|
95
|
+
|
|
96
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
97
|
+
|
|
98
|
+
const queryKey = queryOptions?.queryKey ?? getDictListQueryKey(params);
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof dictList>>> = ({ signal }) => dictList(params, { signal, ...fetchOptions });
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dictList>>, TError, TData> & { queryKey: QueryKey }
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type DictListQueryResult = NonNullable<Awaited<ReturnType<typeof dictList>>>
|
|
112
|
+
export type DictListQueryError = unknown
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @summary Π‘ΠΏΠΈΡΠΎΠΊ ΠΊΠΎΠ½ΡΠ΅Π½Ρ-Π·Π°ΠΏΠΈΡΠ΅ΠΉ
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
export function useDictList<TData = Awaited<ReturnType<typeof dictList>>, TError = unknown>(
|
|
120
|
+
params?: DictListParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dictList>>, TError, TData>, fetch?: RequestInit}
|
|
121
|
+
|
|
122
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
123
|
+
|
|
124
|
+
const queryOptions = getDictListQueryOptions(params,options)
|
|
125
|
+
|
|
126
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
127
|
+
|
|
128
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* API Π΄Π»Ρ ΠΊΠΎΠ½ΡΠ΅Π½Ρ-ΡΠΏΡΠ°Π²ΠΎΡΠ½ΠΈΠΊΠ°
|
|
136
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ Π·Π°ΠΏΠΈΡΡ ΠΏΠΎ ID
|
|
137
|
+
*/
|
|
138
|
+
export type dictRetrieveResponse200 = {
|
|
139
|
+
data: ContentDictionary
|
|
140
|
+
status: 200
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type dictRetrieveResponse404 = {
|
|
144
|
+
data: void
|
|
145
|
+
status: 404
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export type dictRetrieveResponseSuccess = (dictRetrieveResponse200) & {
|
|
149
|
+
headers: Headers;
|
|
150
|
+
};
|
|
151
|
+
export type dictRetrieveResponseError = (dictRetrieveResponse404) & {
|
|
152
|
+
headers: Headers;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type dictRetrieveResponse = (dictRetrieveResponseSuccess | dictRetrieveResponseError)
|
|
156
|
+
|
|
157
|
+
export const getDictRetrieveUrl = (id: number,) => {
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
return `/api/dict/${id}/`
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const dictRetrieve = async (id: number, options?: RequestInit): Promise<dictRetrieveResponse> => {
|
|
166
|
+
|
|
167
|
+
const res = await fetch(getDictRetrieveUrl(id),
|
|
168
|
+
{
|
|
169
|
+
...options,
|
|
170
|
+
method: 'GET'
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
177
|
+
|
|
178
|
+
const data: dictRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
179
|
+
return { data, status: res.status, headers: res.headers } as dictRetrieveResponse
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
export const getDictRetrieveQueryKey = (id: number,) => {
|
|
187
|
+
return [
|
|
188
|
+
`/api/dict/${id}/`
|
|
189
|
+
] as const;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
export const getDictRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof dictRetrieve>>, TError = void>(id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dictRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
194
|
+
) => {
|
|
195
|
+
|
|
196
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
197
|
+
|
|
198
|
+
const queryKey = queryOptions?.queryKey ?? getDictRetrieveQueryKey(id);
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof dictRetrieve>>> = ({ signal }) => dictRetrieve(id, { signal, ...fetchOptions });
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dictRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export type DictRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dictRetrieve>>>
|
|
212
|
+
export type DictRetrieveQueryError = void
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ Π·Π°ΠΏΠΈΡΡ ΠΏΠΎ ID
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
export function useDictRetrieve<TData = Awaited<ReturnType<typeof dictRetrieve>>, TError = void>(
|
|
220
|
+
id: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dictRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
221
|
+
|
|
222
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
223
|
+
|
|
224
|
+
const queryOptions = getDictRetrieveQueryOptions(id,options)
|
|
225
|
+
|
|
226
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
227
|
+
|
|
228
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* ΠΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΎΠ΄Π½Ρ Π·Π°ΠΏΠΈΡΡ ΠΊΠΎΠ½ΡΠ΅Π½Ρ-ΡΠΏΡΠ°Π²ΠΎΡΠ½ΠΈΠΊΠ° ΠΏΠΎ ΡΠΎΡΠ½ΠΎΠΌΡ ΡΠΎΠ²ΠΏΠ°Π΄Π΅Π½ΠΈΡ ΠΊΠ»ΡΡΠ°.
|
|
236
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΠΊΠ»ΡΡΡ
|
|
237
|
+
*/
|
|
238
|
+
export type dictByKeyRetrieveResponse200 = {
|
|
239
|
+
data: ContentByKeyResponse
|
|
240
|
+
status: 200
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export type dictByKeyRetrieveResponse400 = {
|
|
244
|
+
data: void
|
|
245
|
+
status: 400
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export type dictByKeyRetrieveResponse404 = {
|
|
249
|
+
data: void
|
|
250
|
+
status: 404
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type dictByKeyRetrieveResponseSuccess = (dictByKeyRetrieveResponse200) & {
|
|
254
|
+
headers: Headers;
|
|
255
|
+
};
|
|
256
|
+
export type dictByKeyRetrieveResponseError = (dictByKeyRetrieveResponse400 | dictByKeyRetrieveResponse404) & {
|
|
257
|
+
headers: Headers;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export type dictByKeyRetrieveResponse = (dictByKeyRetrieveResponseSuccess | dictByKeyRetrieveResponseError)
|
|
261
|
+
|
|
262
|
+
export const getDictByKeyRetrieveUrl = (params: DictByKeyRetrieveParams,) => {
|
|
263
|
+
const normalizedParams = new URLSearchParams();
|
|
264
|
+
|
|
265
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
266
|
+
|
|
267
|
+
if (value !== undefined) {
|
|
268
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
const stringifiedParams = normalizedParams.toString();
|
|
273
|
+
|
|
274
|
+
return stringifiedParams.length > 0 ? `/api/dict/by_key/?${stringifiedParams}` : `/api/dict/by_key/`
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export const dictByKeyRetrieve = async (params: DictByKeyRetrieveParams, options?: RequestInit): Promise<dictByKeyRetrieveResponse> => {
|
|
278
|
+
|
|
279
|
+
const res = await fetch(getDictByKeyRetrieveUrl(params),
|
|
280
|
+
{
|
|
281
|
+
...options,
|
|
282
|
+
method: 'GET'
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
289
|
+
|
|
290
|
+
const data: dictByKeyRetrieveResponse['data'] = body ? JSON.parse(body) : {}
|
|
291
|
+
return { data, status: res.status, headers: res.headers } as dictByKeyRetrieveResponse
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
export const getDictByKeyRetrieveQueryKey = (params?: DictByKeyRetrieveParams,) => {
|
|
299
|
+
return [
|
|
300
|
+
`/api/dict/by_key/`, ...(params ? [params] : [])
|
|
301
|
+
] as const;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
export const getDictByKeyRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof dictByKeyRetrieve>>, TError = void>(params: DictByKeyRetrieveParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dictByKeyRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
306
|
+
) => {
|
|
307
|
+
|
|
308
|
+
const {query: queryOptions, fetch: fetchOptions} = options ?? {};
|
|
309
|
+
|
|
310
|
+
const queryKey = queryOptions?.queryKey ?? getDictByKeyRetrieveQueryKey(params);
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof dictByKeyRetrieve>>> = ({ signal }) => dictByKeyRetrieve(params, { signal, ...fetchOptions });
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dictByKeyRetrieve>>, TError, TData> & { queryKey: QueryKey }
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export type DictByKeyRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dictByKeyRetrieve>>>
|
|
324
|
+
export type DictByKeyRetrieveQueryError = void
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @summary ΠΠΎΠ»ΡΡΠΈΡΡ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΠΊΠ»ΡΡΡ
|
|
329
|
+
*/
|
|
330
|
+
|
|
331
|
+
export function useDictByKeyRetrieve<TData = Awaited<ReturnType<typeof dictByKeyRetrieve>>, TError = void>(
|
|
332
|
+
params: DictByKeyRetrieveParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dictByKeyRetrieve>>, TError, TData>, fetch?: RequestInit}
|
|
333
|
+
|
|
334
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
335
|
+
|
|
336
|
+
const queryOptions = getDictByKeyRetrieveQueryOptions(params,options)
|
|
337
|
+
|
|
338
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
339
|
+
|
|
340
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|