@veritree/services 2.27.1 → 2.28.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.27.1",
3
+ "version": "2.28.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -6,14 +6,41 @@ class EvidenceApi extends Api {
6
6
  this.resource = "evidence";
7
7
  }
8
8
 
9
- async image(imageId, params) {
9
+ image(imageId, params) {
10
+
10
11
  let url = `${this.getUrl()}/image/${imageId}${this.getUrlParams(params)}`
11
- return await this.get(url);
12
+
13
+ const single = async () => {
14
+ return await this.get(url);
15
+ };
16
+
17
+ const remove = async () => {
18
+ return await this.post(url, null, 'delete');
19
+ };
20
+
21
+
22
+ return {
23
+ single,
24
+ delete: remove,
25
+ };
12
26
  }
13
27
 
14
- async attachment(attachementId, params) {
15
- let url = `${this.getUrl()}/attachment/${attachementId}${this.getUrlParams(params)}`
16
- return await this.get(url);
28
+ attachment(attachmentId, params) {
29
+ let url = `${this.getUrl()}/attachment/${attachmentId}${this.getUrlParams(params)}`
30
+
31
+ const single = async () => {
32
+ return await this.get(url);
33
+ };
34
+
35
+ const remove = async () => {
36
+ return await this.post(url, null, 'delete');
37
+ };
38
+
39
+
40
+ return {
41
+ single,
42
+ delete: remove,
43
+ };
17
44
  }
18
45
  }
19
46
 
@@ -1,9 +1,9 @@
1
- import Api from "../helpers/api";
1
+ import Api from '../helpers/api';
2
2
 
3
3
  class OrganizationsApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = "organizations";
6
+ this.resource = 'organizations';
7
7
  }
8
8
 
9
9
  tasks(orgId) {
@@ -41,7 +41,18 @@ class OrganizationsApi extends Api {
41
41
  return {
42
42
  all,
43
43
  create,
44
- }
44
+ };
45
+ }
46
+
47
+ plantingStats(orgId) {
48
+ const all = async (params) => {
49
+ const url = `${this.getUrl()}/${orgId}/field-updates/planting-stats${this.getUrlParams(
50
+ params
51
+ )}`;
52
+ return await this.get(url);
53
+ };
54
+
55
+ return { all };
45
56
  }
46
57
  }
47
58