@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.
@@ -0,0 +1,129 @@
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
+ TaskStatusResponse
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
+ * ΠŸΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ статус выполнСния Π·Π°Π΄Π°Ρ‡ΠΈ ΠΏΠΎ Π΅Ρ‘ ID.
32
+ * @summary Бтатус Π·Π°Π΄Π°Ρ‡ΠΈ ΠΈΠΌΠΏΠΎΡ€Ρ‚Π°
33
+ */
34
+ export type dogsImportStatusRetrieveResponse200 = {
35
+ data: TaskStatusResponse
36
+ status: 200
37
+ }
38
+
39
+ export type dogsImportStatusRetrieveResponse500 = {
40
+ data: void
41
+ status: 500
42
+ }
43
+
44
+ export type dogsImportStatusRetrieveResponseSuccess = (dogsImportStatusRetrieveResponse200) & {
45
+ headers: Headers;
46
+ };
47
+ export type dogsImportStatusRetrieveResponseError = (dogsImportStatusRetrieveResponse500) & {
48
+ headers: Headers;
49
+ };
50
+
51
+ export type dogsImportStatusRetrieveResponse = (dogsImportStatusRetrieveResponseSuccess | dogsImportStatusRetrieveResponseError)
52
+
53
+ export const getDogsImportStatusRetrieveUrl = (taskId: string,) => {
54
+
55
+
56
+
57
+
58
+ return `/api/dogs/import/status/${taskId}/`
59
+ }
60
+
61
+ export const dogsImportStatusRetrieve = async (taskId: string, options?: RequestInit): Promise<dogsImportStatusRetrieveResponse> => {
62
+
63
+ const res = await fetch(getDogsImportStatusRetrieveUrl(taskId),
64
+ {
65
+ ...options,
66
+ method: 'GET'
67
+
68
+
69
+ }
70
+ )
71
+
72
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
73
+
74
+ const data: dogsImportStatusRetrieveResponse['data'] = body ? JSON.parse(body) : {}
75
+ return { data, status: res.status, headers: res.headers } as dogsImportStatusRetrieveResponse
76
+ }
77
+
78
+
79
+
80
+
81
+
82
+ export const getDogsImportStatusRetrieveQueryKey = (taskId: string,) => {
83
+ return [
84
+ `/api/dogs/import/status/${taskId}/`
85
+ ] as const;
86
+ }
87
+
88
+
89
+ export const getDogsImportStatusRetrieveQueryOptions = <TData = Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError = void>(taskId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError, TData>, fetch?: RequestInit}
90
+ ) => {
91
+
92
+ const {query: queryOptions, fetch: fetchOptions} = options ?? {};
93
+
94
+ const queryKey = queryOptions?.queryKey ?? getDogsImportStatusRetrieveQueryKey(taskId);
95
+
96
+
97
+
98
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>> = ({ signal }) => dogsImportStatusRetrieve(taskId, { signal, ...fetchOptions });
99
+
100
+
101
+
102
+
103
+
104
+ return { queryKey, queryFn, enabled: !!(taskId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError, TData> & { queryKey: QueryKey }
105
+ }
106
+
107
+ export type DogsImportStatusRetrieveQueryResult = NonNullable<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>>
108
+ export type DogsImportStatusRetrieveQueryError = void
109
+
110
+
111
+ /**
112
+ * @summary Бтатус Π·Π°Π΄Π°Ρ‡ΠΈ ΠΈΠΌΠΏΠΎΡ€Ρ‚Π°
113
+ */
114
+
115
+ export function useDogsImportStatusRetrieve<TData = Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError = void>(
116
+ taskId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof dogsImportStatusRetrieve>>, TError, TData>, fetch?: RequestInit}
117
+
118
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
119
+
120
+ const queryOptions = getDogsImportStatusRetrieveQueryOptions(taskId,options)
121
+
122
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
123
+
124
+ return { ...query, queryKey: queryOptions.queryKey };
125
+ }
126
+
127
+
128
+
129
+
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@omerikanec/api-client-demo",
3
+ "version": "0.0.1",
4
+ "description": "Auto-generated typed API client",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./*": {
16
+ "types": "./dist/*.d.ts",
17
+ "import": "./dist/*.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "impact-report.json",
23
+ "impact-report.html",
24
+ "CHANGELOG.md"
25
+ ],
26
+ "publishConfig": {
27
+ "registry": "https://registry.npmjs.org",
28
+ "access": "public"
29
+ },
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "peerDependencies": {
34
+ "@tanstack/react-query": ">=4.0.0",
35
+ "react": ">=17.0.0"
36
+ }
37
+ }