@veritree/services 2.21.1 → 2.21.2-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
@@ -7,8 +7,9 @@ import { ForestTypeSpecies } from './src/endpoints/forest-type-species';
7
7
  import { ForestTypes } from './src/endpoints/forest-types';
8
8
  import { ForestTypeProfiles } from './src/endpoints/forest-types-profiles';
9
9
  import { Images } from './src/endpoints/images';
10
- import { Orgs } from './src/endpoints/orgs';
10
+ import { Methodologies } from './src/endpoints/methodologies';
11
11
  import { Notes } from './src/endpoints/notes';
12
+ import { Orgs } from './src/endpoints/orgs';
12
13
  import { Regions } from './src/endpoints/regions';
13
14
  import { Resellers } from './src/endpoints/resellers';
14
15
  import { SDGs } from './src/endpoints/sdgs';
@@ -22,6 +23,7 @@ import { Tags } from './src/endpoints/tags';
22
23
  import { TreeOrders } from './src/endpoints/trees-orders';
23
24
  import { User } from './src/endpoints/user';
24
25
  import { Users } from './src/endpoints/users';
26
+ import { Utilities } from './src/endpoints/utilities';
25
27
  import { Roles } from './src/endpoints/roles';
26
28
  import { FieldReports } from './src/endpoints/field-reports';
27
29
  import { ExternalReports } from './src/endpoints/external-reports';
@@ -40,9 +42,10 @@ export {
40
42
  ForestTypes,
41
43
  ForestTypeProfiles,
42
44
  FormSubmissions,
45
+ Methodologies,
43
46
  Images,
44
- Orgs,
45
47
  Notes,
48
+ Orgs,
46
49
  Regions,
47
50
  Resellers,
48
51
  SDGs,
@@ -56,6 +59,7 @@ export {
56
59
  TreeOrders,
57
60
  User,
58
61
  Users,
62
+ Utilities,
59
63
  Roles,
60
64
  FieldReports,
61
65
  ExternalReports,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.21.1",
3
+ "version": "2.21.2-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,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,11 +1,11 @@
1
- import Api from "../helpers/api";
2
- import Team from "../helpers/team";
3
- import { getSession } from "../helpers/session";
1
+ import Api from '../helpers/api';
2
+ import Team from '../helpers/team';
3
+ import { getSession } from '../helpers/session';
4
4
 
5
5
  class OrgsApi extends Api {
6
6
  constructor(resource) {
7
7
  super(resource);
8
- this.resource = "orgs";
8
+ this.resource = 'orgs';
9
9
  }
10
10
 
11
11
  users(orgIdAs) {
@@ -35,10 +35,10 @@ class OrgsApi extends Api {
35
35
 
36
36
  siteManagers(orgId) {
37
37
  const locations = () => {
38
- const all = async(userId) => {
38
+ const all = async (userId) => {
39
39
  const url = `${this.getUrl()}/${orgId}/site-managers/${userId}/locations${this.getUrlParams()}`;
40
40
  return await this.get(url);
41
- }
41
+ };
42
42
 
43
43
  const update = async (data) => {
44
44
  const url = `${this.getUrl()}/${orgId}/site-managers/locations${this.getUrlParams()}`;
@@ -47,17 +47,17 @@ class OrgsApi extends Api {
47
47
 
48
48
  return {
49
49
  all,
50
- update
51
- }
52
- }
50
+ update,
51
+ };
52
+ };
53
53
 
54
54
  return {
55
- locations
56
- }
55
+ locations,
56
+ };
57
57
  }
58
58
 
59
59
  _geStatstUrl(isPublic) {
60
- const endpoint = isPublic ? "pstats" : "stats";
60
+ const endpoint = isPublic ? 'pstats' : 'stats';
61
61
  return `${this.getUrl()}/${endpoint}${this.getUrlParams()}`;
62
62
  }
63
63
  }
@@ -0,0 +1,35 @@
1
+ import Api from '../helpers/api';
2
+
3
+ class UtilitiesApi extends Api {
4
+ constructor(resource) {
5
+ super(resource);
6
+ this.resource = 'utilities';
7
+ }
8
+
9
+ uploads() {
10
+ const baseUrl = `${this.getUrl()}/uploads`;
11
+
12
+ const signedCloudUploadUrl = async () => {
13
+ const url = `${baseUrl}/signed-cloud-upload-url`;
14
+ return await this.get(url);
15
+ };
16
+
17
+ const installUpload = async (orgId, data) => {
18
+ const url = `${baseUrl}/install-upload/organization/${orgId}`;
19
+ return await this.post(url, data);
20
+ };
21
+
22
+ const supportedCollections = async () => {
23
+ const url = `${baseUrl}/supported-collections`;
24
+ return await this.get(url);
25
+ };
26
+
27
+ return {
28
+ signedCloudUploadUrl,
29
+ installUpload,
30
+ supportedCollections,
31
+ };
32
+ }
33
+ }
34
+
35
+ export const Utilities = new UtilitiesApi();