@htkimura/files-storage-backend.rest-client 0.0.28 → 0.0.30

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,118 @@
1
+ import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
2
+ import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
3
+ import type { CreateFolderDto, Folder, RenameFolderDto, UpdateParentFolderDto } from '.././model';
4
+ /**
5
+ * Creates a new folder for the authenticated user. Optionally, can specify a parent folder to create it inside.
6
+ * @summary Create a new folder
7
+ */
8
+ export declare const createFolder: (createFolderDto: CreateFolderDto, options?: AxiosRequestConfig) => Promise<AxiosResponse<Folder>>;
9
+ export declare const getCreateFolderMutationOptions: <TData = AxiosResponse<Folder, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
10
+ mutation?: UseMutationOptions<TData, TError, {
11
+ data: CreateFolderDto;
12
+ }, TContext>;
13
+ axios?: AxiosRequestConfig;
14
+ }) => UseMutationOptions<TData, TError, {
15
+ data: CreateFolderDto;
16
+ }, TContext>;
17
+ export type CreateFolderMutationResult = NonNullable<Awaited<ReturnType<typeof createFolder>>>;
18
+ export type CreateFolderMutationBody = CreateFolderDto;
19
+ export type CreateFolderMutationError = AxiosError<unknown>;
20
+ /**
21
+ * @summary Create a new folder
22
+ */
23
+ export declare const useCreateFolder: <TData = AxiosResponse<Folder, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
24
+ mutation?: UseMutationOptions<TData, TError, {
25
+ data: CreateFolderDto;
26
+ }, TContext>;
27
+ axios?: AxiosRequestConfig;
28
+ }) => UseMutationResult<TData, TError, {
29
+ data: CreateFolderDto;
30
+ }, TContext>;
31
+ /**
32
+ * Renames a folder belonging to the authenticated user
33
+ * @summary Rename a folder
34
+ */
35
+ export declare const renameFolder: (id: string, renameFolderDto: RenameFolderDto, options?: AxiosRequestConfig) => Promise<AxiosResponse<Folder>>;
36
+ export declare const getRenameFolderMutationOptions: <TData = AxiosResponse<Folder, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
37
+ mutation?: UseMutationOptions<TData, TError, {
38
+ id: string;
39
+ data: RenameFolderDto;
40
+ }, TContext>;
41
+ axios?: AxiosRequestConfig;
42
+ }) => UseMutationOptions<TData, TError, {
43
+ id: string;
44
+ data: RenameFolderDto;
45
+ }, TContext>;
46
+ export type RenameFolderMutationResult = NonNullable<Awaited<ReturnType<typeof renameFolder>>>;
47
+ export type RenameFolderMutationBody = RenameFolderDto;
48
+ export type RenameFolderMutationError = AxiosError<unknown>;
49
+ /**
50
+ * @summary Rename a folder
51
+ */
52
+ export declare const useRenameFolder: <TData = AxiosResponse<Folder, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
53
+ mutation?: UseMutationOptions<TData, TError, {
54
+ id: string;
55
+ data: RenameFolderDto;
56
+ }, TContext>;
57
+ axios?: AxiosRequestConfig;
58
+ }) => UseMutationResult<TData, TError, {
59
+ id: string;
60
+ data: RenameFolderDto;
61
+ }, TContext>;
62
+ /**
63
+ * Moves a folder to another folder or removes it from its parent folder. Set parentFolderId to null to remove from parent folder.
64
+ * @summary Update folder parent
65
+ */
66
+ export declare const updateParentFolder: (id: string, updateParentFolderDto: UpdateParentFolderDto, options?: AxiosRequestConfig) => Promise<AxiosResponse<Folder>>;
67
+ export declare const getUpdateParentFolderMutationOptions: <TData = AxiosResponse<Folder, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
68
+ mutation?: UseMutationOptions<TData, TError, {
69
+ id: string;
70
+ data: UpdateParentFolderDto;
71
+ }, TContext>;
72
+ axios?: AxiosRequestConfig;
73
+ }) => UseMutationOptions<TData, TError, {
74
+ id: string;
75
+ data: UpdateParentFolderDto;
76
+ }, TContext>;
77
+ export type UpdateParentFolderMutationResult = NonNullable<Awaited<ReturnType<typeof updateParentFolder>>>;
78
+ export type UpdateParentFolderMutationBody = UpdateParentFolderDto;
79
+ export type UpdateParentFolderMutationError = AxiosError<unknown>;
80
+ /**
81
+ * @summary Update folder parent
82
+ */
83
+ export declare const useUpdateParentFolder: <TData = AxiosResponse<Folder, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
84
+ mutation?: UseMutationOptions<TData, TError, {
85
+ id: string;
86
+ data: UpdateParentFolderDto;
87
+ }, TContext>;
88
+ axios?: AxiosRequestConfig;
89
+ }) => UseMutationResult<TData, TError, {
90
+ id: string;
91
+ data: UpdateParentFolderDto;
92
+ }, TContext>;
93
+ /**
94
+ * Deletes a folder belonging to the authenticated user
95
+ * @summary Delete a folder
96
+ */
97
+ export declare const deleteFolder: (id: string, options?: AxiosRequestConfig) => Promise<AxiosResponse<boolean>>;
98
+ export declare const getDeleteFolderMutationOptions: <TData = AxiosResponse<boolean, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
99
+ mutation?: UseMutationOptions<TData, TError, {
100
+ id: string;
101
+ }, TContext>;
102
+ axios?: AxiosRequestConfig;
103
+ }) => UseMutationOptions<TData, TError, {
104
+ id: string;
105
+ }, TContext>;
106
+ export type DeleteFolderMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFolder>>>;
107
+ export type DeleteFolderMutationError = AxiosError<unknown>;
108
+ /**
109
+ * @summary Delete a folder
110
+ */
111
+ export declare const useDeleteFolder: <TData = AxiosResponse<boolean, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
112
+ mutation?: UseMutationOptions<TData, TError, {
113
+ id: string;
114
+ }, TContext>;
115
+ axios?: AxiosRequestConfig;
116
+ }) => UseMutationResult<TData, TError, {
117
+ id: string;
118
+ }, TContext>;
@@ -0,0 +1,117 @@
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
+ import { useMutation } from '@tanstack/react-query';
9
+ import axios from 'axios';
10
+ /**
11
+ * Creates a new folder for the authenticated user. Optionally, can specify a parent folder to create it inside.
12
+ * @summary Create a new folder
13
+ */
14
+ export const createFolder = (createFolderDto, options) => {
15
+ return axios.post(`/folders`, createFolderDto, options);
16
+ };
17
+ export const getCreateFolderMutationOptions = (options) => {
18
+ const mutationKey = ['createFolder'];
19
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
20
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
21
+ options
22
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
23
+ : { mutation: { mutationKey, }, axios: undefined };
24
+ const mutationFn = (props) => {
25
+ const { data } = props ?? {};
26
+ return createFolder(data, axiosOptions);
27
+ };
28
+ return { mutationFn, ...mutationOptions };
29
+ };
30
+ /**
31
+ * @summary Create a new folder
32
+ */
33
+ export const useCreateFolder = (options) => {
34
+ const mutationOptions = getCreateFolderMutationOptions(options);
35
+ return useMutation(mutationOptions);
36
+ };
37
+ /**
38
+ * Renames a folder belonging to the authenticated user
39
+ * @summary Rename a folder
40
+ */
41
+ export const renameFolder = (id, renameFolderDto, options) => {
42
+ return axios.patch(`/folders/${id}/rename`, renameFolderDto, options);
43
+ };
44
+ export const getRenameFolderMutationOptions = (options) => {
45
+ const mutationKey = ['renameFolder'];
46
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
47
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
48
+ options
49
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
50
+ : { mutation: { mutationKey, }, axios: undefined };
51
+ const mutationFn = (props) => {
52
+ const { id, data } = props ?? {};
53
+ return renameFolder(id, data, axiosOptions);
54
+ };
55
+ return { mutationFn, ...mutationOptions };
56
+ };
57
+ /**
58
+ * @summary Rename a folder
59
+ */
60
+ export const useRenameFolder = (options) => {
61
+ const mutationOptions = getRenameFolderMutationOptions(options);
62
+ return useMutation(mutationOptions);
63
+ };
64
+ /**
65
+ * Moves a folder to another folder or removes it from its parent folder. Set parentFolderId to null to remove from parent folder.
66
+ * @summary Update folder parent
67
+ */
68
+ export const updateParentFolder = (id, updateParentFolderDto, options) => {
69
+ return axios.put(`/folders/${id}/parent`, updateParentFolderDto, options);
70
+ };
71
+ export const getUpdateParentFolderMutationOptions = (options) => {
72
+ const mutationKey = ['updateParentFolder'];
73
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
74
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
75
+ options
76
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
77
+ : { mutation: { mutationKey, }, axios: undefined };
78
+ const mutationFn = (props) => {
79
+ const { id, data } = props ?? {};
80
+ return updateParentFolder(id, data, axiosOptions);
81
+ };
82
+ return { mutationFn, ...mutationOptions };
83
+ };
84
+ /**
85
+ * @summary Update folder parent
86
+ */
87
+ export const useUpdateParentFolder = (options) => {
88
+ const mutationOptions = getUpdateParentFolderMutationOptions(options);
89
+ return useMutation(mutationOptions);
90
+ };
91
+ /**
92
+ * Deletes a folder belonging to the authenticated user
93
+ * @summary Delete a folder
94
+ */
95
+ export const deleteFolder = (id, options) => {
96
+ return axios.delete(`/folders/${id}`, options);
97
+ };
98
+ export const getDeleteFolderMutationOptions = (options) => {
99
+ const mutationKey = ['deleteFolder'];
100
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
101
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
102
+ options
103
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
104
+ : { mutation: { mutationKey, }, axios: undefined };
105
+ const mutationFn = (props) => {
106
+ const { id } = props ?? {};
107
+ return deleteFolder(id, axiosOptions);
108
+ };
109
+ return { mutationFn, ...mutationOptions };
110
+ };
111
+ /**
112
+ * @summary Delete a folder
113
+ */
114
+ export const useDeleteFolder = (options) => {
115
+ const mutationOptions = getDeleteFolderMutationOptions(options);
116
+ return useMutation(mutationOptions);
117
+ };
@@ -0,0 +1,11 @@
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
+ export interface CreateFolderDto {
9
+ name: string;
10
+ parentFolderId?: string;
11
+ }
@@ -15,4 +15,5 @@ export interface File {
15
15
  path: string;
16
16
  thumbnailPath?: string;
17
17
  userId: string;
18
+ folderId?: string;
18
19
  }
