@htkimura/files-storage-backend.rest-client 0.0.33 → 0.0.35
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/generated/folder/folder.d.ts +6 -6
- package/dist/generated/folder/folder.js +13 -10
- package/dist/generated/model/index.d.ts +2 -0
- package/dist/generated/model/index.js +2 -0
- package/dist/generated/model/listMyFoldersParams.d.ts +13 -0
- package/dist/generated/model/listMyFoldersParams.js +8 -0
- package/dist/generated/model/myFilesParams.d.ts +4 -0
- package/dist/generated/model/renameFileDto.d.ts +10 -0
- package/dist/generated/model/renameFileDto.js +8 -0
- package/dist/generated/storage/storage.d.ts +32 -1
- package/dist/generated/storage/storage.js +27 -0
- package/dist/generated/user/user.d.ts +1 -1
- package/dist/generated/user/user.js +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
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 { CreateFolderDto, Folder, RenameFolderDto, UpdateParentFolderDto } from '.././model';
|
|
3
|
+
import type { CreateFolderDto, Folder, ListMyFoldersParams, RenameFolderDto, UpdateParentFolderDto } from '.././model';
|
|
4
4
|
/**
|
|
5
|
-
* Returns
|
|
5
|
+
* Returns folders for the authenticated user. Omit parentFolderId to return all folders, pass null for root-level folders only, or pass a folder ID to return direct child folders.
|
|
6
6
|
* @summary List all folders
|
|
7
7
|
*/
|
|
8
|
-
export declare const listMyFolders: (options?: AxiosRequestConfig) => Promise<AxiosResponse<Folder[]>>;
|
|
9
|
-
export declare const getListMyFoldersQueryKey: () => readonly ["/folders"];
|
|
10
|
-
export declare const getListMyFoldersQueryOptions: <TData = AxiosResponse<Folder[], any>, TError = AxiosError<unknown, any>>(options?: {
|
|
8
|
+
export declare const listMyFolders: (params?: ListMyFoldersParams, options?: AxiosRequestConfig) => Promise<AxiosResponse<Folder[]>>;
|
|
9
|
+
export declare const getListMyFoldersQueryKey: (params?: ListMyFoldersParams) => readonly ["/folders", ...ListMyFoldersParams[]];
|
|
10
|
+
export declare const getListMyFoldersQueryOptions: <TData = AxiosResponse<Folder[], any>, TError = AxiosError<unknown, any>>(params?: ListMyFoldersParams, options?: {
|
|
11
11
|
query?: UseQueryOptions<Awaited<ReturnType<typeof listMyFolders>>, TError, TData>;
|
|
12
12
|
axios?: AxiosRequestConfig;
|
|
13
13
|
}) => UseQueryOptions<Awaited<ReturnType<typeof listMyFolders>>, TError, TData> & {
|
|
@@ -18,7 +18,7 @@ export type ListMyFoldersQueryError = AxiosError<unknown>;
|
|
|
18
18
|
/**
|
|
19
19
|
* @summary List all folders
|
|
20
20
|
*/
|
|
21
|
-
export declare function useListMyFolders<TData = Awaited<ReturnType<typeof listMyFolders>>, TError = AxiosError<unknown>>(options?: {
|
|
21
|
+
export declare function useListMyFolders<TData = Awaited<ReturnType<typeof listMyFolders>>, TError = AxiosError<unknown>>(params?: ListMyFoldersParams, options?: {
|
|
22
22
|
query?: UseQueryOptions<Awaited<ReturnType<typeof listMyFolders>>, TError, TData>;
|
|
23
23
|
axios?: AxiosRequestConfig;
|
|
24
24
|
}): UseQueryResult<TData, TError> & {
|
|
@@ -8,26 +8,29 @@
|
|
|
8
8
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
9
9
|
import axios from 'axios';
|
|
10
10
|
/**
|
|
11
|
-
* Returns
|
|
11
|
+
* Returns folders for the authenticated user. Omit parentFolderId to return all folders, pass null for root-level folders only, or pass a folder ID to return direct child folders.
|
|
12
12
|
* @summary List all folders
|
|
13
13
|
*/
|
|
14
|
-
export const listMyFolders = (options) => {
|
|
15
|
-
return axios.get(`/folders`,
|
|
14
|
+
export const listMyFolders = (params, options) => {
|
|
15
|
+
return axios.get(`/folders`, {
|
|
16
|
+
...options,
|
|
17
|
+
params: { ...params, ...options?.params },
|
|
18
|
+
});
|
|
16
19
|
};
|
|
17
|
-
export const getListMyFoldersQueryKey = () => {
|
|
18
|
-
return [`/folders
|
|
20
|
+
export const getListMyFoldersQueryKey = (params) => {
|
|
21
|
+
return [`/folders`, ...(params ? [params] : [])];
|
|
19
22
|
};
|
|
20
|
-
export const getListMyFoldersQueryOptions = (options) => {
|
|
23
|
+
export const getListMyFoldersQueryOptions = (params, options) => {
|
|
21
24
|
const { query: queryOptions, axios: axiosOptions } = options ?? {};
|
|
22
|
-
const queryKey = queryOptions?.queryKey ?? getListMyFoldersQueryKey();
|
|
23
|
-
const queryFn = ({ signal }) => listMyFolders({ signal, ...axiosOptions });
|
|
25
|
+
const queryKey = queryOptions?.queryKey ?? getListMyFoldersQueryKey(params);
|
|
26
|
+
const queryFn = ({ signal }) => listMyFolders(params, { signal, ...axiosOptions });
|
|
24
27
|
return { queryKey, queryFn, ...queryOptions };
|
|
25
28
|
};
|
|
26
29
|
/**
|
|
27
30
|
* @summary List all folders
|
|
28
31
|
*/
|
|
29
|
-
export function useListMyFolders(options) {
|
|
30
|
-
const queryOptions = getListMyFoldersQueryOptions(options);
|
|
32
|
+
export function useListMyFolders(params, options) {
|
|
33
|
+
const queryOptions = getListMyFoldersQueryOptions(params, options);
|
|
31
34
|
const query = useQuery(queryOptions);
|
|
32
35
|
query.queryKey = queryOptions.queryKey;
|
|
33
36
|
return query;
|
|
@@ -25,12 +25,14 @@ export * from './initMultipartUploadOutput';
|
|
|
25
25
|
export * from './listChildrenData';
|
|
26
26
|
export * from './listChildrenOutput';
|
|
27
27
|
export * from './listChildrenParams';
|
|
28
|
+
export * from './listMyFoldersParams';
|
|
28
29
|
export * from './loginDto';
|
|
29
30
|
export * from './moveFileToFolderDto';
|
|
30
31
|
export * from './multipartPartUrlOutput';
|
|
31
32
|
export * from './multipartUploadedPartDto';
|
|
32
33
|
export * from './myFilesParams';
|
|
33
34
|
export * from './refreshTokenDto';
|
|
35
|
+
export * from './renameFileDto';
|
|
34
36
|
export * from './renameFolderDto';
|
|
35
37
|
export * from './updateParentFolderDto';
|
|
36
38
|
export * from './uploadFileOutput';
|
|
@@ -25,12 +25,14 @@ export * from './initMultipartUploadOutput';
|
|
|
25
25
|
export * from './listChildrenData';
|
|
26
26
|
export * from './listChildrenOutput';
|
|
27
27
|
export * from './listChildrenParams';
|
|
28
|
+
export * from './listMyFoldersParams';
|
|
28
29
|
export * from './loginDto';
|
|
29
30
|
export * from './moveFileToFolderDto';
|
|
30
31
|
export * from './multipartPartUrlOutput';
|
|
31
32
|
export * from './multipartUploadedPartDto';
|
|
32
33
|
export * from './myFilesParams';
|
|
33
34
|
export * from './refreshTokenDto';
|
|
35
|
+
export * from './renameFileDto';
|
|
34
36
|
export * from './renameFolderDto';
|
|
35
37
|
export * from './updateParentFolderDto';
|
|
36
38
|
export * from './uploadFileOutput';
|
|
@@ -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
|
+
export type ListMyFoldersParams = {
|
|
9
|
+
/**
|
|
10
|
+
* Filter by parent folder. Omit to return all folders. Pass null for root-level folders only.
|
|
11
|
+
*/
|
|
12
|
+
parentFolderId?: string | null;
|
|
13
|
+
};
|
|
@@ -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 { AbortMultipartUploadParams, CompleteMultipartUploadDto, DeleteBulkFilesByIdsParams, DeleteBulkFilesOutput, File, FileWithPresignedUrl, GetBulkFilesByIdsParams, GetMultipartPartUrlParams, GetPresignedUploadUrlParams, InitMultipartUploadDto, InitMultipartUploadOutput, ListChildrenOutput, ListChildrenParams, MoveFileToFolderDto, MultipartPartUrlOutput, UploadFileOutput } from '.././model';
|
|
3
|
+
import type { AbortMultipartUploadParams, CompleteMultipartUploadDto, DeleteBulkFilesByIdsParams, DeleteBulkFilesOutput, File, FileWithPresignedUrl, GetBulkFilesByIdsParams, GetMultipartPartUrlParams, GetPresignedUploadUrlParams, InitMultipartUploadDto, InitMultipartUploadOutput, ListChildrenOutput, ListChildrenParams, MoveFileToFolderDto, MultipartPartUrlOutput, RenameFileDto, UploadFileOutput } from '.././model';
|
|
4
4
|
/**
|
|
5
5
|
* Returns presigned url to upload file
|
|
6
6
|
* @summary Get presigned url to upload file
|
|
@@ -296,3 +296,34 @@ export declare const useMoveFileToFolder: <TData = AxiosResponse<File, any>, TEr
|
|
|
296
296
|
id: string;
|
|
297
297
|
data: MoveFileToFolderDto;
|
|
298
298
|
}, TContext>;
|
|
299
|
+
/**
|
|
300
|
+
* Renames a file belonging to the authenticated user
|
|
301
|
+
* @summary Rename a file
|
|
302
|
+
*/
|
|
303
|
+
export declare const renameFile: (id: string, renameFileDto: RenameFileDto, options?: AxiosRequestConfig) => Promise<AxiosResponse<File>>;
|
|
304
|
+
export declare const getRenameFileMutationOptions: <TData = AxiosResponse<File, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
|
|
305
|
+
mutation?: UseMutationOptions<TData, TError, {
|
|
306
|
+
id: string;
|
|
307
|
+
data: RenameFileDto;
|
|
308
|
+
}, TContext>;
|
|
309
|
+
axios?: AxiosRequestConfig;
|
|
310
|
+
}) => UseMutationOptions<TData, TError, {
|
|
311
|
+
id: string;
|
|
312
|
+
data: RenameFileDto;
|
|
313
|
+
}, TContext>;
|
|
314
|
+
export type RenameFileMutationResult = NonNullable<Awaited<ReturnType<typeof renameFile>>>;
|
|
315
|
+
export type RenameFileMutationBody = RenameFileDto;
|
|
316
|
+
export type RenameFileMutationError = AxiosError<unknown>;
|
|
317
|
+
/**
|
|
318
|
+
* @summary Rename a file
|
|
319
|
+
*/
|
|
320
|
+
export declare const useRenameFile: <TData = AxiosResponse<File, any>, TError = AxiosError<unknown, any>, TContext = unknown>(options?: {
|
|
321
|
+
mutation?: UseMutationOptions<TData, TError, {
|
|
322
|
+
id: string;
|
|
323
|
+
data: RenameFileDto;
|
|
324
|
+
}, TContext>;
|
|
325
|
+
axios?: AxiosRequestConfig;
|
|
326
|
+
}) => UseMutationResult<TData, TError, {
|
|
327
|
+
id: string;
|
|
328
|
+
data: RenameFileDto;
|
|
329
|
+
}, TContext>;
|
|
@@ -337,3 +337,30 @@ export const useMoveFileToFolder = (options) => {
|
|
|
337
337
|
const mutationOptions = getMoveFileToFolderMutationOptions(options);
|
|
338
338
|
return useMutation(mutationOptions);
|
|
339
339
|
};
|
|
340
|
+
/**
|
|
341
|
+
* Renames a file belonging to the authenticated user
|
|
342
|
+
* @summary Rename a file
|
|
343
|
+
*/
|
|
344
|
+
export const renameFile = (id, renameFileDto, options) => {
|
|
345
|
+
return axios.patch(`/files/${id}/rename`, renameFileDto, options);
|
|
346
|
+
};
|
|
347
|
+
export const getRenameFileMutationOptions = (options) => {
|
|
348
|
+
const mutationKey = ['renameFile'];
|
|
349
|
+
const { mutation: mutationOptions, axios: axiosOptions } = options ?
|
|
350
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
351
|
+
options
|
|
352
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
353
|
+
: { mutation: { mutationKey, }, axios: undefined };
|
|
354
|
+
const mutationFn = (props) => {
|
|
355
|
+
const { id, data } = props ?? {};
|
|
356
|
+
return renameFile(id, data, axiosOptions);
|
|
357
|
+
};
|
|
358
|
+
return { mutationFn, ...mutationOptions };
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* @summary Rename a file
|
|
362
|
+
*/
|
|
363
|
+
export const useRenameFile = (options) => {
|
|
364
|
+
const mutationOptions = getRenameFileMutationOptions(options);
|
|
365
|
+
return useMutation(mutationOptions);
|
|
366
|
+
};
|
|
@@ -106,7 +106,7 @@ export declare function useMe<TData = Awaited<ReturnType<typeof me>>, TError = A
|
|
|
106
106
|
queryKey: QueryKey;
|
|
107
107
|
};
|
|
108
108
|
/**
|
|
109
|
-
* Returns the authenticated user files
|
|
109
|
+
* Returns the authenticated user files. Omit folderId to return all files, pass null for root-level files only, or pass a folder ID to return files from that folder.
|
|
110
110
|
* @summary Get the authenticated user files URLs
|
|
111
111
|
*/
|
|
112
112
|
export declare const myFiles: (params: MyFilesParams, options?: AxiosRequestConfig) => Promise<AxiosResponse<GetUserFilesOutput>>;
|
|
@@ -114,7 +114,7 @@ export function useMe(options) {
|
|
|
114
114
|
return query;
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
|
-
* Returns the authenticated user files
|
|
117
|
+
* Returns the authenticated user files. Omit folderId to return all files, pass null for root-level files only, or pass a folder ID to return files from that folder.
|
|
118
118
|
* @summary Get the authenticated user files URLs
|
|
119
119
|
*/
|
|
120
120
|
export const myFiles = (params, options) => {
|