@datafire/lyft

DataFire integration for Lyft

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@datafire/lyft
133316.0.03 years ago7 years agoMinified + gzip package size for @datafire/lyft in KB

Readme

@datafire/lyft
Client library for Lyft

Installation and Usage

npm install --save @datafire/lyft
let lyft = require('@datafire/lyft').create({
  access_token: "",
  refresh_token: "",
  client_id: "",
  client_secret: "",
  redirect_uri: ""
});

.then(data => {
  console.log(data);
});

Description

Drive your app to success with Lyft's API

Actions

oauthCallback

Exchange the code passed to your redirect URI for an accesstoken
lyft.oauthCallback({
  "code": ""
}, context)

Input

  • input object
code required string

Output

  • output object
access
token string refreshtoken string tokentype string scope string expiration string

oauthRefresh

Exchange a refresh
token for an accesstoken
lyft.oauthRefresh(null, context)

Input

This action has no parameters

Output

  • output object
accesstoken string refreshtoken string tokentype string scope string expiration string

GetCost

Estimate the cost of taking a Lyft between two points.
lyft.GetCost({
  "start_lat": 0,
  "start_lng": 0
}, context)

Input

  • input object
ridetype string (values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): ID of a ride type start
lat required number: Latitude of the starting location
start
lng required number: Longitude of the starting location
end
lat number: Latitude of the ending location
end
lng number: Longitude of the ending location

Output

  • output object
cost
estimates array
* items [CostEstimate](#costestimate)

GetDrivers

The drivers endpoint returns a list of nearby drivers' lat and lng at a given location.
lyft.GetDrivers({
  "lat": 0,
  "lng": 0
}, context)

Input

  • input object
lat required number: Latitude of a location lng required number: Longitude of a location

Output

  • output object
nearbydrivers array
* items [NearbyDriversByRideType](#nearbydriversbyridetype)

GetETA

The ETA endpoint lets you know how quickly a Lyft driver can come get you
lyft.GetETA({
  "lat": 0,
  "lng": 0
}, context)

Input

  • input object
lat required number: Latitude of a location lng required number: Longitude of a location destinationlat number: Latitude of destination location destinationlng number: Longitude of destination location ridetype string (values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): ID of a ride type

Output

  • output object
eta
estimates array
* items [Eta](#eta)

GetProfile

The v1 of this endpoint returns the user's ID, v2 will return more general info about the user. We require authentication for this endpoint, so we extract the user ID from the access token.
lyft.GetProfile(null, context)

Input

This action has no parameters

Output

GetRides

Get a list of past & current rides for this passenger.
lyft.GetRides({
  "start_time": ""
}, context)

Input

  • input object
start
time required string: Restrict to rides starting after this point in time. The earliest supported date is 2015-01-01T00:00:00+00:00
end
time string: Restrict to rides starting before this point in time. The earliest supported date is 2015-01-01T00:00:00+00:00 limit integer: The maximum number of rides to return. The default limit is 10 if not specified. The maximum allowed value is 50, an integer greater that 50 will return at most 50 results.

Output

  • output object
ridehistory array
* items [RideDetail](#ridedetail)

NewRide

Request a Lyft come pick you up at the given location.
lyft.NewRide({
  "request": {
    "ride_type": "",
    "origin": {}
  }
}, context)

Input

  • input object
request required Ride

Output

GetRide

Get the status of a ride along with information about the driver, vehicle and price of a given ride ID
lyft.GetRide({
  "id": ""
}, context)

Input

  • input object
id required string: The ID of the ride

Output

CancelRide

Cancel a ongoing ride which was requested earlier by providing the ride id.
lyft.CancelRide({
  "id": ""
}, context)

Input

  • input object
id required string: The ID of the ride request CancellationRequest

Output

Output schema unknown

SetRideDestination

Add or update the ride's destination. Note that the ride must still be active (not droppedOff or canceled), and that destinations on Lyft Line rides can not be changed.
lyft.SetRideDestination({
  "id": "",
  "request": {}
}, context)

Input

  • input object
id required string: The ID of the ride request required Location

Output

SetRideRating

Add the passenger's 1 to 5 star rating of the ride, optional written feedback, and optional tip amount in minor units and currency. The ride must already be dropped off, and ratings must be given within 24 hours of drop off. For purposes of display, 5 is considered the default rating. When this endpoint is successfully called, payment processing will begin.
lyft.SetRideRating({
  "id": "",
  "request": null
}, context)

Input

  • input object
id required string: The ID of the ride request required RatingRequest

Output

Output schema unknown

GetRideReceipt

Get the receipt information of a processed ride by providing the ride id. Receipts will only be available to view once the payment has been processed. In the case of canceled ride, cancellation penalty is included if applicable.
lyft.GetRideReceipt({
  "id": ""
}, context)

Input

  • input object
id required string: The ID of the ride

Output

GetRideTypes

The ride types endpoint returns information about what kinds of Lyft rides you can request at a given location.
lyft.GetRideTypes({
  "lat": 0,
  "lng": 0
}, context)

Input

  • input object
lat required number: Latitude of a location lng required number: Longitude of a location ridetype string (values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): ID of a ride type

Output

  • output object
ridetypes array
* items [RideType](#ridetype)

SetPrimeTime

Preset a Prime Time percentage in the region surrounding the specified location. This Prime Time percentage will be applied when requesting cost, or when requesting a ride in sandbox mode.
lyft.SetPrimeTime({
  "request": null
}, context)

Input

  • input object
request required SandboxPrimetime

Output

Output schema unknown

SetRideStatus

Propagate a sandbox-ride through various ride status
lyft.SetRideStatus({
  "id": "",
  "request": null
}, context)

Input

  • input object
id required string: The ID of the ride request required SandboxRideStatus

Output

SetRideTypes

The sandbox-ridetypes endpoint allows you to preset the ridetypes in the region surrounding the specified latitude and longitude to allow testing different scenarios
lyft.SetRideTypes({
  "request": null
}, context)

Input

  • input object
request required SandboxRideType

Output

SetRideTypeAvailability

Set driver availability for the provided ridetype in the city/region surrounding the specified location
lyft.SetRideTypeAvailability({
  "ride_type": "",
  "request": null
}, context)

Input

  • input object
ridetype required string (values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv) request required SandboxDriverAvailability

Output

Output schema unknown

Definitions

ApiError

  • ApiError object: Details about why a request failed, such as missing or invalid parameters
error string: A "slug" that serves as the error code (eg. "badparameter") errordescription string: A user-friendly description of the error (appropriate to show to an end-user) errordetail array
* items [ErrorDetail](#errordetail)

CancellationCost

  • CancellationCost object
amount required integer: Total price of the ride currency required string: The ISO 4217 currency code for the amount (e.g. USD) description required string: The description for the cost token string: Token used to confirm the fee when cancelling a request tokenduration integer: How long, in seconds, before the token expires

CancellationCostError

  • CancellationCostError object
amount required integer: Total price of the ride currency required string: The ISO 4217 currency code for the amount (e.g. USD) description required string: The description for the cost token string: Token used to confirm the fee when cancelling a request tokenduration integer: How long, in seconds, before the token expires error string: A "slug" that serves as the error code (eg. "badparameter") errordescription string: A user-friendly description of the error (appropriate to show to an end-user) errordetail array
* items [ErrorDetail](#errordetail)

CancellationRequest

  • CancellationRequest object
cancelconfirmationtoken string: Token affirming the user accepts the cancellation fee. Required if a cancellation fee is in effect.

Charge

  • Charge object
amount required integer: The line item amount currency required string: The currency for the amount payment
method required string: The payment method display name.

Cost

  • Cost object
amount required integer: Total price of the ride currency required string: The ISO 4217 currency code for the amount (e.g. USD) description required string: The description for the cost

CostEstimate

  • CostEstimate object: A non-guaranteed estimate of price
costtoken string: A token that confirms the user has accepted current Prime Time and/or fixed price charges. See 'Request a Lyft' for more details currency string: The ISO 4217 currency code for the amount (e.g. 'USD') displayname string: A human readable description of the ride type estimated
costcentsmax integer: Estimated upper bound for trip cost, in minor units (cents). Estimates are not guaranteed, and only provide a reasonable range based on current conditions.
estimated
costcentsmin integer: Estimated lower bound for trip cost, in minor units (cents). Estimates are not guaranteed, and only provide a reasonable range based on current conditions.
estimated
distancemiles number: Estimated distance for this trip estimateddurationseconds integer: Estimated time to get from the start location to the end. isvalidestimate boolean: The validity of the cost estimate returned primetimeconfirmationtoken string: This token is needed when requesting rides. (Deprecated) primetimepercentage string: Current Prime Time Percentage. Prime Time adds a percentage to ride costs, prior to other applicable fees. When ride requests greatly outnumber available drivers, our system will automatically turn on Prime Time.
ride
type RideTypeEnum

CurrentRideLocation

  • CurrentRideLocation object
lat required number: The latitude component of a location lng required number: The longitude component of a location bearing number: Bearing of the driver's car in degrees

DriverDetail

  • DriverDetail object
firstname required string: The driver's first name imageurl required string: The driver's image url phonenumber required string: The driver's contact phone number. Must be E.164 formatted. rating required string: The driver's rating based in 0-5 scale userid required string: The driver's id

ErrorDetail

  • ErrorDetail object: An object with a single key-value pair, where the key is the name of the invalid parameter, and the value is a description of the error.
field
name string: description of the error

Eta

  • Eta object: Estimated Time of Arrival
display
name string: A human readable description of the ride type etaseconds integer: Estimated seconds for a driver to arrive etasecondsmax integer: Estimated upper bound of seconds for a driver to arrive isvalidestimate boolean: The validity of the ETA estimate returned ridetype RideTypeEnum

LatLng

  • LatLng object
lat required number: The latitude component of a location lng required number: The longitude component of a location

LineItem

  • LineItem object
amount required integer: The line item amount currency required string: The currency for the amount type required string: The line item display name for a charge item

Location

  • Location object
lat required number: The latitude component of a location lng required number: The longitude component of a location address string: A human readable address at/near the given location

NearbyDriver

  • NearbyDriver object
locations array: the lastest recorded driver locations up to 5 sorted in chronological order.
* items [LatLng](#latlng)

NearbyDriversByRideType

  • NearbyDriversByRideType object
drivers array: list of nearby drivers group by ride type sorted by eta
* items [NearbyDriver](#nearbydriver)
ridetype string: driver's ride type. if driver is eligable for several ride types, he will be duplicated.

PassengerDetail

  • PassengerDetail object
firstname required string: The passenger's first name imageurl required string: The passenger's profile image rating required string: The passenger's rating lastname string: The passenger's last name userid string: The passenger's lyft user id

PickupDropoffLocation

  • PickupDropoffLocation object
lat required number: The latitude component of a location lng required number: The longitude component of a location address string: A human readable address at/near the given location time string: Server time when the location object is created

PricingDetails

  • PricingDetails object
base
charge integer: The base charge of the trip
cancelpenaltyamount integer: The charge amount if cancel penalty is involved costminimum integer: The minimum charge for the trip costpermile integer: The cost per mile costperminute integer: The cost per minute currency string: The ISO 4217 currency code for the amount (e.g. USD) trustandservice integer: Service fee

Profile

  • Profile object: Represents the general information about a user.
firstname required string: The first name of this user hastakenaride required boolean: Indicates whether this user has taken at least one Lyft ride id required string: The unique ID of this user lastname required string: The last name of this user

RatingRequest

  • RatingRequest object: Rating and optional feedback and tip
feedback string: The passenger's written feedback about this ride rating required integer: The passenger's rating of this ride from 1 to 5 tip object: Tip amount in minor units and tip currency
* amount `integer`: A tip for the driver in cents. To be charged to the user's default charge account.
* currency `string`: The currency in which you want to tip. e.g. USD

Ride

  • Ride object: Represents a requested, ongoing, or finished Lyft ride
costtoken string: A token that confirms the user has accepted current Prime Time and/or fixed price charges destination object: The requested location for passenger drop off
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
origin required object: The requested location for passenger pickup
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
primetimeconfirmationtoken string: A token that confirms the user has accepted current primetime charges (Deprecated) ride
type required RideTypeEnum

RideDetail

  • RideDetail object: Detail information about a ride
beaconcolor string: Hex color code of the driver AMP device. cancancel array
* items `string` (values: driver, passenger, dispatcher): The array of actors who may cancel the ride at this point
canceledby string: The role of user who canceled the ride (if applicable) cancellationprice object: The cost of cancellation if there would be a penalty
* amount **required** `integer`: Total price of the ride
* currency **required** `string`: The ISO 4217 currency code for the amount (e.g. USD)
* description **required** `string`: The description for the cost
* token `string`: Token used to confirm the fee when cancelling a request
* token_duration `integer`: How long, in seconds, before the token expires
destination object: The requested location for passenger drop off
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* eta_seconds `integer`: Estimated seconds for a driver to pickup or reach destination based on ride status
distance
miles number: The distance, in miles, that this ride traveled. This field is only present after drop-off
driver DriverDetail
dropoff object: The actual location of passenger drop off
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* time `string`: Server time when the location object is created
durationseconds integer: Duration of the ride in seconds from pickup to drop-off. This field is only present after drop-off. feedback string: The written feedback the user left for this ride generatedat string: The request timestamp in date and time lineitems array: The break down of cost
* items [LineItem](#lineitem)
location object: The current location info of the ride
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* bearing `number`: Bearing of the driver's car in degrees
origin object: The requested location for passenger pickup
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* eta_seconds `integer`: Estimated seconds for a driver to pickup or reach destination based on ride status
passenger PassengerDetail
pickup object: The actual location of passenger pickup
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
* time `string`: Server time when the location object is created
price object: The total price for the current ride
* amount **required** `integer`: Total price of the ride
* currency **required** `string`: The ISO 4217 currency code for the amount (e.g. USD)
* description **required** `string`: The description for the cost
pricingdetailsurl string: The web view showing the pricing structure for the geographic area where the ride was taken primetimepercentage string: The Prime Time percentage applied to the base price rating integer: The rating the user left for this ride, from 1 to 5 requestedat string: The ride requested timestamp in date and time rideid string: The unique ID of this ride rideprofile object: Indicates whether the ride was requested from the business profile or personal profile of the user. ridetype RideTypeEnumWithOther routeurl string: The web view showing the passenger, driver, and route for this ride. This field will only be present for rides created through this API, or that have been shared through the "Share my Route" feature status RideStatusEnum vehicle VehicleDetail

RideLocation

  • RideLocation object
lat required number: The latitude component of a location lng required number: The longitude component of a location address string: A human readable address at/near the given location etaseconds integer: Estimated seconds for a driver to pickup or reach destination based on ride status

RideProfileEnum

  • RideProfileEnum string (values: personal, business): The payment profile which the user has picked for the ride

RideReceipt

  • RideReceipt object: Receipt information of a processed ride.
charges array: The break down of charge method
* items [Charge](#charge)
line
items array: The break down of line items
* items [LineItem](#lineitem)
price object: The total price for the current ride
* amount **required** `integer`: Total price of the ride
* currency **required** `string`: The ISO 4217 currency code for the amount (e.g. USD)
* description **required** `string`: The description for the cost
requestedat string: The ride requested timestamp in date and time rideid string: The unique ID of this ride rideprofile object: Indicates whether the ride was requested from the business profile or personal profile of the user.

RideRequest

  • RideRequest object: Minimal set of ride details
destination object: The requested location for passenger drop off
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
origin object: The requested location for passenger pickup
* lat **required** `number`: The latitude component of a location
* lng **required** `number`: The longitude component of a location
* address `string`: A human readable address at/near the given location
passenger PassengerDetail
rideid string: The ID of the requested ride status RideStatusEnum

RideRequestError

  • RideRequestError object: Details about why a request failed, such as missing or invalid parameters
costtoken string: A token that confirms the user has accepted current Prime Time and/or fixed price charges error required string: A "slug" that serves as the error code (eg. "badparameter") errordescription string: A user-friendly description of the error (appropriate to show to an end-user) errordetail array
* items [ErrorDetail](#errordetail)
erroruri string: When a user must go through another flow before requesting a ride, this URI specifies which flow to use (e.g. an account challenge flow in a web view) primetimeconfirmationtoken string: A token that confirms the user has accepted current Prime Time charges (Deprecated) primetimemultiplier number: Current Prime Time multiplier (eg. if primetimepercentage is 100%, primetimemultiplier will be 2.0) primetime
percentage string: Current Prime Time percentage
token
duration string: Validity of the token in seconds

RideStatusEnum

  • RideStatusEnum string (values: pending, accepted, arrived, pickedUp, droppedOff, canceled, scheduled, unknown): The status of the ride

RideType

  • RideType object
display
name string: A human readable description of the ride type
image
url string: The URL of an image representing this ride type
pricingdetails PricingDetails ridetype RideTypeEnum scheduledpricingdetails PricingDetails seats integer: The maximum number of seats available for rides requested with this ride type

RideTypeEnum

  • RideTypeEnum string (values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv): The ID of the ride type

RideTypeEnumWithOther

  • RideTypeEnumWithOther string (values: lyft, lyftline, lyftplus, lyftpremier, lyftlux, lyftluxsuv, other): The ID of the ride type

SandboxDriverAvailability

  • SandboxDriverAvailability object
driveravailability required boolean: The availability of driver in a region lat required number: The latitude component of a location lng required number: The longitude component of a location

SandboxPrimetime

  • SandboxPrimetime object
lat required number: The latitude component of a location lng required number: The longitude component of a location primetimepercentage required string: The Prime Time to be applied as a string, e.g., '25%'

SandboxRideStatus

  • SandboxRideStatus object
status required RideStatusEnum

SandboxRideType

  • SandboxRideType object
lat required number: The latitude component of a location lng required number: The longitude component of a location ridetypes required array
* items [RideTypeEnum](#ridetypeenum)

SandboxRideUpdate

  • SandboxRideUpdate object: Response when a sandbox ride is propagated through ride status
rideid string: The ID of the ride status RideStatusEnum

Tip

  • Tip object
amount integer: A tip for the driver in cents. To be charged to the user's default charge account. currency string: The currency in which you want to tip. e.g. USD

TipParams

  • TipParams object
amount integer: A tip for the driver in cents. To be charged to the user's default charge account. currency string: The currency in which you want to tip. e.g. USD

UserDetail

  • UserDetail object
firstname required string: The passenger's first name imageurl required string: The passenger's profile image rating required string: The passenger's rating

VehicleDetail

  • VehicleDetail object
color required string: The vehicle's color imageurl required string: The vehicle's image url licenseplate required string: The vehicle's license plate licenseplatestate required string: The vehicle's license plate state make required string: The vehicle's maker model required string: The vehicle's model year required integer: The vehicle's model year