@veritree/services 2.52.0 → 2.54.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
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.52.0",
3
+ "version": "2.54.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,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();
@@ -134,6 +134,27 @@ class SponsorsApi extends Api {
134
134
  all,
135
135
  };
136
136
  }
137
+
138
+ pins(orgId) {
139
+ const all = async (params) => {
140
+ const url = `${this.getUrl()}/${orgId}/pins/${this.getUrlParams(params)}`;
141
+
142
+ return await this.get(url);
143
+ };
144
+
145
+ const single = async (pinId, params) => {
146
+ const url = `${this.getUrl()}/${orgId}/pins/${pinId}${this.getUrlParams(
147
+ params
148
+ )}`;
149
+
150
+ return await this.get(url);
151
+ };
152
+
153
+ return {
154
+ all,
155
+ single,
156
+ };
157
+ }
137
158
  }
138
159
 
139
160
  export const Sponsors = new SponsorsApi();