Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-10-29 06:38:17 +00:00
parent 87f310675d
commit ae73a4aca1
170 changed files with 6189 additions and 42 deletions

123
examples/evchargers/README.md Executable file
View File

@@ -0,0 +1,123 @@
# Evchargers
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Evchargers/api](https://m3o.com/Evchargers/api).
Endpoints:
## 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"
"github.com/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"
"github.com/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"
"github.com/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)
}
```
## 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"
"github.com/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)
}
```