@vouchfor/sdk 1.1.0 → 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;
@@ -13,6 +13,14 @@ class CampaignService extends BaseRestService {
13
13
  });
14
14
  }
15
15
 
16
+ update(id, update, apiKey) {
17
+ return this._request({
18
+ apiKey,
19
+ body: update,
20
+ path: `${id}`
21
+ });
22
+ }
23
+
16
24
  get(id, apiKey) {
17
25
  return this._request({ apiKey, path: `${id}` });
18
26
  }
@@ -20,6 +28,10 @@ class CampaignService extends BaseRestService {
20
28
  list(apiKey) {
21
29
  return this._request({ apiKey, path: '' });
22
30
  }
31
+
32
+ vouches(id, apiKey) {
33
+ return this._request({ apiKey, path: `${id}/vouches` });
34
+ }
23
35
  }
24
36
 
25
37
  module.exports = CampaignService;
@@ -13,6 +13,14 @@ class VouchService extends BaseRestService {
13
13
  });
14
14
  }
15
15
 
16
+ update(id, update, apiKey) {
17
+ return this._request({
18
+ apiKey,
19
+ body: update,
20
+ path: `${id}`
21
+ });
22
+ }
23
+
16
24
  get(id, apiKey) {
17
25
  return this._request({ apiKey, path: `${id}` });
18
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Vouch API SDK",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
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
+ })