@veritree/services 2.34.0 → 2.35.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.
Files changed (49) hide show
  1. package/index.js +83 -83
  2. package/package.json +16 -16
  3. package/src/endpoints/bulk-uploads.js +4 -4
  4. package/src/endpoints/countries.js +5 -5
  5. package/src/endpoints/crumbs.js +20 -20
  6. package/src/endpoints/evidence.js +47 -47
  7. package/src/endpoints/external-reports.js +9 -9
  8. package/src/endpoints/field-reports.js +37 -37
  9. package/src/endpoints/field-udpate-verifications.js +5 -5
  10. package/src/endpoints/field-updates.js +16 -16
  11. package/src/endpoints/forest-type-species.js +4 -4
  12. package/src/endpoints/forest-types-profiles.js +4 -4
  13. package/src/endpoints/forest-types.js +14 -14
  14. package/src/endpoints/form-submissions.js +4 -4
  15. package/src/endpoints/geometries.js +4 -4
  16. package/src/endpoints/images-aggregated.js +4 -4
  17. package/src/endpoints/images.js +21 -21
  18. package/src/endpoints/methodologies.js +36 -36
  19. package/src/endpoints/notes.js +14 -14
  20. package/src/endpoints/organizations.js +59 -59
  21. package/src/endpoints/orgs.js +65 -65
  22. package/src/endpoints/password.js +58 -58
  23. package/src/endpoints/planting-sites.js +121 -110
  24. package/src/endpoints/regions.js +41 -41
  25. package/src/endpoints/resellers.js +37 -37
  26. package/src/endpoints/roles.js +4 -4
  27. package/src/endpoints/sdgs.js +4 -4
  28. package/src/endpoints/sponsors.js +86 -86
  29. package/src/endpoints/sso-token.js +5 -5
  30. package/src/endpoints/standards.js +140 -140
  31. package/src/endpoints/stats.js +17 -17
  32. package/src/endpoints/subdomains.js +4 -4
  33. package/src/endpoints/subsite-types.js +5 -5
  34. package/src/endpoints/subsites.js +88 -88
  35. package/src/endpoints/tags.js +14 -14
  36. package/src/endpoints/tasks.js +47 -47
  37. package/src/endpoints/tree-order-statuses.js +4 -4
  38. package/src/endpoints/trees-orders.js +23 -23
  39. package/src/endpoints/user.js +27 -27
  40. package/src/endpoints/users.js +14 -14
  41. package/src/endpoints/utilities.js +35 -35
  42. package/src/endpoints/verifications.js +21 -21
  43. package/src/helpers/api.js +293 -293
  44. package/src/helpers/cookies.js +36 -36
  45. package/src/helpers/relations.js +32 -32
  46. package/src/helpers/sequestrations.js +19 -19
  47. package/src/helpers/session.js +3 -3
  48. package/src/helpers/team.js +45 -45
  49. package/src/utils/args.js +46 -46