@@ -15,5 +15,6 @@ export interface FileWithPresignedThumbnailUrl {
15
15
  path: string;
16
16
  thumbnailPath?: string;
17
17
  userId: string;
18
+ folderId?: string;
18
19
  presignedThumbnailUrl: string;
19
20
  }
@@ -15,5 +15,6 @@ export interface FileWithPresignedUrl {
15
15
  path: string;
16
16
  thumbnailPath?: string;
17
17
  userId: string;
18
+ folderId?: string;
18
19
  presignedUrl: string;
19
20
  }
@@ -0,0 +1,15 @@
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
+ export interface Folder {
9
+ id: string;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ name: string;
13
+ userId: string;
14
+ parentFolderId?: string;
15
+ }
@@ -7,9 +7,9 @@
7
7
  */
8
8
  import type { FileWithPresignedThumbnailUrl } from './fileWithPresignedThumbnailUrl';
9
9
  export interface GetUserFilesOutput {
10
- data: FileWithPresignedThumbnailUrl[];
11
10
  page: number;
12
11
  size: number;
13
12
  total: number;
14
13
  hasMore: boolean;
14
+ data: FileWithPresignedThumbnailUrl[];
15
15
  }
@@ -5,6 +5,7 @@
5
5
  * This API is for storing files for different users
