@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,36 +1,36 @@
1
- import Api from '../helpers/api';
2
-
3
- class MethodologiesApi extends Api {
4
- constructor(resource) {
5
- super(resource);
6
- this.resource = 'methodologies';
7
- }
8
-
9
- async update(id, data, args) {
10
- const url = `${this.getUrl(id)}`;
11
- return await this.post(url, data, 'PATCH', args);
12
- }
13
-
14
- images(id) {
15
- const create = async (purpose, data, args) => {
16
- const url = `${this.getUrl(id)}/images/${purpose}`;
17
- return await this.post(url, data, args);
18
- };
19
-
20
- return {
21
- create,
22
- };
23
- }
24
-
25
- async attach(id, data, args) {
26
- const url = `${this.getUrl(id)}/attach`;
27
- return await this.post(url, data, args);
28
- }
29
-
30
- async detach(id, data, args) {
31
- const url = `${this.getUrl(id)}/detach`;
32
- return await this.post(url, data, args);
33
- }
34
- }
35
-
36
- export const Methodologies = new MethodologiesApi();
1
+ import Api from '../helpers/api';
2
+
3
+ class MethodologiesApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = 'methodologies';
7
+ }
8
+
9
+ async update(id, data, args) {
10
+ const url = `${this.getUrl(id)}`;
11
+ return await this.post(url, data, 'PATCH', args);
12
+ }
13
+
14
+ images(id) {
15
+ const create = async (purpose, data, args) => {
16
+ const url = `${this.getUrl(id)}/images/${purpose}`;
17
+ return await this.post(url, data, args);
18
+ };
19
+
20
+ return {
21
+ create,
22
+ };
23
+ }
24
+
25
+ async attach(id, data, args) {
26
+ const url = `${this.getUrl(id)}/attach`;
27
+ return await this.post(url, data, args);
28
+ }
29
+
30
+ async detach(id, data, args) {
31
+ const url = `${this.getUrl(id)}/detach`;
32
+ return await this.post(url, data, args);
33
+ }
34
+ }
35
+
36
+ export const Methodologies = new MethodologiesApi();
@@ -1,15 +1,15 @@
1
- import Api from "../helpers/api";
2
- import Relations from "../helpers/relations";
3
-
4
- class NotesApi extends Api {
5
- constructor(resource) {
6
- super(resource);
7
- this.resource = "notes";
8
- }
9
-
10
- relation(prefix, id, args) {
11
- return Relations(this, prefix, id, args);
12
- }
13
- }
14
-
1
+ import Api from "../helpers/api";
2
+ import Relations from "../helpers/relations";
3
+
4
+ class NotesApi extends Api {
5
+ constructor(resource) {
6
+ super(resource);
7
+ this.resource = "notes";
8
+ }
9
+
10
+ relation(prefix, id, args) {
11
+ return Relations(this, prefix, id, args);
12
+ }
13
+ }
14
+
15
15
  export const Notes = new NotesApi();
