@veritree/services 2.42.0 → 2.43.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 +4 -2
- package/package.json +1 -1
- package/src/endpoints/field-reports.js +32 -9
- package/src/endpoints/initiatives.js +10 -0
- package/src/endpoints/sponsors.js +27 -14
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ 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 { Initiatives } from './src/endpoints/initiatives';
|
|
10
11
|
import { Methodologies } from './src/endpoints/methodologies';
|
|
11
12
|
import { Notes } from './src/endpoints/notes';
|
|
12
13
|
import { Orgs } from './src/endpoints/orgs';
|
|
@@ -48,8 +49,9 @@ export {
|
|
|
48
49
|
ForestTypes,
|
|
49
50
|
ForestTypeProfiles,
|
|
50
51
|
FormSubmissions,
|
|
51
|
-
Methodologies,
|
|
52
52
|
Images,
|
|
53
|
+
Initiatives,
|
|
54
|
+
Methodologies,
|
|
53
55
|
Notes,
|
|
54
56
|
Orgs,
|
|
55
57
|
Regions,
|
|
@@ -79,5 +81,5 @@ export {
|
|
|
79
81
|
Organizations,
|
|
80
82
|
Tasks,
|
|
81
83
|
Geometries,
|
|
82
|
-
Password
|
|
84
|
+
Password,
|
|
83
85
|
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
2
|
|
|
3
3
|
class FieldReportsApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = 'field-reports';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
evidence(fieldReportId, params) {
|
|
10
|
-
const url = `${this.getUrl()}/${fieldReportId}/evidence${this.getUrlParams(
|
|
10
|
+
const url = `${this.getUrl()}/${fieldReportId}/evidence${this.getUrlParams(
|
|
11
|
+
params
|
|
12
|
+
)}`;
|
|
11
13
|
|
|
12
14
|
const all = async () => {
|
|
13
15
|
return await this.get(url);
|
|
14
|
-
}
|
|
16
|
+
};
|
|
15
17
|
|
|
16
18
|
const attach = async (formData) => {
|
|
17
19
|
return await this.post(url, formData);
|
|
@@ -19,20 +21,41 @@ class FieldReportsApi extends Api {
|
|
|
19
21
|
|
|
20
22
|
const detach = async (evidenceId, fileType = 'images') => {
|
|
21
23
|
const url = `${this.getUrl()}/${fieldReportId}/evidence/${fileType}/${evidenceId}${this.getUrlParams()}`;
|
|
22
|
-
return await this.post(url, null,
|
|
24
|
+
return await this.post(url, null, 'delete');
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
return {
|
|
26
28
|
all,
|
|
27
29
|
attach,
|
|
28
|
-
detach
|
|
29
|
-
}
|
|
30
|
+
detach,
|
|
31
|
+
};
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
blockchain(fieldReportId, params) {
|
|
33
35
|
const url = `${this.getUrl()}/${fieldReportId}${this.getUrlParams(params)}`;
|
|
34
|
-
return this.get(url)
|
|
36
|
+
return this.get(url);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
initiatives(fieldReportId, params) {
|
|
40
|
+
const url = `${this.getUrl()}/${fieldReportId}/initiatives${this.getUrlParams(
|
|
41
|
+
params
|
|
42
|
+
)}`;
|
|
43
|
+
return this.get(url);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
attachInitiatives(fieldReportId, formData, params) {
|
|
47
|
+
const url = `${this.getUrl()}/${fieldReportId}/attach-initiatives${this.getUrlParams(
|
|
48
|
+
params
|
|
49
|
+
)}`;
|
|
50
|
+
return this.post(url, formData, null, params);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
detachInitiatives(fieldReportId, formData, params) {
|
|
54
|
+
const url = `${this.getUrl()}/${fieldReportId}/detach-initiatives${this.getUrlParams(
|
|
55
|
+
params
|
|
56
|
+
)}`;
|
|
57
|
+
return this.post(url, formData, null, params);
|
|
35
58
|
}
|
|
36
59
|
}
|
|
37
60
|
|
|
38
|
-
export const FieldReports = new FieldReportsApi();
|
|
61
|
+
export const FieldReports = new FieldReportsApi();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
2
|
|
|
3
3
|
class SponsorsApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = 'sponsors';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
async map() {
|
|
10
10
|
this.setOrg();
|
|
11
11
|
|
|
12
12
|
if (!this.orgId) {
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error('No org id provided');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const url = `${this.getUrl()}/${this.orgId}/map-data`;
|
|
@@ -21,7 +21,7 @@ class SponsorsApi extends Api {
|
|
|
21
21
|
this.setOrg();
|
|
22
22
|
|
|
23
23
|
if (!this.orgId) {
|
|
24
|
-
throw new Error(
|
|
24
|
+
throw new Error('No org id provided');
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const url = `${this.getUrl()}/${this.orgId}/profile`;
|
|
@@ -105,21 +105,34 @@ class SponsorsApi extends Api {
|
|
|
105
105
|
|
|
106
106
|
const stats = () => {
|
|
107
107
|
const all = async () => {
|
|
108
|
-
const url = `${this.getUrl()}/${
|
|
109
|
-
|
|
110
|
-
)}`;
|
|
111
|
-
|
|
108
|
+
const url = `${this.getUrl()}/${
|
|
109
|
+
this.orgId
|
|
110
|
+
}/regions/${regionId}/stats${this.getUrlParams(args)}`;
|
|
111
|
+
|
|
112
112
|
return await this.get(url);
|
|
113
|
-
}
|
|
113
|
+
};
|
|
114
114
|
|
|
115
115
|
return {
|
|
116
|
-
all
|
|
117
|
-
}
|
|
118
|
-
}
|
|
116
|
+
all,
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
119
|
|
|
120
120
|
return {
|
|
121
|
-
stats
|
|
122
|
-
}
|
|
121
|
+
stats,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
metrics(sponsorId) {
|
|
126
|
+
const all = async (args) => {
|
|
127
|
+
const url = `${this.getUrl()}/${sponsorId}/metrics${this.getUrlParams(
|
|
128
|
+
args
|
|
129
|
+
)}`;
|
|
130
|
+
return await this.get(url);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
all,
|
|
135
|
+
};
|
|
123
136
|
}
|
|
124
137
|
}
|
|
125
138
|
|