@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.
Files changed (112) hide show
  1. package/accounting/accounting.cjs +31 -13
  2. package/accounting/accounting.cjs.map +1 -1
  3. package/accounting/accounting.d.cts +77 -0
  4. package/accounting/accounting.d.ts +10 -1
  5. package/accounting/accounting.js +29 -11
  6. package/accounting/accounting.js.map +1 -1
  7. package/admin/admin.cjs +67 -27
  8. package/admin/admin.cjs.map +1 -1
  9. package/admin/admin.d.cts +324 -0
  10. package/admin/admin.d.ts +55 -22
  11. package/admin/admin.js +57 -17
  12. package/admin/admin.js.map +1 -1
  13. package/application/application.cjs +23 -13
  14. package/application/application.cjs.map +1 -1
  15. package/application/application.d.cts +57 -0
  16. package/application/application.d.ts +7 -1
  17. package/application/application.js +22 -12
  18. package/application/application.js.map +1 -1
  19. package/{chunk-UZTHSGDT.cjs → chunk-J22A7LHX.cjs} +1 -1
  20. package/chunk-J22A7LHX.cjs.map +1 -0
  21. package/{chunk-3RNIDX7T.js → chunk-UKA7G3OB.js} +1 -1
  22. package/{chunk-3RNIDX7T.js.map → chunk-UKA7G3OB.js.map} +1 -1
  23. package/configuration/configuration.cjs +13 -7
  24. package/configuration/configuration.cjs.map +1 -1
  25. package/configuration/configuration.d.cts +29 -0
  26. package/configuration/configuration.d.ts +4 -1
  27. package/configuration/configuration.js +13 -7
  28. package/configuration/configuration.js.map +1 -1
  29. package/{custom-instance-50c9dd5d.d.ts → custom-instance-3d66fe97.d.ts} +826 -826
  30. package/dataset/dataset.cjs +71 -72
  31. package/dataset/dataset.cjs.map +1 -1
  32. package/dataset/dataset.d.cts +315 -0
  33. package/dataset/dataset.d.ts +46 -16
  34. package/dataset/dataset.js +62 -63
  35. package/dataset/dataset.js.map +1 -1
  36. package/exchange-rate/exchange-rate.cjs +43 -32
  37. package/exchange-rate/exchange-rate.cjs.map +1 -1
  38. package/exchange-rate/exchange-rate.d.cts +180 -0
  39. package/exchange-rate/exchange-rate.d.ts +25 -7
  40. package/exchange-rate/exchange-rate.js +38 -27
  41. package/exchange-rate/exchange-rate.js.map +1 -1
  42. package/file/file.cjs +38 -22
  43. package/file/file.cjs.map +1 -1
  44. package/file/file.d.cts +154 -0
  45. package/file/file.d.ts +25 -10
  46. package/file/file.js +34 -18
  47. package/file/file.js.map +1 -1
  48. package/index.cjs +10 -10
  49. package/index.cjs.map +1 -1
  50. package/index.d.cts +2 -0
  51. package/index.d.ts +1 -1
  52. package/index.js +9 -9
  53. package/index.js.map +1 -1
  54. package/instance/instance.cjs +47 -37
  55. package/instance/instance.cjs.map +1 -1
  56. package/instance/instance.d.cts +215 -0
  57. package/instance/instance.d.ts +33 -12
  58. package/instance/instance.js +41 -31
  59. package/instance/instance.js.map +1 -1
  60. package/job/job.cjs +36 -19
  61. package/job/job.cjs.map +1 -1
  62. package/job/job.d.cts +85 -0
  63. package/job/job.d.ts +10 -1
  64. package/job/job.js +34 -17
  65. package/job/job.js.map +1 -1
  66. package/metadata/metadata.cjs +23 -26
  67. package/metadata/metadata.cjs.map +1 -1
  68. package/metadata/metadata.d.cts +132 -0
  69. package/metadata/metadata.d.ts +19 -7
  70. package/metadata/metadata.js +20 -23
  71. package/metadata/metadata.js.map +1 -1
  72. package/package.json +12 -12
  73. package/project/project.cjs +70 -48
  74. package/project/project.cjs.map +1 -1
  75. package/project/project.d.cts +377 -0
  76. package/project/project.d.ts +61 -25
  77. package/project/project.js +59 -37
  78. package/project/project.js.map +1 -1
  79. package/src/accounting/accounting.ts +179 -194
  80. package/src/admin/admin.ts +590 -735
  81. package/src/application/application.ts +125 -141
  82. package/src/configuration/configuration.ts +72 -60
  83. package/src/data-manager-api.schemas.ts +941 -942
  84. package/src/dataset/dataset.ts +591 -770
  85. package/src/exchange-rate/exchange-rate.ts +362 -478
  86. package/src/file/file.ts +292 -357
  87. package/src/instance/instance.ts +427 -533
  88. package/src/job/job.ts +187 -198
  89. package/src/metadata/metadata.ts +247 -339
  90. package/src/project/project.ts +669 -860
  91. package/src/task/task.ts +181 -202
  92. package/src/type/type.ts +72 -68
  93. package/src/user/user.ts +248 -286
  94. package/task/task.cjs +31 -15
  95. package/task/task.cjs.map +1 -1
  96. package/task/task.d.cts +103 -0
  97. package/task/task.d.ts +10 -1
  98. package/task/task.js +29 -13
  99. package/task/task.js.map +1 -1
  100. package/type/type.cjs +13 -7
  101. package/type/type.cjs.map +1 -1
  102. package/type/type.d.cts +31 -0
  103. package/type/type.d.ts +4 -1
  104. package/type/type.js +13 -7
  105. package/type/type.js.map +1 -1
  106. package/user/user.cjs +39 -28
  107. package/user/user.cjs.map +1 -1
  108. package/user/user.d.cts +104 -0
  109. package/user/user.d.ts +16 -4
  110. package/user/user.js +36 -25
  111. package/user/user.js.map +1 -1
  112. package/chunk-UZTHSGDT.cjs.map +0 -1
