@vouchfor/sdk 1.1.3 → 1.1.4

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.
@@ -5,8 +5,12 @@ class IntegrationService extends BaseIntegrationService {
5
5
  super(client, config, '');
6
6
  }
7
7
 
8
- list() {
9
- return this._request({ apiKey, path: 'applications' });
8
+ get applications() {
9
+ return {
10
+ list: () => {
11
+ return this._request({ path: 'applications' });
12
+ }
13
+ }
10
14
  }
11
15
 
12
16
  authenticate({ applicationId, entityId }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/sdk",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Vouch API SDK",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
package/test.js CHANGED
@@ -1,17 +1,22 @@
1
1
  const Vouch = require("./lib/vouch");
2
2
 
3
- const APPLICATION_ID = ''
4
- const vouch = new Vouch({
3
+ const vouchClient = new Vouch({
5
4
  env: 'dev',
6
- apiKey: 'M0VEaIFvWm-l06giRVS4VwvMcWdVuo2ROPFc7rw9QmtprtvTLIkTu26zo94c9',
7
5
  integrationKey: 'b0883f06-84af-4108-8543-31874c335c36-kkr3Wy4CLY8C2g65UT79sgUfOIR2ZzkA9uQam3bTs4ZNdlSs7M'
8
6
  });
9
7
 
8
+ (async () => {
9
+ const response = await vouchClient.integrations.applications.list();
10
+ const items = await response.applications.reduce(async (ac, application) => {
11
+ const arr = await ac;
12
+ console.log(`id => ${application.id}`);
13
+ try {
14
+ const credentials = await vouchClient.integrations.authenticate({ entityId: application.entity.id });
15
+ arr.push(credentials);
16
+ } catch (err) {
17
+ console.error(`failed to get credentials ${err} - ${application.id}`);
18
+ }
10
19
 
11
- vouch.applications.storage.set(
12
- 'e4KEvpqs33',
13
- 'sdk-test',
14
- { test: true },
15
- ).then((result) => {
16
- console.log(result);
17
- })
20
+ return arr;
21
+ }, Promise.resolve([]));
22
+ })();