@veritree/services 2.10.0 → 2.11.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
@@ -22,6 +22,8 @@ import { TreeOrders } from './src/endpoints/trees-orders';
22
22
  import { User } from './src/endpoints/user';
23
23
  import { Users } from './src/endpoints/users';
24
24
  import { Roles } from './src/endpoints/roles';
25
+ import { FieldReports } from './src/endpoints/field-reports';
26
+ import { ExternalReports } from './src/endpoints/external-reports';
25
27
 
26
28
  export {
27
29
  BulkUploads,
@@ -48,4 +50,6 @@ export {
48
50
  User,
49
51
  Users,
50
52
  Roles,
53
+ FieldReports,
54
+ ExternalReports
51
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.10.0",
3
+ "version": "2.11.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,10 @@
1
+ import Api from "../helpers/api";
2
+
3
+ class ExternalReportsApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = "external-reports";
7
+ }
8
+ }
9
+
10
+ export const ExternalReports = new ExternalReportsApi();
@@ -0,0 +1,10 @@
1
+ import Api from "../helpers/api";
2
+
3
+ class FieldReportsApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = "field-reports";
7
+ }
8
+ }
9
+
10
+ export const FieldReports = new FieldReportsApi();
@@ -16,6 +16,29 @@ class SubsitesApi extends Api {
16
16
  get,
17
17
  };
18
18
  }
19
+
20
+ indicators() {
21
+ const all = async (subsite) => {
22
+ const url = `${this.getUrl()}/${subsite}/indicators`;
23
+ return await this.get(url);
24
+ };
25
+
26
+ const create = async (subsite, formData) => {
27
+ const url = `${this.getUrl()}/${subsite}/indicators`;
28
+ return await this.post(url, formData);
29
+ };
30
+
31
+ const deleteFromSubsite = async (subsite, indicator) => {
32
+ const url = `${this.getUrl()}/${subsite}/indicators/${indicator}`;
33
+ return await this.post(url, null, 'delete');
34
+ };
35
+
36
+ return {
37
+ all,
38
+ create,
39
+ deleteFromSubsite,
40
+ };
41
+ }
19
42
  }
20
43
 
21
- export const Subsites = new SubsitesApi();
44
+ export const Subsites = new SubsitesApi();