package/src/file/file.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by orval v6.15.0 🍺
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,109 +8,103 @@ 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 { useQuery, useMutation } from "@tanstack/react-query";
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
- UseQueryResult,
17
+ QueryFunction,
18
18
  QueryKey,
19
- } from "@tanstack/react-query";
19
+ UseMutationOptions,
20
+ UseQueryOptions,
21
+ UseQueryResult
22
+ } from '@tanstack/react-query'
20
23
  import type {
21
- FilesGetResponse,
24
+ DeleteUnmanagedFileParams,
22
25
  DmError,
23
- GetFilesParams,
24
- FilePostResponse,
25
26
  FilePostBodyBody,
26
- DeleteUnmanagedFileParams,
27
- } from "../data-manager-api.schemas";
28
- import { customInstance } from ".././custom-instance";
29
- import type { ErrorType } from ".././custom-instance";
27
+ FilePostResponse,
28
+ FilesGetResponse,
29
+ GetFilesParams
30
+ } from '../data-manager-api.schemas'
31
+ import { customInstance } from '.././custom-instance';
32
+ import type { ErrorType } from '.././custom-instance';
33
+
30
34
 
31
35
  // eslint-disable-next-line
32
- type SecondParameter<T extends (...args: any) => any> = T extends (
36
+ type SecondParameter<T extends (...args: any) => any> = T extends (
33
37
  config: any,
34
- args: infer P
38
+ args: infer P,
35
39
  ) => any
36
40
  ? P
37
41
  : never;
38
42
 
43
+
39
44
  /**
40
45
  * Given a Project and Path the files available to you on that path will be returned along with any additional paths (sub-directories).
41
46
 
42
47
  * @summary Gets the Files on a Project Path
43
48
  */
44
49
  export const getFiles = (
45
- params: GetFilesParams,
46
- options?: SecondParameter<typeof customInstance>,
47
- signal?: AbortSignal
50
+ params: GetFilesParams,
51
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
48
52
  ) => {
49
- return customInstance<FilesGetResponse>(
50
- { url: `/file`, method: "get", params, signal },
51
- options
52
- );
53
- };
54
-
55
- export const getGetFilesQueryKey = (params: GetFilesParams) =>
56
- ["data-manager-api", `/file`, ...(params ? [params] : [])] as const;
57
-
58
- export const getGetFilesQueryOptions = <
59
- TData = Awaited<ReturnType<typeof getFiles>>,
60
- TError = ErrorType<void | DmError>
61
- >(
62
- params: GetFilesParams,
63
- options?: {
64
- query?: UseQueryOptions<
65
- Awaited<ReturnType<typeof getFiles>>,
66
- TError,
67
- TData
68
- >;
69
- request?: SecondParameter<typeof customInstance>;
70
- }
71
- ): UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & {
72
- queryKey: QueryKey;
73
- } => {
74
- const { query: queryOptions, request: requestOptions } = options ?? {};
75
-
76
- const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);
77
-
78
- const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({
79
- signal,
80
- }) => getFiles(params, requestOptions, signal);
81
-
82
- return { queryKey, queryFn, ...queryOptions };
83
- };
84
-
85
- export type GetFilesQueryResult = NonNullable<
86
- Awaited<ReturnType<typeof getFiles>>
87
- >;
88
- export type GetFilesQueryError = ErrorType<void | DmError>;
89
-
90
- export const useGetFiles = <
91
- TData = Awaited<ReturnType<typeof getFiles>>,
92
- TError = ErrorType<void | DmError>
93
- >(
94
- params: GetFilesParams,
95
- options?: {
96
- query?: UseQueryOptions<
97
- Awaited<ReturnType<typeof getFiles>>,
98
- TError,
99
- TData
100
- >;
101
- request?: SecondParameter<typeof customInstance>;
102
- }
103
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
104
- const queryOptions = getGetFilesQueryOptions(params, options);
105
-
106
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
107
- queryKey: QueryKey;
108
- };
109
-
110
- query.queryKey = queryOptions.queryKey;
53
+
54
+
55
+ return customInstance<FilesGetResponse>(
56
+ {url: `/file`, method: 'get',
57
+ params, signal
58
+ },
59
+ options);
60
+ }
61
+
62
+
63
+ export const getGetFilesQueryKey = (params: GetFilesParams,) => {
64
+
65
+ return ["data-manager-api", `/file`, ...(params ? [params]: [])] as const;
66
+ }
67
+
68
+
69
+ export const getGetFilesQueryOptions = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
70
+ ) => {
71
+
72
+ const {query: queryOptions, request: requestOptions} = options ?? {};
73
+
74
+ const queryKey = queryOptions?.queryKey ?? getGetFilesQueryKey(params);
75
+
76
+
77
+
78
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof getFiles>>> = ({ signal }) => getFiles(params, requestOptions, signal);
79
+
80
+
81
+
82
+
83
+
84
+ return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData> & { queryKey: QueryKey }
85
+ }
86
+
87
+ export type GetFilesQueryResult = NonNullable<Awaited<ReturnType<typeof getFiles>>>
88
+ export type GetFilesQueryError = ErrorType<void | DmError>
89
+
90
+ /**
91
+ * @summary Gets the Files on a Project Path
92
+ */
93
+ export const useGetFiles = <TData = Awaited<ReturnType<typeof getFiles>>, TError = ErrorType<void | DmError>>(
94
+ params: GetFilesParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getFiles>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
95
+
96
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
97
+
98
+ const queryOptions = getGetFilesQueryOptions(params,options)
99
+
100
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
101
+
102
+ query.queryKey = queryOptions.queryKey ;
111
103
 
112
104
  return query;
113
- };
105
+ }
106
+
107
+
114
108
 