6
6
  * OpenAPI spec version: 1.0
7
7
  */
8
+ export * from './createFolderDto';
8
9
  export * from './createUserDto';
9
10
  export * from './deleteBulkFilesByIdsParams';
10
11
  export * from './deleteBulkFilesOutput';
@@ -12,12 +13,17 @@ export * from './file';
12
13
  export * from './fileFilterType';
13
14
  export * from './fileWithPresignedThumbnailUrl';
14
15
  export * from './fileWithPresignedUrl';
16
+ export * from './folder';
15
17
  export * from './getBulkFilesByIdsParams';
16
18
  export * from './getPresignedUploadUrlParams';
17
19
  export * from './getUserFilesOutput';
20
+ export * from './listChildrenParams';
18
21
  export * from './loginDto';
22
+ export * from './moveFileToFolderDto';
19
23
  export * from './myFilesParams';
20
24
  export * from './refreshTokenDto';
25
+ export * from './renameFolderDto';
26
+ export * from './updateParentFolderDto';
21
27
  export * from './uploadFileOutput';
22
28
  export * from './user';
23
29
  export * from './userLogin';
@@ -5,6 +5,7 @@
5
5
  * This API is for storing files for different users
6
6
  * OpenAPI spec version: 1.0
7
7
  */
8
+ export * from './createFolderDto';
8
9
  export * from './createUserDto';
