@veritree/services 2.24.0 → 2.25.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/index.js CHANGED
@@ -35,6 +35,7 @@ import { ssoToken } from './src/endpoints/sso-token';
35
35
  import { PlantingSites } from './src/endpoints/planting-sites';
36
36
  import { Organizations } from './src/endpoints/organizations';
37
37
  import { Tasks } from './src/endpoints/tasks';
38
+ import { Geometries } from './src/endpoints/geometries';
38
39
 
39
40
  export {
40
41
  BulkUploads,
@@ -73,5 +74,6 @@ export {
73
74
  ssoToken,
74
75
  PlantingSites,
75
76
  Organizations,
76
- Tasks
77
+ Tasks,
78
+ Geometries
77
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.24.0",
3
+ "version": "2.25.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,5 @@
1
+ import Api from "../helpers/api";
2
+
3
+ const resource = "geometries";
4
+
5
+ export const Geometries = new Api(resource);
@@ -18,6 +18,47 @@ class PlantingSitesApi extends Api {
18
18
  all
19
19
  }
20
20
  }
21
+
22
+ images(subsiteId) {
23
+ let url = `${this.getUrl()}/${subsiteId}/media/images`
24
+
25
+ const attach = async (data, params) => {
26
+ url = `${url}${this.getUrlParams(params)}`;
27
+
28
+ return await this.post(url, data);
29
+ };
30
+
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");
34
+ };
35
+
36
+ return {
37
+ attach,
38
+ delete: remove,
39
+ }
40
+ }
41
+
42
+ attachments(subsiteId) {
43
+ let url = `${this.getUrl()}/${subsiteId}/media/attachments`
44
+
45
+ const attach = async (data, params) => {
46
+ url = `${url}${this.getUrlParams(params)}`;
47
+
48
+ return await this.post(url, data);
49
+ };
50
+
51
+ 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
+ };
55
+
56
+ return {
57
+ attach,
58
+ delete: remove,
59
+ }
60
+ }
61
+
21
62
  }
22
63
 
23
64
  export const PlantingSites = new PlantingSitesApi();