115
109
  /**
116
110
  * 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.
@@ -126,92 +120,71 @@ You cannot add a Dataset to a Project until its upload is complete.
126
120
  * @summary Attach a Dataset, as a File, to a Project
127
121
  */
128
122
  export const attachFile = (
129
- filePostBodyBody: FilePostBodyBody,
130
- options?: SecondParameter<typeof customInstance>
131
- ) => {
132
- const formData = new FormData();
133
- formData.append("dataset_id", filePostBodyBody.dataset_id);
134
- formData.append(
135
- "dataset_version",
136
- filePostBodyBody.dataset_version.toString()
137
- );
138
- formData.append("project_id", filePostBodyBody.project_id);
139
- formData.append("as_type", filePostBodyBody.as_type);
140
- if (filePostBodyBody.path !== undefined) {
141
- formData.append("path", filePostBodyBody.path);
142
- }
143
- if (filePostBodyBody.compress !== undefined) {
144
- formData.append("compress", filePostBodyBody.compress.toString());
145
- }
146
- if (filePostBodyBody.immutable !== undefined) {
147
- formData.append("immutable", filePostBodyBody.immutable.toString());
148
- }
149
-
150
- return customInstance<FilePostResponse>(
151
- {
152
- url: `/file`,
153
- method: "post",
154
- headers: { "Content-Type": "multipart/form-data" },
155
- data: formData,
123
+ filePostBodyBody: FilePostBodyBody,
124
+ options?: SecondParameter<typeof customInstance>,) => {
125
+
126
+ const formData = new FormData();
127
+ formData.append('dataset_id', filePostBodyBody.dataset_id)
128
+ formData.append('dataset_version', filePostBodyBody.dataset_version.toString())
129
+ formData.append('project_id', filePostBodyBody.project_id)
130
+ formData.append('as_type', filePostBodyBody.as_type)
131
+ if(filePostBodyBody.path !== undefined) {
132
+ formData.append('path', filePostBodyBody.path)
133
+ }
134
+ if(filePostBodyBody.compress !== undefined) {
135
+ formData.append('compress', filePostBodyBody.compress.toString())
136
+ }
137
+ if(filePostBodyBody.immutable !== undefined) {
138
+ formData.append('immutable', filePostBodyBody.immutable.toString())
139
+ }
140
+
141
+ return customInstance<FilePostResponse>(
142
+ {url: `/file`, method: 'post',
143
+ headers: {'Content-Type': 'multipart/form-data', },
144
+ data: formData
156
145
  },
157
- options
158
- );
159
- };
160
-
161
- export const getAttachFileMutationOptions = <
162
- TError = ErrorType<void | DmError>,
163
- TContext = unknown
164
- >(options?: {
165
- mutation?: UseMutationOptions<
166
- Awaited<ReturnType<typeof attachFile>>,
167
- TError,
168
- { data: FilePostBodyBody },
169
- TContext
170
- >;
171
- request?: SecondParameter<typeof customInstance>;
172
- }): UseMutationOptions<
173
- Awaited<ReturnType<typeof attachFile>>,
174
- TError,
175
- { data: FilePostBodyBody },
176
- TContext
177
- > => {
178
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
179
-
180
- const mutationFn: MutationFunction<
181
- Awaited<ReturnType<typeof attachFile>>,
182
- { data: FilePostBodyBody }
183
- > = (props) => {
184
- const { data } = props ?? {};
185
-
186
- return attachFile(data, requestOptions);
187
- };
188
-
189
- return { mutationFn, ...mutationOptions };
190
- };
191
-
192
- export type AttachFileMutationResult = NonNullable<
193
- Awaited<ReturnType<typeof attachFile>>
194
- >;
195
- export type AttachFileMutationBody = FilePostBodyBody;
196
- export type AttachFileMutationError = ErrorType<void | DmError>;
197
-
198
- export const useAttachFile = <
199
- TError = ErrorType<void | DmError>,
200
- TContext = unknown
201
- >(options?: {
202
- mutation?: UseMutationOptions<
203
- Awaited<ReturnType<typeof attachFile>>,
204
- TError,
205
- { data: FilePostBodyBody },
206
- TContext
207
- >;
208
- request?: SecondParameter<typeof customInstance>;
209
- }) => {
210
- const mutationOptions = getAttachFileMutationOptions(options);
211
-
212
- return useMutation(mutationOptions);
213
- };
214
- /**
146
+ options);
147
+ }
148
+
149
+
150
+
151
+ export const getAttachFileMutationOptions = <TError = ErrorType<void | DmError>,
152
+
153
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
154
+ ): UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext> => {
155
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
156
+
157
+
158
+
159
+
160
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof attachFile>>, {data: FilePostBodyBody}> = (props) => {
161
+ const {data} = props ?? {};
162
+
163
+ return attachFile(data,requestOptions)
164
+ }
165
+
166
+
167
+
168
+
169
+ return { mutationFn, ...mutationOptions }}
170
+
171
+ export type AttachFileMutationResult = NonNullable<Awaited<ReturnType<typeof attachFile>>>
172
+ export type AttachFileMutationBody = FilePostBodyBody
173
+ export type AttachFileMutationError = ErrorType<void | DmError>
174
+
175
+ /**
176
+ * @summary Attach a Dataset, as a File, to a Project
177
+ */
178
+ export const useAttachFile = <TError = ErrorType<void | DmError>,
179
+
180
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof attachFile>>, TError,{data: FilePostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
181
+ ) => {
182
+
183
+ const mutationOptions = getAttachFileMutationOptions(options);
184
+
185
+ return useMutation(mutationOptions);
186
+ }
187
+ /**
215
188
  * Removes an unmanaged file from a Project. You cannot use this endpoint to delete managed project files.
216
189
 
217
190
  You must be an `editor` or the `owner` of the project to delete a file from a project.
@@ -219,69 +192,56 @@ You must be an `editor` or the `owner` of the project to delete a file from a pr
219
192
  * @summary Delete an unmanaged Project File
220
193
  */
221
194
  export const deleteUnmanagedFile = (
222
- params: DeleteUnmanagedFileParams,
223
- options?: SecondParameter<typeof customInstance>
195
+ params: DeleteUnmanagedFileParams,
196
+ options?: SecondParameter<typeof customInstance>,) => {
197
+
198
+
199
+ return customInstance<void>(
200
+ {url: `/file`, method: 'delete',
201
+ params
202
+ },
203
+ options);
204
+ }
205
+
206
+
207
+
208
+ export const getDeleteUnmanagedFileMutationOptions = <TError = ErrorType<DmError>,
209
+
210
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}
211
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext> => {
212
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
213
+
214
+
215
+
216
+
217
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteUnmanagedFile>>, {params: DeleteUnmanagedFileParams}> = (props) => {
218
+ const {params} = props ?? {};
219
+
220
+ return deleteUnmanagedFile(params,requestOptions)
221
+ }
222
+
223
+
224
+
225
+
226
+ return { mutationFn, ...mutationOptions }}
227
+
228
+ export type DeleteUnmanagedFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUnmanagedFile>>>
229
+
230
+ export type DeleteUnmanagedFileMutationError = ErrorType<DmError>
231
+
232
+ /**
233
+ * @summary Delete an unmanaged Project File
234
+ */
235
+ export const useDeleteUnmanagedFile = <TError = ErrorType<DmError>,
236
+
237
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteUnmanagedFile>>, TError,{params: DeleteUnmanagedFileParams}, TContext>, request?: SecondParameter<typeof customInstance>}
224
238
  ) => {
225
- return customInstance<void>(
226
- { url: `/file`, method: "delete", params },
227
- options
228
- );
229
- };
230
-
231
- export const getDeleteUnmanagedFileMutationOptions = <
232
- TError = ErrorType<DmError>,
233
- TContext = unknown
234
- >(options?: {
235
- mutation?: UseMutationOptions<
236
- Awaited<ReturnType<typeof deleteUnmanagedFile>>,
237
- TError,
238
- { params: DeleteUnmanagedFileParams },
239
- TContext
240
- >;
241
- request?: SecondParameter<typeof customInstance>;
242
- }): UseMutationOptions<
243
- Awaited<ReturnType<typeof deleteUnmanagedFile>>,
244
- TError,
245
- { params: DeleteUnmanagedFileParams },
246
- TContext
247
- > => {
248
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
249
-
250
- const mutationFn: MutationFunction<
251
- Awaited<ReturnType<typeof deleteUnmanagedFile>>,
252
- { params: DeleteUnmanagedFileParams }
253
- > = (props) => {
254
- const { params } = props ?? {};
255
-
256
- return deleteUnmanagedFile(params, requestOptions);
257
- };
258
-
259
- return { mutationFn, ...mutationOptions };
260
- };
261
-
262
- export type DeleteUnmanagedFileMutationResult = NonNullable<
263
- Awaited<ReturnType<typeof deleteUnmanagedFile>>
264
- >;
265
-
266
- export type DeleteUnmanagedFileMutationError = ErrorType<DmError>;
267
-
268
- export const useDeleteUnmanagedFile = <
269
- TError = ErrorType<DmError>,
270
- TContext = unknown
271
- >(options?: {
272
- mutation?: UseMutationOptions<
273
- Awaited<ReturnType<typeof deleteUnmanagedFile>>,
274
- TError,
275
- { params: DeleteUnmanagedFileParams },
276
- TContext
277
- >;
278
- request?: SecondParameter<typeof customInstance>;
279
- }) => {
280
- const mutationOptions = getDeleteUnmanagedFileMutationOptions(options);
281
-
282
- return useMutation(mutationOptions);
283
- };
284
- /**
239
+
240
+ const mutationOptions = getDeleteUnmanagedFileMutationOptions(options);
241
+
242
+ return useMutation(mutationOptions);
243
+ }
244
+ /**
285
245
  * Given a `file_id` the file will be removed from the Project it's attached to.
286
246
 
287
247
  You must be an `editor` or the `owner` 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.
@@ -291,69 +251,55 @@ You cannot delete a Project File until the attach is complete.
291
251
  * @summary Delete/detach a File (from a Project)
292
252
  */
