mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 18:44:26 +00:00
128 lines
2.6 KiB
Markdown
Executable File
128 lines
2.6 KiB
Markdown
Executable File
# Evchargers
|
|
|
|
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/evchargers/api](https://m3o.com/evchargers/api).
|
|
|
|
Endpoints:
|
|
|
|
## ReferenceData
|
|
|
|
Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
|
|
|
|
|
[https://m3o.com/evchargers/api#ReferenceData](https://m3o.com/evchargers/api#ReferenceData)
|
|
|
|
```go
|
|
package example
|
|
|
|
import(
|
|
"fmt"
|
|
"os"
|
|
|
|
"go.m3o.com/evchargers"
|
|
)
|
|
|
|
// Retrieve reference data as used by this API and in conjunction with the Search endpoint
|
|
func GetReferenceData() {
|
|
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
|
rsp, err := evchargersService.ReferenceData(&evchargers.ReferenceDataRequest{
|
|
|
|
})
|
|
fmt.Println(rsp, err)
|
|
|
|
}
|
|
```
|
|
## Search
|
|
|
|
Search by giving a coordinate and a max distance, or bounding box and optional filters
|
|
|
|
|
|
[https://m3o.com/evchargers/api#Search](https://m3o.com/evchargers/api#Search)
|
|
|
|
```go
|
|
package example
|
|
|
|
import(
|
|
"fmt"
|
|
"os"
|
|
|
|
"go.m3o.com/evchargers"
|
|
)
|
|
|
|
// Search by giving a coordinate and a max distance, or bounding box and optional filters
|
|
func SearchByLocation() {
|
|
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
|
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
|
|
Distance: 2000,
|
|
Location: &evchargers.Coordinates{
|
|
Latitude: 51.53336351319885,
|
|
Longitude: -0.0252,
|
|
},
|
|
|
|
})
|
|
fmt.Println(rsp, err)
|
|
|
|
}
|
|
```
|
|
## Search
|
|
|
|
Search by giving a coordinate and a max distance, or bounding box and optional filters
|
|
|
|
|
|
[https://m3o.com/evchargers/api#Search](https://m3o.com/evchargers/api#Search)
|
|
|
|
```go
|
|
package example
|
|
|
|
import(
|
|
"fmt"
|
|
"os"
|
|
|
|
"go.m3o.com/evchargers"
|
|
)
|
|
|
|
// Search by giving a coordinate and a max distance, or bounding box and optional filters
|
|
func SearchByBoundingBox() {
|
|
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_API_TOKEN"))
|
|
rsp, err := evchargersService.Search(&evchargers.SearchRequest{
|
|
Box: &evchargers.BoundingBox{
|
|
},
|
|
|
|
})
|
|
fmt.Println(rsp, err)
|
|
|
|
}
|
|
```
|
|
## Search
|
|
|
|
Search by giving a coordinate and a max distance, or bounding box and optional filters
|
|
|
|
|
|
[https://m3o.com/evchargers/api#Search](https://m3o.com/evchargers/api#Search)
|
|
|
|
```go
|
|
package example
|
|
|
|
import(
|
|
"fmt"
|
|
"os"
|
|
|
|
"go.m3o.com/evchargers"
|
|
)
|
|
|
|
// Search by giving a coordinate and a max distance, or bounding box and optional filters
|
|
func SearchWithFiltersFastChargersOnly() {
|
|
evchargersService := evchargers.NewEvchargersService(os.Getenv("M3O_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)
|
|
|
|
}
|
|
```
|