@edraj/tsdmart 2.6.2 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dmart.service.ts +32 -0
- package/package.json +1 -1
package/dmart.service.ts
CHANGED
|
@@ -196,6 +196,38 @@ export class Dmart {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
public static async resources_from_csv(
|
|
200
|
+
space_name: string,
|
|
201
|
+
subpath: string,
|
|
202
|
+
resourceType: ResourceType,
|
|
203
|
+
schema: string,
|
|
204
|
+
payload: File,
|
|
205
|
+
){
|
|
206
|
+
try {
|
|
207
|
+
let csvUrl = `/managed/resources_from_csv/${resourceType}/${space_name}/${subpath}`;
|
|
208
|
+
|
|
209
|
+
if(schema){
|
|
210
|
+
csvUrl += `/${schema}`;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
let formdata = new FormData();
|
|
214
|
+
formdata.append("resources_file", payload);
|
|
215
|
+
|
|
216
|
+
const headers = {"Content-Type": "multipart/form-data"};
|
|
217
|
+
|
|
218
|
+
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
219
|
+
csvUrl,
|
|
220
|
+
formdata,
|
|
221
|
+
{headers}
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
return data;
|
|
225
|
+
} catch (error) {
|
|
226
|
+
return error;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
199
231
|
public static async space(action: ActionRequest): Promise<ActionResponse> {
|
|
200
232
|
try {
|
|
201
233
|
const { data } = await Dmart.axiosDmartInstance.post<ActionResponse>(
|