293
253
  export const deleteFile = (
294
- fileId: string,
295
- options?: SecondParameter<typeof customInstance>
254
+ fileId: string,
255
+ options?: SecondParameter<typeof customInstance>,) => {
256
+
257
+
258
+ return customInstance<void>(
259
+ {url: `/file/${fileId}`, method: 'delete'
260
+ },
261
+ options);
262
+ }
263
+
264
+
265
+
266
+ export const getDeleteFileMutationOptions = <TError = ErrorType<DmError>,
267
+
268
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
269
+ ): UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext> => {
270
+ const {mutation: mutationOptions, request: requestOptions} = options ?? {};
271
+
272
+
273
+
274
+
275
+ const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteFile>>, {fileId: string}> = (props) => {
276
+ const {fileId} = props ?? {};
277
+
278
+ return deleteFile(fileId,requestOptions)
279
+ }
280
+
281
+
282
+
283
+
284
+ return { mutationFn, ...mutationOptions }}
285
+
286
+ export type DeleteFileMutationResult = NonNullable<Awaited<ReturnType<typeof deleteFile>>>
287
+
288
+ export type DeleteFileMutationError = ErrorType<DmError>
289
+
290
+ /**
291
+ * @summary Delete/detach a File (from a Project)
292
+ */
293
+ export const useDeleteFile = <TError = ErrorType<DmError>,
294
+
295
+ TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteFile>>, TError,{fileId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
296
296
  ) => {
297
- return customInstance<void>(
298
- { url: `/file/${fileId}`, method: "delete" },
299
- options
300
- );
301
- };
302
-
303
- export const getDeleteFileMutationOptions = <
304
- TError = ErrorType<DmError>,
305
- TContext = unknown
306
- >(options?: {
307
- mutation?: UseMutationOptions<
308
- Awaited<ReturnType<typeof deleteFile>>,
309
- TError,
310
- { fileId: string },
311
- TContext
312
- >;
313
- request?: SecondParameter<typeof customInstance>;
314
- }): UseMutationOptions<
315
- Awaited<ReturnType<typeof deleteFile>>,
316
- TError,
317
- { fileId: string },
318
- TContext
319
- > => {
320
- const { mutation: mutationOptions, request: requestOptions } = options ?? {};
321
-
322
- const mutationFn: MutationFunction<
323
- Awaited<ReturnType<typeof deleteFile>>,
324
- { fileId: string }
325
- > = (props) => {
326
- const { fileId } = props ?? {};
327
-
328
- return deleteFile(fileId, requestOptions);
329
- };
330
-
331
- return { mutationFn, ...mutationOptions };
332
- };
333
-
334
- export type DeleteFileMutationResult = NonNullable<
335
- Awaited<ReturnType<typeof deleteFile>>
336
- >;
337
-
338
- export type DeleteFileMutationError = ErrorType<DmError>;
339
-
340
- export const useDeleteFile = <
341
- TError = ErrorType<DmError>,
342
- TContext = unknown
343
- >(options?: {
344
- mutation?: UseMutationOptions<
345
- Awaited<ReturnType<typeof deleteFile>>,
346
- TError,
347
- { fileId: string },
348
- TContext
349
- >;
350
- request?: SecondParameter<typeof customInstance>;
351
- }) => {
352
- const mutationOptions = getDeleteFileMutationOptions(options);
353
-
354
- return useMutation(mutationOptions);
355
- };
356
- /**
297
+
298
+ const mutationOptions = getDeleteFileMutationOptions(options);
299
+
300
+ return useMutation(mutationOptions);
301
+ }
302
+ /**
357
303
  * Given a `file_id` the file will be returned if available.
358
304
 
359
305
  You cannot get a Project File until the attach is complete.
@@ -361,72 +307,61 @@ You cannot get a Project File until the attach is complete.
361
307
  * @summary Download a File (from a project)
362
308
  */
