EV Chargers service (#219)

This commit is contained in:
Dominic Wong
2021-10-01 14:17:54 +01:00
committed by GitHub
parent 3c38d96881
commit f52cfba017
38 changed files with 14584 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
import * as evchargers from "m3o/evchargers";
// Search by giving a coordinate and a max distance, or bounding box and optional filters
async function SearchByBoundingBox() {
let evchargersService = new evchargers.EvchargersService(
process.env.MICRO_API_TOKEN
);
let rsp = await evchargersService.search({
box: {
bottom_left: {
latitude: 51.52627543859447,
longitude: -0.03635349400295168,
},
top_right: {
latitude: 51.56717121807993,
longitude: -0.002293530559768285,
},
},
max_results: 2,
});
console.log(rsp);
}
await SearchByBoundingBox();

View File

@@ -0,0 +1,19 @@
import * as evchargers from "m3o/evchargers";
// Search by giving a coordinate and a max distance, or bounding box and optional filters
async function SearchByLocation() {
let evchargersService = new evchargers.EvchargersService(
process.env.MICRO_API_TOKEN
);
let rsp = await evchargersService.search({
distance: 2000,
location: {
latitude: 51.53336351319885,
longitude: -0.0252,
},
max_results: 2,
});
console.log(rsp);
}
await SearchByLocation();

View File

@@ -0,0 +1,20 @@
import * as evchargers from "m3o/evchargers";
// Search by giving a coordinate and a max distance, or bounding box and optional filters
async function SearchWithFiltersFastChargersOnly() {
let evchargersService = new evchargers.EvchargersService(
process.env.MICRO_API_TOKEN
);
let rsp = await evchargersService.search({
distance: 2000,
levels: ["3"],
location: {
latitude: 51.53336351319885,
longitude: -0.0252,
},
max_results: 2,
});
console.log(rsp);
}
await SearchWithFiltersFastChargersOnly();