9
10
  export * from './deleteBulkFilesByIdsParams';
10
11
  export * from './deleteBulkFilesOutput';
@@ -12,12 +13,17 @@ export * from './file';
12
13
  export * from './fileFilterType';
13
14
  export * from './fileWithPresignedThumbnailUrl';
14
15
  export * from './fileWithPresignedUrl';
16
+ export * from './folder';
15
17
  export * from './getBulkFilesByIdsParams';
16
18
  export * from './getPresignedUploadUrlParams';
17
19
  export * from './getUserFilesOutput';
20
+ export * from './listChildrenParams';
18
21
  export * from './loginDto';
22
+ export * from './moveFileToFolderDto';
19
23
  export * from './myFilesParams';
20
24
  export * from './refreshTokenDto';
25
+ export * from './renameFolderDto';
26
+ export * from './updateParentFolderDto';
21
27
  export * from './uploadFileOutput';
22
28
  export * from './user';
23
29
  export * from './userLogin';
@@ -5,8 +5,8 @@
5
5
  * This API is for storing files for different users
6
6
  * OpenAPI spec version: 1.0
7
7
  */
8
- export type GetPresignedUrlParams = {
9
- fileName: string;
10
- fileType: string;
11
- fileSize: number;
8
+ export type ListChildrenParams = {
9
+ page?: number;
10
+ size?: number;
11
+ parentFolderId?: string;
12
12
  };
@@ -0,0 +1,14 @@
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
+ export interface MoveFileToFolderDto {
9
+ /**
10
+ * ID of the folder to move this file into. Set to null to remove from folder.
11
+ * @nullable
12
+ */
13
+ folderId?: string | null;
14
+ }
@@ -0,0 +1,8 @@
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
+ export {};
@@ -5,6 +5,6 @@
5
5
  * This API is for storing files for different users
6
6
  * OpenAPI spec version: 1.0
7
7
  */
8
- export interface FileFilters {
9
- [key: string]: unknown;
8
+ export interface RenameFolderDto {
9
+ name: string;
10
10
  }
@@ -0,0 +1,8 @@
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
+ export {};
@@ -0,0 +1,14 @@
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
+ export interface UpdateParentFolderDto {
9
+ /**
10
+ * ID of the parent folder to move this folder into. Set to null to remove from parent folder.
11
+ * @nullable
12
+ */
13
+ parentFolderId?: string | null;
14
+ }
@@ -0,0 +1,8 @@
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
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { QueryKey, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
2
2
  import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
3
- import type { DeleteBulkFilesByIdsParams, DeleteBulkFilesOutput, FileWithPresignedUrl, GetBulkFilesByIdsParams, GetPresignedUploadUrlParams, UploadFileOutput } from '.././model';
3
+ import type { DeleteBulkFilesByIdsParams, DeleteBulkFilesOutput, File, FileWithPresignedUrl, GetBulkFilesByIdsParams, GetPresignedUploadUrlParams, ListChildrenParams, MoveFileToFolderDto, UploadFileOutput } from '.././model';
4
4
  /**
5
5
  * Returns presigned url to upload file
6
6
  * @summary Get presigned url to upload file
@@ -140,3 +140,57 @@ export declare const useDeleteFileById: <TData = AxiosResponse<boolean, any>, TE
140
140
  }) => UseMutationResult<TData, TError, {
141
141
  id: string;
142
142
  }, TContext>;
143
+ /**
144
+ * Returns content of a folder. If no folder is provided, list content of root folder
145
+ * @summary Get content of a folder (also works for root folder)
146
+ */
147
+ export declare const listChildren: (params: ListChildrenParams, options?: AxiosRequestConfig) => Promise<AxiosResponse<FileWithPresignedUrl>>;
148
+ export declare const getListChildrenQueryKey: (params: ListChildrenParams) => readonly ["/children", ...ListChildrenParams[]];
149
+ export declare const getListChildrenQueryOptions: <TData = AxiosResponse<FileWithPresignedUrl, any>, TError = AxiosError<unknown, any>>(params: ListChildrenParams, options?: {
150
+ query?: UseQueryOptions<Awaited<ReturnType<typeof listChildren>>, TError, TData>;
151
+ axios?: AxiosRequestConfig;
152
+ }) => UseQueryOptions<Awaited<ReturnType<typeof listChildren>>, TError, TData> & {
153
+ queryKey: QueryKey;
154
+ };
155
+ export type ListChildrenQueryResult = NonNullable<Awaited<ReturnType<typeof listChildren>>>;
156
+ export type ListChildrenQueryError = AxiosError<unknown>;
157
+ /**
158
+ * @summary Get content of a folder (also works for root folder)
159
+ */
160
+ export declare function useListChildren<TData = Awaited<ReturnType<typeof listChildren>>, TError = AxiosError<unknown>>(params: ListChildrenParams, options?: {
161
+ query?: UseQueryOptions<Awaited<ReturnType<typeof listChildren>>, TError, TData>;
162
+ axios?: AxiosRequestConfig;
163
+ }): UseQueryResult<TData, TError> & {
164
+ queryKey: QueryKey;
165
+ };
166
+ /**
167
+ * Moves a file to a folder or removes it from its folder. Set folderId to null to remove from folder.
168
+ * @summary Move file to folder
169
+ */
170
+ export declare const moveFileToFolder: (id: string, moveFileToFolderDto: MoveFileToFolderDto, options?: AxiosRequestConfig) => Promise<AxiosResponse<File>>;
171
+ export declare const getMoveFileToFolderMutationOptions: <TData = AxiosResponse<File, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
172
+ mutation?: UseMutationOptions<TData, TError, {
173
+ id: string;
174
+ data: MoveFileToFolderDto;
175
+ }, TContext>;
176
+ axios?: AxiosRequestConfig;
177
+ }) => UseMutationOptions<TData, TError, {
178
+ id: string;
179
+ data: MoveFileToFolderDto;
180
+ }, TContext>;
181
+ export type MoveFileToFolderMutationResult = NonNullable<Awaited<ReturnType<typeof moveFileToFolder>>>;
182
+ export type MoveFileToFolderMutationBody = MoveFileToFolderDto;
183
+ export type MoveFileToFolderMutationError = AxiosError<unknown>;
184
+ /**
185
+ * @summary Move file to folder
186
+ */
187
+ export declare const useMoveFileToFolder: <TData = AxiosResponse<File, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
188
+ mutation?: UseMutationOptions<TData, TError, {
189
+ id: string;
190
+ data: MoveFileToFolderDto;
191
+ }, TContext>;
192
+ axios?: AxiosRequestConfig;
193
+ }) => UseMutationResult<TData, TError, {
194
+ id: string;
195
+ data: MoveFileToFolderDto;
196
+ }, TContext>;
@@ -171,3 +171,58 @@ export const useDeleteFileById = (options) => {
171
171
  const mutationOptions = getDeleteFileByIdMutationOptions(options);
172
172
  return useMutation(mutationOptions);
173
173
  };
