@veritree/services 2.23.0 → 2.24.1
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 +6 -0
- package/package.json +1 -1
- package/src/endpoints/organizations.js +48 -0
- package/src/endpoints/planting-sites.js +52 -0
- package/src/endpoints/tasks.js +48 -0
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
|
@@ -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,52 @@
|
|
|
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
|
+
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
|
+
return {
|
|
32
|
+
attach
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
attachments(subsiteId) {
|
|
37
|
+
let url = `${this.getUrl()}/${subsiteId}/media/attachments`
|
|
38
|
+
|
|
39
|
+
const attach = async (data, params) => {
|
|
40
|
+
url = `${url}${this.getUrlParams(params)}`;
|
|
41
|
+
|
|
42
|
+
return await this.post(url, data);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
attach
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
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();
|