ryankurte / go-mapbox

Golang Mapbox API module
MIT License
38 stars 20 forks source link

Allow user to provide anotations in query params #28

Open gwuah opened 4 years ago

gwuah commented 4 years ago

Currently, the matrix module only returns durations. But there's an option to also return distances. (https://docs.mapbox.com/api/navigation/#matrix)

So a fix would be to extend request opts to this

type RequestOpts struct {
    Sources      string `url:"sources,omitempty"`
    Destinations string `url:"destinations,omitempty"`
    Annotations string `url:"annotations,omitempty"`
}

and then add setters for annotations. (setSources, setDestinations, setAnnotation) ..

I'm ready to submit a pr, I just need you to confirm if this is a feature you'd wan't to merge.

ryankurte commented 4 years ago

sounds good to me! if it's possible it'd be great to add a test for each variant of this, and looks like we'd also need a Distances field on the DirectionMatrixResponse here to receive both results.