@vouchfor/sdk 1.1.1 → 1.1.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.
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const BaseRestService = require('./base');
|
|
2
|
+
const ApplicationStorageService = require('./applicationStorageService');
|
|
2
3
|
|
|
3
4
|
class ApplicationService extends BaseRestService {
|
|
4
5
|
constructor(client, config) {
|
|
5
6
|
super(client, config, 'applications');
|
|
7
|
+
this.storage = new ApplicationStorageService(client, config);
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
create(application, apiKey) {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const BaseRestService = require('./base');
|
|
2
|
+
|
|
3
|
+
function storagePath(id, key) {
|
|
4
|
+
return `${id}/storage/${key}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
class ApplicationStorageService extends BaseRestService {
|
|
8
|
+
constructor(client, config) {
|
|
9
|
+
super(client, config, 'applications');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
set(id, key, data, apiKey) {
|
|
13
|
+
const path = storagePath(id, key);
|
|
14
|
+
return this._request({
|
|
15
|
+
apiKey,
|
|
16
|
+
body: { data },
|
|
17
|
+
path
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get(id, key, apiKey) {
|
|
22
|
+
const path = storagePath(id, key);
|
|
23
|
+
return this._request({ apiKey, path });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
delete(id, key, apiKey) {
|
|
27
|
+
const path = storagePath(id, key);
|
|
28
|
+
return this._request({
|
|
29
|
+
apiKey,
|
|
30
|
+
method: 'POST',
|
|
31
|
+
path: `${path}/delete`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = ApplicationStorageService;
|
package/package.json
CHANGED
package/test.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Vouch = require("./lib/vouch");
|
|
2
|
+
|
|
3
|
+
const APPLICATION_ID = ''
|
|
4
|
+
const vouch = new Vouch({
|
|
5
|
+
env: 'dev',
|
|
6
|
+
apiKey: 'M0VEaIFvWm-l06giRVS4VwvMcWdVuo2ROPFc7rw9QmtprtvTLIkTu26zo94c9',
|
|
7
|
+
integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M'
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
vouch.applications.storage.set(
|
|
12
|
+
'e4KEvpqs33',
|
|
13
|
+
'sdk-test',
|
|
14
|
+
{ test: true },
|
|
15
|
+
).then((result) => {
|
|
16
|
+
console.log(result);
|
|
17
|
+
})
|