@@ -1,110 +1,121 @@
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
- const remove = async (imageId, params) => {
32
- url = `${this.getUrl()}/${subsiteId}/media/images/${imageId}${this.getUrlParams(
33
- params
34
- )}`;
35
- return await this.post(url, null, 'delete');
36
- };
37
-
38
- return {
39
- attach,
40
- delete: remove,
41
- };
42
- }
43
-
44
- attachments(subsiteId) {
45
- let url = `${this.getUrl()}/${subsiteId}/media/attachments`;
46
-
47
- const attach = async (data, params) => {
48
- url = `${url}${this.getUrlParams(params)}`;
49
-
50
- return await this.post(url, data);
51
- };
52
-
53
- const remove = async (attachmentId, params) => {
54
- url = `${this.getUrl()}/${subsiteId}/media/attachments/${attachmentId}${this.getUrlParams(
55
- params
56
- )}`;
57
- return await this.post(url, null, 'delete');
58
- };
59
-
60
- return {
61
- attach,
62
- delete: remove,
63
- };
64
- }
65
-
66
- stakeholders(plantingSiteId) {
67
- const all = async (params) => {
68
- const url = `${this.getUrl()}/${plantingSiteId}/stakeholders${this.getUrlParams(
69
- params
70
- )}`;
71
- return await this.get(url);
72
- };
73
-
74
- return {
75
- all,
76
- };
77
- }
78
-
79
- evidence(subsiteId, params) {
80
- let url = `${this.getUrl()}/${subsiteId}/evidence`;
81
-
82
- console.log(url);
83
-
84
- const all = async () => {
85
- url = `${url}${this.getUrlParams(params)}`;
86
- return await this.get(url);
87
- };
88
-
89
- const attach = async (formData) => {
90
- url = `${url}${this.getUrlParams(params)}`;
91
- return await this.post(url, formData);
92
- };
93
-
94
- const remove = async (evidenceType, evidenceId) => {
95
- url = `${url}/${evidenceType}/${evidenceId}${this.getUrlParams(
96
- params
97
- )}`;
98
-
99
- return await this.post(url, null, "delete");
100
- };
101
-
102
- return {
103
- all,
104
- attach,
105
- delete: remove,
106
- };
107
- }
108
- }
109
-
110
- export const PlantingSites = new PlantingSitesApi();
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
+ const remove = async (imageId, params) => {
32
+ url = `${this.getUrl()}/${subsiteId}/media/images/${imageId}${this.getUrlParams(
33
+ params
34
+ )}`;
35
+ return await this.post(url, null, 'delete');
36
+ };
37
+
38
+ return {
39
+ attach,
40
+ delete: remove,
41
+ };
42
+ }
43
+
44
+ attachments(subsiteId) {
45
+ let url = `${this.getUrl()}/${subsiteId}/media/attachments`;
46
+
47
+ const attach = async (data, params) => {
48
+ url = `${url}${this.getUrlParams(params)}`;
49
+
50
+ return await this.post(url, data);
51
+ };
52
+
53
+ const remove = async (attachmentId, params) => {
54
+ url = `${this.getUrl()}/${subsiteId}/media/attachments/${attachmentId}${this.getUrlParams(
55
+ params
56
+ )}`;
57
+ return await this.post(url, null, 'delete');
58
+ };
59
+
60
+ return {
61
+ attach,
62
+ delete: remove,
63
+ };
64
+ }
65
+
66
+ stakeholders(plantingSiteId) {
67
+ const all = async (params) => {
68
+ const url = `${this.getUrl()}/${plantingSiteId}/stakeholders${this.getUrlParams(
69
+ params
70
+ )}`;
71
+ return await this.get(url);
72
+ };
73
+
74
+ return {
75
+ all,
76
+ };
77
+ }
78
+
79
+ evidence(subsiteId, params) {
80
+ let url = `${this.getUrl()}/${subsiteId}/evidence`;
81
+
82
+ console.log(url);
83
+
84
+ const all = async () => {
85
+ url = `${url}${this.getUrlParams(params)}`;
86
+ return await this.get(url);
87
+ };
88
+
89
+ const attach = async (formData) => {
90
+ url = `${url}${this.getUrlParams(params)}`;
91
+ return await this.post(url, formData);
92
+ };
93
+
94
+ const remove = async (evidenceType, evidenceId) => {
95
+ url = `${url}/${evidenceType}/${evidenceId}${this.getUrlParams(
96
+ params
97
+ )}`;
98
+
99
+ return await this.post(url, null, "delete");
100
+ };
101
+
102
+ return {
103
+ all,
104
+ attach,
105
+ delete: remove,
106
+ };
107
+ }
108
+
109
+ stats(subsiteId) {
110
+ const all = async (args) => {
111
+ const url = `${this.getUrl()}/${subsiteId}/stats${this.getUrlParams(args)}`;
112
+ return await this.get(url);
113
+ };
114
+
115
+ return {
116
+ all,
117
+ };
118
+ }
119
+ }
120
+
121
+ export const PlantingSites = new PlantingSitesApi();
@@ -1,41 +1,41 @@
1
- import Api from '../helpers/api';
2
-
3
- class RegionsApi extends Api {
4
- constructor(resource) {
5
- super(resource);
6
- this.resource = 'regions';
7
- }
8
- stats(region) {
9
- const all = async () => {
10
- const url = `${this.getUrl()}/${region}/stats`;
11
- return await this.get(url);
12
- };
13
-
14
- return {
15
- all,
16
- };
17
- }
18
- stakeholders(region) {
19
- const all = async (params) => {
20
- const url = `${this.getUrl()}/${region}/stakeholders${this.getUrlParams(
21
- params
22
- )}`;
23
- return await this.get(url);
24
- };
25
-
26
- return {
27
- all,
28
- };
29
- }
30
- listRegions(orgId,orgType) {
31
- const all = async () => {
32
- const url = `${this.getUrl()}/public?org_id=${orgId}&org_type=${orgType}&_v=10.0.0`;
33
- return await this.get(url);
34
- };
35
- return {
36
- all,
37
- };
38
- }
39
- }
40
-
41
- export const Regions = new RegionsApi();
1
+ import Api from '../helpers/api';
2
+
3
+ class RegionsApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = 'regions';
7
+ }
8
+ stats(region) {
9
+ const all = async () => {
10
+ const url = `${this.getUrl()}/${region}/stats`;
11
+ return await this.get(url);
12
+ };
13
+
14
+ return {
15
+ all,
16
+ };
17
+ }
18
+ stakeholders(region) {
19
+ const all = async (params) => {
20
+ const url = `${this.getUrl()}/${region}/stakeholders${this.getUrlParams(
21
+ params
22
+ )}`;
23
+ return await this.get(url);
24
+ };
25
+
26
+ return {
27
+ all,
28
+ };
29
+ }
30
+ listRegions(orgId,orgType) {
31
+ const all = async () => {
32
+ const url = `${this.getUrl()}/public?org_id=${orgId}&org_type=${orgType}&_v=10.0.0`;
33
+ return await this.get(url);
34
+ };
35
+ return {
36
+ all,
37
+ };
38
+ }
39
+ }
40
+
41
+ export const Regions = new RegionsApi();
@@ -1,37 +1,37 @@
1
- import Api from '../helpers/api';
2
-
3
- class ResellersApi extends Api {
4
- constructor(resource) {
5
- super(resource);
6
- this.resource = 'resellers';
7
- }
8
-
9
- statsSold() {
10
- const all = async () => {
11
- const url = `${this.getUrl()}/1/pstats/sold?pretty=1`;
12
- let response;
13
- try {
14
- response = await this.get(url);
15
- } catch (e) {
16
- console.log('error ', e);
17
- }
18
- return response;
19
- };
20
-
21
- return {
22
- all,
23
- };
24
- }
25
-
26
- statsPurchased() {
27
- const all = async () => {
28
- const url = `${this.getUrl()}/1/pstats/purchased?pretty=1`;
29
- };
30
-
31
- return {
32
- all,
33
- };
34
- }
35
- }
36
-
37
- export const Resellers = new ResellersApi();
1
+ import Api from '../helpers/api';
2
+
3
+ class ResellersApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = 'resellers';
7
+ }
8
+
9
+ statsSold() {
10
+ const all = async () => {
11
+ const url = `${this.getUrl()}/1/pstats/sold?pretty=1`;
12
+ let response;
13
+ try {
14
+ response = await this.get(url);
15
+ } catch (e) {
16
+ console.log('error ', e);
17
+ }
18
+ return response;
19
+ };
20
+
21
+ return {
22
+ all,
23
+ };
24
+ }
25
+
26
+ statsPurchased() {
27
+ const all = async () => {
28
+ const url = `${this.getUrl()}/1/pstats/purchased?pretty=1`;
29
+ };
30
+
31
+ return {
32
+ all,
33
+ };
34
+ }
35
+ }
36
+
37
+ export const Resellers = new ResellersApi();
@@ -1,5 +1,5 @@
1
- import Api from '../helpers/api';
2
-
3
- const resource = 'roles';
4
-
1
+ import Api from '../helpers/api';
2
+
3
+ const resource = 'roles';
4
+
5
5
  export const Roles = new Api(resource);