174
+ /**
175
+ * Returns content of a folder. If no folder is provided, list content of root folder
176
+ * @summary Get content of a folder (also works for root folder)
177
+ */
178
+ export const listChildren = (params, options) => {
179
+ return axios.get(`/children`, {
180
+ ...options,
181
+ params: { ...params, ...options?.params },
182
+ });
183
+ };
184
+ export const getListChildrenQueryKey = (params) => {
185
+ return [`/children`, ...(params ? [params] : [])];
186
+ };
187
+ export const getListChildrenQueryOptions = (params, options) => {
188
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
189
+ const queryKey = queryOptions?.queryKey ?? getListChildrenQueryKey(params);
190
+ const queryFn = ({ signal }) => listChildren(params, { signal, ...axiosOptions });
191
+ return { queryKey, queryFn, ...queryOptions };
192
+ };
193
+ /**
194
+ * @summary Get content of a folder (also works for root folder)
195
+ */
196
+ export function useListChildren(params, options) {
197
+ const queryOptions = getListChildrenQueryOptions(params, options);
198
+ const query = useQuery(queryOptions);
199
+ query.queryKey = queryOptions.queryKey;
200
+ return query;
201
+ }
202
+ /**
203
+ * Moves a file to a folder or removes it from its folder. Set folderId to null to remove from folder.
204
+ * @summary Move file to folder
205
+ */
206
+ export const moveFileToFolder = (id, moveFileToFolderDto, options) => {
207
+ return axios.put(`/files/${id}/folder`, moveFileToFolderDto, options);
208
+ };
209
+ export const getMoveFileToFolderMutationOptions = (options) => {
210
+ const mutationKey = ['moveFileToFolder'];
211
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
212
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
213
+ options
214
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
215
+ : { mutation: { mutationKey, }, axios: undefined };
216
+ const mutationFn = (props) => {
217
+ const { id, data } = props ?? {};
218
+ return moveFileToFolder(id, data, axiosOptions);
219
+ };
220
+ return { mutationFn, ...mutationOptions };
221
+ };
222
+ /**
223
+ * @summary Move file to folder
224
+ */
225
+ export const useMoveFileToFolder = (options) => {
226
+ const mutationOptions = getMoveFileToFolderMutationOptions(options);
227
+ return useMutation(mutationOptions);
228
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htkimura/files-storage-backend.rest-client",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "REST client of files-storage-backend",
5
5
  "author": "Henry Kimura",
6
6
  "license": "MIT",
@@ -28,9 +28,12 @@
28
28
  "axios": "^1.7.9"
29
29
  },
30
30
  "devDependencies": {
31
+ "@tanstack/react-query": "^5.66.0",
31
32
  "@types/node": "^22.13.5",
32
33
  "@types/react": "^19.0.10",
33
34
  "@types/react-dom": "^19.0.4",
35
+ "react": "^19.0.0",
36
+ "react-dom": "^19.0.0",
34
37
  "typescript": "^5.7.3"
35
38
  }
36
39
  }
@@ -1,12 +0,0 @@
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
- export type StorageControllerGetPresignedUrlParams = {
9
- fileName: string;
10
- fileType: string;
11
- fileSize: number;
12
- };