Skip to content

Latest commit

 

History

History
356 lines (284 loc) · 17.4 KB

api.md

File metadata and controls

356 lines (284 loc) · 17.4 KB

Objects

flywheel : object

The flywheeljs library main exported object

Typedefs

SignupPromise : object

The type of the object returned with a successfully resolved signup promise.

SearchPromise : object

The type of the object returned with a successfully resolved search promise.

LoginPromise : object

The type of the object returned with a successfully resolved login promise.

ApplicationContextPromise : object

The type of the object returned with a successfully resolved application context promise. I added a question mark on those properties that are not clear to me.

UserInfoPromise : object

The type of the object returned with a successfully resolved user info promise. I added a question mark on those properties that are not clear to me.

ETAPromise : object

The type of the object returned with a successfully resolved search promise.

RidePromise : object

The type of the object returned with a successfully resolved ride promise. It includes a lot of properties, only the most interesting ones are documented here.

flywheel : object

The flywheeljs library main exported object

Kind: global namespace

flywheel.signup(options) ⇒ Promise

Sign up a new user for the Flywheel service

Kind: static method of flywheel
Returns: Promise - A promise that returns SignupPromise if resolved and an object containing the error if rejected.

Param Type Default Description
options object Options object parameter
options.firstName string Flywheel user first name
options.email string Flywheel user email
options.password string Flywheel user password
options.telephone string Flywheel user phone number
[options.latitude] number 0 Default latitude (in degrees). This value can be overriden when ordering a cab
[options.longitude] number 0 Default longitude (in degrees). This value can be overriden when ordering a cab

Example

flywheel.signup({
  firstName: 'John',
  email: 'john@doe.com',
  password: 'johndoe123',
  telephone: '123123123',
  latitude: 37.615223,
  longitude: -122.389977
})
.then(response => {
  console.log(response.data.passenger);
})
.catch(response => {
  console.log(response.data.error);
});

flywheel.search(options) ⇒ Promise

Search for cabs around a given position

Kind: static method of flywheel
Returns: Promise - A promise that returns SearchPromise if resolved and an object containing the error if rejected.

Param Type Default Description
options object Options object parameter
[options.by] string "'location'" The field to search by
[options.filter] string "'hailable'" A filter to be applied to the search request
[options.latitude] number 0 Default latitude (in degrees) used when ordering cabs
[options.longitude] number 0 Default longitude (in degrees) used when ordering cabs
[options.authToken] number '(null)' User authentication token (if she's logged)

flywheel.login(options) ⇒ Promise

Login a user

Kind: static method of flywheel
Returns: Promise - A promise that returns LoginPromise if resolved and an object containing the error if rejected.

Param Type Description
options object Options object parameter
options.email string The user email
options.password string The user password

flywheel.applicationContext(options) ⇒ Promise

Get some application context data given a specific location.

Kind: static method of flywheel
Returns: Promise - A promise that returns ApplicationContextPromise if resolved and an object containing the error if rejected.

Param Type Description
options object Options object parameter
options.authToken string An authentication token
options.latitude number A given latitude (in degrees) used when ordering cabs
options.longitude number A given longitude (in degrees) used when ordering cabs

flywheel.userInfo(options) ⇒ Promise

Get user info

Kind: static method of flywheel
Returns: Promise - A promise that returns UserInfoPromise if resolved and an object containing the error if rejected.

Param Type Description
options object Options object parameter
options.userId string The user id. It can be obtained from the 'passenger' object after logging in
options.authToken string The authentication token

flywheel.eta(options) ⇒ Promise

Get estimated time of arrival

Kind: static method of flywheel
Returns: Promise - A promise that returns ETAPromise if resolved and an object containing the error if rejected.

Param Type Description
options object Options object parameter
options.origin string The user id. It can be obtained from the 'passenger' object after logging in)
options.authToken string The authentication token

flywheel.createRide(options) ⇒ Promise

Create a new request for a ride

Kind: static method of flywheel
Returns: Promise - A promise that returns RidePromise if resolved and an object containing the error if rejected.

Param Type Description
options object Options object parameter
options.pickUpLat number Pickup latitude (in degrees)
options.pickUpLon number Pickup latitude (in degrees)
options.address string The pickup address, for example: "22 Estate Ct". Use some geocoding service like google maps to obtain it: http://maps.googleapis.com/maps/api/geocode/json?address=<user_typed_address>
options.state string The state short name, for example: "CA". Use some geocoding service like google maps to obtain it: http://maps.googleapis.com/maps/api/geocode/json?address=<user_typed_address>
options.country string The country name, for example: "United States". Use some geocoding service like google maps to obtain it: http://maps.googleapis.com/maps/api/geocode/json?address=<user_typed_address>
options.city string The city name, for example: "South San Francisco". Use some geocoding service like google maps to obtain it: http://maps.googleapis.com/maps/api/geocode/json?address=<user_typed_address>
options.passenger object The passenger object. Only 'name' (string) and 'telephone' (string) are required
options.serviceAvailabilitiesId string The service id. It can be obtained using applicationContext()
options.tip number The ride tip (in cents)
options.authToken string The authentication token
options.notes string Any notes to be sent to the cab driver

