@omerikanec/api-client-demo 2.0.2 → 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
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { Page, PagesListParams, PaginatedPageList } from '../api.schemas';
|
|
3
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
4
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
5
|
+
/**
|
|
6
|
+
* API CMS страниц
|
|
7
|
+
* @summary Список CMS-страниц
|
|
8
|
+
*/
|
|
9
|
+
export type pagesListResponse200 = {
|
|
10
|
+
data: PaginatedPageList;
|
|
11
|
+
status: 200;
|
|
12
|
+
};
|
|
13
|
+
export type pagesListResponseSuccess = (pagesListResponse200) & {
|
|
14
|
+
headers: Headers;
|
|
15
|
+
};
|
|
16
|
+
export type pagesListResponse = (pagesListResponseSuccess);
|
|
17
|
+
export declare const getPagesListUrl: (params?: PagesListParams) => string;
|
|
18
|
+
export declare const pagesList: (params?: PagesListParams, options?: RequestInit) => Promise<pagesListResponse>;
|
|
19
|
+
export declare const getPagesListQueryKey: (params?: PagesListParams) => readonly ["/api/pages/", ...PagesListParams[]];
|
|
20
|
+
export declare const getPagesListQueryOptions: <TData = Awaited<ReturnType<typeof pagesList>>, TError = unknown>(params?: PagesListParams, options?: {
|
|
21
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof pagesList>>, TError, TData>;
|
|
22
|
+
fetch?: RequestInit;
|
|
23
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof pagesList>>, TError, TData> & {
|
|
24
|
+
queryKey: QueryKey;
|
|
25
|
+
};
|
|
26
|
+
export type PagesListQueryResult = NonNullable<Awaited<ReturnType<typeof pagesList>>>;
|
|
27
|
+
export type PagesListQueryError = unknown;
|
|
28
|
+
/**
|
|
29
|
+
* @summary Список CMS-страниц
|
|
30
|
+
*/
|
|
31
|
+
export declare function usePagesList<TData = Awaited<ReturnType<typeof pagesList>>, TError = unknown>(params?: PagesListParams, options?: {
|
|
32
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof pagesList>>, TError, TData>;
|
|
33
|
+
fetch?: RequestInit;
|
|
34
|
+
}): UseQueryResult<TData, TError> & {
|
|
35
|
+
queryKey: QueryKey;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* API CMS страниц
|
|
39
|
+
* @summary Получить CMS-страницу по slug
|
|
40
|
+
*/
|
|
41
|
+
export type pagesRetrieveResponse200 = {
|
|
42
|
+
data: Page;
|
|
43
|
+
status: 200;
|
|
44
|
+
};
|
|
45
|
+
export type pagesRetrieveResponse404 = {
|
|
46
|
+
data: void;
|
|
47
|
+
status: 404;
|
|
48
|
+
};
|
|
49
|
+
export type pagesRetrieveResponseSuccess = (pagesRetrieveResponse200) & {
|
|
50
|
+
headers: Headers;
|
|
51
|
+
};
|
|
52
|
+
export type pagesRetrieveResponseError = (pagesRetrieveResponse404) & {
|
|
53
|
+
headers: Headers;
|
|
54
|
+
};
|
|
55
|
+
export type pagesRetrieveResponse = (pagesRetrieveResponseSuccess | pagesRetrieveResponseError);
|
|
56
|
+
export declare const getPagesRetrieveUrl: (slug: string) => string;
|
|
57
|
+
export declare const pagesRetrieve: (slug: string, options?: RequestInit) => Promise<pagesRetrieveResponse>;
|
|
58
|
+
export declare const getPagesRetrieveQueryKey: (slug: string) => readonly [`/api/pages/${string}/`];
|
|
59
|
+
export declare const getPagesRetrieveQueryOptions: <TData = Awaited<ReturnType<typeof pagesRetrieve>>, TError = void>(slug: string, options?: {
|
|
60
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof pagesRetrieve>>, TError, TData>;
|
|
61
|
+
fetch?: RequestInit;
|
|
62
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof pagesRetrieve>>, TError, TData> & {
|
|
63
|
+
queryKey: QueryKey;
|
|
64
|
+
};
|
|
65
|
+
export type PagesRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof pagesRetrieve>>>;
|
|
66
|
+
export type PagesRetrieveQueryError = void;
|
|
67
|
+
/**
|
|
68
|
+
* @summary Получить CMS-страницу по slug
|
|
69
|
+
*/
|
|
70
|
+
export declare function usePagesRetrieve<TData = Awaited<ReturnType<typeof pagesRetrieve>>, TError = void>(slug: string, options?: {
|
|
71
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof pagesRetrieve>>, TError, TData>;
|
|
72
|
+
fetch?: RequestInit;
|
|
73
|
+
}): UseQueryResult<TData, TError> & {
|
|
74
|
+
queryKey: QueryKey;
|
|
75
|
+
};
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
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 { useQuery } from '@tanstack/react-query';
|
|
9
|
+
;
|
|
10
|
+
export const getPagesListUrl = (params) => {
|
|
11
|
+
const normalizedParams = new URLSearchParams();
|
|
12
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
13
|
+
if (value !== undefined) {
|
|
14
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString());
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const stringifiedParams = normalizedParams.toString();
|
|
18
|
+
return stringifiedParams.length > 0 ? `/api/pages/?${stringifiedParams}` : `/api/pages/`;
|
|
19
|
+
};
|
|
20
|
+
export const pagesList = async (params, options) => {
|
|
21
|
+
const res = await fetch(getPagesListUrl(params), {
|
|
22
|
+
...options,
|
|
23
|
+
method: 'GET'
|
|
24
|
+
});
|
|
25
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
26
|
+
const data = body ? JSON.parse(body) : {};
|
|
27
|
+
return { data, status: res.status, headers: res.headers };
|
|
28
|
+
};
|
|
29
|
+
export const getPagesListQueryKey = (params) => {
|
|
30
|
+
return [
|
|
31
|
+
`/api/pages/`, ...(params ? [params] : [])
|
|
32
|
+
];
|
|
33
|
+
};
|
|
34
|
+
export const getPagesListQueryOptions = (params, options) => {
|
|
35
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
36
|
+
const queryKey = queryOptions?.queryKey ?? getPagesListQueryKey(params);
|
|
37
|
+
const queryFn = ({ signal }) => pagesList(params, { signal, ...fetchOptions });
|
|
38
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @summary Список CMS-страниц
|
|
42
|
+
*/
|
|
43
|
+
export function usePagesList(params, options) {
|
|
44
|
+
const queryOptions = getPagesListQueryOptions(params, options);
|
|
45
|
+
const query = useQuery(queryOptions);
|
|
46
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
47
|
+
}
|
|
48
|
+
export const getPagesRetrieveUrl = (slug) => {
|
|
49
|
+
return `/api/pages/${slug}/`;
|
|
50
|
+
};
|
|
51
|
+
export const pagesRetrieve = async (slug, options) => {
|
|
52
|
+
const res = await fetch(getPagesRetrieveUrl(slug), {
|
|
53
|
+
...options,
|
|
54
|
+
method: 'GET'
|
|
55
|
+
});
|
|
56
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
57
|
+
const data = body ? JSON.parse(body) : {};
|
|
58
|
+
return { data, status: res.status, headers: res.headers };
|
|
59
|
+
};
|
|
60
|
+
export const getPagesRetrieveQueryKey = (slug) => {
|
|
61
|
+
return [
|
|
62
|
+
`/api/pages/${slug}/`
|
|
63
|
+
];
|
|
64
|
+
};
|
|
65
|
+
export const getPagesRetrieveQueryOptions = (slug, options) => {
|
|
66
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
67
|
+
const queryKey = queryOptions?.queryKey ?? getPagesRetrieveQueryKey(slug);
|
|
68
|
+
const queryFn = ({ signal }) => pagesRetrieve(slug, { signal, ...fetchOptions });
|
|
69
|
+
return { queryKey, queryFn, enabled: !!(slug), ...queryOptions };
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @summary Получить CMS-страницу по slug
|
|
73
|
+
*/
|
|
74
|
+
export function usePagesRetrieve(slug, options) {
|
|
75
|
+
const queryOptions = getPagesRetrieveQueryOptions(slug, options);
|
|
76
|
+
const query = useQuery(queryOptions);
|
|
77
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
78
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { QueryKey, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { UserProfile, UserProfileRequest } from '../api.schemas';
|
|
3
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
4
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
5
|
+
/**
|
|
6
|
+
* Возвращает профиль текущего авторизованного пользователя.
|
|
7
|
+
* @summary Получить свой профиль
|
|
8
|
+
*/
|
|
9
|
+
export type meRetrieveResponse200 = {
|
|
10
|
+
data: UserProfile;
|
|
11
|
+
status: 200;
|
|
12
|
+
};
|
|
13
|
+
export type meRetrieveResponse401 = {
|
|
14
|
+
data: void;
|
|
15
|
+
status: 401;
|
|
16
|
+
};
|
|
17
|
+
export type meRetrieveResponse404 = {
|
|
18
|
+
data: void;
|
|
19
|
+
status: 404;
|
|
20
|
+
};
|
|
21
|
+
export type meRetrieveResponseSuccess = (meRetrieveResponse200) & {
|
|
22
|
+
headers: Headers;
|
|
23
|
+
};
|
|
24
|
+
export type meRetrieveResponseError = (meRetrieveResponse401 | meRetrieveResponse404) & {
|
|
25
|
+
headers: Headers;
|
|
26
|
+
};
|
|
27
|
+
export type meRetrieveResponse = (meRetrieveResponseSuccess | meRetrieveResponseError);
|
|
28
|
+
export declare const getMeRetrieveUrl: () => string;
|
|
29
|
+
export declare const meRetrieve: (options?: RequestInit) => Promise<meRetrieveResponse>;
|
|
30
|
+
export declare const getMeRetrieveQueryKey: () => readonly ["/api/me/"];
|
|
31
|
+
export declare const getMeRetrieveQueryOptions: <TData = Awaited<ReturnType<typeof meRetrieve>>, TError = void>(options?: {
|
|
32
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof meRetrieve>>, TError, TData>;
|
|
33
|
+
fetch?: RequestInit;
|
|
34
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof meRetrieve>>, TError, TData> & {
|
|
35
|
+
queryKey: QueryKey;
|
|
36
|
+
};
|
|
37
|
+
export type MeRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof meRetrieve>>>;
|
|
38
|
+
export type MeRetrieveQueryError = void;
|
|
39
|
+
/**
|
|
40
|
+
* @summary Получить свой профиль
|
|
41
|
+
*/
|
|
42
|
+
export declare function useMeRetrieve<TData = Awaited<ReturnType<typeof meRetrieve>>, TError = void>(options?: {
|
|
43
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof meRetrieve>>, TError, TData>;
|
|
44
|
+
fetch?: RequestInit;
|
|
45
|
+
}): UseQueryResult<TData, TError> & {
|
|
46
|
+
queryKey: QueryKey;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Частичное обновление профиля текущего пользователя.
|
|
50
|
+
* @summary Обновить свой профиль
|
|
51
|
+
*/
|
|
52
|
+
export type meProfileUpdateResponse200 = {
|
|
53
|
+
data: UserProfile;
|
|
54
|
+
status: 200;
|
|
55
|
+
};
|
|
56
|
+
export type meProfileUpdateResponse400 = {
|
|
57
|
+
data: void;
|
|
58
|
+
status: 400;
|
|
59
|
+
};
|
|
60
|
+
export type meProfileUpdateResponse401 = {
|
|
61
|
+
data: void;
|
|
62
|
+
status: 401;
|
|
63
|
+
};
|
|
64
|
+
export type meProfileUpdateResponse404 = {
|
|
65
|
+
data: void;
|
|
66
|
+
status: 404;
|
|
67
|
+
};
|
|
68
|
+
export type meProfileUpdateResponseSuccess = (meProfileUpdateResponse200) & {
|
|
69
|
+
headers: Headers;
|
|
70
|
+
};
|
|
71
|
+
export type meProfileUpdateResponseError = (meProfileUpdateResponse400 | meProfileUpdateResponse401 | meProfileUpdateResponse404) & {
|
|
72
|
+
headers: Headers;
|
|
73
|
+
};
|
|
74
|
+
export type meProfileUpdateResponse = (meProfileUpdateResponseSuccess | meProfileUpdateResponseError);
|
|
75
|
+
export declare const getMeProfileUpdateUrl: () => string;
|
|
76
|
+
export declare const meProfileUpdate: (userProfileRequest: UserProfileRequest, options?: RequestInit) => Promise<meProfileUpdateResponse>;
|
|
77
|
+
export declare const getMeProfileUpdateMutationOptions: <TError = void, TContext = unknown>(options?: {
|
|
78
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof meProfileUpdate>>, TError, {
|
|
79
|
+
data: UserProfileRequest;
|
|
80
|
+
}, TContext>;
|
|
81
|
+
fetch?: RequestInit;
|
|
82
|
+
}) => UseMutationOptions<Awaited<ReturnType<typeof meProfileUpdate>>, TError, {
|
|
83
|
+
data: UserProfileRequest;
|
|
84
|
+
}, TContext>;
|
|
85
|
+
export type MeProfileUpdateMutationResult = NonNullable<Awaited<ReturnType<typeof meProfileUpdate>>>;
|
|
86
|
+
export type MeProfileUpdateMutationBody = UserProfileRequest;
|
|
87
|
+
export type MeProfileUpdateMutationError = void;
|
|
88
|
+
/**
|
|
89
|
+
* @summary Обновить свой профиль
|
|
90
|
+
*/
|
|
91
|
+
export declare const useMeProfileUpdate: <TError = void, TContext = unknown>(options?: {
|
|
92
|
+
mutation?: UseMutationOptions<Awaited<ReturnType<typeof meProfileUpdate>>, TError, {
|
|
93
|
+
data: UserProfileRequest;
|
|
94
|
+
}, TContext>;
|
|
95
|
+
fetch?: RequestInit;
|
|
96
|
+
}) => UseMutationResult<Awaited<ReturnType<typeof meProfileUpdate>>, TError, {
|
|
97
|
+
data: UserProfileRequest;
|
|
98
|
+
}, TContext>;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { useMutation, useQuery } from '@tanstack/react-query';
|
|
9
|
+
export const getMeRetrieveUrl = () => {
|
|
10
|
+
return `/api/me/`;
|
|
11
|
+
};
|
|
12
|
+
export const meRetrieve = async (options) => {
|
|
13
|
+
const res = await fetch(getMeRetrieveUrl(), {
|
|
14
|
+
...options,
|
|
15
|
+
method: 'GET'
|
|
16
|
+
});
|
|
17
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
18
|
+
const data = body ? JSON.parse(body) : {};
|
|
19
|
+
return { data, status: res.status, headers: res.headers };
|
|
20
|
+
};
|
|
21
|
+
export const getMeRetrieveQueryKey = () => {
|
|
22
|
+
return [
|
|
23
|
+
`/api/me/`
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
export const getMeRetrieveQueryOptions = (options) => {
|
|
27
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
28
|
+
const queryKey = queryOptions?.queryKey ?? getMeRetrieveQueryKey();
|
|
29
|
+
const queryFn = ({ signal }) => meRetrieve({ signal, ...fetchOptions });
|
|
30
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @summary Получить свой профиль
|
|
34
|
+
*/
|
|
35
|
+
export function useMeRetrieve(options) {
|
|
36
|
+
const queryOptions = getMeRetrieveQueryOptions(options);
|
|
37
|
+
const query = useQuery(queryOptions);
|
|
38
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
39
|
+
}
|
|
40
|
+
export const getMeProfileUpdateUrl = () => {
|
|
41
|
+
return `/api/me/profile/`;
|
|
42
|
+
};
|
|
43
|
+
export const meProfileUpdate = async (userProfileRequest, options) => {
|
|
44
|
+
const res = await fetch(getMeProfileUpdateUrl(), {
|
|
45
|
+
...options,
|
|
46
|
+
method: 'PUT',
|
|
47
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
48
|
+
body: JSON.stringify(userProfileRequest)
|
|
49
|
+
});
|
|
50
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
51
|
+
const data = body ? JSON.parse(body) : {};
|
|
52
|
+
return { data, status: res.status, headers: res.headers };
|
|
53
|
+
};
|
|
54
|
+
export const getMeProfileUpdateMutationOptions = (options) => {
|
|
55
|
+
const mutationKey = ['meProfileUpdate'];
|
|
56
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ?
|
|
57
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
58
|
+
options
|
|
59
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
60
|
+
: { mutation: { mutationKey, }, fetch: undefined };
|
|
61
|
+
const mutationFn = (props) => {
|
|
62
|
+
const { data } = props ?? {};
|
|
63
|
+
return meProfileUpdate(data, fetchOptions);
|
|
64
|
+
};
|
|
65
|
+
return { mutationFn, ...mutationOptions };
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* @summary Обновить свой профиль
|
|
69
|
+
*/
|
|
70
|
+
export const useMeProfileUpdate = (options) => {
|
|
71
|
+
return useMutation(getMeProfileUpdateMutationOptions(options));
|
|
72
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { TaskStatusResponse } from '../api.schemas';
|
|
3
|
+
type AwaitedInput<T> = PromiseLike<T> | T;
|
|
4
|
+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
5
|
+
/**
|
|
6
|
+
* Получить статус выполнения задачи по её ID.
|
|
7
|
+
* @summary Статус задачи импорта
|
|
8
|
+
*/
|
|
9
|
+
export type dogsImportStatusRetrieveResponse200 = {
|
|
10
|
+
data: TaskStatusResponse;
|
|
11
|
+
status: 200;
|
|
12
|
+
};
|
|
13
|
+
export type dogsImportStatusRetrieveResponse500 = {
|
|
14
|
+
data: void;
|
|
15
|
+
status: 500;
|
|
16
|
+
};
|
|
17
|
+
export type dogsImportStatusRetrieveResponseSuccess = (dogsImportStatusRetrieveResponse200) & {
|
|
18
|
+
headers: Headers;
|
|
19
|
+
};
|
|
20
|
+
export type dogsImportStatusRetrieveResponseError = (dogsImportStatusRetrieveResponse500) & {
|
|
21
|
+
headers: Headers;
|
|
22
|
+
};
|
|
23
|
+
export type dogsImportStatusRetrieveResponse = (dogsImportStatusRetrieveResponseSuccess | dogsImportStatusRetrieveResponseError);
|
|
24
|
+
export declare const getDogsImportStatusRetrieveUrl: (taskId: string) => string;
|
|
25
|
+
export declare const dogsImportStatusRetrieve: (taskId: string, options?: RequestInit) => Promise<dogsImportStatusRetrieveResponse>;
|
|
26
|
+
export declare const getDogsImportStatusRetrieveQueryKey: (taskId: string) => readonly [`/api/dogs/import/status/${string}/`];
|
|
27
|
+
export declare const getDogsImportStatusRetrieveQueryOptions: <TData = Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError = void>(taskId: string, options?: {
|
|
28
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError, TData>;
|
|
29
|
+
fetch?: RequestInit;
|
|
30
|
+
}) => UseQueryOptions<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError, TData> & {
|
|
31
|
+
queryKey: QueryKey;
|
|
32
|
+
};
|
|
33
|
+
export type DogsImportStatusRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>>;
|
|
34
|
+
export type DogsImportStatusRetrieveQueryError = void;
|
|
35
|
+
/**
|
|
36
|
+
* @summary Статус задачи импорта
|
|
37
|
+
*/
|
|
38
|
+
export declare function useDogsImportStatusRetrieve<TData = Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError = void>(taskId: string, options?: {
|
|
39
|
+
query?: UseQueryOptions<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError, TData>;
|
|
40
|
+
fetch?: RequestInit;
|
|
41
|
+
}): UseQueryResult<TData, TError> & {
|
|
42
|
+
queryKey: QueryKey;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { useQuery } from '@tanstack/react-query';
|
|
9
|
+
export const getDogsImportStatusRetrieveUrl = (taskId) => {
|
|
10
|
+
return `/api/dogs/import/status/${taskId}/`;
|
|
11
|
+
};
|
|
12
|
+
export const dogsImportStatusRetrieve = async (taskId, options) => {
|
|
13
|
+
const res = await fetch(getDogsImportStatusRetrieveUrl(taskId), {
|
|
14
|
+
...options,
|
|
15
|
+
method: 'GET'
|
|
16
|
+
});
|
|
17
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
18
|
+
const data = body ? JSON.parse(body) : {};
|
|
19
|
+
return { data, status: res.status, headers: res.headers };
|
|
20
|
+
};
|
|
21
|
+
export const getDogsImportStatusRetrieveQueryKey = (taskId) => {
|
|
22
|
+
return [
|
|
23
|
+
`/api/dogs/import/status/${taskId}/`
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
export const getDogsImportStatusRetrieveQueryOptions = (taskId, options) => {
|
|
27
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
28
|
+
const queryKey = queryOptions?.queryKey ?? getDogsImportStatusRetrieveQueryKey(taskId);
|
|
29
|
+
const queryFn = ({ signal }) => dogsImportStatusRetrieve(taskId, { signal, ...fetchOptions });
|
|
30
|
+
return { queryKey, queryFn, enabled: !!(taskId), ...queryOptions };
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @summary Статус задачи импорта
|
|
34
|
+
*/
|
|
35
|
+
export function useDogsImportStatusRetrieve(taskId, options) {
|
|
36
|
+
const queryOptions = getDogsImportStatusRetrieveQueryOptions(taskId, options);
|
|
37
|
+
const query = useQuery(queryOptions);
|
|
38
|
+
return { ...query, queryKey: queryOptions.queryKey };
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.0.3",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "НКП Сибирский Хаски API",
|
|
5
|
-
"version": "1.0.0",
|
|
6
|
-
"description": "API для Национального клуба породы Сибирский хаски"
|
|
7
|
-
},
|
|
8
|
-
"paths": {
|
|
9
|
-
"/api/activity-feed/": {
|
|
10
|
-
"get": {
|
|
11
|
-
"operationId": "activity_feed_retrieve",
|
|
12
|
-
"description": "Возвращает последние сообщения из Telegram-канала клуба (кешируется на 1 минуту).",
|
|
13
|
-
"summary": "Лента активности",
|
|
14
|
-
"tags": [
|
|
15
|
-
"Home"
|
|
16
|
-
],
|
|
17
|
-
"security": [
|
|
18
|
-
{
|
|
19
|
-
"cookieAuth": []
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"tokenAuth": []
|
|
23
|
-
},
|
|
24
|
-
{}
|
|
25
|
-
],
|
|
26
|
-
"responses": {
|
|
27
|
-
"200": {
|
|
28
|
-
"content": {
|
|
29
|
-
"application/json": {
|
|
30
|
-
"schema": {
|
|
31
|
-
"$ref": "#/components/schemas/ActivityFeedResponse"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"description": ""
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"components": {
|
|
42
|
-
"schemas": {
|
|
43
|
-
"ActivityFeedResponse": {
|
|
44
|
-
"type": "object",
|
|
45
|
-
"properties": {
|
|
46
|
-
"results": {
|
|
47
|
-
"type": "array",
|
|
48
|
-
"items": {},
|
|
49
|
-
"description": "Список последних сообщений из Telegram-канала"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"required": [
|
|
53
|
-
"results"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"securitySchemes": {
|
|
58
|
-
"cookieAuth": {
|
|
59
|
-
"type": "apiKey",
|
|
60
|
-
"in": "cookie",
|
|
61
|
-
"name": "sessionid"
|
|
62
|
-
},
|
|
63
|
-
"tokenAuth": {
|
|
64
|
-
"type": "apiKey",
|
|
65
|
-
"in": "header",
|
|
66
|
-
"name": "Authorization",
|
|
67
|
-
"description": "Token-based authentication with required prefix \"Token\""
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|