Files
m3o-go/examples/evchargers/README.md
2022-01-28 11:38:06 +00:00

2.6 KiB
Executable File

Evchargers

An m3o.com API. For example usage see 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

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 by giving a coordinate and a max distance, or bounding box and optional filters

https://m3o.com/evchargers/api#Search

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

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

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)
	
}