@veritree/services 2.23.0 → 2.24.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
@@ -32,6 +32,9 @@ import { Crumbs } from './src/endpoints/crumbs';
32
32
  import { Verifications } from './src/endpoints/verifications';
33
33
  import { ImagesAggregated } from './src/endpoints/images-aggregated';
34
34
  import { ssoToken } from './src/endpoints/sso-token';
35
+ import { PlantingSites } from './src/endpoints/planting-sites';
36
+ import { Organizations } from './src/endpoints/organizations';
37
+ import { Tasks } from './src/endpoints/tasks';
35
38
 
36
39
  export {
37
40
  BulkUploads,
@@ -68,4 +71,7 @@ export {
68
71
  Verifications,
69
72
  ImagesAggregated,
70
73
  ssoToken,
74
+ PlantingSites,
75
+ Organizations,
76
+ Tasks
71
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.23.0",
3
+ "version": "2.24.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,48 @@
1
+ import Api from "../helpers/api";
2
+
3
+ class OrganizationsApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = "organizations";
7
+ }
8
+
9
+ tasks(orgId) {
10
+ let url = `${this.getUrl()}/${orgId}/tasks`;
11
+
12
+ const all = async (params) => {
13
+ url = `${url}${this.getUrlParams(params)}`;
14
+ return await this.get(url);
15
+ };
16
+
17
+ const create = async (data) => {
18
+ url = `${url}${this.getUrlParams()}`;
19
+ return await this.post(url, data);
20
+ };
21
+
22
+ return {
23
+ all,
24
+ create,
25
+ };
26
+ }
27
+
28
+ taskCategories(orgId) {
29
+ let url = `${this.getUrl()}/${orgId}/task-categories`;
30
+
31
+ const all = async (params) => {
32
+ url = `${url}${this.getUrlParams(params)}`;
33
+ return await this.get(url);
34
+ };
35
+
36
+ const create = async (data) => {
37
+ url = `${url}${this.getUrlParams()}`;
38
+ return await this.post(url, data);
39
+ };
40
+
41
+ return {
42
+ all,
43
+ create,
44
+ }
45
+ }
46
+ }
47
+
48
+ export const Organizations = new OrganizationsApi();
@@ -0,0 +1,23 @@
1
+ import Api from "../helpers/api";
2
+
3
+ class PlantingSitesApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = "planting-sites";
7
+ }
8
+
9
+ users(plantingSiteId) {
10
+ let url = `${this.getUrl()}/${plantingSiteId}/users`
11
+
12
+ const all = async (params) => {
13
+ url = `${url}${this.getUrlParams(params)}`
14
+ return await this.get(url);
15
+ }
16
+
17
+ return {
18
+ all
19
+ }
20
+ }
21
+ }
22
+
23
+ export const PlantingSites = new PlantingSitesApi();
@@ -0,0 +1,48 @@
1
+ import Api from "../helpers/api";
2
+
3
+ class TasksApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = "tasks";
7
+ }
8
+
9
+ geometries(taskPublicId) {
10
+ let url = `${this.getUrl()}/${taskPublicId}/geometries`;
11
+
12
+ const all = async (params) => {
13
+ url = `${url}${this.getUrlParams(params)}`;
14
+ return await this.get(url);
15
+ };
16
+
17
+ const attach = async (data) => {
18
+ url = `${url}${this.getUrlParams()}`;
19
+ return await this.post(url, data);
20
+ };
21
+
22
+ return {
23
+ all,
24
+ attach,
25
+ };
26
+ }
27
+
28
+ users(taskPublicId) {
29
+ let url = `${this.getUrl()}/${taskPublicId}`;
30
+
31
+ const attach = async (data) => {
32
+ url = `${url}/users-attach${this.getUrlParams()}`;
33
+ return await this.post(url, data);
34
+ }
35
+
36
+ const detach = async (data) => {
37
+ url = `${url}/users-detach${this.getUrlParams()}`;
38
+ return await this.post(url, data);
39
+ }
40
+
41
+ return {
42
+ attach,
43
+ detach
44
+ }
45
+ }
46
+ }
47
+
48
+ export const Tasks = new TasksApi();