@squonk/data-manager-client 1.2.3 → 1.2.4-rc.2
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 +31 -13
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.cts +77 -0
- package/accounting/accounting.d.ts +10 -1
- package/accounting/accounting.js +29 -11
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +67 -27
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +324 -0
- package/admin/admin.d.ts +55 -22
- package/admin/admin.js +57 -17
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +23 -13
- package/application/application.cjs.map +1 -1
- package/application/application.d.cts +57 -0
- package/application/application.d.ts +7 -1
- package/application/application.js +22 -12
- package/application/application.js.map +1 -1
- package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
- package/chunk-J22A7LHX.cjs.map +1 -0
- package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
- package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
- package/configuration/configuration.cjs +13 -7
- package/configuration/configuration.cjs.map +1 -1
- package/configuration/configuration.d.cts +29 -0
- package/configuration/configuration.d.ts +4 -1
- package/configuration/configuration.js +13 -7
- package/configuration/configuration.js.map +1 -1
- package/{custom-instance-50c9dd5d.d.ts → custom-instance-3d66fe97.d.ts} +826 -826
- package/dataset/dataset.cjs +71 -72
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.cts +315 -0
- package/dataset/dataset.d.ts +46 -16
- package/dataset/dataset.js +62 -63
- package/dataset/dataset.js.map +1 -1
- package/exchange-rate/exchange-rate.cjs +43 -32
- package/exchange-rate/exchange-rate.cjs.map +1 -1
- package/exchange-rate/exchange-rate.d.cts +180 -0
- package/exchange-rate/exchange-rate.d.ts +25 -7
- package/exchange-rate/exchange-rate.js +38 -27
- package/exchange-rate/exchange-rate.js.map +1 -1
- package/file/file.cjs +38 -22
- package/file/file.cjs.map +1 -1
- package/file/file.d.cts +154 -0
- package/file/file.d.ts +25 -10
- package/file/file.js +34 -18
- package/file/file.js.map +1 -1
- package/index.cjs +10 -10
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -0
- package/index.d.ts +1 -1
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/instance/instance.cjs +47 -37
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.cts +215 -0
- package/instance/instance.d.ts +33 -12
- package/instance/instance.js +41 -31
- package/instance/instance.js.map +1 -1
- package/job/job.cjs +36 -19
- package/job/job.cjs.map +1 -1
- package/job/job.d.cts +85 -0
- package/job/job.d.ts +10 -1
- package/job/job.js +34 -17
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +23 -26
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.cts +132 -0
- package/metadata/metadata.d.ts +19 -7
- package/metadata/metadata.js +20 -23
- package/metadata/metadata.js.map +1 -1
- package/package.json +12 -12
- package/project/project.cjs +70 -48
- package/project/project.cjs.map +1 -1
- package/project/project.d.cts +377 -0
- package/project/project.d.ts +61 -25
- package/project/project.js +59 -37
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +179 -194
- package/src/admin/admin.ts +590 -735
- package/src/application/application.ts +125 -141
- package/src/configuration/configuration.ts +72 -60
- package/src/data-manager-api.schemas.ts +941 -942
- package/src/dataset/dataset.ts +591 -770
- package/src/exchange-rate/exchange-rate.ts +362 -478
- package/src/file/file.ts +292 -357
- package/src/instance/instance.ts +427 -533
- package/src/job/job.ts +187 -198
- package/src/metadata/metadata.ts +247 -339
- package/src/project/project.ts +669 -860
- package/src/task/task.ts +181 -202
- package/src/type/type.ts +72 -68
- package/src/user/user.ts +248 -286
- package/task/task.cjs +31 -15
- package/task/task.cjs.map +1 -1
- package/task/task.d.cts +103 -0
- package/task/task.d.ts +10 -1
- package/task/task.js +29 -13
- package/task/task.js.map +1 -1
- package/type/type.cjs +13 -7
- package/type/type.cjs.map +1 -1
- package/type/type.d.cts +31 -0
- package/type/type.d.ts +4 -1
- package/type/type.js +13 -7
- package/type/type.js.map +1 -1
- package/user/user.cjs +39 -28
- package/user/user.cjs.map +1 -1
- package/user/user.d.cts +104 -0
- package/user/user.d.ts +16 -4
- package/user/user.js +36 -25
- package/user/user.js.map +1 -1
- package/chunk-UZTHSGDT.cjs.map +0 -1
package/src/dataset/dataset.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generated by orval v6.
|
|
2
|
+
* Generated by orval v6.20.0 🍺
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Dataset Manager API
|
|
5
5
|
* The Dataset Manager API service.
|
|
@@ -8,40 +8,45 @@ A service that allows *registered* users to make **Datasets** and associated **M
|
|
|
8
8
|
|
|
9
9
|
* OpenAPI spec version: 1.2
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
useMutation,
|
|
13
|
+
useQuery
|
|
14
|
+
} from '@tanstack/react-query'
|
|
12
15
|
import type {
|
|
13
|
-
UseQueryOptions,
|
|
14
|
-
UseMutationOptions,
|
|
15
|
-
QueryFunction,
|
|
16
16
|
MutationFunction,
|
|
17
|
-
|
|
17
|
+
QueryFunction,
|
|
18
18
|
QueryKey,
|
|
19
|
-
|
|
19
|
+
UseMutationOptions,
|
|
20
|
+
UseQueryOptions,
|
|
21
|
+
UseQueryResult
|
|
22
|
+
} from '@tanstack/react-query'
|
|
20
23
|
import type {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
DatasetPutBodyBody,
|
|
24
|
+
DatasetDetail,
|
|
25
|
+
DatasetDigestGetResponse,
|
|
24
26
|
DatasetPostBodyBody,
|
|
27
|
+
DatasetPutBodyBody,
|
|
28
|
+
DatasetPutPostResponse,
|
|
29
|
+
DatasetSchemaGetResponse,
|
|
25
30
|
DatasetsGetResponse,
|
|
31
|
+
DeleteDatasetParams,
|
|
32
|
+
DmError,
|
|
26
33
|
GetDatasetsParams,
|
|
27
|
-
DatasetVersionsGetResponse,
|
|
28
34
|
GetVersionsParams,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
import { customInstance } from ".././custom-instance";
|
|
35
|
-
import type { ErrorType } from ".././custom-instance";
|
|
35
|
+
TaskIdentity
|
|
36
|
+
} from '../data-manager-api.schemas'
|
|
37
|
+
import { customInstance } from '.././custom-instance';
|
|
38
|
+
import type { ErrorType } from '.././custom-instance';
|
|
39
|
+
|
|
36
40
|
|
|
37
41
|
// eslint-disable-next-line
|
|
38
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
42
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
39
43
|
config: any,
|
|
40
|
-
args: infer P
|
|
44
|
+
args: infer P,
|
|
41
45
|
) => any
|
|
42
46
|
? P
|
|
43
47
|
: never;
|
|
44
48
|
|
|
49
|
+
|
|
45
50
|
/**
|
|
46
51
|
* Using an unmanaged file in a Project as a source a Dataset (or new Dataset Version) is created.
|
|
47
52
|
|
|
@@ -52,98 +57,74 @@ Behaves like the corresponding **POST** method except the file is expected to ex
|
|
|
52
57
|
* @summary Create a Dataset from a file in a Project
|
|
53
58
|
*/
|
|
54
59
|
export const createDatasetFromFile = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return customInstance<DatasetPutPostResponse>(
|
|
83
|
-
{
|
|
84
|
-
url: `/dataset`,
|
|
85
|
-
method: "put",
|
|
86
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
87
|
-
data: formData,
|
|
60
|
+
datasetPutBodyBody: DatasetPutBodyBody,
|
|
61
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
62
|
+
|
|
63
|
+
const formData = new FormData();
|
|
64
|
+
formData.append('dataset_type', datasetPutBodyBody.dataset_type)
|
|
65
|
+
if(datasetPutBodyBody.format_extra_variables !== undefined) {
|
|
66
|
+
formData.append('format_extra_variables', datasetPutBodyBody.format_extra_variables)
|
|
67
|
+
}
|
|
68
|
+
if(datasetPutBodyBody.skip_molecule_load !== undefined) {
|
|
69
|
+
formData.append('skip_molecule_load', datasetPutBodyBody.skip_molecule_load.toString())
|
|
70
|
+
}
|
|
71
|
+
formData.append('project_id', datasetPutBodyBody.project_id)
|
|
72
|
+
formData.append('path', datasetPutBodyBody.path)
|
|
73
|
+
formData.append('file_name', datasetPutBodyBody.file_name)
|
|
74
|
+
if(datasetPutBodyBody.dataset_id !== undefined) {
|
|
75
|
+
formData.append('dataset_id', datasetPutBodyBody.dataset_id)
|
|
76
|
+
}
|
|
77
|
+
if(datasetPutBodyBody.unit_id !== undefined) {
|
|
78
|
+
formData.append('unit_id', datasetPutBodyBody.unit_id)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return customInstance<DatasetPutPostResponse>(
|
|
82
|
+
{url: `/dataset`, method: 'put',
|
|
83
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
84
|
+
data: formData
|
|
88
85
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
>(options?: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
TError = ErrorType<void | DmError>,
|
|
132
|
-
TContext = unknown
|
|
133
|
-
>(options?: {
|
|
134
|
-
mutation?: UseMutationOptions<
|
|
135
|
-
Awaited<ReturnType<typeof createDatasetFromFile>>,
|
|
136
|
-
TError,
|
|
137
|
-
{ data: DatasetPutBodyBody },
|
|
138
|
-
TContext
|
|
139
|
-
>;
|
|
140
|
-
request?: SecondParameter<typeof customInstance>;
|
|
141
|
-
}) => {
|
|
142
|
-
const mutationOptions = getCreateDatasetFromFileMutationOptions(options);
|
|
143
|
-
|
|
144
|
-
return useMutation(mutationOptions);
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
86
|
+
options);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export const getCreateDatasetFromFileMutationOptions = <TError = ErrorType<void | DmError>,
|
|
92
|
+
|
|
93
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDatasetFromFile>>, TError,{data: DatasetPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
94
|
+
): UseMutationOptions<Awaited<ReturnType<typeof createDatasetFromFile>>, TError,{data: DatasetPutBodyBody}, TContext> => {
|
|
95
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createDatasetFromFile>>, {data: DatasetPutBodyBody}> = (props) => {
|
|
101
|
+
const {data} = props ?? {};
|
|
102
|
+
|
|
103
|
+
return createDatasetFromFile(data,requestOptions)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
return { mutationFn, ...mutationOptions }}
|
|
110
|
+
|
|
111
|
+
export type CreateDatasetFromFileMutationResult = NonNullable<Awaited<ReturnType<typeof createDatasetFromFile>>>
|
|
112
|
+
export type CreateDatasetFromFileMutationBody = DatasetPutBodyBody
|
|
113
|
+
export type CreateDatasetFromFileMutationError = ErrorType<void | DmError>
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @summary Create a Dataset from a file in a Project
|
|
117
|
+
*/
|
|
118
|
+
export const useCreateDatasetFromFile = <TError = ErrorType<void | DmError>,
|
|
119
|
+
|
|
120
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createDatasetFromFile>>, TError,{data: DatasetPutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
121
|
+
) => {
|
|
122
|
+
|
|
123
|
+
const mutationOptions = getCreateDatasetFromFileMutationOptions(options);
|
|
124
|
+
|
|
125
|
+
return useMutation(mutationOptions);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
147
128
|
* Uploads a dataset.
|
|
148
129
|
|
|
149
130
|
Dataset file-naming is strictly limited to a fixed set of extensions based on the Dataset **Type**. You can obtain the supported types (and their extensions) via the `/type` endpoint. Filenames that do not comply with the supported filename extensions will be rejected.
|
|
@@ -157,97 +138,73 @@ Datasets undergo some processing in an asynchronous **Task** after control retur
|
|
|
157
138
|
* @summary Upload an external file as a Dataset
|
|
158
139
|
*/
|
|
159
140
|
export const uploadDataset = (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
formData.append("unit_id", datasetPostBodyBody.unit_id);
|
|
185
|
-
|
|
186
|
-
return customInstance<DatasetPutPostResponse>(
|
|
187
|
-
{
|
|
188
|
-
url: `/dataset`,
|
|
189
|
-
method: "post",
|
|
190
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
191
|
-
data: formData,
|
|
141
|
+
datasetPostBodyBody: DatasetPostBodyBody,
|
|
142
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
143
|
+
|
|
144
|
+
const formData = new FormData();
|
|
145
|
+
formData.append('dataset_file', datasetPostBodyBody.dataset_file)
|
|
146
|
+
formData.append('dataset_type', datasetPostBodyBody.dataset_type)
|
|
147
|
+
if(datasetPostBodyBody.format_extra_variables !== undefined) {
|
|
148
|
+
formData.append('format_extra_variables', datasetPostBodyBody.format_extra_variables)
|
|
149
|
+
}
|
|
150
|
+
if(datasetPostBodyBody.skip_molecule_load !== undefined) {
|
|
151
|
+
formData.append('skip_molecule_load', datasetPostBodyBody.skip_molecule_load.toString())
|
|
152
|
+
}
|
|
153
|
+
if(datasetPostBodyBody.as_filename !== undefined) {
|
|
154
|
+
formData.append('as_filename', datasetPostBodyBody.as_filename)
|
|
155
|
+
}
|
|
156
|
+
if(datasetPostBodyBody.dataset_id !== undefined) {
|
|
157
|
+
formData.append('dataset_id', datasetPostBodyBody.dataset_id)
|
|
158
|
+
}
|
|
159
|
+
formData.append('unit_id', datasetPostBodyBody.unit_id)
|
|
160
|
+
|
|
161
|
+
return customInstance<DatasetPutPostResponse>(
|
|
162
|
+
{url: `/dataset`, method: 'post',
|
|
163
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
164
|
+
data: formData
|
|
192
165
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
>(options?: {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
TError = ErrorType<void | DmError>,
|
|
236
|
-
TContext = unknown
|
|
237
|
-
>(options?: {
|
|
238
|
-
mutation?: UseMutationOptions<
|
|
239
|
-
Awaited<ReturnType<typeof uploadDataset>>,
|
|
240
|
-
TError,
|
|
241
|
-
{ data: DatasetPostBodyBody },
|
|
242
|
-
TContext
|
|
243
|
-
>;
|
|
244
|
-
request?: SecondParameter<typeof customInstance>;
|
|
245
|
-
}) => {
|
|
246
|
-
const mutationOptions = getUploadDatasetMutationOptions(options);
|
|
247
|
-
|
|
248
|
-
return useMutation(mutationOptions);
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
166
|
+
options);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
export const getUploadDatasetMutationOptions = <TError = ErrorType<void | DmError>,
|
|
172
|
+
|
|
173
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uploadDataset>>, TError,{data: DatasetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
174
|
+
): UseMutationOptions<Awaited<ReturnType<typeof uploadDataset>>, TError,{data: DatasetPostBodyBody}, TContext> => {
|
|
175
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof uploadDataset>>, {data: DatasetPostBodyBody}> = (props) => {
|
|
181
|
+
const {data} = props ?? {};
|
|
182
|
+
|
|
183
|
+
return uploadDataset(data,requestOptions)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
return { mutationFn, ...mutationOptions }}
|
|
190
|
+
|
|
191
|
+
export type UploadDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof uploadDataset>>>
|
|
192
|
+
export type UploadDatasetMutationBody = DatasetPostBodyBody
|
|
193
|
+
export type UploadDatasetMutationError = ErrorType<void | DmError>
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @summary Upload an external file as a Dataset
|
|
197
|
+
*/
|
|
198
|
+
export const useUploadDataset = <TError = ErrorType<void | DmError>,
|
|
199
|
+
|
|
200
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uploadDataset>>, TError,{data: DatasetPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
201
|
+
) => {
|
|
202
|
+
|
|
203
|
+
const mutationOptions = getUploadDatasetMutationOptions(options);
|
|
204
|
+
|
|
205
|
+
return useMutation(mutationOptions);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
251
208
|
* Returns datasets that you have access to, whether attached to a project or not.
|
|
252
209
|
|
|
253
210
|
You will not see Datasets while their upload is still in progress.
|
|
@@ -259,75 +216,64 @@ Note that if `editors` are combined with `owner username`, then the datasets wil
|
|
|
259
216
|
* @summary Get Datasets that are available to you
|
|
260
217
|
*/
|
|
261
218
|
export const getDatasets = (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
219
|
+
params?: GetDatasetsParams,
|
|
220
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
221
|
+
) => {
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
return customInstance<DatasetsGetResponse>(
|
|
225
|
+
{url: `/dataset`, method: 'get',
|
|
226
|
+
params, signal
|
|
227
|
+
},
|
|
228
|
+
options);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
export const getGetDatasetsQueryKey = (params?: GetDatasetsParams,) => {
|
|
233
|
+
|
|
234
|
+
return ["data-manager-api", `/dataset`, ...(params ? [params]: [])] as const;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
export const getGetDatasetsQueryOptions = <TData = Awaited<ReturnType<typeof getDatasets>>, TError = ErrorType<void | DmError>>(params?: GetDatasetsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDatasets>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
265
239
|
) => {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
export type GetDatasetsQueryResult = NonNullable<
|
|
303
|
-
Awaited<ReturnType<typeof getDatasets>>
|
|
304
|
-
>;
|
|
305
|
-
export type GetDatasetsQueryError = ErrorType<void | DmError>;
|
|
306
|
-
|
|
307
|
-
export const useGetDatasets = <
|
|
308
|
-
TData = Awaited<ReturnType<typeof getDatasets>>,
|
|
309
|
-
TError = ErrorType<void | DmError>
|
|
310
|
-
>(
|
|
311
|
-
params?: GetDatasetsParams,
|
|
312
|
-
options?: {
|
|
313
|
-
query?: UseQueryOptions<
|
|
314
|
-
Awaited<ReturnType<typeof getDatasets>>,
|
|
315
|
-
TError,
|
|
316
|
-
TData
|
|
317
|
-
>;
|
|
318
|
-
request?: SecondParameter<typeof customInstance>;
|
|
319
|
-
}
|
|
320
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
321
|
-
const queryOptions = getGetDatasetsQueryOptions(params, options);
|
|
322
|
-
|
|
323
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
324
|
-
queryKey: QueryKey;
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
query.queryKey = queryOptions.queryKey;
|
|
240
|
+
|
|
241
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
242
|
+
|
|
243
|
+
const queryKey = queryOptions?.queryKey ?? getGetDatasetsQueryKey(params);
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getDatasets>>> = ({ signal }) => getDatasets(params, requestOptions, signal);
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getDatasets>>, TError, TData> & { queryKey: QueryKey }
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export type GetDatasetsQueryResult = NonNullable<Awaited<ReturnType<typeof getDatasets>>>
|
|
257
|
+
export type GetDatasetsQueryError = ErrorType<void | DmError>
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @summary Get Datasets that are available to you
|
|
261
|
+
*/
|
|
262
|
+
export const useGetDatasets = <TData = Awaited<ReturnType<typeof getDatasets>>, TError = ErrorType<void | DmError>>(
|
|
263
|
+
params?: GetDatasetsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDatasets>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
264
|
+
|
|
265
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
266
|
+
|
|
267
|
+
const queryOptions = getGetDatasetsQueryOptions(params,options)
|
|
268
|
+
|
|
269
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
270
|
+
|
|
271
|
+
query.queryKey = queryOptions.queryKey ;
|
|
328
272
|
|
|
329
273
|
return query;
|
|
330
|
-
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
331
277
|
|
|
332
278
|
/**
|
|
333
279
|
* Returns a list of Dataset Versions.
|
|
@@ -337,81 +283,68 @@ You will not see Datasets while their upload is still in progress.
|
|
|
337
283
|
* @summary Gets all the Versions of a specific Dataset
|
|
338
284
|
*/
|
|
339
285
|
export const getVersions = (
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
286
|
+
datasetId: string,
|
|
287
|
+
params?: GetVersionsParams,
|
|
288
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
289
|
+
) => {
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
return customInstance<DatasetDetail>(
|
|
293
|
+
{url: `/dataset/${datasetId}/versions`, method: 'get',
|
|
294
|
+
params, signal
|
|
295
|
+
},
|
|
296
|
+
options);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
export const getGetVersionsQueryKey = (datasetId: string,
|
|
301
|
+
params?: GetVersionsParams,) => {
|
|
302
|
+
|
|
303
|
+
return ["data-manager-api", `/dataset/${datasetId}/versions`, ...(params ? [params]: [])] as const;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
export const getGetVersionsQueryOptions = <TData = Awaited<ReturnType<typeof getVersions>>, TError = ErrorType<void | DmError>>(datasetId: string,
|
|
308
|
+
params?: GetVersionsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersions>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
344
309
|
) => {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
queryKey: QueryKey
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
const queryKey
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersions>>> = ({
|
|
379
|
-
signal,
|
|
380
|
-
}) => getVersions(datasetId, params, requestOptions, signal);
|
|
381
|
-
|
|
382
|
-
return { queryKey, queryFn, enabled: !!datasetId, ...queryOptions };
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
export type GetVersionsQueryResult = NonNullable<
|
|
386
|
-
Awaited<ReturnType<typeof getVersions>>
|
|
387
|
-
>;
|
|
388
|
-
export type GetVersionsQueryError = ErrorType<void | DmError>;
|
|
389
|
-
|
|
390
|
-
export const useGetVersions = <
|
|
391
|
-
TData = Awaited<ReturnType<typeof getVersions>>,
|
|
392
|
-
TError = ErrorType<void | DmError>
|
|
393
|
-
>(
|
|
394
|
-
datasetId: string,
|
|
395
|
-
params?: GetVersionsParams,
|
|
396
|
-
options?: {
|
|
397
|
-
query?: UseQueryOptions<
|
|
398
|
-
Awaited<ReturnType<typeof getVersions>>,
|
|
399
|
-
TError,
|
|
400
|
-
TData
|
|
401
|
-
>;
|
|
402
|
-
request?: SecondParameter<typeof customInstance>;
|
|
403
|
-
}
|
|
404
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
405
|
-
const queryOptions = getGetVersionsQueryOptions(datasetId, params, options);
|
|
406
|
-
|
|
407
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
408
|
-
queryKey: QueryKey;
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
query.queryKey = queryOptions.queryKey;
|
|
310
|
+
|
|
311
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
312
|
+
|
|
313
|
+
const queryKey = queryOptions?.queryKey ?? getGetVersionsQueryKey(datasetId,params);
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getVersions>>> = ({ signal }) => getVersions(datasetId,params, requestOptions, signal);
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
return { queryKey, queryFn, enabled: !!(datasetId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getVersions>>, TError, TData> & { queryKey: QueryKey }
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export type GetVersionsQueryResult = NonNullable<Awaited<ReturnType<typeof getVersions>>>
|
|
327
|
+
export type GetVersionsQueryError = ErrorType<void | DmError>
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* @summary Gets all the Versions of a specific Dataset
|
|
331
|
+
*/
|
|
332
|
+
export const useGetVersions = <TData = Awaited<ReturnType<typeof getVersions>>, TError = ErrorType<void | DmError>>(
|
|
333
|
+
datasetId: string,
|
|
334
|
+
params?: GetVersionsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getVersions>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
335
|
+
|
|
336
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
337
|
+
|
|
338
|
+
const queryOptions = getGetVersionsQueryOptions(datasetId,params,options)
|
|
339
|
+
|
|
340
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
341
|
+
|
|
342
|
+
query.queryKey = queryOptions.queryKey ;
|
|
412
343
|
|
|
413
344
|
return query;
|
|
414
|
-
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
|
|
415
348
|
|
|
416
349
|
/**
|
|
417
350
|
* Given the Dataset `id` and `version` the Dataset will be removed. The API does not prevent you removing a Dataset that's been used in a **Project**. When removed using this endpoint the Dataset is automatically detached from any and all Projects that it was attached to and any corresponding Project Files relating to the Dataset are also removed.
|
|
@@ -423,75 +356,58 @@ You cannot delete a Dataset until its upload is complete.
|
|
|
423
356
|
* @summary Delete a Dataset
|
|
424
357
|
*/
|
|
425
358
|
export const deleteDataset = (
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
url: `/dataset/${datasetId}/${datasetVersion}`,
|
|
434
|
-
|
|
435
|
-
params,
|
|
359
|
+
datasetId: string,
|
|
360
|
+
datasetVersion: number,
|
|
361
|
+
params?: DeleteDatasetParams,
|
|
362
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
return customInstance<TaskIdentity>(
|
|
366
|
+
{url: `/dataset/${datasetId}/${datasetVersion}`, method: 'delete',
|
|
367
|
+
params
|
|
436
368
|
},
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
>(options?: {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
TError = ErrorType<void | DmError>,
|
|
480
|
-
TContext = unknown
|
|
481
|
-
>(options?: {
|
|
482
|
-
mutation?: UseMutationOptions<
|
|
483
|
-
Awaited<ReturnType<typeof deleteDataset>>,
|
|
484
|
-
TError,
|
|
485
|
-
{ datasetId: string; datasetVersion: number; params?: DeleteDatasetParams },
|
|
486
|
-
TContext
|
|
487
|
-
>;
|
|
488
|
-
request?: SecondParameter<typeof customInstance>;
|
|
489
|
-
}) => {
|
|
490
|
-
const mutationOptions = getDeleteDatasetMutationOptions(options);
|
|
491
|
-
|
|
492
|
-
return useMutation(mutationOptions);
|
|
493
|
-
};
|
|
494
|
-
/**
|
|
369
|
+
options);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
export const getDeleteDatasetMutationOptions = <TError = ErrorType<void | DmError>,
|
|
375
|
+
|
|
376
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDataset>>, TError,{datasetId: string;datasetVersion: number;params?: DeleteDatasetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
377
|
+
): UseMutationOptions<Awaited<ReturnType<typeof deleteDataset>>, TError,{datasetId: string;datasetVersion: number;params?: DeleteDatasetParams}, TContext> => {
|
|
378
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteDataset>>, {datasetId: string;datasetVersion: number;params?: DeleteDatasetParams}> = (props) => {
|
|
384
|
+
const {datasetId,datasetVersion,params} = props ?? {};
|
|
385
|
+
|
|
386
|
+
return deleteDataset(datasetId,datasetVersion,params,requestOptions)
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
return { mutationFn, ...mutationOptions }}
|
|
393
|
+
|
|
394
|
+
export type DeleteDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteDataset>>>
|
|
395
|
+
|
|
396
|
+
export type DeleteDatasetMutationError = ErrorType<void | DmError>
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @summary Delete a Dataset
|
|
400
|
+
*/
|
|
401
|
+
export const useDeleteDataset = <TError = ErrorType<void | DmError>,
|
|
402
|
+
|
|
403
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteDataset>>, TError,{datasetId: string;datasetVersion: number;params?: DeleteDatasetParams}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
404
|
+
) => {
|
|
405
|
+
|
|
406
|
+
const mutationOptions = getDeleteDatasetMutationOptions(options);
|
|
407
|
+
|
|
408
|
+
return useMutation(mutationOptions);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
495
411
|
* Given a `dataset_id` the dataset will be returned if available.
|
|
496
412
|
|
|
497
413
|
You cannot get a Dataset until its upload is complete.
|
|
@@ -499,93 +415,67 @@ You cannot get a Dataset until its upload is complete.
|
|
|
499
415
|
* @summary Download a Dataset
|
|
500
416
|
*/
|
|
501
417
|
export const downloadDataset = (
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
signal?: AbortSignal
|
|
418
|
+
datasetId: string,
|
|
419
|
+
datasetVersion: number,
|
|
420
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
506
421
|
) => {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
export const useDownloadDataset = <
|
|
561
|
-
TData = Awaited<ReturnType<typeof downloadDataset>>,
|
|
562
|
-
TError = ErrorType<DmError>
|
|
563
|
-
>(
|
|
564
|
-
datasetId: string,
|
|
565
|
-
datasetVersion: number,
|
|
566
|
-
options?: {
|
|
567
|
-
query?: UseQueryOptions<
|
|
568
|
-
Awaited<ReturnType<typeof downloadDataset>>,
|
|
569
|
-
TError,
|
|
570
|
-
TData
|
|
571
|
-
>;
|
|
572
|
-
request?: SecondParameter<typeof customInstance>;
|
|
573
|
-
}
|
|
574
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
575
|
-
const queryOptions = getDownloadDatasetQueryOptions(
|
|
576
|
-
datasetId,
|
|
577
|
-
datasetVersion,
|
|
578
|
-
options
|
|
579
|
-
);
|
|
580
|
-
|
|
581
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
582
|
-
queryKey: QueryKey;
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
query.queryKey = queryOptions.queryKey;
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
return customInstance<void>(
|
|
425
|
+
{url: `/dataset/${datasetId}/${datasetVersion}`, method: 'get', signal
|
|
426
|
+
},
|
|
427
|
+
options);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
export const getDownloadDatasetQueryKey = (datasetId: string,
|
|
432
|
+
datasetVersion: number,) => {
|
|
433
|
+
|
|
434
|
+
return ["data-manager-api", `/dataset/${datasetId}/${datasetVersion}`] as const;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
export const getDownloadDatasetQueryOptions = <TData = Awaited<ReturnType<typeof downloadDataset>>, TError = ErrorType<DmError>>(datasetId: string,
|
|
439
|
+
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadDataset>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
440
|
+
) => {
|
|
441
|
+
|
|
442
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
443
|
+
|
|
444
|
+
const queryKey = queryOptions?.queryKey ?? getDownloadDatasetQueryKey(datasetId,datasetVersion);
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadDataset>>> = ({ signal }) => downloadDataset(datasetId,datasetVersion, requestOptions, signal);
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
return { queryKey, queryFn, enabled: !!(datasetId && datasetVersion), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof downloadDataset>>, TError, TData> & { queryKey: QueryKey }
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export type DownloadDatasetQueryResult = NonNullable<Awaited<ReturnType<typeof downloadDataset>>>
|
|
458
|
+
export type DownloadDatasetQueryError = ErrorType<DmError>
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* @summary Download a Dataset
|
|
462
|
+
*/
|
|
463
|
+
export const useDownloadDataset = <TData = Awaited<ReturnType<typeof downloadDataset>>, TError = ErrorType<DmError>>(
|
|
464
|
+
datasetId: string,
|
|
465
|
+
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadDataset>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
466
|
+
|
|
467
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
468
|
+
|
|
469
|
+
const queryOptions = getDownloadDatasetQueryOptions(datasetId,datasetVersion,options)
|
|
470
|
+
|
|
471
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
472
|
+
|
|
473
|
+
query.queryKey = queryOptions.queryKey ;
|
|
586
474
|
|
|
587
475
|
return query;
|
|
588
|
-
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
|
|
589
479
|
|
|
590
480
|
/**
|
|
591
481
|
* The user is removed from the Dataset's `editor` list. The user is removed from all versions of a dataset. You can remove yourself but an `owner` (creator) will always have access to the dataset.
|
|
@@ -597,70 +487,56 @@ You cannot modify Dataset editors until its upload is complete.
|
|
|
597
487
|
* @summary Remove a user's edit permission for a Dataset
|
|
598
488
|
*/
|
|
599
489
|
export const removeEditorFromDataset = (
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
490
|
+
datasetId: string,
|
|
491
|
+
userId: string,
|
|
492
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
return customInstance<void>(
|
|
496
|
+
{url: `/dataset/${datasetId}/editor/${userId}`, method: 'delete'
|
|
497
|
+
},
|
|
498
|
+
options);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
export const getRemoveEditorFromDatasetMutationOptions = <TError = ErrorType<DmError>,
|
|
504
|
+
|
|
505
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeEditorFromDataset>>, TError,{datasetId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
506
|
+
): UseMutationOptions<Awaited<ReturnType<typeof removeEditorFromDataset>>, TError,{datasetId: string;userId: string}, TContext> => {
|
|
507
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof removeEditorFromDataset>>, {datasetId: string;userId: string}> = (props) => {
|
|
513
|
+
const {datasetId,userId} = props ?? {};
|
|
514
|
+
|
|
515
|
+
return removeEditorFromDataset(datasetId,userId,requestOptions)
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
return { mutationFn, ...mutationOptions }}
|
|
522
|
+
|
|
523
|
+
export type RemoveEditorFromDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof removeEditorFromDataset>>>
|
|
524
|
+
|
|
525
|
+
export type RemoveEditorFromDatasetMutationError = ErrorType<DmError>
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* @summary Remove a user's edit permission for a Dataset
|
|
529
|
+
*/
|
|
530
|
+
export const useRemoveEditorFromDataset = <TError = ErrorType<DmError>,
|
|
531
|
+
|
|
532
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeEditorFromDataset>>, TError,{datasetId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
603
533
|
) => {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
export const getRemoveEditorFromDatasetMutationOptions = <
|
|
611
|
-
TError = ErrorType<DmError>,
|
|
612
|
-
TContext = unknown
|
|
613
|
-
>(options?: {
|
|
614
|
-
mutation?: UseMutationOptions<
|
|
615
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>,
|
|
616
|
-
TError,
|
|
617
|
-
{ datasetId: string; userId: string },
|
|
618
|
-
TContext
|
|
619
|
-
>;
|
|
620
|
-
request?: SecondParameter<typeof customInstance>;
|
|
621
|
-
}): UseMutationOptions<
|
|
622
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>,
|
|
623
|
-
TError,
|
|
624
|
-
{ datasetId: string; userId: string },
|
|
625
|
-
TContext
|
|
626
|
-
> => {
|
|
627
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
628
|
-
|
|
629
|
-
const mutationFn: MutationFunction<
|
|
630
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>,
|
|
631
|
-
{ datasetId: string; userId: string }
|
|
632
|
-
> = (props) => {
|
|
633
|
-
const { datasetId, userId } = props ?? {};
|
|
634
|
-
|
|
635
|
-
return removeEditorFromDataset(datasetId, userId, requestOptions);
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
return { mutationFn, ...mutationOptions };
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
export type RemoveEditorFromDatasetMutationResult = NonNullable<
|
|
642
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>
|
|
643
|
-
>;
|
|
644
|
-
|
|
645
|
-
export type RemoveEditorFromDatasetMutationError = ErrorType<DmError>;
|
|
646
|
-
|
|
647
|
-
export const useRemoveEditorFromDataset = <
|
|
648
|
-
TError = ErrorType<DmError>,
|
|
649
|
-
TContext = unknown
|
|
650
|
-
>(options?: {
|
|
651
|
-
mutation?: UseMutationOptions<
|
|
652
|
-
Awaited<ReturnType<typeof removeEditorFromDataset>>,
|
|
653
|
-
TError,
|
|
654
|
-
{ datasetId: string; userId: string },
|
|
655
|
-
TContext
|
|
656
|
-
>;
|
|
657
|
-
request?: SecondParameter<typeof customInstance>;
|
|
658
|
-
}) => {
|
|
659
|
-
const mutationOptions = getRemoveEditorFromDatasetMutationOptions(options);
|
|
660
|
-
|
|
661
|
-
return useMutation(mutationOptions);
|
|
662
|
-
};
|
|
663
|
-
/**
|
|
534
|
+
|
|
535
|
+
const mutationOptions = getRemoveEditorFromDatasetMutationOptions(options);
|
|
536
|
+
|
|
537
|
+
return useMutation(mutationOptions);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
664
540
|
* The user is added to the dataset's `editor`` list. The dataset `owner` is automatically an editor and so does not need to be added as an `editor`.
|
|
665
541
|
|
|
666
542
|
You must be an `editor` or `owner` of the dataset.
|
|
@@ -670,147 +546,118 @@ You cannot modify Dataset editors until its upload is complete.
|
|
|
670
546
|
* @summary Give a user edit permission for a Dataset
|
|
671
547
|
*/
|
|
672
548
|
export const addEditorToDataset = (
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
549
|
+
datasetId: string,
|
|
550
|
+
userId: string,
|
|
551
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
return customInstance<void>(
|
|
555
|
+
{url: `/dataset/${datasetId}/editor/${userId}`, method: 'put'
|
|
556
|
+
},
|
|
557
|
+
options);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
export const getAddEditorToDatasetMutationOptions = <TError = ErrorType<DmError>,
|
|
563
|
+
|
|
564
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addEditorToDataset>>, TError,{datasetId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
565
|
+
): UseMutationOptions<Awaited<ReturnType<typeof addEditorToDataset>>, TError,{datasetId: string;userId: string}, TContext> => {
|
|
566
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof addEditorToDataset>>, {datasetId: string;userId: string}> = (props) => {
|
|
572
|
+
const {datasetId,userId} = props ?? {};
|
|
573
|
+
|
|
574
|
+
return addEditorToDataset(datasetId,userId,requestOptions)
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
return { mutationFn, ...mutationOptions }}
|
|
581
|
+
|
|
582
|
+
export type AddEditorToDatasetMutationResult = NonNullable<Awaited<ReturnType<typeof addEditorToDataset>>>
|
|
583
|
+
|
|
584
|
+
export type AddEditorToDatasetMutationError = ErrorType<DmError>
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* @summary Give a user edit permission for a Dataset
|
|
588
|
+
*/
|
|
589
|
+
export const useAddEditorToDataset = <TError = ErrorType<DmError>,
|
|
590
|
+
|
|
591
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addEditorToDataset>>, TError,{datasetId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
676
592
|
) => {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
export const getAddEditorToDatasetMutationOptions = <
|
|
684
|
-
TError = ErrorType<DmError>,
|
|
685
|
-
TContext = unknown
|
|
686
|
-
>(options?: {
|
|
687
|
-
mutation?: UseMutationOptions<
|
|
688
|
-
Awaited<ReturnType<typeof addEditorToDataset>>,
|
|
689
|
-
TError,
|
|
690
|
-
{ datasetId: string; userId: string },
|
|
691
|
-
TContext
|
|
692
|
-
>;
|
|
693
|
-
request?: SecondParameter<typeof customInstance>;
|
|
694
|
-
}): UseMutationOptions<
|
|
695
|
-
Awaited<ReturnType<typeof addEditorToDataset>>,
|
|
696
|
-
TError,
|
|
697
|
-
{ datasetId: string; userId: string },
|
|
698
|
-
TContext
|
|
699
|
-
> => {
|
|
700
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
701
|
-
|
|
702
|
-
const mutationFn: MutationFunction<
|
|
703
|
-
Awaited<ReturnType<typeof addEditorToDataset>>,
|
|
704
|
-
{ datasetId: string; userId: string }
|
|
705
|
-
> = (props) => {
|
|
706
|
-
const { datasetId, userId } = props ?? {};
|
|
707
|
-
|
|
708
|
-
return addEditorToDataset(datasetId, userId, requestOptions);
|
|
709
|
-
};
|
|
710
|
-
|
|
711
|
-
return { mutationFn, ...mutationOptions };
|
|
712
|
-
};
|
|
713
|
-
|
|
714
|
-
export type AddEditorToDatasetMutationResult = NonNullable<
|
|
715
|
-
Awaited<ReturnType<typeof addEditorToDataset>>
|
|
716
|
-
>;
|
|
717
|
-
|
|
718
|
-
export type AddEditorToDatasetMutationError = ErrorType<DmError>;
|
|
719
|
-
|
|
720
|
-
export const useAddEditorToDataset = <
|
|
721
|
-
TError = ErrorType<DmError>,
|
|
722
|
-
TContext = unknown
|
|
723
|
-
>(options?: {
|
|
724
|
-
mutation?: UseMutationOptions<
|
|
725
|
-
Awaited<ReturnType<typeof addEditorToDataset>>,
|
|
726
|
-
TError,
|
|
727
|
-
{ datasetId: string; userId: string },
|
|
728
|
-
TContext
|
|
729
|
-
>;
|
|
730
|
-
request?: SecondParameter<typeof customInstance>;
|
|
731
|
-
}) => {
|
|
732
|
-
const mutationOptions = getAddEditorToDatasetMutationOptions(options);
|
|
733
|
-
|
|
734
|
-
return useMutation(mutationOptions);
|
|
735
|
-
};
|
|
736
|
-
/**
|
|
593
|
+
|
|
594
|
+
const mutationOptions = getAddEditorToDatasetMutationOptions(options);
|
|
595
|
+
|
|
596
|
+
return useMutation(mutationOptions);
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
737
599
|
* Returns a dataset ID and version of a dataset that matches the provided SHA256 digest, a 64-character hex string.
|
|
738
600
|
|
|
739
601
|
* @summary Gets the first Dataset that matches the provided digest
|
|
740
602
|
*/
|
|
741
603
|
export const getDatasetDigest = (
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
signal?: AbortSignal
|
|
604
|
+
datasetDigest: string,
|
|
605
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
745
606
|
) => {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
export const
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
export
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
options?: {
|
|
796
|
-
query?: UseQueryOptions<
|
|
797
|
-
Awaited<ReturnType<typeof getDatasetDigest>>,
|
|
798
|
-
TError,
|
|
799
|
-
TData
|
|
800
|
-
>;
|
|
801
|
-
request?: SecondParameter<typeof customInstance>;
|
|
802
|
-
}
|
|
803
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
804
|
-
const queryOptions = getGetDatasetDigestQueryOptions(datasetDigest, options);
|
|
805
|
-
|
|
806
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
807
|
-
queryKey: QueryKey;
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
query.queryKey = queryOptions.queryKey;
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
return customInstance<DatasetDigestGetResponse>(
|
|
610
|
+
{url: `/dataset/digest/${datasetDigest}`, method: 'get', signal
|
|
611
|
+
},
|
|
612
|
+
options);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
export const getGetDatasetDigestQueryKey = (datasetDigest: string,) => {
|
|
617
|
+
|
|
618
|
+
return ["data-manager-api", `/dataset/digest/${datasetDigest}`] as const;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
export const getGetDatasetDigestQueryOptions = <TData = Awaited<ReturnType<typeof getDatasetDigest>>, TError = ErrorType<void | DmError>>(datasetDigest: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDatasetDigest>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
623
|
+
) => {
|
|
624
|
+
|
|
625
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
626
|
+
|
|
627
|
+
const queryKey = queryOptions?.queryKey ?? getGetDatasetDigestQueryKey(datasetDigest);
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getDatasetDigest>>> = ({ signal }) => getDatasetDigest(datasetDigest, requestOptions, signal);
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
return { queryKey, queryFn, enabled: !!(datasetDigest), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getDatasetDigest>>, TError, TData> & { queryKey: QueryKey }
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export type GetDatasetDigestQueryResult = NonNullable<Awaited<ReturnType<typeof getDatasetDigest>>>
|
|
641
|
+
export type GetDatasetDigestQueryError = ErrorType<void | DmError>
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* @summary Gets the first Dataset that matches the provided digest
|
|
645
|
+
*/
|
|
646
|
+
export const useGetDatasetDigest = <TData = Awaited<ReturnType<typeof getDatasetDigest>>, TError = ErrorType<void | DmError>>(
|
|
647
|
+
datasetDigest: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getDatasetDigest>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
648
|
+
|
|
649
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
650
|
+
|
|
651
|
+
const queryOptions = getGetDatasetDigestQueryOptions(datasetDigest,options)
|
|
652
|
+
|
|
653
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
654
|
+
|
|
655
|
+
query.queryKey = queryOptions.queryKey ;
|
|
811
656
|
|
|
812
657
|
return query;
|
|
813
|
-
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
|
|
814
661
|
|
|
815
662
|
/**
|
|
816
663
|
* Returns the property schema for a Dataset versions in JSON format (if available).
|
|
@@ -818,91 +665,65 @@ export const useGetDatasetDigest = <
|
|
|
818
665
|
* @summary Gets the property schema for a specific Dataset
|
|
819
666
|
*/
|
|
820
667
|
export const getSchema = (
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
signal?: AbortSignal
|
|
668
|
+
datasetId: string,
|
|
669
|
+
datasetVersion: number,
|
|
670
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
825
671
|
) => {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
method:
|
|
830
|
-
signal,
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
return customInstance<DatasetSchemaGetResponse>(
|
|
675
|
+
{url: `/dataset/${datasetId}/schema/${datasetVersion}`, method: 'get', signal
|
|
831
676
|
},
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
export const getGetSchemaQueryKey = (
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
>
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
export const useGetSchema = <
|
|
881
|
-
TData = Awaited<ReturnType<typeof getSchema>>,
|
|
882
|
-
TError = ErrorType<void | DmError>
|
|
883
|
-
>(
|
|
884
|
-
datasetId: string,
|
|
885
|
-
datasetVersion: number,
|
|
886
|
-
options?: {
|
|
887
|
-
query?: UseQueryOptions<
|
|
888
|
-
Awaited<ReturnType<typeof getSchema>>,
|
|
889
|
-
TError,
|
|
890
|
-
TData
|
|
891
|
-
>;
|
|
892
|
-
request?: SecondParameter<typeof customInstance>;
|
|
893
|
-
}
|
|
894
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
895
|
-
const queryOptions = getGetSchemaQueryOptions(
|
|
896
|
-
datasetId,
|
|
897
|
-
datasetVersion,
|
|
898
|
-
options
|
|
899
|
-
);
|
|
900
|
-
|
|
901
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
902
|
-
queryKey: QueryKey;
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
query.queryKey = queryOptions.queryKey;
|
|
677
|
+
options);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
export const getGetSchemaQueryKey = (datasetId: string,
|
|
682
|
+
datasetVersion: number,) => {
|
|
683
|
+
|
|
684
|
+
return ["data-manager-api", `/dataset/${datasetId}/schema/${datasetVersion}`] as const;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
export const getGetSchemaQueryOptions = <TData = Awaited<ReturnType<typeof getSchema>>, TError = ErrorType<void | DmError>>(datasetId: string,
|
|
689
|
+
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getSchema>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
690
|
+
) => {
|
|
691
|
+
|
|
692
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
693
|
+
|
|
694
|
+
const queryKey = queryOptions?.queryKey ?? getGetSchemaQueryKey(datasetId,datasetVersion);
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSchema>>> = ({ signal }) => getSchema(datasetId,datasetVersion, requestOptions, signal);
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
return { queryKey, queryFn, enabled: !!(datasetId && datasetVersion), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSchema>>, TError, TData> & { queryKey: QueryKey }
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export type GetSchemaQueryResult = NonNullable<Awaited<ReturnType<typeof getSchema>>>
|
|
708
|
+
export type GetSchemaQueryError = ErrorType<void | DmError>
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* @summary Gets the property schema for a specific Dataset
|
|
712
|
+
*/
|
|
713
|
+
export const useGetSchema = <TData = Awaited<ReturnType<typeof getSchema>>, TError = ErrorType<void | DmError>>(
|
|
714
|
+
datasetId: string,
|
|
715
|
+
datasetVersion: number, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getSchema>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
716
|
+
|
|
717
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
718
|
+
|
|
719
|
+
const queryOptions = getGetSchemaQueryOptions(datasetId,datasetVersion,options)
|
|
720
|
+
|
|
721
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
722
|
+
|
|
723
|
+
query.queryKey = queryOptions.queryKey ;
|
|
906
724
|
|
|
907
725
|
return query;
|
|
908
|
-
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|