-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathess.js
59 lines (51 loc) · 1.66 KB
/
ess.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* eslint-disable no-console */
const {
markObjectReceived,
getObjectsByType,
downloadObjectFile,
establishObectTypeWebhook,
} = require('../src/external/essRequests');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
process.env.LOG_MODE="none";
const nodeId = '89b5345b4a3d01ed5d053417e96bd9df320e765adb12dd9971485dc5';
const agreementId = '6bec1300d84a95d0acca516f1855dd22fe8ec17bb36a165683ae2777e18baebf';
const objectType = 'model';
const objectId = 'img_reco_poc.zip';
const correlationId = '--correlation--';
getObjectsByType(nodeId, agreementId, objectType, correlationId)
.then((data) => {
console.log('===> getObjectsByType success', data);
return data;
})
.catch((error) => {
console.log('===> getObjectsByType error', error);
throw error;
});
markObjectReceived(nodeId, agreementId, objectType, objectId, correlationId)
.then((data) => {
console.log('===> markObjectConsumed success', data);
return data;
})
.catch((error) => {
console.log('===> markObjectConsumed error', error);
throw error;
});
downloadObjectFile(nodeId, agreementId, objectType, objectId, correlationId)
.then((data) => {
console.log('===> getObjectsByType success', data);
return data;
})
.catch((error) => {
console.log('===> getObjectsByType error', error);
throw error;
});
const receiverUrl = 'http://localhost:3000';
establishObectTypeWebhook(nodeId, agreementId, objectType, receiverUrl, correlationId)
.then((data) => {
console.log('===> establishObjectTypeWebhook success', data);
return data;
})
.catch((error) => {
console.log('===> establishObjectTypeWebhook error', error);
throw error;
});