@@ -1,5 +1,5 @@
1
- import Api from "../helpers/api";
2
-
3
- const resource = "sdgs";
4
-
1
+ import Api from "../helpers/api";
2
+
3
+ const resource = "sdgs";
4
+
5
5
  export const SDGs = new Api(resource);
@@ -1,86 +1,86 @@
1
- import Api from '../helpers/api';
2
-
3
- class SponsorsApi extends Api {
4
- constructor(resource) {
5
- super(resource);
6
- this.resource = 'sponsors';
7
- }
8
-
9
- async map() {
10
- this.setOrg();
11
-
12
- if (!this.orgId) {
13
- throw new Error('No org id provided');
14
- }
15
-
16
- const url = `${this.getUrl()}/${this.orgId}/map-data`;
17
- return await this.get(url);
18
- }
19
-
20
- async profile() {
21
- this.setOrg();
22
-
23
- if (!this.orgId) {
24
- throw new Error('No org id provided');
25
- }
26
-
27
- const url = `${this.getUrl()}/${this.orgId}/profile`;
28
- return await this.get(url);
29
- }
30
-
31
- async plantingStats(args) {
32
- const url = `${this.getUrl()}/planting-stats${this.getUrlParams(args)}`;
33
- return await this.get(url);
34
- }
35
-
36
- async totalPlantingStats(args) {
37
- const url = `${this.getUrl()}/total-planting-stats${this.getUrlParams(
38
- args
39
- )}`;
40
- return await this.get(url);
41
- }
42
-
43
- cms(args) {
44
- const urlParams = this.getUrlParams(args);
45
-
46
- const token = async () => {
47
- const url = `${this.getUrl()}/${this.orgId}/cms/token${urlParams}`;
48
- return await this.get(url);
49
- };
50
-
51
- const imageUploadUrl = async () => {
52
- const url = `${this.getUrl()}/${this.orgId}/cms/image-upload-url${urlParams}`;
53
- return await this.get(url);
54
- };
55
-
56
- const credentials = async (orgId, data) => {
57
- const url = `${this.getUrl()}/${orgId}/cms/credentials${urlParams}`;
58
- return await this.post(url, data);
59
- };
60
-
61
- return {
62
- token,
63
- imageUploadUrl,
64
- credentials,
65
- };
66
- }
67
-
68
- tools(args) {
69
- const get = async (sponsorId) => {
70
- const url = `${this.getUrl()}/${sponsorId}/tools${this.getUrlParams(args)}`;
71
- return await this.get(url);
72
- }
73
-
74
- const create = async (sponsorId, data) => {
75
- const url = `${this.getUrl()}/${sponsorId}/tools`;
76
- return await this.post(url, data);
77
- }
78
-
79
- return {
80
- get,
81
- create
82
- }
83
- }
84
- }
85
-
86
- export const Sponsors = new SponsorsApi();
1
+ import Api from '../helpers/api';
2
+
3
+ class SponsorsApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = 'sponsors';
7
+ }
8
+
9
+ async map() {
10
+ this.setOrg();
11
+
12
+ if (!this.orgId) {
13
+ throw new Error('No org id provided');
14
+ }
15
+
16
+ const url = `${this.getUrl()}/${this.orgId}/map-data`;
17
+ return await this.get(url);
18
+ }
19
+
20
+ async profile() {
21
+ this.setOrg();
22
+
23
+ if (!this.orgId) {
24
+ throw new Error('No org id provided');
25
+ }
26
+
27
+ const url = `${this.getUrl()}/${this.orgId}/profile`;
28
+ return await this.get(url);
29
+ }
30
+
31
+ async plantingStats(args) {
32
+ const url = `${this.getUrl()}/planting-stats${this.getUrlParams(args)}`;
33
+ return await this.get(url);
34
+ }
35
+
36
+ async totalPlantingStats(args) {
37
+ const url = `${this.getUrl()}/total-planting-stats${this.getUrlParams(
38
+ args
39
+ )}`;
40
+ return await this.get(url);
41
+ }
42
+
43
+ cms(args) {
44
+ const urlParams = this.getUrlParams(args);
45
+
46
+ const token = async () => {
47
+ const url = `${this.getUrl()}/${this.orgId}/cms/token${urlParams}`;
48
+ return await this.get(url);
49
+ };
50
+
51
+ const imageUploadUrl = async () => {
52
+ const url = `${this.getUrl()}/${this.orgId}/cms/image-upload-url${urlParams}`;
53
+ return await this.get(url);
54
+ };
55
+
56
+ const credentials = async (orgId, data) => {
57
+ const url = `${this.getUrl()}/${orgId}/cms/credentials${urlParams}`;
58
+ return await this.post(url, data);
59
+ };
60
+
61
+ return {
62
+ token,
63
+ imageUploadUrl,
64
+ credentials,
65
+ };
66
+ }
67
+
68
+ tools(args) {
69
+ const get = async (sponsorId) => {
70
+ const url = `${this.getUrl()}/${sponsorId}/tools${this.getUrlParams(args)}`;
71
+ return await this.get(url);
72
+ }
73
+
74
+ const create = async (sponsorId, data) => {
75
+ const url = `${this.getUrl()}/${sponsorId}/tools`;
76
+ return await this.post(url, data);
77
+ }
78
+
79
+ return {
80
+ get,
81
+ create
82
+ }
83
+ }
84
+ }
85
+
86
+ export const Sponsors = new SponsorsApi();
@@ -1,5 +1,5 @@
1
- import Api from "../helpers/api";
2
-
3
- const resource = "sso-token";
4
-
5
- export const ssoToken = new Api(resource);
1
+ import Api from "../helpers/api";
2
+
3
+ const resource = "sso-token";
4
+
5
+ export const ssoToken = new Api(resource);