363
309
  export const downloadFile = (
364
- fileId: string,
365
- options?: SecondParameter<typeof customInstance>,
366
- signal?: AbortSignal
310
+ fileId: string,
311
+ options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
312
+ ) => {
313
+
314
+
315
+ return customInstance<void>(
316
+ {url: `/file/${fileId}`, method: 'get', signal
317
+ },
318
+ options);
319
+ }
320
+
321
+
322
+ export const getDownloadFileQueryKey = (fileId: string,) => {
323
+
324
+ return ["data-manager-api", `/file/${fileId}`] as const;
325
+ }
326
+
327
+
328
+ export const getDownloadFileQueryOptions = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
367
329
  ) => {
368
- return customInstance<void>(
369
- { url: `/file/${fileId}`, method: "get", signal },
370
- options
371
- );
372
- };
373
-
374
- export const getDownloadFileQueryKey = (fileId: string) =>
375
- ["data-manager-api", `/file/${fileId}`] as const;
376
-
377
- export const getDownloadFileQueryOptions = <
378
- TData = Awaited<ReturnType<typeof downloadFile>>,
379
- TError = ErrorType<DmError>
380
- >(
381
- fileId: string,
382
- options?: {
383
- query?: UseQueryOptions<
384
- Awaited<ReturnType<typeof downloadFile>>,
385
- TError,
386
- TData
387
- >;
388
- request?: SecondParameter<typeof customInstance>;
389
- }
390
- ): UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData> & {
391
- queryKey: QueryKey;
392
- } => {
393
- const { query: queryOptions, request: requestOptions } = options ?? {};
394
-
395
- const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);
396
-
397
- const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({
398
- signal,
399
- }) => downloadFile(fileId, requestOptions, signal);
400
-
401
- return { queryKey, queryFn, enabled: !!fileId, ...queryOptions };
402
- };
403
-
404
- export type DownloadFileQueryResult = NonNullable<
405
- Awaited<ReturnType<typeof downloadFile>>
406
- >;
407
- export type DownloadFileQueryError = ErrorType<DmError>;
408
-
409
- export const useDownloadFile = <
410
- TData = Awaited<ReturnType<typeof downloadFile>>,
411
- TError = ErrorType<DmError>
412
- >(
413
- fileId: string,
414
- options?: {
415
- query?: UseQueryOptions<
416
- Awaited<ReturnType<typeof downloadFile>>,
417
- TError,
418
- TData
419
- >;
420
- request?: SecondParameter<typeof customInstance>;
421
- }
422
- ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
423
- const queryOptions = getDownloadFileQueryOptions(fileId, options);
424
-
425
- const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
426
- queryKey: QueryKey;
427
- };
428
-
429
- query.queryKey = queryOptions.queryKey;
330
+
331
+ const {query: queryOptions, request: requestOptions} = options ?? {};
332
+
333
+ const queryKey = queryOptions?.queryKey ?? getDownloadFileQueryKey(fileId);
334
+
335
+
336
+
337
+ const queryFn: QueryFunction<Awaited<ReturnType<typeof downloadFile>>> = ({ signal }) => downloadFile(fileId, requestOptions, signal);
338
+
339
+
340
+
341
+
342
+
343
+ return { queryKey, queryFn, enabled: !!(fileId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData> & { queryKey: QueryKey }
344
+ }
345
+
346
+ export type DownloadFileQueryResult = NonNullable<Awaited<ReturnType<typeof downloadFile>>>
347
+ export type DownloadFileQueryError = ErrorType<DmError>
348
+
349
+ /**
350
+ * @summary Download a File (from a project)
351
+ */
352
+ export const useDownloadFile = <TData = Awaited<ReturnType<typeof downloadFile>>, TError = ErrorType<DmError>>(
353
+ fileId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof downloadFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
354
+
355
+ ): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
356
+
357
+ const queryOptions = getDownloadFileQueryOptions(fileId,options)
358
+
359
+ const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
360
+
361
+ query.queryKey = queryOptions.queryKey ;
430
362
 
431
363
  return query;
432
- };
364
+ }
365
+
366
+
367
+