Skip to content

kamlendrachauhan/uber-api-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang SDK for the Uber API

GoDoc Build Status

This package provides an SDK for use with the Uber API. Currently, the following API endpoints are supported:

  • Products
  • Price Estimates
  • Time Estimates

OAuth support for user profile and past activity access is forthcoming.

Prior to use, you'll need to need to register an application in the Uber developer portal and obtain the appropriate tokens and keys. More information about the Uber API can be found here: https://developer.uber.com/.

Usage

Full usage info can be found in the godocs.

A sample client has been included with this source that demonstrates its usage. The package import path is github.com/anweiss/uber-api-golang/uber. The package requires the creation of a Client type with a set of RequestOptions. The RequestOptions type holds the token and OAuth parameters.

import "github.com/anweiss/uber-api-golang/uber"

var options uber.RequestOptions{
  ServerToken: SERVER_TOKEN
  ClientId: CLIENT_ID
  ...
}

client := uber.Create(&options)

Retrieving Products

You can retrieve product endpoints by creating a variable which will hold the endpoint's type and required properties and pass the object Client.Get()

pl := &uber.Products{}
pl.Latitude = LAT
pl.Longitude = LONG
if e := client.Get(p1); e != nil {
  log.Fatal(e)
}

The products are retrieved and stored in the Products property.

fmt.Println("Here are the Uber options available for your area: \n")
for _, product := range pl.Products {
  fmt.Println(product.DisplayName + ": " + product.Description)
}

About

Golang SDK for the Uber API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages