@veritree/services 2.13.3 → 2.14.1

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.
package/index.js CHANGED
@@ -26,6 +26,7 @@ import { FieldReports } from './src/endpoints/field-reports';
26
26
  import { ExternalReports } from './src/endpoints/external-reports';
27
27
  import { Evidence } from './src/endpoints/evidence';
28
28
  import { Crumbs } from './src/endpoints/crumbs';
29
+ import { Verifications } from './src/endpoints/verifications';
29
30
 
30
31
  export {
31
32
  BulkUploads,
@@ -55,5 +56,6 @@ export {
55
56
  FieldReports,
56
57
  ExternalReports,
57
58
  Evidence,
58
- Crumbs
59
+ Crumbs,
60
+ Verifications
59
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.13.3",
3
+ "version": "2.14.1",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -17,15 +17,15 @@ class FieldReportsApi extends Api {
17
17
  return await this.post(url, formData);
18
18
  };
19
19
 
20
- const detachImage = async (evidenceId) => {
21
- const url = `${this.getUrl()}/${fieldReportId}/evidence/images/${evidenceId}${this.getUrlParams()}`;
20
+ const detach = async (evidenceId, fileType = 'images') => {
21
+ const url = `${this.getUrl()}/${fieldReportId}/evidence/${fileType}/${evidenceId}${this.getUrlParams()}`;
22
22
  return await this.post(url, null, "delete");
23
23
  };
24
24
 
25
25
  return {
26
26
  all,
27
27
  attach,
28
- detachImage
28
+ detach
29
29
  }
30
30
  }
31
31
  }
@@ -1,4 +1,5 @@
1
1
  import Api from '../helpers/api';
2
+ import { createParamsStringFromArgs } from '../utils/args';
2
3
 
3
4
  class StandardsApi extends Api {
4
5
  constructor(resource) {
@@ -7,8 +8,8 @@ class StandardsApi extends Api {
7
8
  }
8
9
 
9
10
  themes() {
10
- const all = async () => {
11
- const url = `${this.getUrl()}/themes`;
11
+ const all = async (args) => {
12
+ const url = `${this.getUrl()}/themes?${createParamsStringFromArgs(args)}`;
12
13
  return await this.get(url);
13
14
  };
14
15
 
@@ -45,6 +45,18 @@ class SubsitesApi extends Api {
45
45
  const url = `${this.getUrl()}/${subsite}/stats${this.getUrlParams(args)}`;
46
46
  return await this.get(url);
47
47
  };
48
+
49
+ return {
50
+ all,
51
+ };
52
+ }
53
+
54
+ evidence(subsiteId) {
55
+ const all = async () => {
56
+ const url = `${this.getUrl()}/${subsiteId}/evidence${this.getUrlParams(args)}`;
57
+ return await this.get(url);
58
+ };
59
+
48
60
  return {
49
61
  all,
50
62
  };
@@ -0,0 +1,21 @@
1
+ import Api from "../helpers/api";
2
+
3
+ class VerificationsApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = "verifications";
7
+ }
8
+
9
+ verify(verifiableType, verifiableId) {
10
+ const post = async (data) => {
11
+ const url = `${this.baseUrl}/${verifiableType}/${verifiableId}/verify${this.getUrlParams()}`;
12
+ return await this.post(url, data);
13
+ };
14
+
15
+ return {
16
+ post,
17
+ };
18
+ }
19
+ }
20
+
21
+ export const Verifications = new VerificationsApi();