@veritree/services 2.53.0 → 2.55.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 +2 -0
- package/package.json +1 -1
- package/src/endpoints/organizations.js +12 -5
- package/src/endpoints/pins.js +15 -6
- package/src/endpoints/sensors.js +26 -0
package/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { Pins } from './src/endpoints/pins';
|
|
|
15
15
|
import { Regions } from './src/endpoints/regions';
|
|
16
16
|
import { Resellers } from './src/endpoints/resellers';
|
|
17
17
|
import { SDGs } from './src/endpoints/sdgs';
|
|
18
|
+
import { Sensors } from './src/endpoints/sensors';
|
|
18
19
|
import { Sponsors } from './src/endpoints/sponsors';
|
|
19
20
|
import { Standards } from './src/endpoints/standards';
|
|
20
21
|
import { Stats } from './src/endpoints/stats';
|
|
@@ -59,6 +60,7 @@ export {
|
|
|
59
60
|
Regions,
|
|
60
61
|
Resellers,
|
|
61
62
|
SDGs,
|
|
63
|
+
Sensors,
|
|
62
64
|
Sponsors,
|
|
63
65
|
Standards,
|
|
64
66
|
Stats,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from "../helpers/api";
|
|
2
2
|
|
|
3
3
|
class OrganizationsApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = "organizations";
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
tasks(orgId) {
|
|
@@ -57,9 +57,7 @@ class OrganizationsApi extends Api {
|
|
|
57
57
|
|
|
58
58
|
pins(orgId) {
|
|
59
59
|
const all = async (params) => {
|
|
60
|
-
const url = `${this.getUrl()}/${orgId}/pins/${this.getUrlParams(
|
|
61
|
-
params
|
|
62
|
-
)}`;
|
|
60
|
+
const url = `${this.getUrl()}/${orgId}/pins/${this.getUrlParams(params)}`;
|
|
63
61
|
|
|
64
62
|
return await this.get(url);
|
|
65
63
|
};
|
|
@@ -72,9 +70,18 @@ class OrganizationsApi extends Api {
|
|
|
72
70
|
return await this.get(url);
|
|
73
71
|
};
|
|
74
72
|
|
|
73
|
+
const create = async (data, params) => {
|
|
74
|
+
const url = `${this.getUrl()}/${orgId}/pins${this.getUrlParams(
|
|
75
|
+
params
|
|
76
|
+
)}`;
|
|
77
|
+
|
|
78
|
+
return await this.post(url, data);
|
|
79
|
+
};
|
|
80
|
+
|
|
75
81
|
return {
|
|
76
82
|
all,
|
|
77
83
|
single,
|
|
84
|
+
create,
|
|
78
85
|
};
|
|
79
86
|
}
|
|
80
87
|
|
package/src/endpoints/pins.js
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from "../helpers/api";
|
|
2
2
|
|
|
3
3
|
class PinsApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = "pins";
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
evidence(pinId) {
|
|
10
|
-
const all = async (
|
|
11
|
-
const url = `${this.getUrl()}/${pinId}/evidence
|
|
12
|
-
|
|
10
|
+
const all = async (params) => {
|
|
11
|
+
const url = `${this.getUrl()}/${pinId}/evidence${this.getUrlParams(
|
|
12
|
+
params
|
|
13
13
|
)}`;
|
|
14
|
+
|
|
14
15
|
return await this.get(url);
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
const attach = async (formData, params) => {
|
|
19
|
+
const url = `${this.getUrl()}/${pinId}/evidence${this.getUrlParams(
|
|
20
|
+
params
|
|
21
|
+
)}`;
|
|
22
|
+
|
|
23
|
+
return await this.post(url, formData);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return { all, attach };
|
|
18
27
|
}
|
|
19
28
|
}
|
|
20
29
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
|
+
|
|
3
|
+
class SensorsApi extends Api {
|
|
4
|
+
constructor(resource) {
|
|
5
|
+
super(resource);
|
|
6
|
+
this.resource = 'sensors';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
sensorTypes() {
|
|
10
|
+
const all = async (args) => {
|
|
11
|
+
const params = {
|
|
12
|
+
...args,
|
|
13
|
+
orgless: true,
|
|
14
|
+
};
|
|
15
|
+
const url = `${this.getUrl()}/sensor-types/${this.getUrlParams(params)}`;
|
|
16
|
+
|
|
17
|
+
return await this.get(url);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
all,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Sensors = new SensorsApi();
|