@veritree/services 2.72.0 → 2.74.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
@@ -43,6 +43,7 @@ import { Geometries } from './src/endpoints/geometries';
43
43
  import { Password } from './src/endpoints/password';
44
44
  import { TreeCodes } from './src/endpoints/tree-codes';
45
45
  import { Inventory } from './src/endpoints/inventory';
46
+ import { Allocations } from './src/endpoints/allocations';
46
47
 
47
48
  export {
48
49
  BulkUploads,
@@ -89,5 +90,6 @@ export {
89
90
  Geometries,
90
91
  Password,
91
92
  TreeCodes,
92
- Inventory
93
+ Inventory,
94
+ Allocations
93
95
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.72.0",
3
+ "version": "2.74.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 = "allocations";
4
+
5
+ export const Allocations = new Api(resource);
@@ -1,9 +1,9 @@
1
- import Api from "../helpers/api";
1
+ import Api from '../helpers/api';
2
2
 
3
3
  class TasksApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = "tasks";
6
+ this.resource = 'tasks';
7
7
  }
8
8
 
9
9
  geometries(taskPublicId) {
@@ -98,7 +98,7 @@ class TasksApi extends Api {
98
98
  */
99
99
  const update = async (categoryId, data, params) => {
100
100
  const url = generateUrl(null, categoryId, params);
101
- return await this.post(url, data, "patch");
101
+ return await this.post(url, data, 'patch');
102
102
  };
103
103
 
104
104
  /**
@@ -119,6 +119,25 @@ class TasksApi extends Api {
119
119
  delete: remove,
120
120
  };
121
121
  }
122
+
123
+ evidence(taskPublicId) {
124
+ let url = `${this.getUrl()}/${taskPublicId}/evidence`;
125
+
126
+ const all = async (params) => {
127
+ url = `${url}${this.getUrlParams(params)}`;
128
+ return await this.get(url);
129
+ };
130
+
131
+ const attach = async (data) => {
132
+ url = `${url}${this.getUrlParams()}`;
133
+ return await this.post(url, data);
134
+ };
135
+
136
+ return {
137
+ all,
138
+ attach,
139
+ };
140
+ }
122
141
  }
123
142
 
124
143
  export const Tasks = new TasksApi();