Open odeke-em opened 7 years ago
So in regards to the trip experiences, checklist of already implemented features:
[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)
}
}
}
All the necessary methods have been implemented, now what's needed is an app to glue all the pieces together simple ideas:
The trip experiences API allows Uber to send contextual information about the user, for example: