mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-16 13:04:34 +00:00
EV Chargers service (#219)
This commit is contained in:
4
examples/evchargers/referenceData/curl/getReferenceData.sh
Executable file
4
examples/evchargers/referenceData/curl/getReferenceData.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
curl "https://api.m3o.com/v1/evchargers/ReferenceData" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{}'
|
||||
14
examples/evchargers/referenceData/go/getReferenceData.go
Executable file
14
examples/evchargers/referenceData/go/getReferenceData.go
Executable file
@@ -0,0 +1,14 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/evchargers"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Retrieve reference data as used by this API
|
||||
func GetReferenceData() {
|
||||
evchargersService := evchargers.NewEvchargersService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
12
examples/evchargers/referenceData/node/getReferenceData.js
Executable file
12
examples/evchargers/referenceData/node/getReferenceData.js
Executable file
@@ -0,0 +1,12 @@
|
||||
import * as evchargers from "m3o/evchargers";
|
||||
|
||||
// Retrieve reference data as used by this API
|
||||
async function GetReferenceData() {
|
||||
let evchargersService = new evchargers.EvchargersService(
|
||||
process.env.MICRO_API_TOKEN
|
||||
);
|
||||
let rsp = await evchargersService.referenceData({});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await GetReferenceData();
|
||||
16
examples/evchargers/search/curl/searchByBoundingBox.sh
Executable file
16
examples/evchargers/search/curl/searchByBoundingBox.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
curl "https://api.m3o.com/v1/evchargers/Search" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"box": {
|
||||
"bottom_left": {
|
||||
"latitude": 51.52627543859447,
|
||||
"longitude": -0.03635349400295168
|
||||
},
|
||||
"top_right": {
|
||||
"latitude": 51.56717121807993,
|
||||
"longitude": -0.002293530559768285
|
||||
}
|
||||
},
|
||||
"max_results": 2
|
||||
}'
|
||||
11
examples/evchargers/search/curl/searchByLocation.sh
Executable file
11
examples/evchargers/search/curl/searchByLocation.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
curl "https://api.m3o.com/v1/evchargers/Search" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"distance": 2000,
|
||||
"location": {
|
||||
"latitude": 51.53336351319885,
|
||||
"longitude": -0.0252
|
||||
},
|
||||
"max_results": 2
|
||||
}'
|
||||
14
examples/evchargers/search/curl/searchWithFiltersFastChargersOnly.sh
Executable file
14
examples/evchargers/search/curl/searchWithFiltersFastChargersOnly.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
curl "https://api.m3o.com/v1/evchargers/Search" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"distance": 2000,
|
||||
"levels": [
|
||||
"3"
|
||||
],
|
||||
"location": {
|
||||
"latitude": 51.53336351319885,
|
||||
"longitude": -0.0252
|
||||
},
|
||||
"max_results": 2
|
||||
}'
|
||||
16
examples/evchargers/search/go/searchByBoundingBox.go
Executable file
16
examples/evchargers/search/go/searchByBoundingBox.go
Executable file
@@ -0,0 +1,16 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/evchargers"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Search by giving a coordinate and a max distance, or bounding box and optional filters
|
||||
func SearchByBoundingBox() {
|
||||
evchargersService := evchargers.NewEvchargersService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
|
||||
Box: &evchargers.BoundingBox{},
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
20
examples/evchargers/search/go/searchByLocation.go
Executable file
20
examples/evchargers/search/go/searchByLocation.go
Executable file
@@ -0,0 +1,20 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/evchargers"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Search by giving a coordinate and a max distance, or bounding box and optional filters
|
||||
func SearchByLocation() {
|
||||
evchargersService := evchargers.NewEvchargersService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
|
||||
Distance: 2000,
|
||||
Location: &evchargers.Coordinates{
|
||||
Latitude: 51.53336351319885,
|
||||
Longitude: -0.0252,
|
||||
},
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
21
examples/evchargers/search/go/searchWithFiltersFastChargersOnly.go
Executable file
21
examples/evchargers/search/go/searchWithFiltersFastChargersOnly.go
Executable file
@@ -0,0 +1,21 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/evchargers"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Search by giving a coordinate and a max distance, or bounding box and optional filters
|
||||
func SearchWithFiltersFastChargersOnly() {
|
||||
evchargersService := evchargers.NewEvchargersService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
|
||||
Distance: 2000,
|
||||
Levels: []string{"3"},
|
||||
Location: &evchargers.Coordinates{
|
||||
Latitude: 51.53336351319885,
|
||||
Longitude: -0.0252,
|
||||
},
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
24
examples/evchargers/search/node/searchByBoundingBox.js
Executable file
24
examples/evchargers/search/node/searchByBoundingBox.js
Executable 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();
|
||||
19
examples/evchargers/search/node/searchByLocation.js
Executable file
19
examples/evchargers/search/node/searchByLocation.js
Executable 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();
|
||||
20
examples/evchargers/search/node/searchWithFiltersFastChargersOnly.js
Executable file
20
examples/evchargers/search/node/searchWithFiltersFastChargersOnly.js
Executable 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();
|
||||
Reference in New Issue
Block a user