Skip to content

Latest commit

 

History

History
106 lines (69 loc) · 2.71 KB

README.md

File metadata and controls

106 lines (69 loc) · 2.71 KB

Baato Go Client

Build Documentation License Release tag

Baato Go Client Logo

Go client to consume Baato APIs easily.

Initialization

// Import core APIs
import (
	baato "github.com/baato/baato-go-client/lib"
	geocode "github.com/baato/baato-go-client/lib/geocode"
)

// initialize Baato core module
accessToken := "YOUR BAATO ACCESS TOKEN HERE" // Get Baato token from environment
baatoMap := baato.Baato(accessToken)

Available APIs

  • Geocoding (Search) API
  • ReverseGeocoding (Reverse Search) API
  • Nearby Features API
  • Directions API

Usage

For a detailed usage instructions, please visit documentation for the Baato-Go-Client avaiable here. Quick usage examples are shown here.

Geocode (Search) API

// intialize geocoding request options
var geocodingRequest = geocode.GeocodeRequestOptions{
	Q:     "do",
	Limit: 5,
}

geocode, _ := baatoMap.Geocode.GetGeocode(geocodingRequest)

fmt.Println(geocode.Data)

ReverseGeocode (Reverse Search) API

// intialize reverse geocoding request options
var reverseGeocodingRequest = reversegeocode.ReverseGeocodeRequestOptions{
	Lat: 27.717728723291803,
	Lon: 85.32784938812257,
}

reverseGeocode, _ := baatoMap.ReverseGeocode.GetReverseGeocode(reverseGeocodingRequest)

fmt.Println(reverseGeocode.Data)

Nearby Places API

You can use this API to get nearby places around a point that is interesting for you. For a complete list of supported type of places, please see the docs.

// intialize nearby places request options
var nearbyPlacesRequest = nearby.NearbyPlacesRequestOptions{
	Type: "eat",
	Lat:  27.717728723291803,
	Lon:  85.32784938812257,
}

nearbyplaces, _ := baatoMap.NearbyPlaces.GetNearbyPlaces(nearbyPlacesRequest)

fmt.Println(nearbyplaces.Data)

Directions API

// intialize directions request options. PointsArray represents points that we should pass through.
directionsRequest := directions.DirectionsRequestOptions{
	PointsArray: []string{"27.6733433,85.2763307", "27.67444444,85.28047222"},
	Mode:        "bike",
}

directions, _ := baatoMap.Directions.GetDirections(directionsRequest)

fmt.Println(directions.Data)

Contribution

You can contribute in many ways (development, issue/bug reporting, feature request, etc.)