Please note that this SDK is deprecated and is no longer officially supported by Lyft.
lyft-go-sdk is a Go client library for accessing the Lyft API.
- You must first create a Lyft Developer account here.
- Once registered, create a new application here.
- Your new application will be assigned a Client ID and Client Secret (for use with two- or three-legged OAuth) and a Client Token (for use with public endpoints that don't require user context).
go get github.com/lyft/lyft-go-sdk/lyft
The lyft
package provides a Client
for accessing the Lyft API. Authentication is handled by the http.Client
passed to NewAPIClient
to handle OAuth2. The Lyft API uses the Client Credentials grant for public endpoints and the Authorization Code grant for endpoints that require a user context; see example for the former and the latter.
client := lyft.NewAPIClient(httpClient, "my-sample-app")
// Get a list of rides taken by the authenticated user within the past 30 days.
result, resp, err := client.UserApi.GetRides(time.Now().AddDate(0, 0, -30), nil)
// Get driver ETA for the specified location.
result, _, err := client.PublicApi.GetETA(37.7763, -122.3918, nil)
// Preset Prime Time to 25% in the specified location.
resp, err := client.SandboxApi.SetPrimeTime(lyft.SandboxPrimetime{
Lat: 37.7884,
Lng: -122.4076,
PrimetimePercentage: "25%",
})
All URIs are relative to https://api.lyft.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
PublicApi | GetCost | Get /cost | Cost estimates |
PublicApi | GetDrivers | Get /drivers | Available drivers nearby |
PublicApi | GetETA | Get /eta | Pickup ETAs |
PublicApi | GetRideTypes | Get /ridetypes | Types of rides |
SandboxApi | SetPrimeTime | Put /sandbox/primetime | Preset Prime Time percentage |
SandboxApi | SetRideStatus | Put /sandbox/rides/{id} | Propagate ride through ride status |
SandboxApi | SetRideTypeAvailability | Put /sandbox/ridetypes/{ride_type} | Driver availability for processing ride request |
SandboxApi | SetRideTypes | Put /sandbox/ridetypes | Preset types of rides for sandbox |
UserApi | CancelRide | Post /rides/{id}/cancel | Cancel a ongoing requested ride |
UserApi | GetProfile | Get /profile | The user's general info |
UserApi | GetRide | Get /rides/{id} | Get the ride detail of a given ride ID |
UserApi | GetRideReceipt | Get /rides/{id}/receipt | Get the receipt of the rides. |
UserApi | GetRides | Get /rides | List rides |
UserApi | NewRide | Post /rides | Request a Lyft |
UserApi | SetRideDestination | Put /rides/{id}/destination | Update the destination of the ride |
UserApi | SetRideRating | Put /rides/{id}/rating | Add the passenger's rating, feedback, and tip |
- ApiError
- CancellationCost
- CancellationCostError
- CancellationRequest
- Charge
- Cost
- CostEstimate
- CostEstimateResponse
- CurrentRideLocation
- DriverDetail
- ErrorDetail
- Eta
- EtaEstimateResponse
- LatLng
- LineItem
- Location
- NearbyDriver
- NearbyDriversByRideType
- NearbyDriversResponse
- PassengerDetail
- PickupDropoffLocation
- PricingDetails
- Profile
- RatingRequest
- Ride
- RideDetail
- RideLocation
- RideProfileEnum
- RideReceipt
- RideRequest
- RideRequestError
- RideStatusEnum
- RideType
- RideTypeEnum
- RideTypeEnumWithOther
- RideTypesResponse
- RidesResponse
- SandboxDriverAvailability
- SandboxPrimetime
- SandboxRideStatus
- SandboxRideType
- SandboxRideUpdate
- Tip
- TipParams
- UserDetail
- VehicleDetail
If you're looking for help configuring or using the SDK, or if you have general questions related to our APIs, the Lyft Developer Platform team provides support through our forum as well as on Stack Overflow (using the lyft-api
tag).
If you've found a vulnerability or a potential vulnerability in the Lyft Go SDK, please let us know at security@lyft.com. We'll send a confirmation email to acknowledge your report, and we'll send an additional email when we've identified the issue positively or negatively.