-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.go
37 lines (29 loc) · 744 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"context"
"github.com/lyft/lyft-go-sdk/lyft"
"log"
"github.com/davecgh/go-spew/spew"
"golang.org/x/oauth2/clientcredentials"
)
func main() {
config := clientcredentials.Config{
ClientID: "YOUR-CLIENT-ID",
ClientSecret: "YOUR-CLIENT-SECRET",
TokenURL: "https://api.lyft.com/oauth/token",
Scopes: []string{"public"},
}
httpClient := config.Client(context.Background())
client := lyft.NewAPIClient(httpClient, "sample-app")
opt := map[string]interface{}{
"endLat": 37.7884,
"endLng": -122.4076,
"rideType": string(lyft.RideTypeLyft),
}
result, _, err := client.PublicApi.GetCost(37.7763, -122.3918, opt)
if err != nil {
log.Fatal(err)
} else {
spew.Dump(result)
}
}