@squonk/data-manager-client 4.2.0 → 4.3.0
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/accounting/accounting.cjs +96 -95
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.cts +47 -47
- package/accounting/accounting.d.ts +47 -47
- package/accounting/accounting.js +102 -101
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +120 -145
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +121 -121
- package/admin/admin.d.ts +121 -121
- package/admin/admin.js +127 -152
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +39 -43
- package/application/application.cjs.map +1 -1
- package/application/application.d.cts +25 -25
- package/application/application.d.ts +25 -25
- package/application/application.js +42 -46
- package/application/application.js.map +1 -1
- package/chunk-OYRETEBZ.js +25 -0
- package/chunk-OYRETEBZ.js.map +1 -0
- package/{chunk-TKLTUR4R.cjs → chunk-RB2KVIEK.cjs} +1 -1
- package/chunk-RB2KVIEK.cjs.map +1 -0
- package/{chunk-EBOQPVLG.js → chunk-XYDLYMQ2.js} +1 -1
- package/chunk-XYDLYMQ2.js.map +1 -0
- package/chunk-ZLY5XEOQ.cjs +25 -0
- package/chunk-ZLY5XEOQ.cjs.map +1 -0
- package/configuration/configuration.cjs +38 -45
- package/configuration/configuration.cjs.map +1 -1
- package/configuration/configuration.d.cts +25 -25
- package/configuration/configuration.d.ts +25 -25
- package/configuration/configuration.js +42 -49
- package/configuration/configuration.js.map +1 -1
- package/dataset/dataset.cjs +126 -141
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.cts +102 -102
- package/dataset/dataset.d.ts +102 -102
- package/dataset/dataset.js +132 -147
- package/dataset/dataset.js.map +1 -1
- package/digest/digest.cjs +22 -24
- package/digest/digest.cjs.map +1 -1
- package/digest/digest.d.cts +14 -14
- package/digest/digest.d.ts +14 -14
- package/digest/digest.js +24 -26
- package/digest/digest.js.map +1 -1
- package/exchange-rate/exchange-rate.cjs +111 -109
- package/exchange-rate/exchange-rate.cjs.map +1 -1
- package/exchange-rate/exchange-rate.d.cts +69 -69
- package/exchange-rate/exchange-rate.d.ts +69 -69
- package/exchange-rate/exchange-rate.js +117 -115
- package/exchange-rate/exchange-rate.js.map +1 -1
- package/file-and-path/file-and-path.cjs +93 -138
- package/file-and-path/file-and-path.cjs.map +1 -1
- package/file-and-path/file-and-path.d.cts +102 -102
- package/file-and-path/file-and-path.d.ts +102 -102
- package/file-and-path/file-and-path.js +105 -150
- package/file-and-path/file-and-path.js.map +1 -1
- package/index.cjs +80 -102
- package/index.cjs.map +1 -1
- package/index.d.cts +2401 -2326
- package/index.d.ts +2401 -2326
- package/index.js +79 -101
- package/index.js.map +1 -1
- package/instance/instance.cjs +100 -107
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.cts +76 -76
- package/instance/instance.d.ts +76 -76
- package/instance/instance.js +105 -112
- package/instance/instance.js.map +1 -1
- package/inventory/inventory.cjs +22 -25
- package/inventory/inventory.cjs.map +1 -1
- package/inventory/inventory.d.cts +14 -14
- package/inventory/inventory.d.ts +14 -14
- package/inventory/inventory.js +24 -27
- package/inventory/inventory.js.map +1 -1
- package/job/job.cjs +55 -67
- package/job/job.cjs.map +1 -1
- package/job/job.d.cts +36 -36
- package/job/job.d.ts +36 -36
- package/job/job.js +60 -72
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +61 -59
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.cts +47 -47
- package/metadata/metadata.d.ts +47 -47
- package/metadata/metadata.js +65 -63
- package/metadata/metadata.js.map +1 -1
- package/package.json +13 -16
- package/project/project.cjs +165 -186
- package/project/project.cjs.map +1 -1
- package/project/project.d.cts +157 -157
- package/project/project.d.ts +157 -157
- package/project/project.js +172 -193
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +767 -461
- package/src/admin/admin.ts +1187 -787
- package/src/application/application.ts +377 -231
- package/src/configuration/configuration.ts +348 -237
- package/src/custom-instance.ts +3 -3
- package/src/data-manager-api.schemas.ts +2538 -2492
- package/src/dataset/dataset.ts +1199 -792
- package/src/digest/digest.ts +198 -122
- package/src/exchange-rate/exchange-rate.ts +1088 -612
- package/src/file-and-path/file-and-path.ts +869 -616
- package/src/index.ts +2 -2
- package/src/instance/instance.ts +804 -539
- package/src/inventory/inventory.ts +200 -122
- package/src/job/job.ts +556 -348
- package/src/metadata/metadata.ts +587 -371
- package/src/options-mutator.ts +27 -0
- package/src/project/project.ts +1576 -1034
- package/src/task/task.ts +434 -295
- package/src/type/type.ts +180 -126
- package/src/user/user.ts +846 -398
- package/src/workflow/workflow.ts +1750 -1089
- package/task/task.cjs +45 -59
- package/task/task.cjs.map +1 -1
- package/task/task.d.cts +33 -33
- package/task/task.d.ts +33 -33
- package/task/task.js +51 -65
- package/task/task.js.map +1 -1
- package/type/type.cjs +21 -26
- package/type/type.cjs.map +1 -1
- package/type/type.d.cts +14 -14
- package/type/type.d.ts +14 -14
- package/type/type.js +24 -29
- package/type/type.js.map +1 -1
- package/user/user.cjs +114 -80
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +107 -48
- package/user/user.d.ts +107 -48
- package/user/user.js +120 -86
- package/user/user.js.map +1 -1
- package/workflow/workflow.cjs +179 -193
- package/workflow/workflow.cjs.map +1 -1
- package/workflow/workflow.d.cts +146 -146
- package/workflow/workflow.d.ts +146 -146
- package/workflow/workflow.js +187 -201
- package/workflow/workflow.js.map +1 -1
- package/chunk-EBOQPVLG.js.map +0 -1
- package/chunk-TKLTUR4R.cjs.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
|
-
* Generated by orval v7.
|
|
2
|
+
* Generated by orval v7.10.0 🍺
|
|
4
3
|
* Do not edit manually.
|
|
5
4
|
* Dataset Manager API
|
|
6
5
|
* The Dataset Manager API service.
|
|
@@ -9,16 +8,13 @@ A service that allows *registered* users to make **Datasets** and associated **M
|
|
|
9
8
|
|
|
10
9
|
* OpenAPI spec version: 4.1
|
|
11
10
|
*/
|
|
12
|
-
import {
|
|
13
|
-
useMutation,
|
|
14
|
-
useQuery,
|
|
15
|
-
useSuspenseQuery
|
|
16
|
-
} from '@tanstack/react-query'
|
|
11
|
+
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
17
12
|
import type {
|
|
18
13
|
DataTag,
|
|
19
14
|
DefinedInitialDataOptions,
|
|
20
15
|
DefinedUseQueryResult,
|
|
21
16
|
MutationFunction,
|
|
17
|
+
QueryClient,
|
|
22
18
|
QueryFunction,
|
|
23
19
|
QueryKey,
|
|
24
20
|
UndefinedInitialDataOptions,
|
|
@@ -27,8 +23,9 @@ import type {
|
|
|
27
23
|
UseQueryOptions,
|
|
28
24
|
UseQueryResult,
|
|
29
25
|
UseSuspenseQueryOptions,
|
|
30
|
-
UseSuspenseQueryResult
|
|
31
|
-
} from
|
|
26
|
+
UseSuspenseQueryResult,
|
|
27
|
+
} from "@tanstack/react-query";
|
|
28
|
+
|
|
32
29
|
import type {
|
|
33
30
|
CreatePathParams,
|
|
34
31
|
DeletePathParams,
|
|
@@ -39,14 +36,15 @@ import type {
|
|
|
39
36
|
FilesGetResponse,
|
|
40
37
|
GetFilesParams,
|
|
41
38
|
MoveFileInProjectParams,
|
|
42
|
-
MovePathParams
|
|
43
|
-
} from
|
|
44
|
-
import { customInstance } from '.././custom-instance';
|
|
45
|
-
import type { ErrorType } from '.././custom-instance';
|
|
46
|
-
|
|
39
|
+
MovePathParams,
|
|
40
|
+
} from "../data-manager-api.schemas";
|
|
47
41
|
|
|
48
|
-
|
|
42
|
+
import { customInstance } from ".././custom-instance";
|
|
43
|
+
import type { ErrorType } from ".././custom-instance";
|
|
44
|
+
import { mutationMutator } from ".././options-mutator";
|
|
45
|
+
import { queryMutator } from ".././options-mutator";
|
|
49
46
|
|
|
47
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
50
48
|
|
|
51
49
|
/**
|
|
52
50
|
* Creates a new Path within a Project. Every directory in the Path will be created. The path will belong to the User and Project.
|
|
@@ -56,64 +54,79 @@ Only Project editors can create Paths.
|
|
|
56
54
|
* @summary Create a new Project Path
|
|
57
55
|
*/
|
|
58
56
|
export const createPath = (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return customInstance<void>(
|
|
64
|
-
{url: `/path`, method: 'PUT',
|
|
65
|
-
params
|
|
66
|
-
},
|
|
67
|
-
options);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export const getCreatePathMutationOptions = <TData = Awaited<ReturnType<typeof createPath>>, TError = ErrorType<void | DmError>,
|
|
73
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{params: CreatePathParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
57
|
+
params: CreatePathParams,
|
|
58
|
+
options?: SecondParameter<typeof customInstance>,
|
|
74
59
|
) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
return customInstance<void>({ url: `/path`, method: "PUT", params }, options);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const useCreatePathMutationOptions = <
|
|
64
|
+
TError = ErrorType<void | DmError>,
|
|
65
|
+
TContext = unknown,
|
|
66
|
+
>(options?: {
|
|
67
|
+
mutation?: UseMutationOptions<
|
|
68
|
+
Awaited<ReturnType<typeof createPath>>,
|
|
69
|
+
TError,
|
|
70
|
+
{ params: CreatePathParams },
|
|
71
|
+
TContext
|
|
72
|
+
>;
|
|
73
|
+
request?: SecondParameter<typeof customInstance>;
|
|
74
|
+
}): UseMutationOptions<
|
|
75
|
+
Awaited<ReturnType<typeof createPath>>,
|
|
76
|
+
TError,
|
|
77
|
+
{ params: CreatePathParams },
|
|
78
|
+
TContext
|
|
79
|
+
> => {
|
|
80
|
+
const mutationKey = ["createPath"];
|
|
81
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
82
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
83
|
+
? options
|
|
84
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
85
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
86
|
+
|
|
87
|
+
const mutationFn: MutationFunction<
|
|
88
|
+
Awaited<ReturnType<typeof createPath>>,
|
|
89
|
+
{ params: CreatePathParams }
|
|
90
|
+
> = (props) => {
|
|
91
|
+
const { params } = props ?? {};
|
|
92
|
+
|
|
93
|
+
return createPath(params, requestOptions);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
97
|
+
|
|
98
|
+
return customOptions;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type CreatePathMutationResult = NonNullable<Awaited<ReturnType<typeof createPath>>>;
|
|
102
|
+
|
|
103
|
+
export type CreatePathMutationError = ErrorType<void | DmError>;
|
|
95
104
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
export type CreatePathMutationError = ErrorType<void | DmError>
|
|
99
|
-
|
|
100
|
-
/**
|
|
105
|
+
/**
|
|
101
106
|
* @summary Create a new Project Path
|
|
102
107
|
*/
|
|
103
|
-
export const useCreatePath = <
|
|
104
|
-
|
|
108
|
+
export const useCreatePath = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
109
|
+
options?: {
|
|
110
|
+
mutation?: UseMutationOptions<
|
|
111
|
+
Awaited<ReturnType<typeof createPath>>,
|
|
112
|
+
TError,
|
|
113
|
+
{ params: CreatePathParams },
|
|
114
|
+
TContext
|
|
115
|
+
>;
|
|
116
|
+
request?: SecondParameter<typeof customInstance>;
|
|
117
|
+
},
|
|
118
|
+
queryClient?: QueryClient,
|
|
105
119
|
): UseMutationResult<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/**
|
|
120
|
+
Awaited<ReturnType<typeof createPath>>,
|
|
121
|
+
TError,
|
|
122
|
+
{ params: CreatePathParams },
|
|
123
|
+
TContext
|
|
124
|
+
> => {
|
|
125
|
+
const mutationOptions = useCreatePathMutationOptions(options);
|
|
126
|
+
|
|
127
|
+
return useMutation(mutationOptions, queryClient);
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
117
130
|
* Deletes a Path within the Project. Be aware that the deletion of a Path will result in the contents of the Path also being deleted. If there are files in Path or sub-directories, they will all be deleted.
|
|
118
131
|
|
|
119
132
|
Only Project editors can delete Paths.
|
|
@@ -121,64 +134,79 @@ Only Project editors can delete Paths.
|
|
|
121
134
|
* @summary Delete a Project Path
|
|
122
135
|
*/
|
|
123
136
|
export const deletePath = (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return customInstance<void>(
|
|
129
|
-
{url: `/path`, method: 'DELETE',
|
|
130
|
-
params
|
|
131
|
-
},
|
|
132
|
-
options);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
export const getDeletePathMutationOptions = <TData = Awaited<ReturnType<typeof deletePath>>, TError = ErrorType<void | DmError>,
|
|
138
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{params: DeletePathParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
137
|
+
params: DeletePathParams,
|
|
138
|
+
options?: SecondParameter<typeof customInstance>,
|
|
139
139
|
) => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
140
|
+
return customInstance<void>({ url: `/path`, method: "DELETE", params }, options);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const useDeletePathMutationOptions = <
|
|
144
|
+
TError = ErrorType<void | DmError>,
|
|
145
|
+
TContext = unknown,
|
|
146
|
+
>(options?: {
|
|
147
|
+
mutation?: UseMutationOptions<
|
|
148
|
+
Awaited<ReturnType<typeof deletePath>>,
|
|
149
|
+
TError,
|
|
150
|
+
{ params: DeletePathParams },
|
|
151
|
+
TContext
|
|
152
|
+
>;
|
|
153
|
+
request?: SecondParameter<typeof customInstance>;
|
|
154
|
+
}): UseMutationOptions<
|
|
155
|
+
Awaited<ReturnType<typeof deletePath>>,
|
|
156
|
+
TError,
|
|
157
|
+
{ params: DeletePathParams },
|
|
158
|
+
TContext
|
|
159
|
+
> => {
|
|
160
|
+
const mutationKey = ["deletePath"];
|
|
161
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
162
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
163
|
+
? options
|
|
164
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
165
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
166
|
+
|
|
167
|
+
const mutationFn: MutationFunction<
|
|
168
|
+
Awaited<ReturnType<typeof deletePath>>,
|
|
169
|
+
{ params: DeletePathParams }
|
|
170
|
+
> = (props) => {
|
|
171
|
+
const { params } = props ?? {};
|
|
172
|
+
|
|
173
|
+
return deletePath(params, requestOptions);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
177
|
+
|
|
178
|
+
return customOptions;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type DeletePathMutationResult = NonNullable<Awaited<ReturnType<typeof deletePath>>>;
|
|
182
|
+
|
|
183
|
+
export type DeletePathMutationError = ErrorType<void | DmError>;
|
|
152
184
|
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{params: DeletePathParams}, TContext>}
|
|
160
|
-
|
|
161
|
-
export type DeletePathMutationResult = NonNullable<Awaited<ReturnType<typeof deletePath>>>
|
|
162
|
-
|
|
163
|
-
export type DeletePathMutationError = ErrorType<void | DmError>
|
|
164
|
-
|
|
165
|
-
/**
|
|
185
|
+
/**
|
|
166
186
|
* @summary Delete a Project Path
|
|
167
187
|
*/
|
|
168
|
-
export const useDeletePath = <
|
|
169
|
-
|
|
188
|
+
export const useDeletePath = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
189
|
+
options?: {
|
|
190
|
+
mutation?: UseMutationOptions<
|
|
191
|
+
Awaited<ReturnType<typeof deletePath>>,
|
|
192
|
+
TError,
|
|
193
|
+
{ params: DeletePathParams },
|
|
194
|
+
TContext
|
|
195
|
+
>;
|
|
196
|
+
request?: SecondParameter<typeof customInstance>;
|
|
197
|
+
},
|
|
198
|
+
queryClient?: QueryClient,
|
|
170
199
|
): UseMutationResult<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
/**
|
|
200
|
+
Awaited<ReturnType<typeof deletePath>>,
|
|
201
|
+
TError,
|
|
202
|
+
{ params: DeletePathParams },
|
|
203
|
+
TContext
|
|
204
|
+
> => {
|
|
205
|
+
const mutationOptions = useDeletePathMutationOptions(options);
|
|
206
|
+
|
|
207
|
+
return useMutation(mutationOptions, queryClient);
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
182
210
|
* Moves and existing Path within a Project. The path will belong to the User and Project. Any ProjectFile instances on the path will be moved to the new path.
|
|
183
211
|
|
|
184
212
|
Only Project editors can move Paths.
|
|
@@ -186,207 +214,286 @@ Only Project editors can move Paths.
|
|
|
186
214
|
* @summary Move a Project Path
|
|
187
215
|
*/
|
|
188
216
|
export const movePath = (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return customInstance<void>(
|
|
194
|
-
{url: `/path/move`, method: 'PUT',
|
|
195
|
-
params
|
|
196
|
-
},
|
|
197
|
-
options);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
export const getMovePathMutationOptions = <TData = Awaited<ReturnType<typeof movePath>>, TError = ErrorType<void | DmError>,
|
|
203
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{params: MovePathParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
217
|
+
params: MovePathParams,
|
|
218
|
+
options?: SecondParameter<typeof customInstance>,
|
|
204
219
|
) => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
return customInstance<void>({ url: `/path/move`, method: "PUT", params }, options);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export const useMovePathMutationOptions = <
|
|
224
|
+
TError = ErrorType<void | DmError>,
|
|
225
|
+
TContext = unknown,
|
|
226
|
+
>(options?: {
|
|
227
|
+
mutation?: UseMutationOptions<
|
|
228
|
+
Awaited<ReturnType<typeof movePath>>,
|
|
229
|
+
TError,
|
|
230
|
+
{ params: MovePathParams },
|
|
231
|
+
TContext
|
|
232
|
+
>;
|
|
233
|
+
request?: SecondParameter<typeof customInstance>;
|
|
234
|
+
}): UseMutationOptions<
|
|
235
|
+
Awaited<ReturnType<typeof movePath>>,
|
|
236
|
+
TError,
|
|
237
|
+
{ params: MovePathParams },
|
|
238
|
+
TContext
|
|
239
|
+
> => {
|
|
240
|
+
const mutationKey = ["movePath"];
|
|
241
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
242
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
243
|
+
? options
|
|
244
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
245
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
246
|
+
|
|
247
|
+
const mutationFn: MutationFunction<
|
|
248
|
+
Awaited<ReturnType<typeof movePath>>,
|
|
249
|
+
{ params: MovePathParams }
|
|
250
|
+
> = (props) => {
|
|
251
|
+
const { params } = props ?? {};
|
|
252
|
+
|
|
253
|
+
return movePath(params, requestOptions);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
257
|
+
|
|
258
|
+
return customOptions;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export type MovePathMutationResult = NonNullable<Awaited<ReturnType<typeof movePath>>>;
|
|
262
|
+
|
|
263
|
+
export type MovePathMutationError = ErrorType<void | DmError>;
|
|
211
264
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof movePath>>, {params: MovePathParams}> = (props) => {
|
|
216
|
-
const {params} = props ?? {};
|
|
217
|
-
|
|
218
|
-
return movePath(params,requestOptions)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{params: MovePathParams}, TContext>}
|
|
225
|
-
|
|
226
|
-
export type MovePathMutationResult = NonNullable<Awaited<ReturnType<typeof movePath>>>
|
|
227
|
-
|
|
228
|
-
export type MovePathMutationError = ErrorType<void | DmError>
|
|
229
|
-
|
|
230
|
-
/**
|
|
265
|
+
/**
|
|
231
266
|
* @summary Move a Project Path
|
|
232
267
|
*/
|
|
233
|
-
export const useMovePath = <
|
|
234
|
-
|
|
268
|
+
export const useMovePath = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
269
|
+
options?: {
|
|
270
|
+
mutation?: UseMutationOptions<
|
|
271
|
+
Awaited<ReturnType<typeof movePath>>,
|
|
272
|
+
TError,
|
|
273
|
+
{ params: MovePathParams },
|
|
274
|
+
TContext
|
|
275
|
+
>;
|
|
276
|
+
request?: SecondParameter<typeof customInstance>;
|
|
277
|
+
},
|
|
278
|
+
queryClient?: QueryClient,
|
|
235
279
|
): UseMutationResult<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
/**
|
|
280
|
+
Awaited<ReturnType<typeof movePath>>,
|
|
281
|
+
TError,
|
|
282
|
+
{ params: MovePathParams },
|
|
283
|
+
TContext
|
|
284
|
+
> => {
|
|
285
|
+
const mutationOptions = useMovePathMutationOptions(options);
|
|
286
|
+
|
|
287
|
+
return useMutation(mutationOptions, queryClient);
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
247
290
|
* Given a Project and Path the files available to you on that path will be returned along with any additional paths (sub-directories).
|
|
248
291
|
|
|
249
292
|
* @summary Gets the Files on a Project Path
|
|
250
293
|
*/
|
|
251
294
|
export const getFiles = (
|
|
252
|
-
|
|
253
|
-
|
|
295
|
+
params: GetFilesParams,
|
|
296
|
+
options?: SecondParameter<typeof customInstance>,
|
|
297
|
+
signal?: AbortSignal,
|
|
254
298
|
) => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
299
|
+
return customInstance<FilesGetResponse>({ url: `/file`, method: "GET", params, signal }, options);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export const getGetFilesQueryKey = (params: GetFilesParams) => {
|
|
303
|
+
return [`/file`, ...(params ? [params] : [])] as const;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export const useGetFilesQueryOptions = <
|
|
307
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
308
|
+
TError = ErrorType<void | DmError>,
|
|
309
|
+
>(
|
|
310
|
+
params: GetFilesParams,
|
|
311
|
+
options?: {
|
|
312
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
313
|
+
request?: SecondParameter<typeof customInstance>;
|
|
314
|
+
},
|
|
271
315
|
) => {
|
|
316
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
272
317
|
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);
|
|
276
|
-
|
|
277
|
-
|
|
318
|
+
const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);
|
|
278
319
|
|
|
279
|
-
|
|
320
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({ signal }) =>
|
|
321
|
+
getFiles(params, requestOptions, signal);
|
|
280
322
|
|
|
281
|
-
|
|
323
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
282
324
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
export type GetFilesQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>
|
|
289
|
-
export type GetFilesQueryError = ErrorType<void | DmError>
|
|
325
|
+
return customOptions as UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & {
|
|
326
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
290
329
|
|
|
330
|
+
export type GetFilesQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>;
|
|
331
|
+
export type GetFilesQueryError = ErrorType<void | DmError>;
|
|
291
332
|
|
|
292
|
-
export function useGetFiles<
|
|
293
|
-
|
|
333
|
+
export function useGetFiles<
|
|
334
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
335
|
+
TError = ErrorType<void | DmError>,
|
|
336
|
+
>(
|
|
337
|
+
params: GetFilesParams,
|
|
338
|
+
options: {
|
|
339
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>> &
|
|
340
|
+
Pick<
|
|
294
341
|
DefinedInitialDataOptions<
|
|
295
342
|
Awaited<ReturnType<typeof getFiles>>,
|
|
296
343
|
TError,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
344
|
+
Awaited<ReturnType<typeof getFiles>>
|
|
345
|
+
>,
|
|
346
|
+
"initialData"
|
|
347
|
+
>;
|
|
348
|
+
request?: SecondParameter<typeof customInstance>;
|
|
349
|
+
},
|
|
350
|
+
queryClient?: QueryClient,
|
|
351
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
352
|
+
export function useGetFiles<
|
|
353
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
354
|
+
TError = ErrorType<void | DmError>,
|
|
355
|
+
>(
|
|
356
|
+
params: GetFilesParams,
|
|
357
|
+
options?: {
|
|
358
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>> &
|
|
359
|
+
Pick<
|
|
304
360
|
UndefinedInitialDataOptions<
|
|
305
361
|
Awaited<ReturnType<typeof getFiles>>,
|
|
306
362
|
TError,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
363
|
+
Awaited<ReturnType<typeof getFiles>>
|
|
364
|
+
>,
|
|
365
|
+
"initialData"
|
|
366
|
+
>;
|
|
367
|
+
request?: SecondParameter<typeof customInstance>;
|
|
368
|
+
},
|
|
369
|
+
queryClient?: QueryClient,
|
|
370
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
371
|
+
export function useGetFiles<
|
|
372
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
373
|
+
TError = ErrorType<void | DmError>,
|
|
374
|
+
>(
|
|
375
|
+
params: GetFilesParams,
|
|
376
|
+
options?: {
|
|
377
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
378
|
+
request?: SecondParameter<typeof customInstance>;
|
|
379
|
+
},
|
|
380
|
+
queryClient?: QueryClient,
|
|
381
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
316
382
|
/**
|
|
317
383
|
* @summary Gets the Files on a Project Path
|
|
318
384
|
*/
|
|
319
385
|
|
|
320
|
-
export function useGetFiles<
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
386
|
+
export function useGetFiles<
|
|
387
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
388
|
+
TError = ErrorType<void | DmError>,
|
|
389
|
+
>(
|
|
390
|
+
params: GetFilesParams,
|
|
391
|
+
options?: {
|
|
392
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
393
|
+
request?: SecondParameter<typeof customInstance>;
|
|
394
|
+
},
|
|
395
|
+
queryClient?: QueryClient,
|
|
396
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
397
|
+
const queryOptions = useGetFilesQueryOptions(params, options);
|
|
398
|
+
|
|
399
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
400
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
query.queryKey = queryOptions.queryKey;
|
|
330
404
|
|
|
331
405
|
return query;
|
|
332
406
|
}
|
|
333
407
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
408
|
+
export const useGetFilesSuspenseQueryOptions = <
|
|
409
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
410
|
+
TError = ErrorType<void | DmError>,
|
|
411
|
+
>(
|
|
412
|
+
params: GetFilesParams,
|
|
413
|
+
options?: {
|
|
414
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
415
|
+
request?: SecondParameter<typeof customInstance>;
|
|
416
|
+
},
|
|
337
417
|
) => {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
export type GetFilesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles
|
|
355
|
-
export type GetFilesSuspenseQueryError = ErrorType<void | DmError
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
418
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
419
|
+
|
|
420
|
+
const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);
|
|
421
|
+
|
|
422
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({ signal }) =>
|
|
423
|
+
getFiles(params, requestOptions, signal);
|
|
424
|
+
|
|
425
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
426
|
+
|
|
427
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
428
|
+
Awaited<ReturnType<typeof getFiles>>,
|
|
429
|
+
TError,
|
|
430
|
+
TData
|
|
431
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
export type GetFilesSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>;
|
|
435
|
+
export type GetFilesSuspenseQueryError = ErrorType<void | DmError>;
|
|
436
|
+
|
|
437
|
+
export function useGetFilesSuspense<
|
|
438
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
439
|
+
TError = ErrorType<void | DmError>,
|
|
440
|
+
>(
|
|
441
|
+
params: GetFilesParams,
|
|
442
|
+
options: {
|
|
443
|
+
query: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
444
|
+
request?: SecondParameter<typeof customInstance>;
|
|
445
|
+
},
|
|
446
|
+
queryClient?: QueryClient,
|
|
447
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
448
|
+
export function useGetFilesSuspense<
|
|
449
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
450
|
+
TError = ErrorType<void | DmError>,
|
|
451
|
+
>(
|
|
452
|
+
params: GetFilesParams,
|
|
453
|
+
options?: {
|
|
454
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
455
|
+
request?: SecondParameter<typeof customInstance>;
|
|
456
|
+
},
|
|
457
|
+
queryClient?: QueryClient,
|
|
458
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
459
|
+
export function useGetFilesSuspense<
|
|
460
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
461
|
+
TError = ErrorType<void | DmError>,
|
|
462
|
+
>(
|
|
463
|
+
params: GetFilesParams,
|
|
464
|
+
options?: {
|
|
465
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
466
|
+
request?: SecondParameter<typeof customInstance>;
|
|
467
|
+
},
|
|
468
|
+
queryClient?: QueryClient,
|
|
469
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
370
470
|
/**
|
|
371
471
|
* @summary Gets the Files on a Project Path
|
|
372
472
|
*/
|
|
373
473
|
|
|
374
|
-
export function useGetFilesSuspense<
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
474
|
+
export function useGetFilesSuspense<
|
|
475
|
+
TData = Awaited<ReturnType<typeof getFiles>>,
|
|
476
|
+
TError = ErrorType<void | DmError>,
|
|
477
|
+
>(
|
|
478
|
+
params: GetFilesParams,
|
|
479
|
+
options?: {
|
|
480
|
+
query?: Partial<UseSuspenseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>>;
|
|
481
|
+
request?: SecondParameter<typeof customInstance>;
|
|
482
|
+
},
|
|
483
|
+
queryClient?: QueryClient,
|
|
484
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
485
|
+
const queryOptions = useGetFilesSuspenseQueryOptions(params, options);
|
|
486
|
+
|
|
487
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
488
|
+
TData,
|
|
489
|
+
TError
|
|
490
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
491
|
+
|
|
492
|
+
query.queryKey = queryOptions.queryKey;
|
|
384
493
|
|
|
385
494
|
return query;
|
|
386
495
|
}
|
|
387
496
|
|
|
388
|
-
|
|
389
|
-
|
|
390
497
|
/**
|
|
391
498
|
* Given a Project and a Dataset the Dataset will be attached (added) to the project as a File using the format provided. When attached the Dataset is referred to as a Project **File**. As format conversion may take some time the file may not be immediately available. You should use the `task_id` you're presented with on the `/task` endpoint to determine when the file is available to the project.
|
|
392
499
|
|
|
@@ -401,80 +508,104 @@ You cannot add a Dataset to a Project until its upload is complete.
|
|
|
401
508
|
* @summary Attach a Dataset, as a File, to a Project
|
|
402
509
|
*/
|
|
403
510
|
export const attachFile = (
|
|
404
|
-
|
|
405
|
-
|
|
511
|
+
filePostBodyBody: FilePostBodyBody,
|
|
512
|
+
options?: SecondParameter<typeof customInstance>,
|
|
513
|
+
signal?: AbortSignal,
|
|
406
514
|
) => {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
formUrlEncoded.append(
|
|
410
|
-
formUrlEncoded.append(
|
|
411
|
-
formUrlEncoded.append(
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
515
|
+
const formUrlEncoded = new URLSearchParams();
|
|
516
|
+
formUrlEncoded.append(`dataset_id`, filePostBodyBody.dataset_id);
|
|
517
|
+
formUrlEncoded.append(`dataset_version`, filePostBodyBody.dataset_version.toString());
|
|
518
|
+
formUrlEncoded.append(`project_id`, filePostBodyBody.project_id);
|
|
519
|
+
formUrlEncoded.append(`as_type`, filePostBodyBody.as_type);
|
|
520
|
+
if (filePostBodyBody.path !== undefined) {
|
|
521
|
+
formUrlEncoded.append(`path`, filePostBodyBody.path);
|
|
522
|
+
}
|
|
523
|
+
if (filePostBodyBody.compress !== undefined) {
|
|
524
|
+
formUrlEncoded.append(`compress`, filePostBodyBody.compress.toString());
|
|
525
|
+
}
|
|
526
|
+
if (filePostBodyBody.immutable !== undefined) {
|
|
527
|
+
formUrlEncoded.append(`immutable`, filePostBodyBody.immutable.toString());
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return customInstance<FilePostResponse>(
|
|
531
|
+
{
|
|
532
|
+
url: `/file`,
|
|
533
|
+
method: "POST",
|
|
534
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
535
|
+
data: formUrlEncoded,
|
|
536
|
+
signal,
|
|
427
537
|
},
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
538
|
+
options,
|
|
539
|
+
);
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
export const useAttachFileMutationOptions = <
|
|
543
|
+
TError = ErrorType<void | DmError>,
|
|
544
|
+
TContext = unknown,
|
|
545
|
+
>(options?: {
|
|
546
|
+
mutation?: UseMutationOptions<
|
|
547
|
+
Awaited<ReturnType<typeof attachFile>>,
|
|
548
|
+
TError,
|
|
549
|
+
{ data: FilePostBodyBody },
|
|
550
|
+
TContext
|
|
551
|
+
>;
|
|
552
|
+
request?: SecondParameter<typeof customInstance>;
|
|
553
|
+
}): UseMutationOptions<
|
|
554
|
+
Awaited<ReturnType<typeof attachFile>>,
|
|
555
|
+
TError,
|
|
556
|
+
{ data: FilePostBodyBody },
|
|
557
|
+
TContext
|
|
558
|
+
> => {
|
|
559
|
+
const mutationKey = ["attachFile"];
|
|
560
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
561
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
562
|
+
? options
|
|
563
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
564
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
565
|
+
|
|
566
|
+
const mutationFn: MutationFunction<
|
|
567
|
+
Awaited<ReturnType<typeof attachFile>>,
|
|
568
|
+
{ data: FilePostBodyBody }
|
|
569
|
+
> = (props) => {
|
|
570
|
+
const { data } = props ?? {};
|
|
571
|
+
|
|
572
|
+
return attachFile(data, requestOptions);
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
576
|
+
|
|
577
|
+
return customOptions;
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
export type AttachFileMutationResult = NonNullable<Awaited<ReturnType<typeof attachFile>>>;
|
|
581
|
+
export type AttachFileMutationBody = FilePostBodyBody;
|
|
582
|
+
export type AttachFileMutationError = ErrorType<void | DmError>;
|
|
453
583
|
|
|
454
|
-
|
|
455
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{data: FilePostBodyBody}, TContext>}
|
|
456
|
-
|
|
457
|
-
export type AttachFileMutationResult = NonNullable<Awaited<ReturnType<typeof attachFile>>>
|
|
458
|
-
export type AttachFileMutationBody = FilePostBodyBody
|
|
459
|
-
export type AttachFileMutationError = ErrorType<void | DmError>
|
|
460
|
-
|
|
461
|
-
/**
|
|
584
|
+
/**
|
|
462
585
|
* @summary Attach a Dataset, as a File, to a Project
|
|
463
586
|
*/
|
|
464
|
-
export const useAttachFile = <
|
|
465
|
-
|
|
587
|
+
export const useAttachFile = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
588
|
+
options?: {
|
|
589
|
+
mutation?: UseMutationOptions<
|
|
590
|
+
Awaited<ReturnType<typeof attachFile>>,
|
|
591
|
+
TError,
|
|
592
|
+
{ data: FilePostBodyBody },
|
|
593
|
+
TContext
|
|
594
|
+
>;
|
|
595
|
+
request?: SecondParameter<typeof customInstance>;
|
|
596
|
+
},
|
|
597
|
+
queryClient?: QueryClient,
|
|
466
598
|
): UseMutationResult<
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
/**
|
|
599
|
+
Awaited<ReturnType<typeof attachFile>>,
|
|
600
|
+
TError,
|
|
601
|
+
{ data: FilePostBodyBody },
|
|
602
|
+
TContext
|
|
603
|
+
> => {
|
|
604
|
+
const mutationOptions = useAttachFileMutationOptions(options);
|
|
605
|
+
|
|
606
|
+
return useMutation(mutationOptions, queryClient);
|
|
607
|
+
};
|
|
608
|
+
/**
|
|
478
609
|
* Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.
|
|
479
610
|
|
|
480
611
|
You must be an `editor` of the Project to delete a file from a Project.
|
|
@@ -482,64 +613,81 @@ You must be an `editor` of the Project to delete a file from a Project.
|
|
|
482
613
|
* @summary Delete an unmanaged Project File
|
|
483
614
|
*/
|
|
484
615
|
export const deleteUnmanagedFile = (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
return customInstance<void>(
|
|
490
|
-
{url: `/file`, method: 'DELETE',
|
|
491
|
-
params
|
|
492
|
-
},
|
|
493
|
-
options);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
export const getDeleteUnmanagedFileMutationOptions = <TData = Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError = ErrorType<void | DmError>,
|
|
499
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
616
|
+
params: DeleteUnmanagedFileParams,
|
|
617
|
+
options?: SecondParameter<typeof customInstance>,
|
|
500
618
|
) => {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
619
|
+
return customInstance<void>({ url: `/file`, method: "DELETE", params }, options);
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
export const useDeleteUnmanagedFileMutationOptions = <
|
|
623
|
+
TError = ErrorType<void | DmError>,
|
|
624
|
+
TContext = unknown,
|
|
625
|
+
>(options?: {
|
|
626
|
+
mutation?: UseMutationOptions<
|
|
627
|
+
Awaited<ReturnType<typeof deleteUnmanagedFile>>,
|
|
628
|
+
TError,
|
|
629
|
+
{ params: DeleteUnmanagedFileParams },
|
|
630
|
+
TContext
|
|
631
|
+
>;
|
|
632
|
+
request?: SecondParameter<typeof customInstance>;
|
|
633
|
+
}): UseMutationOptions<
|
|
634
|
+
Awaited<ReturnType<typeof deleteUnmanagedFile>>,
|
|
635
|
+
TError,
|
|
636
|
+
{ params: DeleteUnmanagedFileParams },
|
|
637
|
+
TContext
|
|
638
|
+
> => {
|
|
639
|
+
const mutationKey = ["deleteUnmanagedFile"];
|
|
640
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
641
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
642
|
+
? options
|
|
643
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
644
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
645
|
+
|
|
646
|
+
const mutationFn: MutationFunction<
|
|
647
|
+
Awaited<ReturnType<typeof deleteUnmanagedFile>>,
|
|
648
|
+
{ params: DeleteUnmanagedFileParams }
|
|
649
|
+
> = (props) => {
|
|
650
|
+
const { params } = props ?? {};
|
|
651
|
+
|
|
652
|
+
return deleteUnmanagedFile(params, requestOptions);
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
656
|
+
|
|
657
|
+
return customOptions;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
export type DeleteUnmanagedFileMutationResult = NonNullable<
|
|
661
|
+
Awaited<ReturnType<typeof deleteUnmanagedFile>>
|
|
662
|
+
>;
|
|
663
|
+
|
|
664
|
+
export type DeleteUnmanagedFileMutationError = ErrorType<void | DmError>;
|
|
510
665
|
|
|
511
|
-
|
|
512
|
-
const {params} = props ?? {};
|
|
513
|
-
|
|
514
|
-
return deleteUnmanagedFile(params,requestOptions)
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{params: DeleteUnmanagedFileParams}, TContext>}
|
|
521
|
-
|
|
522
|
-
export type DeleteUnmanagedFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUnmanagedFile>>>
|
|
523
|
-
|
|
524
|
-
export type DeleteUnmanagedFileMutationError = ErrorType<void | DmError>
|
|
525
|
-
|
|
526
|
-
/**
|
|
666
|
+
/**
|
|
527
667
|
* @summary Delete an unmanaged Project File
|
|
528
668
|
*/
|
|
529
|
-
export const useDeleteUnmanagedFile = <
|
|
530
|
-
|
|
669
|
+
export const useDeleteUnmanagedFile = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
670
|
+
options?: {
|
|
671
|
+
mutation?: UseMutationOptions<
|
|
672
|
+
Awaited<ReturnType<typeof deleteUnmanagedFile>>,
|
|
673
|
+
TError,
|
|
674
|
+
{ params: DeleteUnmanagedFileParams },
|
|
675
|
+
TContext
|
|
676
|
+
>;
|
|
677
|
+
request?: SecondParameter<typeof customInstance>;
|
|
678
|
+
},
|
|
679
|
+
queryClient?: QueryClient,
|
|
531
680
|
): UseMutationResult<
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
/**
|
|
681
|
+
Awaited<ReturnType<typeof deleteUnmanagedFile>>,
|
|
682
|
+
TError,
|
|
683
|
+
{ params: DeleteUnmanagedFileParams },
|
|
684
|
+
TContext
|
|
685
|
+
> => {
|
|
686
|
+
const mutationOptions = useDeleteUnmanagedFileMutationOptions(options);
|
|
687
|
+
|
|
688
|
+
return useMutation(mutationOptions, queryClient);
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
543
691
|
* Move an **Unmanaged** file, optionally renaming it, to a new path.
|
|
544
692
|
|
|
545
693
|
You must be an `editor` of the project
|
|
@@ -547,64 +695,81 @@ You must be an `editor` of the project
|
|
|
547
695
|
* @summary Move an unmanaged file in a Project
|
|
548
696
|
*/
|
|
549
697
|
export const moveFileInProject = (
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return customInstance<void>(
|
|
555
|
-
{url: `/file/move`, method: 'PUT',
|
|
556
|
-
params
|
|
557
|
-
},
|
|
558
|
-
options);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
export const getMoveFileInProjectMutationOptions = <TData = Awaited<ReturnType<typeof moveFileInProject>>, TError = ErrorType<void | DmError>,
|
|
564
|
-
TContext = unknown>(options?: { mutation?:UseMutationOptions<TData, TError,{params: MoveFileInProjectParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
698
|
+
params: MoveFileInProjectParams,
|
|
699
|
+
options?: SecondParameter<typeof customInstance>,
|
|
565
700
|
) => {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
701
|
+
return customInstance<void>({ url: `/file/move`, method: "PUT", params }, options);
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
export const useMoveFileInProjectMutationOptions = <
|
|
705
|
+
TError = ErrorType<void | DmError>,
|
|
706
|
+
TContext = unknown,
|
|
707
|
+
>(options?: {
|
|
708
|
+
mutation?: UseMutationOptions<
|
|
709
|
+
Awaited<ReturnType<typeof moveFileInProject>>,
|
|
710
|
+
TError,
|
|
711
|
+
{ params: MoveFileInProjectParams },
|
|
712
|
+
TContext
|
|
713
|
+
>;
|
|
714
|
+
request?: SecondParameter<typeof customInstance>;
|
|
715
|
+
}): UseMutationOptions<
|
|
716
|
+
Awaited<ReturnType<typeof moveFileInProject>>,
|
|
717
|
+
TError,
|
|
718
|
+
{ params: MoveFileInProjectParams },
|
|
719
|
+
TContext
|
|
720
|
+
> => {
|
|
721
|
+
const mutationKey = ["moveFileInProject"];
|
|
722
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
723
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
724
|
+
? options
|
|
725
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
726
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
727
|
+
|
|
728
|
+
const mutationFn: MutationFunction<
|
|
729
|
+
Awaited<ReturnType<typeof moveFileInProject>>,
|
|
730
|
+
{ params: MoveFileInProjectParams }
|
|
731
|
+
> = (props) => {
|
|
732
|
+
const { params } = props ?? {};
|
|
733
|
+
|
|
734
|
+
return moveFileInProject(params, requestOptions);
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
738
|
+
|
|
739
|
+
return customOptions;
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
export type MoveFileInProjectMutationResult = NonNullable<
|
|
743
|
+
Awaited<ReturnType<typeof moveFileInProject>>
|
|
744
|
+
>;
|
|
745
|
+
|
|
746
|
+
export type MoveFileInProjectMutationError = ErrorType<void | DmError>;
|
|
581
747
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{params: MoveFileInProjectParams}, TContext>}
|
|
586
|
-
|
|
587
|
-
export type MoveFileInProjectMutationResult = NonNullable<Awaited<ReturnType<typeof moveFileInProject>>>
|
|
588
|
-
|
|
589
|
-
export type MoveFileInProjectMutationError = ErrorType<void | DmError>
|
|
590
|
-
|
|
591
|
-
/**
|
|
748
|
+
/**
|
|
592
749
|
* @summary Move an unmanaged file in a Project
|
|
593
750
|
*/
|
|
594
|
-
export const useMoveFileInProject = <
|
|
595
|
-
|
|
751
|
+
export const useMoveFileInProject = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
752
|
+
options?: {
|
|
753
|
+
mutation?: UseMutationOptions<
|
|
754
|
+
Awaited<ReturnType<typeof moveFileInProject>>,
|
|
755
|
+
TError,
|
|
756
|
+
{ params: MoveFileInProjectParams },
|
|
757
|
+
TContext
|
|
758
|
+
>;
|
|
759
|
+
request?: SecondParameter<typeof customInstance>;
|
|
760
|
+
},
|
|
761
|
+
queryClient?: QueryClient,
|
|
596
762
|
): UseMutationResult<
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
/**
|
|
763
|
+
Awaited<ReturnType<typeof moveFileInProject>>,
|
|
764
|
+
TError,
|
|
765
|
+
{ params: MoveFileInProjectParams },
|
|
766
|
+
TContext
|
|
767
|
+
> => {
|
|
768
|
+
const mutationOptions = useMoveFileInProjectMutationOptions(options);
|
|
769
|
+
|
|
770
|
+
return useMutation(mutationOptions, queryClient);
|
|
771
|
+
};
|
|
772
|
+
/**
|
|
608
773
|
* Given a `file_id` the file will be removed from the Project it's attached to.
|
|
609
774
|
|
|
610
775
|
You must be an `editor` of the project to delete a file from a Project. Being an `editor` of the original Dataset does not give you the ability to detach it from the Project.
|
|
@@ -613,64 +778,76 @@ You cannot delete a Project File until the attach is complete.
|
|
|
613
778
|
|
|
614
779
|
* @summary Delete/detach a File (from a Project)
|
|
615
780
|
*/
|
|
616
|
-
export const deleteFile = (
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
)
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
781
|
+
export const deleteFile = (fileId: string, options?: SecondParameter<typeof customInstance>) => {
|
|
782
|
+
return customInstance<void>({ url: `/file/${fileId}`, method: "DELETE" }, options);
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
export const useDeleteFileMutationOptions = <
|
|
786
|
+
TError = ErrorType<void | DmError>,
|
|
787
|
+
TContext = unknown,
|
|
788
|
+
>(options?: {
|
|
789
|
+
mutation?: UseMutationOptions<
|
|
790
|
+
Awaited<ReturnType<typeof deleteFile>>,
|
|
791
|
+
TError,
|
|
792
|
+
{ fileId: string },
|
|
793
|
+
TContext
|
|
794
|
+
>;
|
|
795
|
+
request?: SecondParameter<typeof customInstance>;
|
|
796
|
+
}): UseMutationOptions<
|
|
797
|
+
Awaited<ReturnType<typeof deleteFile>>,
|
|
798
|
+
TError,
|
|
799
|
+
{ fileId: string },
|
|
800
|
+
TContext
|
|
801
|
+
> => {
|
|
802
|
+
const mutationKey = ["deleteFile"];
|
|
803
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
804
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
805
|
+
? options
|
|
806
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
807
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
808
|
+
|
|
809
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteFile>>, { fileId: string }> = (
|
|
810
|
+
props,
|
|
811
|
+
) => {
|
|
812
|
+
const { fileId } = props ?? {};
|
|
813
|
+
|
|
814
|
+
return deleteFile(fileId, requestOptions);
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
818
|
+
|
|
819
|
+
return customOptions;
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
export type DeleteFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFile>>>;
|
|
823
|
+
|
|
824
|
+
export type DeleteFileMutationError = ErrorType<void | DmError>;
|
|
649
825
|
|
|
650
|
-
|
|
651
|
-
return { mutationFn, ...mutationOptions } as UseMutationOptions<TData, TError,{fileId: string}, TContext>}
|
|
652
|
-
|
|
653
|
-
export type DeleteFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFile>>>
|
|
654
|
-
|
|
655
|
-
export type DeleteFileMutationError = ErrorType<void | DmError>
|
|
656
|
-
|
|
657
|
-
/**
|
|
826
|
+
/**
|
|
658
827
|
* @summary Delete/detach a File (from a Project)
|
|
659
828
|
*/
|
|
660
|
-
export const useDeleteFile = <
|
|
661
|
-
|
|
829
|
+
export const useDeleteFile = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
830
|
+
options?: {
|
|
831
|
+
mutation?: UseMutationOptions<
|
|
832
|
+
Awaited<ReturnType<typeof deleteFile>>,
|
|
833
|
+
TError,
|
|
834
|
+
{ fileId: string },
|
|
835
|
+
TContext
|
|
836
|
+
>;
|
|
837
|
+
request?: SecondParameter<typeof customInstance>;
|
|
838
|
+
},
|
|
839
|
+
queryClient?: QueryClient,
|
|
662
840
|
): UseMutationResult<
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
/**
|
|
841
|
+
Awaited<ReturnType<typeof deleteFile>>,
|
|
842
|
+
TError,
|
|
843
|
+
{ fileId: string },
|
|
844
|
+
TContext
|
|
845
|
+
> => {
|
|
846
|
+
const mutationOptions = useDeleteFileMutationOptions(options);
|
|
847
|
+
|
|
848
|
+
return useMutation(mutationOptions, queryClient);
|
|
849
|
+
};
|
|
850
|
+
/**
|
|
674
851
|
* Given a `file_id` the file will be returned if available.
|
|
675
852
|
|
|
676
853
|
You cannot get a Project File until the attach is complete.
|
|
@@ -678,140 +855,216 @@ You cannot get a Project File until the attach is complete.
|
|
|
678
855
|
* @summary Download a File (from a project)
|
|
679
856
|
*/
|
|
680
857
|
export const downloadFile = (
|
|
681
|
-
|
|
682
|
-
|
|
858
|
+
fileId: string,
|
|
859
|
+
options?: SecondParameter<typeof customInstance>,
|
|
860
|
+
signal?: AbortSignal,
|
|
683
861
|
) => {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
862
|
+
return customInstance<void>({ url: `/file/${fileId}`, method: "GET", signal }, options);
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
export const getDownloadFileQueryKey = (fileId: string) => {
|
|
866
|
+
return [`/file/${fileId}`] as const;
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
export const useDownloadFileQueryOptions = <
|
|
870
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
871
|
+
TError = ErrorType<void | DmError>,
|
|
872
|
+
>(
|
|
873
|
+
fileId: string,
|
|
874
|
+
options?: {
|
|
875
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>>;
|
|
876
|
+
request?: SecondParameter<typeof customInstance>;
|
|
877
|
+
},
|
|
699
878
|
) => {
|
|
879
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
700
880
|
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);
|
|
881
|
+
const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);
|
|
704
882
|
|
|
705
|
-
|
|
883
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({ signal }) =>
|
|
884
|
+
downloadFile(fileId, requestOptions, signal);
|
|
706
885
|
|
|
707
|
-
|
|
886
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
708
887
|
|
|
709
|
-
|
|
888
|
+
return customOptions as UseQueryOptions<
|
|
889
|
+
Awaited<ReturnType<typeof downloadFile>>,
|
|
890
|
+
TError,
|
|
891
|
+
TData
|
|
892
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
893
|
+
};
|
|
710
894
|
|
|
711
|
-
|
|
895
|
+
export type DownloadFileQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>;
|
|
896
|
+
export type DownloadFileQueryError = ErrorType<void | DmError>;
|
|
712
897
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
fileId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>> & Pick<
|
|
898
|
+
export function useDownloadFile<
|
|
899
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
900
|
+
TError = ErrorType<void | DmError>,
|
|
901
|
+
>(
|
|
902
|
+
fileId: string,
|
|
903
|
+
options: {
|
|
904
|
+
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>> &
|
|
905
|
+
Pick<
|
|
722
906
|
DefinedInitialDataOptions<
|
|
723
907
|
Awaited<ReturnType<typeof downloadFile>>,
|
|
724
908
|
TError,
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
909
|
+
Awaited<ReturnType<typeof downloadFile>>
|
|
910
|
+
>,
|
|
911
|
+
"initialData"
|
|
912
|
+
>;
|
|
913
|
+
request?: SecondParameter<typeof customInstance>;
|
|
914
|
+
},
|
|
915
|
+
queryClient?: QueryClient,
|
|
916
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
917
|
+
export function useDownloadFile<
|
|
918
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
919
|
+
TError = ErrorType<void | DmError>,
|
|
920
|
+
>(
|
|
921
|
+
fileId: string,
|
|
922
|
+
options?: {
|
|
923
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>> &
|
|
924
|
+
Pick<
|
|
732
925
|
UndefinedInitialDataOptions<
|
|
733
926
|
Awaited<ReturnType<typeof downloadFile>>,
|
|
734
927
|
TError,
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
928
|
+
Awaited<ReturnType<typeof downloadFile>>
|
|
929
|
+
>,
|
|
930
|
+
"initialData"
|
|
931
|
+
>;
|
|
932
|
+
request?: SecondParameter<typeof customInstance>;
|
|
933
|
+
},
|
|
934
|
+
queryClient?: QueryClient,
|
|
935
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
936
|
+
export function useDownloadFile<
|
|
937
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
938
|
+
TError = ErrorType<void | DmError>,
|
|
939
|
+
>(
|
|
940
|
+
fileId: string,
|
|
941
|
+
options?: {
|
|
942
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>>;
|
|
943
|
+
request?: SecondParameter<typeof customInstance>;
|
|
944
|
+
},
|
|
945
|
+
queryClient?: QueryClient,
|
|
946
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
744
947
|
/**
|
|
745
948
|
* @summary Download a File (from a project)
|
|
746
949
|
*/
|
|
747
950
|
|
|
748
|
-
export function useDownloadFile<
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
951
|
+
export function useDownloadFile<
|
|
952
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
953
|
+
TError = ErrorType<void | DmError>,
|
|
954
|
+
>(
|
|
955
|
+
fileId: string,
|
|
956
|
+
options?: {
|
|
957
|
+
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>>;
|
|
958
|
+
request?: SecondParameter<typeof customInstance>;
|
|
959
|
+
},
|
|
960
|
+
queryClient?: QueryClient,
|
|
961
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
962
|
+
const queryOptions = useDownloadFileQueryOptions(fileId, options);
|
|
963
|
+
|
|
964
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
965
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
query.queryKey = queryOptions.queryKey;
|
|
758
969
|
|
|
759
970
|
return query;
|
|
760
971
|
}
|
|
761
972
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
973
|
+
export const useDownloadFileSuspenseQueryOptions = <
|
|
974
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
975
|
+
TError = ErrorType<void | DmError>,
|
|
976
|
+
>(
|
|
977
|
+
fileId: string,
|
|
978
|
+
options?: {
|
|
979
|
+
query?: Partial<
|
|
980
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>
|
|
981
|
+
>;
|
|
982
|
+
request?: SecondParameter<typeof customInstance>;
|
|
983
|
+
},
|
|
765
984
|
) => {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
export type DownloadFileSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile
|
|
783
|
-
export type DownloadFileSuspenseQueryError = ErrorType<void | DmError
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
985
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
986
|
+
|
|
987
|
+
const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);
|
|
988
|
+
|
|
989
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({ signal }) =>
|
|
990
|
+
downloadFile(fileId, requestOptions, signal);
|
|
991
|
+
|
|
992
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
993
|
+
|
|
994
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
995
|
+
Awaited<ReturnType<typeof downloadFile>>,
|
|
996
|
+
TError,
|
|
997
|
+
TData
|
|
998
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
export type DownloadFileSuspenseQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>;
|
|
1002
|
+
export type DownloadFileSuspenseQueryError = ErrorType<void | DmError>;
|
|
1003
|
+
|
|
1004
|
+
export function useDownloadFileSuspense<
|
|
1005
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
1006
|
+
TError = ErrorType<void | DmError>,
|
|
1007
|
+
>(
|
|
1008
|
+
fileId: string,
|
|
1009
|
+
options: {
|
|
1010
|
+
query: Partial<
|
|
1011
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>
|
|
1012
|
+
>;
|
|
1013
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1014
|
+
},
|
|
1015
|
+
queryClient?: QueryClient,
|
|
1016
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1017
|
+
export function useDownloadFileSuspense<
|
|
1018
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
1019
|
+
TError = ErrorType<void | DmError>,
|
|
1020
|
+
>(
|
|
1021
|
+
fileId: string,
|
|
1022
|
+
options?: {
|
|
1023
|
+
query?: Partial<
|
|
1024
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>
|
|
1025
|
+
>;
|
|
1026
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1027
|
+
},
|
|
1028
|
+
queryClient?: QueryClient,
|
|
1029
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1030
|
+
export function useDownloadFileSuspense<
|
|
1031
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
1032
|
+
TError = ErrorType<void | DmError>,
|
|
1033
|
+
>(
|
|
1034
|
+
fileId: string,
|
|
1035
|
+
options?: {
|
|
1036
|
+
query?: Partial<
|
|
1037
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>
|
|
1038
|
+
>;
|
|
1039
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1040
|
+
},
|
|
1041
|
+
queryClient?: QueryClient,
|
|
1042
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
798
1043
|
/**
|
|
799
1044
|
* @summary Download a File (from a project)
|
|
800
1045
|
*/
|
|
801
1046
|
|
|
802
|
-
export function useDownloadFileSuspense<
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
1047
|
+
export function useDownloadFileSuspense<
|
|
1048
|
+
TData = Awaited<ReturnType<typeof downloadFile>>,
|
|
1049
|
+
TError = ErrorType<void | DmError>,
|
|
1050
|
+
>(
|
|
1051
|
+
fileId: string,
|
|
1052
|
+
options?: {
|
|
1053
|
+
query?: Partial<
|
|
1054
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>
|
|
1055
|
+
>;
|
|
1056
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1057
|
+
},
|
|
1058
|
+
queryClient?: QueryClient,
|
|
1059
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
1060
|
+
const queryOptions = useDownloadFileSuspenseQueryOptions(fileId, options);
|
|
1061
|
+
|
|
1062
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
1063
|
+
TData,
|
|
1064
|
+
TError
|
|
1065
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1066
|
+
|
|
1067
|
+
query.queryKey = queryOptions.queryKey;
|
|
812
1068
|
|
|
813
1069
|
return query;
|
|
814
1070
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|