@veritree/services 2.26.5 → 2.27.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.26.5",
3
+ "version": "2.27.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,26 +1,26 @@
1
- import Api from "../helpers/api";
1
+ import Api from '../helpers/api';
2
2
 
3
3
  class PlantingSitesApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = "planting-sites";
6
+ this.resource = 'planting-sites';
7
7
  }
8
8
 
9
9
  users(plantingSiteId) {
10
- let url = `${this.getUrl()}/${plantingSiteId}/users`
10
+ let url = `${this.getUrl()}/${plantingSiteId}/users`;
11
11
 
12
12
  const all = async (params) => {
13
- url = `${url}${this.getUrlParams(params)}`
13
+ url = `${url}${this.getUrlParams(params)}`;
14
14
  return await this.get(url);
15
- }
15
+ };
16
16
 
17
- return {
18
- all
19
- }
17
+ return {
18
+ all,
19
+ };
20
20
  }
21
21
 
22
22
  images(subsiteId) {
23
- let url = `${this.getUrl()}/${subsiteId}/media/images`
23
+ let url = `${this.getUrl()}/${subsiteId}/media/images`;
24
24
 
25
25
  const attach = async (data, params) => {
26
26
  url = `${url}${this.getUrlParams(params)}`;
@@ -29,18 +29,20 @@ class PlantingSitesApi extends Api {
29
29
  };
30
30
 
31
31
  const remove = async (imageId, params) => {
32
- url = `${this.getUrl()}/${subsiteId}/media/images/${imageId}${this.getUrlParams(params)}`
33
- return await this.post(url, null, "delete");
32
+ url = `${this.getUrl()}/${subsiteId}/media/images/${imageId}${this.getUrlParams(
33
+ params
34
+ )}`;
35
+ return await this.post(url, null, 'delete');
34
36
  };
35
37
 
36
- return {
37
- attach,
38
+ return {
39
+ attach,
38
40
  delete: remove,
39
- }
41
+ };
40
42
  }
41
43
 
42
44
  attachments(subsiteId) {
43
- let url = `${this.getUrl()}/${subsiteId}/media/attachments`
45
+ let url = `${this.getUrl()}/${subsiteId}/media/attachments`;
44
46
 
45
47
  const attach = async (data, params) => {
46
48
  url = `${url}${this.getUrlParams(params)}`;
@@ -49,16 +51,30 @@ class PlantingSitesApi extends Api {
49
51
  };
50
52
 
51
53
  const remove = async (attachmentId, params) => {
52
- url = `${this.getUrl()}/${subsiteId}/media/attachments/${attachmentId}${this.getUrlParams(params)}`
53
- return await this.post(url, null, "delete");
54
+ url = `${this.getUrl()}/${subsiteId}/media/attachments/${attachmentId}${this.getUrlParams(
55
+ params
56
+ )}`;
57
+ return await this.post(url, null, 'delete');
54
58
  };
55
59
 
56
- return {
60
+ return {
57
61
  attach,
58
62
  delete: remove,
59
- }
63
+ };
60
64
  }
61
65
 
66
+ stakeholders(plantingSiteId) {
67
+ const all = async (params) => {
68
+ const url = `${this.getUrl()}/${plantingSiteId}/stakeholders${this.getUrlParams(
69
+ params
70
+ )}`;
71
+ return await this.get(url);
72
+ };
73
+
74
+ return {
75
+ all,
76
+ };
77
+ }
62
78
  }
63
79
 
64
- export const PlantingSites = new PlantingSitesApi();
80
+ export const PlantingSites = new PlantingSitesApi();
@@ -1,9 +1,9 @@
1
- import Api from "../helpers/api";
1
+ import Api from '../helpers/api';
2
2
 
3
3
  class RegionsApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = "regions";
6
+ this.resource = 'regions';
7
7
  }
8
8
  stats(region) {
9
9
  const all = async () => {
@@ -11,6 +11,18 @@ class RegionsApi extends Api {
11
11
  return await this.get(url);
12
12
  };
13
13
 
14
+ return {
15
+ all,
16
+ };
17
+ }
18
+ stakeholders(region) {
19
+ const all = async (params) => {
20
+ const url = `${this.getUrl()}/${region}/stakeholders${this.getUrlParams(
21
+ params
22
+ )}`;
23
+ return await this.get(url);
24
+ };
25
+
14
26
  return {
15
27
  all,
16
28
  };