uber
uber copied to clipboard
trip experiences: implement the trip experiences API
The trip experiences API allows Uber to send contextual information about the user, for example:
- How long they have left on their trip
- The current location of the Uber(where the user and driver are at the moment)
- Where the user is coming from and also going to Now that webhooks have been added with #30, it is now possible to implement a trip experiences app that say integrates with their:
- Nest app at home to turn on the thermostat
- Find local news
- Find tourist attractions nearby and make recommendations
So in regards to the trip experiences, checklist of already implemented features:
- [X] /GET authorize https://github.com/orijtech/uber/blob/5b520a38487c31ea637a308738e60594839e93d6/cmd/uber/main.go#L41-L71
- [X] /POST token https://github.com/orijtech/uber/blob/5b520a38487c31ea637a308738e60594839e93d6/cmd/uber/main.go#L41-L71 but implemented in https://github.com/orijtech/uber/blob/e28016ad9686c14fb3a8ebafb5d01e4a45095e6a/oauth2/oauth2.go#L189-L232
- [X] Ride products /GET me: Already implemented client.MyProfile
func Example_client_RetrieveMyProfile() {
client, err := uber.NewClient()
if err != nil {
log.Fatal(err)
}
myProfile, err := client.RetrieveMyProfile()
if err != nil {
log.Fatal(err)
}
fmt.Printf("Here is my profile: %#v\n", myProfile)
}
- [X] Ride products /GET History, already implemented
func Example_client_ListHistory() {
client, err := uber.NewClient()
if err != nil {
log.Fatal(err)
}
pagesChan, cancelPaging, err := client.ListHistory(&uber.Pager{
MaxPages: 4,
LimitPerPage: 10,
StartOffset: 0,
})
if err != nil {
log.Fatal(err)
}
for page := range pagesChan {
if page.Err != nil {
fmt.Printf("Page: #%d err: %v\n", page.PageNumber, page.Err)
continue
}
fmt.Printf("Page: #%d\n\n", page.PageNumber)
for i, trip := range page.Trips {
startCity := trip.StartCity
if startCity.Name == "Tokyo" {
fmt.Printf("aha found the first Tokyo trip, canceling any more requests!: %#v\n", trip)
cancelPaging()
break
}
// Otherwise, continue listing
fmt.Printf("Trip: #%d ==> %#v place: %#v\n", i, trip, startCity)
}
}
}
- [X] List products implemented by https://github.com/orijtech/uber/pull/39
- [X] ProductByID implemented by https://github.com/orijtech/uber/pull/39
- [X] Details of current trip
- [X] Request by ID
All the necessary methods have been implemented, now what's needed is an app to glue all the pieces together simple ideas:
- [ ] Linking up with a Phillips Hue bulb and turn it on on when the car approaches
- [ ] Implement Brad Fitzpatrick's garage door opener for Uber
- [ ] Link up with Nest