-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkgapis.routes.js
47 lines (43 loc) · 1.08 KB
/
pkgapis.routes.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
const pkgapis = require("./pkgapis");
var pkgAPIs = {};
const BASE_URI = "/pkg"
/**
Sends a package of metadata xml, public key (if present) and its attachments for the given iri
Input json object submitted to the API:
{
"data": {
"iri": "/akn/ke/act/legge/2018-07-06/Test_tags_2/eng@/!main"
"noAtt": True (====> Optional flag to get pkg without attachments)
}
}
*/
pkgAPIs[`${BASE_URI}/load`] = {
method: "post",
stack: [
pkgapis.receiveSubmitData,
pkgapis.loadPkgForIri,
pkgapis.unzipDBPkg,
pkgapis.prepareAndSendPkg
]
};
/**
Saves a package of signed metadata xml and public key for iri
Input json object submitted to the API:
{
"data": {
"iri": "/akn/ke/act/legge/2018-07-06/Test_tags_2/eng@/!main",
"file": metadata xml,
"public_key: public key
}
}
*/
pkgAPIs[`${BASE_URI}/upload`] = {
method: "post",
stack: [
pkgapis.receiveFilesSubmitData,
pkgapis.prepToSavePkg,
pkgapis.savePkgForIri,
pkgapis.returnResponse
]
};
module.exports.pkgAPIs = pkgAPIs;