@squonk/data-manager-client 1.2.3-rc.2 → 1.2.4-rc.1
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-a2110e78.d.ts} +825 -825
- 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 +940 -941
- 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/project/project.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,112 +8,106 @@ 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
|
-
ProjectsGetResponse,
|
|
22
24
|
DmError,
|
|
23
|
-
GetProjectsParams,
|
|
24
|
-
ProjectPostResponse,
|
|
25
|
-
ProjectPostBodyBody,
|
|
26
|
-
ProjectGetResponse,
|
|
27
|
-
ProjectPatchBodyBody,
|
|
28
|
-
ProjectDeleteResponse,
|
|
29
25
|
GetProjectFileParams,
|
|
30
|
-
ProjectFilePutBodyBody,
|
|
31
26
|
GetProjectFileWithTokenParams,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
GetProjectsParams,
|
|
28
|
+
ProjectDetail,
|
|
29
|
+
ProjectFilePutBodyBody,
|
|
30
|
+
ProjectPatchBodyBody,
|
|
31
|
+
ProjectPostBodyBody,
|
|
32
|
+
ProjectPostResponse,
|
|
33
|
+
ProjectsGetResponse,
|
|
34
|
+
TaskIdentity
|
|
35
|
+
} from '../data-manager-api.schemas'
|
|
36
|
+
import { customInstance } from '.././custom-instance';
|
|
37
|
+
import type { ErrorType } from '.././custom-instance';
|
|
38
|
+
|
|
35
39
|
|
|
36
40
|
// eslint-disable-next-line
|
|
37
|
-
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
41
|
+
type SecondParameter<T extends (...args: any) => any> = T extends (
|
|
38
42
|
config: any,
|
|
39
|
-
args: infer P
|
|
43
|
+
args: infer P,
|
|
40
44
|
) => any
|
|
41
45
|
? P
|
|
42
46
|
: never;
|
|
43
47
|
|
|
48
|
+
|
|
44
49
|
/**
|
|
45
50
|
* @summary Get all Projects available to you
|
|
46
51
|
*/
|
|
47
52
|
export const getProjects = (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
params?: GetProjectsParams,
|
|
54
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
55
|
+
) => {
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
return customInstance<ProjectsGetResponse>(
|
|
59
|
+
{url: `/project`, method: 'get',
|
|
60
|
+
params, signal
|
|
61
|
+
},
|
|
62
|
+
options);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export const getGetProjectsQueryKey = (params?: GetProjectsParams,) => {
|
|
67
|
+
|
|
68
|
+
return ["data-manager-api", `/project`, ...(params ? [params]: [])] as const;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export const getGetProjectsQueryOptions = <TData = Awaited<ReturnType<typeof getProjects>>, TError = ErrorType<void | DmError>>(params?: GetProjectsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProjects>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
51
73
|
) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export type GetProjectsQueryResult = NonNullable<
|
|
89
|
-
Awaited<ReturnType<typeof getProjects>>
|
|
90
|
-
>;
|
|
91
|
-
export type GetProjectsQueryError = ErrorType<void | DmError>;
|
|
92
|
-
|
|
93
|
-
export const useGetProjects = <
|
|
94
|
-
TData = Awaited<ReturnType<typeof getProjects>>,
|
|
95
|
-
TError = ErrorType<void | DmError>
|
|
96
|
-
>(
|
|
97
|
-
params?: GetProjectsParams,
|
|
98
|
-
options?: {
|
|
99
|
-
query?: UseQueryOptions<
|
|
100
|
-
Awaited<ReturnType<typeof getProjects>>,
|
|
101
|
-
TError,
|
|
102
|
-
TData
|
|
103
|
-
>;
|
|
104
|
-
request?: SecondParameter<typeof customInstance>;
|
|
105
|
-
}
|
|
106
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
107
|
-
const queryOptions = getGetProjectsQueryOptions(params, options);
|
|
108
|
-
|
|
109
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
110
|
-
queryKey: QueryKey;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
query.queryKey = queryOptions.queryKey;
|
|
74
|
+
|
|
75
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
76
|
+
|
|
77
|
+
const queryKey = queryOptions?.queryKey ?? getGetProjectsQueryKey(params);
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProjects>>> = ({ signal }) => getProjects(params, requestOptions, signal);
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProjects>>, TError, TData> & { queryKey: QueryKey }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type GetProjectsQueryResult = NonNullable<Awaited<ReturnType<typeof getProjects>>>
|
|
91
|
+
export type GetProjectsQueryError = ErrorType<void | DmError>
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @summary Get all Projects available to you
|
|
95
|
+
*/
|
|
96
|
+
export const useGetProjects = <TData = Awaited<ReturnType<typeof getProjects>>, TError = ErrorType<void | DmError>>(
|
|
97
|
+
params?: GetProjectsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProjects>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
98
|
+
|
|
99
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
100
|
+
|
|
101
|
+
const queryOptions = getGetProjectsQueryOptions(params,options)
|
|
102
|
+
|
|
103
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
104
|
+
|
|
105
|
+
query.queryKey = queryOptions.queryKey ;
|
|
114
106
|
|
|
115
107
|
return query;
|
|
116
|
-
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
117
111
|
|
|
118
112
|
/**
|
|
119
113
|
* Creates a new Project, assigning and returning a unique **ID**. A persistent volume is created in the cluster and assigned to your Project. It's here you can add **Datasets** as **Files** and run **Applications** and **Jobs**.
|
|
@@ -127,155 +121,125 @@ The name you give the Project is free-form text (can contain spaces etc.) but th
|
|
|
127
121
|
* @summary Create a new Project
|
|
128
122
|
*/
|
|
129
123
|
export const createProject = (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
145
|
-
data: formData,
|
|
124
|
+
projectPostBodyBody: ProjectPostBodyBody,
|
|
125
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
126
|
+
|
|
127
|
+
const formData = new FormData();
|
|
128
|
+
formData.append('name', projectPostBodyBody.name)
|
|
129
|
+
if(projectPostBodyBody.private !== undefined) {
|
|
130
|
+
formData.append('private', projectPostBodyBody.private.toString())
|
|
131
|
+
}
|
|
132
|
+
formData.append('tier_product_id', projectPostBodyBody.tier_product_id)
|
|
133
|
+
|
|
134
|
+
return customInstance<ProjectPostResponse>(
|
|
135
|
+
{url: `/project`, method: 'post',
|
|
136
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
137
|
+
data: formData
|
|
146
138
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
>(options?: {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
TError = ErrorType<DmError | void>,
|
|
190
|
-
TContext = unknown
|
|
191
|
-
>(options?: {
|
|
192
|
-
mutation?: UseMutationOptions<
|
|
193
|
-
Awaited<ReturnType<typeof createProject>>,
|
|
194
|
-
TError,
|
|
195
|
-
{ data: ProjectPostBodyBody },
|
|
196
|
-
TContext
|
|
197
|
-
>;
|
|
198
|
-
request?: SecondParameter<typeof customInstance>;
|
|
199
|
-
}) => {
|
|
200
|
-
const mutationOptions = getCreateProjectMutationOptions(options);
|
|
201
|
-
|
|
202
|
-
return useMutation(mutationOptions);
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
139
|
+
options);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
export const getCreateProjectMutationOptions = <TError = ErrorType<DmError | void>,
|
|
145
|
+
|
|
146
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProject>>, TError,{data: ProjectPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
147
|
+
): UseMutationOptions<Awaited<ReturnType<typeof createProject>>, TError,{data: ProjectPostBodyBody}, TContext> => {
|
|
148
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createProject>>, {data: ProjectPostBodyBody}> = (props) => {
|
|
154
|
+
const {data} = props ?? {};
|
|
155
|
+
|
|
156
|
+
return createProject(data,requestOptions)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
return { mutationFn, ...mutationOptions }}
|
|
163
|
+
|
|
164
|
+
export type CreateProjectMutationResult = NonNullable<Awaited<ReturnType<typeof createProject>>>
|
|
165
|
+
export type CreateProjectMutationBody = ProjectPostBodyBody
|
|
166
|
+
export type CreateProjectMutationError = ErrorType<DmError | void>
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @summary Create a new Project
|
|
170
|
+
*/
|
|
171
|
+
export const useCreateProject = <TError = ErrorType<DmError | void>,
|
|
172
|
+
|
|
173
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createProject>>, TError,{data: ProjectPostBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
174
|
+
) => {
|
|
175
|
+
|
|
176
|
+
const mutationOptions = getCreateProjectMutationOptions(options);
|
|
177
|
+
|
|
178
|
+
return useMutation(mutationOptions);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
205
181
|
* Gets the details of a Project that is available to you.
|
|
206
182
|
|
|
207
183
|
* @summary Get a Project
|
|
208
184
|
*/
|
|
209
185
|
export const getProject = (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
186
|
+
projectId: string,
|
|
187
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
188
|
+
) => {
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
return customInstance<ProjectDetail>(
|
|
192
|
+
{url: `/project/${projectId}`, method: 'get', signal
|
|
193
|
+
},
|
|
194
|
+
options);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
export const getGetProjectQueryKey = (projectId: string,) => {
|
|
199
|
+
|
|
200
|
+
return ["data-manager-api", `/project/${projectId}`] as const;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
export const getGetProjectQueryOptions = <TData = Awaited<ReturnType<typeof getProject>>, TError = ErrorType<void | DmError>>(projectId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProject>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
213
205
|
) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
projectId:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
return { queryKey, queryFn, enabled: !!projectId, ...queryOptions };
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
export type GetProjectQueryResult = NonNullable<
|
|
251
|
-
Awaited<ReturnType<typeof getProject>>
|
|
252
|
-
>;
|
|
253
|
-
export type GetProjectQueryError = ErrorType<void | DmError>;
|
|
254
|
-
|
|
255
|
-
export const useGetProject = <
|
|
256
|
-
TData = Awaited<ReturnType<typeof getProject>>,
|
|
257
|
-
TError = ErrorType<void | DmError>
|
|
258
|
-
>(
|
|
259
|
-
projectId: string,
|
|
260
|
-
options?: {
|
|
261
|
-
query?: UseQueryOptions<
|
|
262
|
-
Awaited<ReturnType<typeof getProject>>,
|
|
263
|
-
TError,
|
|
264
|
-
TData
|
|
265
|
-
>;
|
|
266
|
-
request?: SecondParameter<typeof customInstance>;
|
|
267
|
-
}
|
|
268
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
269
|
-
const queryOptions = getGetProjectQueryOptions(projectId, options);
|
|
270
|
-
|
|
271
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
272
|
-
queryKey: QueryKey;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
query.queryKey = queryOptions.queryKey;
|
|
206
|
+
|
|
207
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
208
|
+
|
|
209
|
+
const queryKey = queryOptions?.queryKey ?? getGetProjectQueryKey(projectId);
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProject>>> = ({ signal }) => getProject(projectId, requestOptions, signal);
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
return { queryKey, queryFn, enabled: !!(projectId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProject>>, TError, TData> & { queryKey: QueryKey }
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export type GetProjectQueryResult = NonNullable<Awaited<ReturnType<typeof getProject>>>
|
|
223
|
+
export type GetProjectQueryError = ErrorType<void | DmError>
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @summary Get a Project
|
|
227
|
+
*/
|
|
228
|
+
export const useGetProject = <TData = Awaited<ReturnType<typeof getProject>>, TError = ErrorType<void | DmError>>(
|
|
229
|
+
projectId: string, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProject>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
230
|
+
|
|
231
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
232
|
+
|
|
233
|
+
const queryOptions = getGetProjectQueryOptions(projectId,options)
|
|
234
|
+
|
|
235
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
236
|
+
|
|
237
|
+
query.queryKey = queryOptions.queryKey ;
|
|
276
238
|
|
|
277
239
|
return query;
|
|
278
|
-
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
279
243
|
|
|
280
244
|
/**
|
|
281
245
|
* Used to update some adjustable parameters of a Project, i.e. to make it `private` or make it `public``. What can be adjusted will depend on the purchased **Product**
|
|
@@ -283,83 +247,65 @@ export const useGetProject = <
|
|
|
283
247
|
* @summary Adjust an existing Project
|
|
284
248
|
*/
|
|
285
249
|
export const patchProject = (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
303
|
-
data: formData,
|
|
250
|
+
projectId: string,
|
|
251
|
+
projectPatchBodyBody: ProjectPatchBodyBody,
|
|
252
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
253
|
+
|
|
254
|
+
const formData = new FormData();
|
|
255
|
+
if(projectPatchBodyBody.private !== undefined) {
|
|
256
|
+
formData.append('private', projectPatchBodyBody.private.toString())
|
|
257
|
+
}
|
|
258
|
+
if(projectPatchBodyBody.name !== undefined) {
|
|
259
|
+
formData.append('name', projectPatchBodyBody.name)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return customInstance<void>(
|
|
263
|
+
{url: `/project/${projectId}`, method: 'patch',
|
|
264
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
265
|
+
data: formData
|
|
304
266
|
},
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
>(options?: {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
TError = ErrorType<DmError>,
|
|
348
|
-
TContext = unknown
|
|
349
|
-
>(options?: {
|
|
350
|
-
mutation?: UseMutationOptions<
|
|
351
|
-
Awaited<ReturnType<typeof patchProject>>,
|
|
352
|
-
TError,
|
|
353
|
-
{ projectId: string; data: ProjectPatchBodyBody },
|
|
354
|
-
TContext
|
|
355
|
-
>;
|
|
356
|
-
request?: SecondParameter<typeof customInstance>;
|
|
357
|
-
}) => {
|
|
358
|
-
const mutationOptions = getPatchProjectMutationOptions(options);
|
|
359
|
-
|
|
360
|
-
return useMutation(mutationOptions);
|
|
361
|
-
};
|
|
362
|
-
/**
|
|
267
|
+
options);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
export const getPatchProjectMutationOptions = <TError = ErrorType<DmError>,
|
|
273
|
+
|
|
274
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchProject>>, TError,{projectId: string;data: ProjectPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
275
|
+
): UseMutationOptions<Awaited<ReturnType<typeof patchProject>>, TError,{projectId: string;data: ProjectPatchBodyBody}, TContext> => {
|
|
276
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchProject>>, {projectId: string;data: ProjectPatchBodyBody}> = (props) => {
|
|
282
|
+
const {projectId,data} = props ?? {};
|
|
283
|
+
|
|
284
|
+
return patchProject(projectId,data,requestOptions)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
return { mutationFn, ...mutationOptions }}
|
|
291
|
+
|
|
292
|
+
export type PatchProjectMutationResult = NonNullable<Awaited<ReturnType<typeof patchProject>>>
|
|
293
|
+
export type PatchProjectMutationBody = ProjectPatchBodyBody
|
|
294
|
+
export type PatchProjectMutationError = ErrorType<DmError>
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* @summary Adjust an existing Project
|
|
298
|
+
*/
|
|
299
|
+
export const usePatchProject = <TError = ErrorType<DmError>,
|
|
300
|
+
|
|
301
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchProject>>, TError,{projectId: string;data: ProjectPatchBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
302
|
+
) => {
|
|
303
|
+
|
|
304
|
+
const mutationOptions = getPatchProjectMutationOptions(options);
|
|
305
|
+
|
|
306
|
+
return useMutation(mutationOptions);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
363
309
|
* Deletes an existing Project.
|
|
364
310
|
|
|
365
311
|
You must be an `editor` or the `owner` of the project.
|
|
@@ -369,69 +315,55 @@ Once deleted all **Files**, working directories and material in the Project will
|
|
|
369
315
|
* @summary Delete a Project
|
|
370
316
|
*/
|
|
371
317
|
export const deleteProject = (
|
|
372
|
-
|
|
373
|
-
|
|
318
|
+
projectId: string,
|
|
319
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
return customInstance<TaskIdentity>(
|
|
323
|
+
{url: `/project/${projectId}`, method: 'delete'
|
|
324
|
+
},
|
|
325
|
+
options);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
export const getDeleteProjectMutationOptions = <TError = ErrorType<void | DmError>,
|
|
331
|
+
|
|
332
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProject>>, TError,{projectId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
333
|
+
): UseMutationOptions<Awaited<ReturnType<typeof deleteProject>>, TError,{projectId: string}, TContext> => {
|
|
334
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteProject>>, {projectId: string}> = (props) => {
|
|
340
|
+
const {projectId} = props ?? {};
|
|
341
|
+
|
|
342
|
+
return deleteProject(projectId,requestOptions)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
return { mutationFn, ...mutationOptions }}
|
|
349
|
+
|
|
350
|
+
export type DeleteProjectMutationResult = NonNullable<Awaited<ReturnType<typeof deleteProject>>>
|
|
351
|
+
|
|
352
|
+
export type DeleteProjectMutationError = ErrorType<void | DmError>
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @summary Delete a Project
|
|
356
|
+
*/
|
|
357
|
+
export const useDeleteProject = <TError = ErrorType<void | DmError>,
|
|
358
|
+
|
|
359
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteProject>>, TError,{projectId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
374
360
|
) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export const getDeleteProjectMutationOptions = <
|
|
382
|
-
TError = ErrorType<void | DmError>,
|
|
383
|
-
TContext = unknown
|
|
384
|
-
>(options?: {
|
|
385
|
-
mutation?: UseMutationOptions<
|
|
386
|
-
Awaited<ReturnType<typeof deleteProject>>,
|
|
387
|
-
TError,
|
|
388
|
-
{ projectId: string },
|
|
389
|
-
TContext
|
|
390
|
-
>;
|
|
391
|
-
request?: SecondParameter<typeof customInstance>;
|
|
392
|
-
}): UseMutationOptions<
|
|
393
|
-
Awaited<ReturnType<typeof deleteProject>>,
|
|
394
|
-
TError,
|
|
395
|
-
{ projectId: string },
|
|
396
|
-
TContext
|
|
397
|
-
> => {
|
|
398
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
399
|
-
|
|
400
|
-
const mutationFn: MutationFunction<
|
|
401
|
-
Awaited<ReturnType<typeof deleteProject>>,
|
|
402
|
-
{ projectId: string }
|
|
403
|
-
> = (props) => {
|
|
404
|
-
const { projectId } = props ?? {};
|
|
405
|
-
|
|
406
|
-
return deleteProject(projectId, requestOptions);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
return { mutationFn, ...mutationOptions };
|
|
410
|
-
};
|
|
411
|
-
|
|
412
|
-
export type DeleteProjectMutationResult = NonNullable<
|
|
413
|
-
Awaited<ReturnType<typeof deleteProject>>
|
|
414
|
-
>;
|
|
415
|
-
|
|
416
|
-
export type DeleteProjectMutationError = ErrorType<void | DmError>;
|
|
417
|
-
|
|
418
|
-
export const useDeleteProject = <
|
|
419
|
-
TError = ErrorType<void | DmError>,
|
|
420
|
-
TContext = unknown
|
|
421
|
-
>(options?: {
|
|
422
|
-
mutation?: UseMutationOptions<
|
|
423
|
-
Awaited<ReturnType<typeof deleteProject>>,
|
|
424
|
-
TError,
|
|
425
|
-
{ projectId: string },
|
|
426
|
-
TContext
|
|
427
|
-
>;
|
|
428
|
-
request?: SecondParameter<typeof customInstance>;
|
|
429
|
-
}) => {
|
|
430
|
-
const mutationOptions = getDeleteProjectMutationOptions(options);
|
|
431
|
-
|
|
432
|
-
return useMutation(mutationOptions);
|
|
433
|
-
};
|
|
434
|
-
/**
|
|
361
|
+
|
|
362
|
+
const mutationOptions = getDeleteProjectMutationOptions(options);
|
|
363
|
+
|
|
364
|
+
return useMutation(mutationOptions);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
435
367
|
* Adds a user to a Project as an `editor`. Editors can add and remove datasets in a project and delete the project.
|
|
436
368
|
|
|
437
369
|
An `editor` of a project is not automatically an `editor` of any datasets the project contains.
|
|
@@ -441,70 +373,56 @@ You must be an `editor` or the `owner` of the project
|
|
|
441
373
|
* @summary Add a Project Editor
|
|
442
374
|
*/
|
|
443
375
|
export const addEditorToProject = (
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
376
|
+
projectId: string,
|
|
377
|
+
userId: string,
|
|
378
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
return customInstance<void>(
|
|
382
|
+
{url: `/project/${projectId}/editor/${userId}`, method: 'put'
|
|
383
|
+
},
|
|
384
|
+
options);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
export const getAddEditorToProjectMutationOptions = <TError = ErrorType<DmError>,
|
|
390
|
+
|
|
391
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addEditorToProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
392
|
+
): UseMutationOptions<Awaited<ReturnType<typeof addEditorToProject>>, TError,{projectId: string;userId: string}, TContext> => {
|
|
393
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof addEditorToProject>>, {projectId: string;userId: string}> = (props) => {
|
|
399
|
+
const {projectId,userId} = props ?? {};
|
|
400
|
+
|
|
401
|
+
return addEditorToProject(projectId,userId,requestOptions)
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
return { mutationFn, ...mutationOptions }}
|
|
408
|
+
|
|
409
|
+
export type AddEditorToProjectMutationResult = NonNullable<Awaited<ReturnType<typeof addEditorToProject>>>
|
|
410
|
+
|
|
411
|
+
export type AddEditorToProjectMutationError = ErrorType<DmError>
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* @summary Add a Project Editor
|
|
415
|
+
*/
|
|
416
|
+
export const useAddEditorToProject = <TError = ErrorType<DmError>,
|
|
417
|
+
|
|
418
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addEditorToProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
447
419
|
) => {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
export const getAddEditorToProjectMutationOptions = <
|
|
455
|
-
TError = ErrorType<DmError>,
|
|
456
|
-
TContext = unknown
|
|
457
|
-
>(options?: {
|
|
458
|
-
mutation?: UseMutationOptions<
|
|
459
|
-
Awaited<ReturnType<typeof addEditorToProject>>,
|
|
460
|
-
TError,
|
|
461
|
-
{ projectId: string; userId: string },
|
|
462
|
-
TContext
|
|
463
|
-
>;
|
|
464
|
-
request?: SecondParameter<typeof customInstance>;
|
|
465
|
-
}): UseMutationOptions<
|
|
466
|
-
Awaited<ReturnType<typeof addEditorToProject>>,
|
|
467
|
-
TError,
|
|
468
|
-
{ projectId: string; userId: string },
|
|
469
|
-
TContext
|
|
470
|
-
> => {
|
|
471
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
472
|
-
|
|
473
|
-
const mutationFn: MutationFunction<
|
|
474
|
-
Awaited<ReturnType<typeof addEditorToProject>>,
|
|
475
|
-
{ projectId: string; userId: string }
|
|
476
|
-
> = (props) => {
|
|
477
|
-
const { projectId, userId } = props ?? {};
|
|
478
|
-
|
|
479
|
-
return addEditorToProject(projectId, userId, requestOptions);
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
return { mutationFn, ...mutationOptions };
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
export type AddEditorToProjectMutationResult = NonNullable<
|
|
486
|
-
Awaited<ReturnType<typeof addEditorToProject>>
|
|
487
|
-
>;
|
|
488
|
-
|
|
489
|
-
export type AddEditorToProjectMutationError = ErrorType<DmError>;
|
|
490
|
-
|
|
491
|
-
export const useAddEditorToProject = <
|
|
492
|
-
TError = ErrorType<DmError>,
|
|
493
|
-
TContext = unknown
|
|
494
|
-
>(options?: {
|
|
495
|
-
mutation?: UseMutationOptions<
|
|
496
|
-
Awaited<ReturnType<typeof addEditorToProject>>,
|
|
497
|
-
TError,
|
|
498
|
-
{ projectId: string; userId: string },
|
|
499
|
-
TContext
|
|
500
|
-
>;
|
|
501
|
-
request?: SecondParameter<typeof customInstance>;
|
|
502
|
-
}) => {
|
|
503
|
-
const mutationOptions = getAddEditorToProjectMutationOptions(options);
|
|
504
|
-
|
|
505
|
-
return useMutation(mutationOptions);
|
|
506
|
-
};
|
|
507
|
-
/**
|
|
420
|
+
|
|
421
|
+
const mutationOptions = getAddEditorToProjectMutationOptions(options);
|
|
422
|
+
|
|
423
|
+
return useMutation(mutationOptions);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
508
426
|
* Deletes a project `editor`. The editor can be you.
|
|
509
427
|
|
|
510
428
|
A project must always have one `editor` so you will not be able to delete the last editor of a project.
|
|
@@ -514,70 +432,56 @@ You must be an `editor` or the `owner` of the project
|
|
|
514
432
|
* @summary Delete a Project Editor
|
|
515
433
|
*/
|
|
516
434
|
export const removeEditorFromProject = (
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
435
|
+
projectId: string,
|
|
436
|
+
userId: string,
|
|
437
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
return customInstance<void>(
|
|
441
|
+
{url: `/project/${projectId}/editor/${userId}`, method: 'delete'
|
|
442
|
+
},
|
|
443
|
+
options);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
export const getRemoveEditorFromProjectMutationOptions = <TError = ErrorType<DmError>,
|
|
449
|
+
|
|
450
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeEditorFromProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
451
|
+
): UseMutationOptions<Awaited<ReturnType<typeof removeEditorFromProject>>, TError,{projectId: string;userId: string}, TContext> => {
|
|
452
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof removeEditorFromProject>>, {projectId: string;userId: string}> = (props) => {
|
|
458
|
+
const {projectId,userId} = props ?? {};
|
|
459
|
+
|
|
460
|
+
return removeEditorFromProject(projectId,userId,requestOptions)
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
return { mutationFn, ...mutationOptions }}
|
|
467
|
+
|
|
468
|
+
export type RemoveEditorFromProjectMutationResult = NonNullable<Awaited<ReturnType<typeof removeEditorFromProject>>>
|
|
469
|
+
|
|
470
|
+
export type RemoveEditorFromProjectMutationError = ErrorType<DmError>
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* @summary Delete a Project Editor
|
|
474
|
+
*/
|
|
475
|
+
export const useRemoveEditorFromProject = <TError = ErrorType<DmError>,
|
|
476
|
+
|
|
477
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeEditorFromProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
520
478
|
) => {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
export const getRemoveEditorFromProjectMutationOptions = <
|
|
528
|
-
TError = ErrorType<DmError>,
|
|
529
|
-
TContext = unknown
|
|
530
|
-
>(options?: {
|
|
531
|
-
mutation?: UseMutationOptions<
|
|
532
|
-
Awaited<ReturnType<typeof removeEditorFromProject>>,
|
|
533
|
-
TError,
|
|
534
|
-
{ projectId: string; userId: string },
|
|
535
|
-
TContext
|
|
536
|
-
>;
|
|
537
|
-
request?: SecondParameter<typeof customInstance>;
|
|
538
|
-
}): UseMutationOptions<
|
|
539
|
-
Awaited<ReturnType<typeof removeEditorFromProject>>,
|
|
540
|
-
TError,
|
|
541
|
-
{ projectId: string; userId: string },
|
|
542
|
-
TContext
|
|
543
|
-
> => {
|
|
544
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
545
|
-
|
|
546
|
-
const mutationFn: MutationFunction<
|
|
547
|
-
Awaited<ReturnType<typeof removeEditorFromProject>>,
|
|
548
|
-
{ projectId: string; userId: string }
|
|
549
|
-
> = (props) => {
|
|
550
|
-
const { projectId, userId } = props ?? {};
|
|
551
|
-
|
|
552
|
-
return removeEditorFromProject(projectId, userId, requestOptions);
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
return { mutationFn, ...mutationOptions };
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
export type RemoveEditorFromProjectMutationResult = NonNullable<
|
|
559
|
-
Awaited<ReturnType<typeof removeEditorFromProject>>
|
|
560
|
-
>;
|
|
561
|
-
|
|
562
|
-
export type RemoveEditorFromProjectMutationError = ErrorType<DmError>;
|
|
563
|
-
|
|
564
|
-
export const useRemoveEditorFromProject = <
|
|
565
|
-
TError = ErrorType<DmError>,
|
|
566
|
-
TContext = unknown
|
|
567
|
-
>(options?: {
|
|
568
|
-
mutation?: UseMutationOptions<
|
|
569
|
-
Awaited<ReturnType<typeof removeEditorFromProject>>,
|
|
570
|
-
TError,
|
|
571
|
-
{ projectId: string; userId: string },
|
|
572
|
-
TContext
|
|
573
|
-
>;
|
|
574
|
-
request?: SecondParameter<typeof customInstance>;
|
|
575
|
-
}) => {
|
|
576
|
-
const mutationOptions = getRemoveEditorFromProjectMutationOptions(options);
|
|
577
|
-
|
|
578
|
-
return useMutation(mutationOptions);
|
|
579
|
-
};
|
|
580
|
-
/**
|
|
479
|
+
|
|
480
|
+
const mutationOptions = getRemoveEditorFromProjectMutationOptions(options);
|
|
481
|
+
|
|
482
|
+
return useMutation(mutationOptions);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
581
485
|
* Adds a user to a project as an `observer`. Observers can view Projects and download files but they cannot modify Project data or run **Applications** or **Jobs**.
|
|
582
486
|
|
|
583
487
|
You must be an `editor` or the `owner` of the Project to add Observers
|
|
@@ -585,70 +489,56 @@ You must be an `editor` or the `owner` of the Project to add Observers
|
|
|
585
489
|
* @summary Add a Project Observer
|
|
586
490
|
*/
|
|
587
491
|
export const addObserverToProject = (
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
492
|
+
projectId: string,
|
|
493
|
+
userId: string,
|
|
494
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
return customInstance<void>(
|
|
498
|
+
{url: `/project/${projectId}/observer/${userId}`, method: 'put'
|
|
499
|
+
},
|
|
500
|
+
options);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
export const getAddObserverToProjectMutationOptions = <TError = ErrorType<DmError>,
|
|
506
|
+
|
|
507
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addObserverToProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
508
|
+
): UseMutationOptions<Awaited<ReturnType<typeof addObserverToProject>>, TError,{projectId: string;userId: string}, TContext> => {
|
|
509
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof addObserverToProject>>, {projectId: string;userId: string}> = (props) => {
|
|
515
|
+
const {projectId,userId} = props ?? {};
|
|
516
|
+
|
|
517
|
+
return addObserverToProject(projectId,userId,requestOptions)
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
return { mutationFn, ...mutationOptions }}
|
|
524
|
+
|
|
525
|
+
export type AddObserverToProjectMutationResult = NonNullable<Awaited<ReturnType<typeof addObserverToProject>>>
|
|
526
|
+
|
|
527
|
+
export type AddObserverToProjectMutationError = ErrorType<DmError>
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* @summary Add a Project Observer
|
|
531
|
+
*/
|
|
532
|
+
export const useAddObserverToProject = <TError = ErrorType<DmError>,
|
|
533
|
+
|
|
534
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addObserverToProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
591
535
|
) => {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
export const getAddObserverToProjectMutationOptions = <
|
|
599
|
-
TError = ErrorType<DmError>,
|
|
600
|
-
TContext = unknown
|
|
601
|
-
>(options?: {
|
|
602
|
-
mutation?: UseMutationOptions<
|
|
603
|
-
Awaited<ReturnType<typeof addObserverToProject>>,
|
|
604
|
-
TError,
|
|
605
|
-
{ projectId: string; userId: string },
|
|
606
|
-
TContext
|
|
607
|
-
>;
|
|
608
|
-
request?: SecondParameter<typeof customInstance>;
|
|
609
|
-
}): UseMutationOptions<
|
|
610
|
-
Awaited<ReturnType<typeof addObserverToProject>>,
|
|
611
|
-
TError,
|
|
612
|
-
{ projectId: string; userId: string },
|
|
613
|
-
TContext
|
|
614
|
-
> => {
|
|
615
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
616
|
-
|
|
617
|
-
const mutationFn: MutationFunction<
|
|
618
|
-
Awaited<ReturnType<typeof addObserverToProject>>,
|
|
619
|
-
{ projectId: string; userId: string }
|
|
620
|
-
> = (props) => {
|
|
621
|
-
const { projectId, userId } = props ?? {};
|
|
622
|
-
|
|
623
|
-
return addObserverToProject(projectId, userId, requestOptions);
|
|
624
|
-
};
|
|
625
|
-
|
|
626
|
-
return { mutationFn, ...mutationOptions };
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
export type AddObserverToProjectMutationResult = NonNullable<
|
|
630
|
-
Awaited<ReturnType<typeof addObserverToProject>>
|
|
631
|
-
>;
|
|
632
|
-
|
|
633
|
-
export type AddObserverToProjectMutationError = ErrorType<DmError>;
|
|
634
|
-
|
|
635
|
-
export const useAddObserverToProject = <
|
|
636
|
-
TError = ErrorType<DmError>,
|
|
637
|
-
TContext = unknown
|
|
638
|
-
>(options?: {
|
|
639
|
-
mutation?: UseMutationOptions<
|
|
640
|
-
Awaited<ReturnType<typeof addObserverToProject>>,
|
|
641
|
-
TError,
|
|
642
|
-
{ projectId: string; userId: string },
|
|
643
|
-
TContext
|
|
644
|
-
>;
|
|
645
|
-
request?: SecondParameter<typeof customInstance>;
|
|
646
|
-
}) => {
|
|
647
|
-
const mutationOptions = getAddObserverToProjectMutationOptions(options);
|
|
648
|
-
|
|
649
|
-
return useMutation(mutationOptions);
|
|
650
|
-
};
|
|
651
|
-
/**
|
|
536
|
+
|
|
537
|
+
const mutationOptions = getAddObserverToProjectMutationOptions(options);
|
|
538
|
+
|
|
539
|
+
return useMutation(mutationOptions);
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
652
542
|
* Deletes a project `observer`.
|
|
653
543
|
|
|
654
544
|
You must be an `editor` or the `owner` of the Project to remove Observers
|
|
@@ -656,70 +546,56 @@ You must be an `editor` or the `owner` of the Project to remove Observers
|
|
|
656
546
|
* @summary Delete a Project Observer
|
|
657
547
|
*/
|
|
658
548
|
export const removeObserverFromProject = (
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
549
|
+
projectId: string,
|
|
550
|
+
userId: string,
|
|
551
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
return customInstance<void>(
|
|
555
|
+
{url: `/project/${projectId}/observer/${userId}`, method: 'delete'
|
|
556
|
+
},
|
|
557
|
+
options);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
export const getRemoveObserverFromProjectMutationOptions = <TError = ErrorType<DmError>,
|
|
563
|
+
|
|
564
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeObserverFromProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
565
|
+
): UseMutationOptions<Awaited<ReturnType<typeof removeObserverFromProject>>, TError,{projectId: string;userId: string}, TContext> => {
|
|
566
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof removeObserverFromProject>>, {projectId: string;userId: string}> = (props) => {
|
|
572
|
+
const {projectId,userId} = props ?? {};
|
|
573
|
+
|
|
574
|
+
return removeObserverFromProject(projectId,userId,requestOptions)
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
return { mutationFn, ...mutationOptions }}
|
|
581
|
+
|
|
582
|
+
export type RemoveObserverFromProjectMutationResult = NonNullable<Awaited<ReturnType<typeof removeObserverFromProject>>>
|
|
583
|
+
|
|
584
|
+
export type RemoveObserverFromProjectMutationError = ErrorType<DmError>
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* @summary Delete a Project Observer
|
|
588
|
+
*/
|
|
589
|
+
export const useRemoveObserverFromProject = <TError = ErrorType<DmError>,
|
|
590
|
+
|
|
591
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof removeObserverFromProject>>, TError,{projectId: string;userId: string}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
662
592
|
) => {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
export const getRemoveObserverFromProjectMutationOptions = <
|
|
670
|
-
TError = ErrorType<DmError>,
|
|
671
|
-
TContext = unknown
|
|
672
|
-
>(options?: {
|
|
673
|
-
mutation?: UseMutationOptions<
|
|
674
|
-
Awaited<ReturnType<typeof removeObserverFromProject>>,
|
|
675
|
-
TError,
|
|
676
|
-
{ projectId: string; userId: string },
|
|
677
|
-
TContext
|
|
678
|
-
>;
|
|
679
|
-
request?: SecondParameter<typeof customInstance>;
|
|
680
|
-
}): UseMutationOptions<
|
|
681
|
-
Awaited<ReturnType<typeof removeObserverFromProject>>,
|
|
682
|
-
TError,
|
|
683
|
-
{ projectId: string; userId: string },
|
|
684
|
-
TContext
|
|
685
|
-
> => {
|
|
686
|
-
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
687
|
-
|
|
688
|
-
const mutationFn: MutationFunction<
|
|
689
|
-
Awaited<ReturnType<typeof removeObserverFromProject>>,
|
|
690
|
-
{ projectId: string; userId: string }
|
|
691
|
-
> = (props) => {
|
|
692
|
-
const { projectId, userId } = props ?? {};
|
|
693
|
-
|
|
694
|
-
return removeObserverFromProject(projectId, userId, requestOptions);
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
return { mutationFn, ...mutationOptions };
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
export type RemoveObserverFromProjectMutationResult = NonNullable<
|
|
701
|
-
Awaited<ReturnType<typeof removeObserverFromProject>>
|
|
702
|
-
>;
|
|
703
|
-
|
|
704
|
-
export type RemoveObserverFromProjectMutationError = ErrorType<DmError>;
|
|
705
|
-
|
|
706
|
-
export const useRemoveObserverFromProject = <
|
|
707
|
-
TError = ErrorType<DmError>,
|
|
708
|
-
TContext = unknown
|
|
709
|
-
>(options?: {
|
|
710
|
-
mutation?: UseMutationOptions<
|
|
711
|
-
Awaited<ReturnType<typeof removeObserverFromProject>>,
|
|
712
|
-
TError,
|
|
713
|
-
{ projectId: string; userId: string },
|
|
714
|
-
TContext
|
|
715
|
-
>;
|
|
716
|
-
request?: SecondParameter<typeof customInstance>;
|
|
717
|
-
}) => {
|
|
718
|
-
const mutationOptions = getRemoveObserverFromProjectMutationOptions(options);
|
|
719
|
-
|
|
720
|
-
return useMutation(mutationOptions);
|
|
721
|
-
};
|
|
722
|
-
/**
|
|
593
|
+
|
|
594
|
+
const mutationOptions = getRemoveObserverFromProjectMutationOptions(options);
|
|
595
|
+
|
|
596
|
+
return useMutation(mutationOptions);
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
723
599
|
* Gets a file from the project, with an optional path. This method should be used to get arbitrary files from the Project's file system (typically **unmanaged** files).
|
|
724
600
|
|
|
725
601
|
For **managed** files you should consider using the `/file/{file_id}` endpoint.
|
|
@@ -729,87 +605,68 @@ You must be an `editor` or the `owner` of the Project if the Project is `private
|
|
|
729
605
|
* @summary Download a Project file
|
|
730
606
|
*/
|
|
731
607
|
export const getProjectFile = (
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
608
|
+
projectId: string,
|
|
609
|
+
params: GetProjectFileParams,
|
|
610
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
611
|
+
) => {
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
return customInstance<void>(
|
|
615
|
+
{url: `/project/${projectId}/file`, method: 'get',
|
|
616
|
+
params, signal
|
|
617
|
+
},
|
|
618
|
+
options);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
export const getGetProjectFileQueryKey = (projectId: string,
|
|
623
|
+
params: GetProjectFileParams,) => {
|
|
624
|
+
|
|
625
|
+
return ["data-manager-api", `/project/${projectId}/file`, ...(params ? [params]: [])] as const;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
export const getGetProjectFileQueryOptions = <TData = Awaited<ReturnType<typeof getProjectFile>>, TError = ErrorType<DmError>>(projectId: string,
|
|
630
|
+
params: GetProjectFileParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProjectFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
736
631
|
) => {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
);
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
queryOptions?.queryKey ?? getGetProjectFileQueryKey(projectId, params);
|
|
771
|
-
|
|
772
|
-
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProjectFile>>> = ({
|
|
773
|
-
signal,
|
|
774
|
-
}) => getProjectFile(projectId, params, requestOptions, signal);
|
|
775
|
-
|
|
776
|
-
return { queryKey, queryFn, enabled: !!projectId, ...queryOptions };
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
export type GetProjectFileQueryResult = NonNullable<
|
|
780
|
-
Awaited<ReturnType<typeof getProjectFile>>
|
|
781
|
-
>;
|
|
782
|
-
export type GetProjectFileQueryError = ErrorType<DmError>;
|
|
783
|
-
|
|
784
|
-
export const useGetProjectFile = <
|
|
785
|
-
TData = Awaited<ReturnType<typeof getProjectFile>>,
|
|
786
|
-
TError = ErrorType<DmError>
|
|
787
|
-
>(
|
|
788
|
-
projectId: string,
|
|
789
|
-
params: GetProjectFileParams,
|
|
790
|
-
options?: {
|
|
791
|
-
query?: UseQueryOptions<
|
|
792
|
-
Awaited<ReturnType<typeof getProjectFile>>,
|
|
793
|
-
TError,
|
|
794
|
-
TData
|
|
795
|
-
>;
|
|
796
|
-
request?: SecondParameter<typeof customInstance>;
|
|
797
|
-
}
|
|
798
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
799
|
-
const queryOptions = getGetProjectFileQueryOptions(
|
|
800
|
-
projectId,
|
|
801
|
-
params,
|
|
802
|
-
options
|
|
803
|
-
);
|
|
804
|
-
|
|
805
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
806
|
-
queryKey: QueryKey;
|
|
807
|
-
};
|
|
808
|
-
|
|
809
|
-
query.queryKey = queryOptions.queryKey;
|
|
632
|
+
|
|
633
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
634
|
+
|
|
635
|
+
const queryKey = queryOptions?.queryKey ?? getGetProjectFileQueryKey(projectId,params);
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProjectFile>>> = ({ signal }) => getProjectFile(projectId,params, requestOptions, signal);
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
return { queryKey, queryFn, enabled: !!(projectId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProjectFile>>, TError, TData> & { queryKey: QueryKey }
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
export type GetProjectFileQueryResult = NonNullable<Awaited<ReturnType<typeof getProjectFile>>>
|
|
649
|
+
export type GetProjectFileQueryError = ErrorType<DmError>
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* @summary Download a Project file
|
|
653
|
+
*/
|
|
654
|
+
export const useGetProjectFile = <TData = Awaited<ReturnType<typeof getProjectFile>>, TError = ErrorType<DmError>>(
|
|
655
|
+
projectId: string,
|
|
656
|
+
params: GetProjectFileParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProjectFile>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
657
|
+
|
|
658
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
659
|
+
|
|
660
|
+
const queryOptions = getGetProjectFileQueryOptions(projectId,params,options)
|
|
661
|
+
|
|
662
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
663
|
+
|
|
664
|
+
query.queryKey = queryOptions.queryKey ;
|
|
810
665
|
|
|
811
666
|
return query;
|
|
812
|
-
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
|
|
813
670
|
|
|
814
671
|
/**
|
|
815
672
|
* The user provides an external file for upload to the Project using an optional Path. The path is created if it does not exist.
|
|
@@ -819,84 +676,66 @@ You must be an `editor` or the `owner` of the project
|
|
|
819
676
|
* @summary Upload a file into a Project
|
|
820
677
|
*/
|
|
821
678
|
export const addFileToProject = (
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
840
|
-
data: formData,
|
|
679
|
+
projectId: string,
|
|
680
|
+
projectFilePutBodyBody: ProjectFilePutBodyBody,
|
|
681
|
+
options?: SecondParameter<typeof customInstance>,) => {
|
|
682
|
+
|
|
683
|
+
const formData = new FormData();
|
|
684
|
+
formData.append('file', projectFilePutBodyBody.file)
|
|
685
|
+
if(projectFilePutBodyBody.as_filename !== undefined) {
|
|
686
|
+
formData.append('as_filename', projectFilePutBodyBody.as_filename)
|
|
687
|
+
}
|
|
688
|
+
if(projectFilePutBodyBody.path !== undefined) {
|
|
689
|
+
formData.append('path', projectFilePutBodyBody.path)
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
return customInstance<void>(
|
|
693
|
+
{url: `/project/${projectId}/file`, method: 'put',
|
|
694
|
+
headers: {'Content-Type': 'multipart/form-data', },
|
|
695
|
+
data: formData
|
|
841
696
|
},
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
>(options?: {
|
|
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
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
TError = ErrorType<DmError>,
|
|
885
|
-
TContext = unknown
|
|
886
|
-
>(options?: {
|
|
887
|
-
mutation?: UseMutationOptions<
|
|
888
|
-
Awaited<ReturnType<typeof addFileToProject>>,
|
|
889
|
-
TError,
|
|
890
|
-
{ projectId: string; data: ProjectFilePutBodyBody },
|
|
891
|
-
TContext
|
|
892
|
-
>;
|
|
893
|
-
request?: SecondParameter<typeof customInstance>;
|
|
894
|
-
}) => {
|
|
895
|
-
const mutationOptions = getAddFileToProjectMutationOptions(options);
|
|
896
|
-
|
|
897
|
-
return useMutation(mutationOptions);
|
|
898
|
-
};
|
|
899
|
-
/**
|
|
697
|
+
options);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
export const getAddFileToProjectMutationOptions = <TError = ErrorType<DmError>,
|
|
703
|
+
|
|
704
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addFileToProject>>, TError,{projectId: string;data: ProjectFilePutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
705
|
+
): UseMutationOptions<Awaited<ReturnType<typeof addFileToProject>>, TError,{projectId: string;data: ProjectFilePutBodyBody}, TContext> => {
|
|
706
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?? {};
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof addFileToProject>>, {projectId: string;data: ProjectFilePutBodyBody}> = (props) => {
|
|
712
|
+
const {projectId,data} = props ?? {};
|
|
713
|
+
|
|
714
|
+
return addFileToProject(projectId,data,requestOptions)
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
return { mutationFn, ...mutationOptions }}
|
|
721
|
+
|
|
722
|
+
export type AddFileToProjectMutationResult = NonNullable<Awaited<ReturnType<typeof addFileToProject>>>
|
|
723
|
+
export type AddFileToProjectMutationBody = ProjectFilePutBodyBody
|
|
724
|
+
export type AddFileToProjectMutationError = ErrorType<DmError>
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* @summary Upload a file into a Project
|
|
728
|
+
*/
|
|
729
|
+
export const useAddFileToProject = <TError = ErrorType<DmError>,
|
|
730
|
+
|
|
731
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof addFileToProject>>, TError,{projectId: string;data: ProjectFilePutBodyBody}, TContext>, request?: SecondParameter<typeof customInstance>}
|
|
732
|
+
) => {
|
|
733
|
+
|
|
734
|
+
const mutationOptions = getAddFileToProjectMutationOptions(options);
|
|
735
|
+
|
|
736
|
+
return useMutation(mutationOptions);
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
900
739
|
* Gets a file from the project, with an optional path. This method should be used to get arbitrary files from the Project's file system (typically **unmanaged** files).
|
|
901
740
|
|
|
902
741
|
For **managed** files you should consider using the `/file/{file_id}` endpoint.
|
|
@@ -906,96 +745,66 @@ As there is no authentication for this endpoint you must provide a valid token.
|
|
|
906
745
|
* @summary Download a Project file using a Token
|
|
907
746
|
*/
|
|
908
747
|
export const getProjectFileWithToken = (
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
signal?: AbortSignal
|
|
748
|
+
projectId: string,
|
|
749
|
+
params: GetProjectFileWithTokenParams,
|
|
750
|
+
options?: SecondParameter<typeof customInstance>,signal?: AbortSignal
|
|
913
751
|
) => {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
method:
|
|
918
|
-
|
|
919
|
-
signal,
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
return customInstance<void>(
|
|
755
|
+
{url: `/project/${projectId}/file-with-token`, method: 'get',
|
|
756
|
+
params, signal
|
|
920
757
|
},
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
export const getGetProjectFileWithTokenQueryKey = (
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
)
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
export type GetProjectFileWithTokenQueryResult = NonNullable<
|
|
969
|
-
Awaited<ReturnType<typeof getProjectFileWithToken>>
|
|
970
|
-
>;
|
|
971
|
-
export type GetProjectFileWithTokenQueryError = ErrorType<DmError>;
|
|
972
|
-
|
|
973
|
-
export const useGetProjectFileWithToken = <
|
|
974
|
-
TData = Awaited<ReturnType<typeof getProjectFileWithToken>>,
|
|
975
|
-
TError = ErrorType<DmError>
|
|
976
|
-
>(
|
|
977
|
-
projectId: string,
|
|
978
|
-
params: GetProjectFileWithTokenParams,
|
|
979
|
-
options?: {
|
|
980
|
-
query?: UseQueryOptions<
|
|
981
|
-
Awaited<ReturnType<typeof getProjectFileWithToken>>,
|
|
982
|
-
TError,
|
|
983
|
-
TData
|
|
984
|
-
>;
|
|
985
|
-
request?: SecondParameter<typeof customInstance>;
|
|
986
|
-
}
|
|
987
|
-
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
988
|
-
const queryOptions = getGetProjectFileWithTokenQueryOptions(
|
|
989
|
-
projectId,
|
|
990
|
-
params,
|
|
991
|
-
options
|
|
992
|
-
);
|
|
993
|
-
|
|
994
|
-
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
|
995
|
-
queryKey: QueryKey;
|
|
996
|
-
};
|
|
997
|
-
|
|
998
|
-
query.queryKey = queryOptions.queryKey;
|
|
758
|
+
options);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
export const getGetProjectFileWithTokenQueryKey = (projectId: string,
|
|
763
|
+
params: GetProjectFileWithTokenParams,) => {
|
|
764
|
+
|
|
765
|
+
return ["data-manager-api", `/project/${projectId}/file-with-token`, ...(params ? [params]: [])] as const;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
export const getGetProjectFileWithTokenQueryOptions = <TData = Awaited<ReturnType<typeof getProjectFileWithToken>>, TError = ErrorType<DmError>>(projectId: string,
|
|
770
|
+
params: GetProjectFileWithTokenParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProjectFileWithToken>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
771
|
+
) => {
|
|
772
|
+
|
|
773
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
774
|
+
|
|
775
|
+
const queryKey = queryOptions?.queryKey ?? getGetProjectFileWithTokenQueryKey(projectId,params);
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getProjectFileWithToken>>> = ({ signal }) => getProjectFileWithToken(projectId,params, requestOptions, signal);
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
return { queryKey, queryFn, enabled: !!(projectId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getProjectFileWithToken>>, TError, TData> & { queryKey: QueryKey }
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
export type GetProjectFileWithTokenQueryResult = NonNullable<Awaited<ReturnType<typeof getProjectFileWithToken>>>
|
|
789
|
+
export type GetProjectFileWithTokenQueryError = ErrorType<DmError>
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* @summary Download a Project file using a Token
|
|
793
|
+
*/
|
|
794
|
+
export const useGetProjectFileWithToken = <TData = Awaited<ReturnType<typeof getProjectFileWithToken>>, TError = ErrorType<DmError>>(
|
|
795
|
+
projectId: string,
|
|
796
|
+
params: GetProjectFileWithTokenParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getProjectFileWithToken>>, TError, TData>, request?: SecondParameter<typeof customInstance>}
|
|
797
|
+
|
|
798
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
|
|
799
|
+
|
|
800
|
+
const queryOptions = getGetProjectFileWithTokenQueryOptions(projectId,params,options)
|
|
801
|
+
|
|
802
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
803
|
+
|
|
804
|
+
query.queryKey = queryOptions.queryKey ;
|
|
999
805
|
|
|
1000
806
|
return query;
|
|
1001
|
-
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|