flywheel.getRideStatus(options) ⇒ Promise

Get the status of a specific ride

Kind: static method of flywheel
Returns: Promise - A promise that returns RidePromise if resolved and an object containing the error if rejected.

Param Type Description
options object Options object parameter
options.rideId number The ride id
options.authToken number The authentication token

flywheel.cancelRide(options) ⇒ Promise

Cancel a specific ride

Kind: static method of flywheel
Returns: Promise - A promise that returns RidePromise if resolved and an object containing the error if rejected.

Param Type Description
options object Options object parameter
options.rideId number The ride id
options.authToken number The authentication token

SignupPromise : object

The type of the object returned with a successfully resolved signup promise.

Kind: global typedef
Properties

Name Type Description
auth_token string The token that can be used to authenticate future requests
passenger object An object including the user information. Some relevant fields are: id, first_name, last_name, and email.

SearchPromise : object

The type of the object returned with a successfully resolved search promise.

Kind: global typedef
Properties

Name Type Description
drivers array An array containing the drivers available at that location. Some relevant fields are: id, vehicle, latitude and longitude.

LoginPromise : object

The type of the object returned with a successfully resolved login promise.

Kind: global typedef
Properties

Name Type Description
auth_token string The token that can be used to authenticate future requests
passenger object An object including the user information. Some relevant fields are: id, first_name, last_name, and email.
scheduled_rides object An array containing the user scheduled rides

ApplicationContextPromise : object

The type of the object returned with a successfully resolved application context promise. I added a question mark on those properties that are not clear to me.

Kind: global typedef
Properties

Name Type Description
service_availabilities array An array of the services available at the given location. The service 'id' parameter is required for other requests (createRide, for example)
on_board_cancellation_window object The amount of time (in secs) allowed to cancel a ride without being charged
application_details object Some applications details, like the url on the app store
flywheel_service_fee number The fee charged by flywheel (in cents)
hailing_distance number Max hailing distance in meters (?)
maximum_hail_time number Max hail time in secs (before a request fails?)
straight_line_approximation_speed number ?
points_of_interest array ?
alerts array ?
on_board_cancellation_window number The amount of time (in secs) where a cancellation is not charged (?)
gps_warning_distance number ?
preferred_eta_provider string ?
booked_ride_countdown_window number ?
invite_friends object Referral rewards (in cents)
time_zone_identifier string Time zone
utc_offset number Offset (in secs) from UTC time
share_eta_msg string Some string used in the app UI
enable_asking_point bool ?

UserInfoPromise : object

The type of the object returned with a successfully resolved user info promise. I added a question mark on those properties that are not clear to me.

Kind: global typedef
Properties

Name Type Description
id string The user (passenger) id
first_name string The user first name
last_name string The user last name
email string The user email
has_dummy_email bool True if the user has a dummy email (whatever that might mean)
telephone string The user telephone
canonical_telephone string ?
addresses array The user addresses
mobile_devices array The user mobile devices
dispatch_service_accounts array ?
default_tip_percent number Default tip percentage
credit_balance number ?
credits_since_last_session number ?
payment_instruments array The payment instruments linked to this user. The payment object contains a property token that is required for creating rides
payment_instruments_count number Number of payment instruments
latest_ride_id string Latest ride id
referral_code string Referral code for this user
latest_ride_id string Latest ride id
nonfatal_errors array ?
disabled_features array ?
oauth_id string ?
oauth_provider string I guess Google, FB, etc.
sms_verification_required bool ?
is_agent_also bool ?
added_by string ?
special_characteristics array ?
ivr_blocked bool ?
newly_added bool ?
suspended_upto object ?

ETAPromise : object

The type of the object returned with a successfully resolved search promise.

Kind: global typedef
Properties

Name Type Description
status string "OK" if the location can be reached
response array An array that contains at least one object with the estimated durations. It has the following properties: 'duration' (in secs), 'duration_in_traffic' (in secs) and 'distance'

RidePromise : object

The type of the object returned with a successfully resolved ride promise. It includes a lot of properties, only the most interesting ones are documented here.

Kind: global typedef
Properties

Name Type Description
id string The ride id
notes string The notes attached to the ride, created by the user
status string hailing if the ride is still to be assigned, hail_accepted if a cab driver accepted the ride, canceled if it's been canceled
failure_reason string The reason why the ride failed, if any
client_created_at string Formatted creation date
created_at number Creation timestamp
updated_at number The reason why the ride failed
passenger object An object with the same structure than UserInfoPromise
pick_up_location object Pick up location
drop_off_location object Drop off location (can be empty)
hail object This object contains all details about the hail, including the driver information
payment_instrument object The payment instrument used to pay for this ride