@@ -1,59 +1,59 @@
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
- plantingStats(orgId) {
48
- const all = async (params) => {
49
- const url = `${this.getUrl()}/${orgId}/field-updates/planting-stats${this.getUrlParams(
50
- params
51
- )}`;
52
- return await this.get(url);
53
- };
54
-
55
- return { all };
56
- }
57
- }
58
-
59
- export const Organizations = new OrganizationsApi();
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
+ plantingStats(orgId) {
48
+ const all = async (params) => {
49
+ const url = `${this.getUrl()}/${orgId}/field-updates/planting-stats${this.getUrlParams(
50
+ params
51
+ )}`;
52
+ return await this.get(url);
53
+ };
54
+
55
+ return { all };
56
+ }
57
+ }
58
+
59
+ export const Organizations = new OrganizationsApi();
@@ -1,65 +1,65 @@
1
- import Api from '../helpers/api';
2
- import Team from '../helpers/team';
3
- import { getSession } from '../helpers/session';
4
-
5
- class OrgsApi extends Api {
6
- constructor(resource) {
7
- super(resource);
8
- this.resource = 'orgs';
9
- }
10
-
11
- users(orgIdAs) {
12
- const orgId = orgIdAs ? orgIdAs : getSession().orgId;
13
- return Team(this, orgId);
14
- }
15
-
16
- async roles(orgId, params) {
17
- const url = `${this.getUrl()}/${orgId}/roles${this.getUrlParams(params)}`;
18
- return await this.get(url);
19
- }
20
-
21
- async emails(orgId, data, params) {
22
- const url = `${this.getUrl()}/${orgId}/emails${this.getUrlParams(params)}`;
23
- return await this.post(url, data);
24
- }
25
-
26
- async stats() {
27
- const url = `${this._geStatstUrl()}`;
28
- return await this.get(url);
29
- }
30
-
31
- async publicStats() {
32
- const url = `${this._geStatstUrl(true)}`;
33
- return await this.get(url);
34
- }
35
-
36
- siteManagers(orgId) {
37
- const locations = () => {
38
- const all = async (userId) => {
39
- const url = `${this.getUrl()}/${orgId}/site-managers/${userId}/locations${this.getUrlParams()}`;
40
- return await this.get(url);
41
- };
42
-
43
- const update = async (data) => {
44
- const url = `${this.getUrl()}/${orgId}/site-managers/locations${this.getUrlParams()}`;
45
- return await this.post(url, data, 'put');
46
- };
47
-
48
- return {
49
- all,
50
- update,
51
- };
52
- };
53
-
54
- return {
55
- locations,
56
- };
57
- }
58
-
59
- _geStatstUrl(isPublic) {
60
- const endpoint = isPublic ? 'pstats' : 'stats';
61
- return `${this.getUrl()}/${endpoint}${this.getUrlParams()}`;
62
- }
63
- }
64
-
65
- export const Orgs = new OrgsApi();
1
+ import Api from '../helpers/api';
2
+ import Team from '../helpers/team';
3
+ import { getSession } from '../helpers/session';
4
+
5
+ class OrgsApi extends Api {
6
+ constructor(resource) {
7
+ super(resource);
8
+ this.resource = 'orgs';
9
+ }
10
+
11
+ users(orgIdAs) {
12
+ const orgId = orgIdAs ? orgIdAs : getSession().orgId;
13
+ return Team(this, orgId);
14
+ }
15
+
16
+ async roles(orgId, params) {
17
+ const url = `${this.getUrl()}/${orgId}/roles${this.getUrlParams(params)}`;
18
+ return await this.get(url);
19
+ }
20
+
21
+ async emails(orgId, data, params) {
22
+ const url = `${this.getUrl()}/${orgId}/emails${this.getUrlParams(params)}`;
23
+ return await this.post(url, data);
24
+ }
25
+
26
+ async stats() {
27
+ const url = `${this._geStatstUrl()}`;
28
+ return await this.get(url);
29
+ }
30
+
31
+ async publicStats() {
32
+ const url = `${this._geStatstUrl(true)}`;
33
+ return await this.get(url);
34
+ }
35
+
36
+ siteManagers(orgId) {
37
+ const locations = () => {
38
+ const all = async (userId) => {
39
+ const url = `${this.getUrl()}/${orgId}/site-managers/${userId}/locations${this.getUrlParams()}`;
40
+ return await this.get(url);
41
+ };
42
+
43
+ const update = async (data) => {
44
+ const url = `${this.getUrl()}/${orgId}/site-managers/locations${this.getUrlParams()}`;
45
+ return await this.post(url, data, 'put');
46
+ };
47
+
48
+ return {
49
+ all,
50
+ update,
51
+ };
52
+ };
53
+
54
+ return {
55
+ locations,
56
+ };
57
+ }
58
+
59
+ _geStatstUrl(isPublic) {
60
+ const endpoint = isPublic ? 'pstats' : 'stats';
61
+ return `${this.getUrl()}/${endpoint}${this.getUrlParams()}`;
62
+ }
63
+ }
64
+
65
+ export const Orgs = new OrgsApi();
@@ -1,58 +1,58 @@
1
- import Api from "../helpers/api";
2
-
3
- /**
4
- * This is a namespace that contains documentation elements
5
- * belonging to the Password domain.
6
- *
7
- * @namespace Password
8
- */
9
- class PasswordApi extends Api {
10
- constructor(resource) {
11
- super(resource);
12
- this.resource = "password";
13
- }
14
-
15
- recovery() {
16
- /**
17
- * Sends a recovery password email to the specified email address.
18
- *
19
- * @param {Object} data - An object containing the following properties:
20
- * @param {string} data.email - The email address to send the recovery email to.
21
- * @param {string} [data.return_url] - The URL to redirect the user to after they reset their password.
22
- * @returns {Promise<boolean>} - A Promise that resolves to a boolean indicating whether the email was sent successfully.
23
- */
24
- const post = async (data) => {
25
- const url = `${this.getUrl()}/email`;
26
-
27
- return await this.post(url, data);
28
- };
29
-
30
- return {
31
- post,
32
- };
33
- }
34
-
35
- reset() {
36
- /**
37
- * Sends a POST request to reset a password with the specified email, token, and password.
38
- *
39
- * @param {Object} data - An object containing the following properties:
40
- * @param {string} data.email - The email address of the user whose password is being reset.
41
- * @param {string} data.token - The token associated with the password reset request.
42
- * @param {string} data.password - The new password to set for the user.
43
- * @param {string} data.password_confirmation - The new password confimation to set for the user.
44
- * @returns {Promise<Object>} - A Promise that resolves to the result of the POST request.
45
- */
46
- const post = async (data) => {
47
- const url = `${this.getUrl()}/reset`
48
-
49
- return await this.post(url, data);
50
- };
51
-
52
- return {
53
- post,
54
- };
55
- }
56
- }
57
-
58
- export const Password = new PasswordApi();
1
+ import Api from "../helpers/api";
2
+
3
+ /**
4
+ * This is a namespace that contains documentation elements
5
+ * belonging to the Password domain.
6
+ *
7
+ * @namespace Password
8
+ */
9
+ class PasswordApi extends Api {
10
+ constructor(resource) {
11
+ super(resource);
12
+ this.resource = "password";
13
+ }
14
+
15
+ recovery() {
16
+ /**
17
+ * Sends a recovery password email to the specified email address.
18
+ *
19
+ * @param {Object} data - An object containing the following properties:
20
+ * @param {string} data.email - The email address to send the recovery email to.
21
+ * @param {string} [data.return_url] - The URL to redirect the user to after they reset their password.
22
+ * @returns {Promise<boolean>} - A Promise that resolves to a boolean indicating whether the email was sent successfully.
23
+ */
24
+ const post = async (data) => {
25
+ const url = `${this.getUrl()}/email`;
26
+
27
+ return await this.post(url, data);
28
+ };
29
+
30
+ return {
31
+ post,
32
+ };
33
+ }
34
+
35
+ reset() {
36
+ /**
37
+ * Sends a POST request to reset a password with the specified email, token, and password.
38
+ *
39
+ * @param {Object} data - An object containing the following properties:
40
+ * @param {string} data.email - The email address of the user whose password is being reset.
41
+ * @param {string} data.token - The token associated with the password reset request.
42
+ * @param {string} data.password - The new password to set for the user.
43
+ * @param {string} data.password_confirmation - The new password confimation to set for the user.
44
+ * @returns {Promise<Object>} - A Promise that resolves to the result of the POST request.
45
+ */
46
+ const post = async (data) => {
47
+ const url = `${this.getUrl()}/reset`
48
+
49
+ return await this.post(url, data);
50
+ };
51
+
52
+ return {
53
+ post,
54
+ };
55
+ }
56
+ }
57
+
58
+ export const Password = new PasswordApi();