@htkimura/files-storage-backend.rest-client 0.0.13 → 0.0.15
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/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.4.1 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* files-storage
|
|
5
|
+
* This API is for storing files for different users
|
|
6
|
+
* OpenAPI spec version: 1.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type StorageControllerGetPresignedUrlParams = {
|
|
10
|
+
fileName: string;
|
|
11
|
+
fileType: string;
|
|
12
|
+
fileSize: number;
|
|
13
|
+
};
|
|
@@ -6,15 +6,11 @@
|
|
|
6
6
|
* OpenAPI spec version: 1.0
|
|
7
7
|
*/
|
|
8
8
|
import {
|
|
9
|
-
useMutation,
|
|
10
9
|
useQuery
|
|
11
10
|
} from '@tanstack/react-query'
|
|
12
11
|
import type {
|
|
13
|
-
MutationFunction,
|
|
14
12
|
QueryFunction,
|
|
15
13
|
QueryKey,
|
|
16
|
-
UseMutationOptions,
|
|
17
|
-
UseMutationResult,
|
|
18
14
|
UseQueryOptions,
|
|
19
15
|
UseQueryResult
|
|
20
16
|
} from '@tanstack/react-query'
|
|
@@ -24,54 +20,59 @@ import type {
|
|
|
24
20
|
AxiosRequestConfig,
|
|
25
21
|
AxiosResponse
|
|
26
22
|
} from 'axios'
|
|
23
|
+
import type {
|
|
24
|
+
StorageControllerGetPresignedUrlParams
|
|
25
|
+
} from '.././model'
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
|
|
30
|
-
export const
|
|
31
|
-
|
|
29
|
+
export const storageControllerGetPresignedUrl = (
|
|
30
|
+
params: StorageControllerGetPresignedUrlParams, options?: AxiosRequestConfig
|
|
32
31
|
): Promise<AxiosResponse<void>> => {
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
return axios.get(
|
|
36
|
-
`/
|
|
35
|
+
`/uploads/presigned-url`,{
|
|
36
|
+
...options,
|
|
37
|
+
params: {...params, ...options?.params},}
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
|
|
41
|
-
export const
|
|
42
|
-
return [`/
|
|
42
|
+
export const getStorageControllerGetPresignedUrlQueryKey = (params: StorageControllerGetPresignedUrlParams,) => {
|
|
43
|
+
return [`/uploads/presigned-url`, ...(params ? [params]: [])] as const;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
export const
|
|
47
|
+
export const getStorageControllerGetPresignedUrlQueryOptions = <TData = Awaited<ReturnType<typeof storageControllerGetPresignedUrl>>, TError = AxiosError<unknown>>(params: StorageControllerGetPresignedUrlParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof storageControllerGetPresignedUrl>>, TError, TData>, axios?: AxiosRequestConfig}
|
|
47
48
|
) => {
|
|
48
49
|
|
|
49
50
|
const {query: queryOptions, axios: axiosOptions} = options ?? {};
|
|
50
51
|
|
|
51
|
-
const queryKey = queryOptions?.queryKey ??
|
|
52
|
+
const queryKey = queryOptions?.queryKey ?? getStorageControllerGetPresignedUrlQueryKey(params);
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
|
|
55
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof
|
|
56
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof storageControllerGetPresignedUrl>>> = ({ signal }) => storageControllerGetPresignedUrl(params, { signal, ...axiosOptions });
|
|
56
57
|
|
|
57
58
|
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
|
|
61
|
-
return { queryKey, queryFn,
|
|
62
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof storageControllerGetPresignedUrl>>, TError, TData> & { queryKey: QueryKey }
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
export type
|
|
65
|
-
export type
|
|
65
|
+
export type StorageControllerGetPresignedUrlQueryResult = NonNullable<Awaited<ReturnType<typeof storageControllerGetPresignedUrl>>>
|
|
66
|
+
export type StorageControllerGetPresignedUrlQueryError = AxiosError<unknown>
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
|
|
69
|
-
export function
|
|
70
|
-
|
|
70
|
+
export function useStorageControllerGetPresignedUrl<TData = Awaited<ReturnType<typeof storageControllerGetPresignedUrl>>, TError = AxiosError<unknown>>(
|
|
71
|
+
params: StorageControllerGetPresignedUrlParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof storageControllerGetPresignedUrl>>, TError, TData>, axios?: AxiosRequestConfig}
|
|
71
72
|
|
|
72
73
|
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
73
74
|
|
|
74
|
-
const queryOptions =
|
|
75
|
+
const queryOptions = getStorageControllerGetPresignedUrlQueryOptions(params,options)
|
|
75
76
|
|
|
76
77
|
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
77
78
|
|
|
@@ -82,57 +83,3 @@ export function useStorageControllerGetObjectUrl<TData = Awaited<ReturnType<type
|
|
|
82
83
|
|
|
83
84
|
|
|
84
85
|
|
|
85
|
-
export const storageControllerUploadObject = (
|
|
86
|
-
options?: AxiosRequestConfig
|
|
87
|
-
): Promise<AxiosResponse<void>> => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return axios.post(
|
|
91
|
-
`/objects`,undefined,options
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export const getStorageControllerUploadObjectMutationOptions = <TData = Awaited<ReturnType<typeof storageControllerUploadObject>>, TError = AxiosError<unknown>,
|
|
98
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,void, TContext>, axios?: AxiosRequestConfig}
|
|
99
|
-
) => {
|
|
100
|
-
const mutationKey = ['storageControllerUploadObject'];
|
|
101
|
-
const {mutation: mutationOptions, axios: axiosOptions} = options ?
|
|
102
|
-
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
103
|
-
options
|
|
104
|
-
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
105
|
-
: {mutation: { mutationKey, }, axios: undefined};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof storageControllerUploadObject>>, void> = () => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return storageControllerUploadObject(axiosOptions)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,void, TContext>}
|
|
120
|
-
|
|
121
|
-
export type StorageControllerUploadObjectMutationResult = NonNullable<Awaited<ReturnType<typeof storageControllerUploadObject>>>
|
|
122
|
-
|
|
123
|
-
export type StorageControllerUploadObjectMutationError = AxiosError<unknown>
|
|
124
|
-
|
|
125
|
-
export const useStorageControllerUploadObject = <TData = Awaited<ReturnType<typeof storageControllerUploadObject>>, TError = AxiosError<unknown>,
|
|
126
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,void, TContext>, axios?: AxiosRequestConfig}
|
|
127
|
-
): UseMutationResult<
|
|
128
|
-
TData,
|
|
129
|
-
TError,
|
|
130
|
-
void,
|
|
131
|
-
TContext
|
|
132
|
-
> => {
|
|
133
|
-
|
|
134
|
-
const mutationOptions = getStorageControllerUploadObjectMutationOptions(options);
|
|
135
|
-
|
|
136
|
-
return useMutation(mutationOptions);
|
|
137
|
-
}
|
|
138
|
-
|
package/src/generated/index.ts
DELETED