Documentation ¶
Index ¶
- Constants
- Variables
- type ActionableError
- type ActivationStatus
- type Activity
- type Batch
- type Client
- func NewClient(tokens ...string) (*Client, error)
- func NewClientFromEnv() (*Client, error)
- func NewClientFromOAuth2File(tokenFilepath string) (*Client, error)
- func NewClientFromOAuth2Token(token *oauth2.Token) (*Client, error)
- func NewSandboxedClient(tokens ...string) (*Client, error)
- func NewSandboxedClientFromEnv() (*Client, error)
- func (c *Client) ActivitiesByID(id string, query url.Values) ([]*Activity, error)
- func (c *Client) ApplyPromoCode(promoCode string) (*PromoCode, error)
- func (c *Client) CancelDelivery(deliveryID string) error
- func (c *Client) CurrentTrip() (*Trip, error)
- func (c *Client) DriverProfile() (*Profile, error)
- func (c *Client) EnrollmentByID(id string) (*Enrollment, error)
- func (c *Client) Enrollments(query url.Values) ([]*Enrollment, error)
- func (c *Client) EstimatePrice(ereq *EstimateRequest) (pagesChan chan *PriceEstimatesPage, cancelPaging func(), err error)
- func (c *Client) EstimateTime(treq *EstimateRequest) (pagesChan chan *TimeEstimatesPage, cancelPaging func(), err error)
- func (c *Client) ListAllMyHistory() (thChan chan *TripThreadPage, cancelFn func(), err error)
- func (c *Client) ListDeliveries(dReq *DeliveryListRequest) (*DeliveryThread, error)
- func (c *Client) ListDriverPayments(dpq *DriverInfoQuery) (*DriverInfoResponse, error)
- func (c *Client) ListDriverTrips(dpq *DriverInfoQuery) (*DriverInfoResponse, error)
- func (c *Client) ListHistory(threq *Pager) (thChan chan *TripThreadPage, cancelFn func(), err error)
- func (c *Client) ListPaymentMethods() (*PaymentListing, error)
- func (c *Client) ListProducts(place *Place) ([]*Product, error)
- func (c *Client) OpenMapForTrip(tripID string) error
- func (c *Client) Place(placeName PlaceName) (*Place, error)
- func (c *Client) ProductByID(productID string) (*Product, error)
- func (c *Client) RequestDelivery(req *DeliveryRequest) (*Delivery, error)
- func (c *Client) RequestMap(tripID string) (*Map, error)
- func (c *Client) RequestReceipt(receiptID string) (*Receipt, error)
- func (c *Client) RequestRide(rreq *RideRequest) (*Ride, error)
- func (c *Client) RetrieveMyProfile() (*Profile, error)
- func (c *Client) Sandboxed() bool
- func (c *Client) SetBearerToken(token string)
- func (c *Client) SetHTTPRoundTripper(rt http.RoundTripper)
- func (c *Client) SetSandboxMode(sandboxed bool)
- func (c *Client) TripByID(id string) (*Trip, error)
- func (c *Client) UpdateEnrollmentByID(id string, update *EnrollmentUpdate) (*Enrollment, error)
- func (c *Client) UpdatePlace(pp *PlaceParams) (*Place, error)
- func (c *Client) UpfrontFare(esReq *EstimateRequest) (*UpfrontFare, error)
- type Contact
- type CurrencyCode
- type Delivery
- type DeliveryListRequest
- type DeliveryPage
- type DeliveryRequest
- type DeliveryThread
- type Driver
- type DriverInfoPage
- type DriverInfoQuery
- type DriverInfoResponse
- type Endpoint
- type Enrollment
- type EnrollmentStatus
- type EnrollmentUpdate
- type Error
- type EstimateRequest
- type Fare
- type FareBreakdown
- type FareEstimate
- type Item
- type Location
- type Map
- type Pager
- type Payment
- type PaymentCategory
- type PaymentListing
- type PaymentMethod
- type Phone
- type Place
- type PlaceName
- type PlaceParams
- type PriceDetails
- type PriceEstimate
- type PriceEstimatesPage
- type Product
- type ProductGroup
- type Profile
- type PromoCode
- type PromoCodeRequest
- type Receipt
- type Ride
- type RideRequest
- type ServiceFee
- type State
- type Status
- type StatusChange
- type TimeEstimate
- type TimeEstimatesPage
- type Trip
- type TripThread
- type TripThreadPage
- type Unit
- type UpfrontFare
- type Vehicle
- type WaypointType
Constants ¶
const ( DefaultLimitPerPage = int64(50) DefaultStartOffset = int64(0) )
const ( UnitMile otils.NullableString = "mile" UnitKM otils.NullableString = "km" )
const (
NoThrottle = -1
)
Variables ¶
var ( ErrInvalidStartPlaceOrCoords = errors.New("invalid startPlace or (startLat, startLon)") ErrInvalidEndPlaceOrCoords = errors.New("invalid endPlace or (endLat, endLon)") )
var ErrCardHasOutstandingBalance = &ActionableError{
msg: "the associated card has an outstanding balance. Please update billing information",
code: 400,
signature: "card_assoc_outstanding_balance",
}
- 400 :: card_assoc_outstanding_balance :: The user's associated card has an outstanding balance. The user must update the billing info.
var ErrDestinationOutsideServiceArea = &ActionableError{
msg: "the destination is not supported by the requested product",
code: 422,
signature: "outside_service_area",
}
* 422 :: outside_service_area :: The destination is not supported by the requested product.
var ErrDestinationRequired = &ActionableError{
msg: "this product requires setting a destination",
code: 422,
signature: "destination_required",
}
- 422 :: destination_required :: This product requires setting a destination for ride requests.
var ErrDistanceExceeded = &ActionableError{
msg: "the distance between start and end location exceeds 100 miles",
code: 422,
signature: "distance_exceeded",
}
* 422 :: distance_exceeded :: The distance between start and end locations exceeds 100 miles.
var ErrFareExpired = &ActionableError{
msg: "the fare has expired for the requested product. Please get estimates again, confirm the new fare and then re-request",
code: 409,
signature: "fare_expired",
}
- 409 :: fare_expired :: The fare has expired for the requested product. Please get estimates again, confirm the new fare, and then re-request.
var ErrForbiddenRequest = &ActionableError{
msg: "you are forbidden from making a request at this time. Please consult our support team",
code: 403,
signature: "forbidden",
action: "https://help.uber.com,support@uber.com",
}
- 403 :: forbidden :: This user is forbidden from making a request at this time and should consult our support team by visiting https://help.uber.com or by emailing support@uber.com
var ErrInsufficientBalance = &ActionableError{
msg: "insufficient balance on the credit card associated with your account. Please update billing information",
code: 400,
signature: "insufficient_balance",
}
- 400 :: insufficient_balance :: There is insufficient balance on the credit card associated with the user. The user must update the billing info.
var ErrInternalServerError = &ActionableError{
msg: "an unknown error has occured",
code: 500,
signature: "internal_server_error",
}
* 500 :: internal_server_error :: An unknown error has occured.
var ErrInvalidFareID = &ActionableError{
msg: "the fare id is invalid or expired",
code: 422,
signature: "invalid_fare_id",
}
* 422 :: invalid_fare_id :: This fare id is invalid or expired.
var ErrInvalidMobilePhoneNumber = &ActionableError{
msg: "the mobile phone number is not supported. We don't allow phone numbers for some providers that allow the creation of temporary phone numbers",
code: 400,
signature: "invalid_mobile_phone_number",
}
- 400 :: invalid_mobile_phone_number :: The user's mobile phone number is not supported. We don't allow phone numbers for some providers that allow the creation of temporary phone numbers.
var ErrInvalidPayment = &ActionableError{
msg: "rider's payment is invalid. Please update billing information",
code: 400,
signature: "invalid_payment",
}
- 400 :: invalid_payment :: The rider's payment method is invalid. The user must update the billing info. This could include e.g Android Pay.
var ErrInvalidPaymentMethod = &ActionableError{
msg: "the provided payment method is not valid",
code: 400,
signature: "invalid_payment_method",
}
* 400 :: invalid_payment_method :: The provided payment method is not valid.
var ErrInvalidSeatCount = &ActionableError{
msg: "number of seats exceeds max capacity",
code: 422,
signature: "invalid_seat_count",
}
* 422 :: invalid_seat_count :: Number of seats exceeds max capacity.
var ErrInvalidUberPoolDestination = &ActionableError{
msg: "this destination is not supported for uberPOOL",
code: 422,
signature: "validation_failed",
}
* 422 :: validation_failed :: The destination is not supported for uberPOOL.
var ErrMissingNationalID = &ActionableError{
msg: "certain jurisdictions require registration of your national ID or passport number before taking a ride. Please enter your national ID or passport number through the Uber iOS or Android app",
code: 403,
signature: "missing_national_id",
}
- 403 :: missing_national_id :: Certain jurisdictions require Uber users to register their national ID number or passport number before taking a ride. If a user receives this error when booking a trip through the Developer API, they must enter their national ID number or passport number through the Uber iOS or Android app.
var ErrMissingPaymentMethod = &ActionableError{
msg: "please add at least one payment method on file before requesting a car",
code: 409,
signature: "missing_payment_method",
action: "https://riders.uber.com",
}
- 409 :: missing_payment_method :: The rider must have at least one payment method on file to request a car. The rider must add a payment method by using the native mobile application or by visiting https://riders.uber.com
var ErrNoProductFound = &ActionableError{
msg: "an invalid product ID was requested. Retry the API call with a valid product ID",
code: 404,
signature: "no_product_found",
}
- 404 :: no_product_found :: An invalid product ID was requested. Retry the API call with a valid product ID.
var ErrOutstandingBalance = &ActionableError{
msg: "your account has outstanding balances. Please update billing information",
code: 400,
signature: "outstanding_balance_update_billing",
}
- 400 :: outstanding_balance_update_billing :: The user has outstanding balances. The user must update the billing info.
var ErrPayBalance = &ActionableError{
msg: "you have an outstanding balance. Please update your account settings",
code: 403,
signature: "pay_balance",
action: "https://riders.uber.com",
}
- 403 :: pay_balance :: The rider has an outstanding balance and must update their account settings by using the native mobile application or by visiting https://riders.uber.com
var ErrPaymentMethodNotAllowed = &ActionableError{
msg: "the payment method is not allowed",
code: 400,
signature: "payment_method_not_allowed",
}
* 400 :: payment_method_not_allowed :: The payment method is not allowed.
var (
ErrProccessingRequest = errors.New("error_")
)
var ErrProcessingRequest = &ActionableError{
msg: "encountered a error processing the request",
code: 400,
signature: "error_processing_request",
}
* 400 :: error_processing_request :: Error processing the request.
var ErrProductNotAllowed = &ActionableError{
msg: "the requested product is not available to you unfortunately. Please select another product",
code: 403,
signature: "product_not_allowed",
}
- 403 :: product_not_allowed :: The product being requested is not available to the user. Have them select a different product to successfully make a request.
var ErrPromotionsRevoked = &ActionableError{
msg: "encountered a error processing the request",
code: 400,
signature: "promotions_revoked",
}
* 400 :: promotions_revoked :: Promotions revoked.
var ErrRetryRequest = &ActionableError{ msg: "an error has occured when attempting to reques a product. Please retry the request", code: 409, signature: "retry_request", retryable: true, }
- 409 :: retry_request :: An error has occured when attempting to request a product. Please reattempt the request on behalf of the user.
var ErrSamePickupAsDroOff = &ActionableError{
msg: "pickup and dropoff cannot be the same",
code: 422,
signature: "same_pickup_dropoff",
}
* 422 :: same_pickup_dropoff :: Pickup and Dropoff can't be the same.
var ErrSurge = &ActionableError{
msg: "surge pricing is currently in effect for this product. Please confirm the surge pricing first",
code: 409,
signature: "surge",
}
- 409 :: surge :: Surge pricing is currently in effect for this product. Please have the user confirm surge pricing by sending them to the surge_confirmation href described.
var ErrTooManyCancellations = &ActionableError{
msg: "you are temporarily blocked for canceling too many times",
code: 403,
signature: "too_many_cancellations",
}
- 403 :: too_many_cancellations :: The rider is temporarily blocked due to canceling too many times.
var ErrUnconfirmedEmail = &ActionableError{
msg: "unconfirmed email address",
code: 400,
signature: "unconfirmed_email",
action: "https://riders.uber.com",
}
UberErrors
- 400 :: Unconfirmed email :: The user hasn't confirmed their email address. Instruct them to confirm their email by visiting https://riders.uber.com or within the native mobile application.
var ErrUnverified = &ActionableError{
msg: "your phone number hasn't yet been confirmed",
code: 403,
signature: "unverified",
action: "https://riders.uber.com",
}
- 403 :: unverified :: The user hasn't confirmed their phone number. Instruct the user to confirm their mobile phone number within the native mobile app or by visiting https://riders.uber.com
var ErrUserCurrentlyOnTrip = &ActionableError{
msg: "the user is currently on a trip",
code: 409,
signature: "current_trip_exists",
}
* 409 :: current_trip_exists :: The user is currently on a trip.
var ErrUserNotAllowed = &ActionableError{
msg: "unfortunately you are banned and not permitted to request a ride",
code: 403,
signature: "user_not_allowed",
}
* 403 :: user_not_allowed :: The user is banned and not permitted to request a ride.
var ErrVerificationRequired = &ActionableError{
msg: "you aren't allowed to make ride requests through the API. Please use the Uber iOS or Android rider app to get a ride",
code: 403,
signature: "verification_required",
}
- 403 :: verification_required :: The user currently cannot make ride requests through the API and is advised to use the Uber iOS or Android rider app to get a ride.
Functions ¶
This section is empty.
Types ¶
type ActionableError ¶
type ActionableError struct {
// contains filtered or unexported fields
}
func (*ActionableError) Action ¶
func (ae *ActionableError) Action() string
func (*ActionableError) Error ¶
func (ae *ActionableError) Error() string
func (*ActionableError) HasAction ¶
func (ae *ActionableError) HasAction() bool
type ActivationStatus ¶ added in v0.0.4
type ActivationStatus string
const ( Other ActivationStatus = "other" Onboarding ActivationStatus = "onboarding" Active ActivationStatus = "active" InActive ActivationStatus = "inactive" )
type Client ¶
func NewClientFromEnv ¶
func NewClientFromOAuth2File ¶
func NewSandboxedClient ¶
func (*Client) ActivitiesByID ¶ added in v0.1.8
func (*Client) ApplyPromoCode ¶
func (*Client) CancelDelivery ¶
CancelDelivery cancels a delivery referenced by its ID. There are potential cancellation fees associated. See https://developer.uber.com/docs/deliveries/faq for more information.
func (*Client) CurrentTrip ¶ added in v0.0.4
CurrentTrip returns the details of the ongoing trip. It is a privileged method that requires FULL ACCESS when used for all Uber riders. See more information about scopes here https://developer.uber.com/docs/riders/guides/scopes.
func (*Client) DriverProfile ¶ added in v0.0.4
func (*Client) EnrollmentByID ¶ added in v0.1.6
func (c *Client) EnrollmentByID(id string) (*Enrollment, error)
func (*Client) Enrollments ¶ added in v0.1.6
func (c *Client) Enrollments(query url.Values) ([]*Enrollment, error)
func (*Client) EstimatePrice ¶
func (c *Client) EstimatePrice(ereq *EstimateRequest) (pagesChan chan *PriceEstimatesPage, cancelPaging func(), err error)
func (*Client) EstimateTime ¶
func (c *Client) EstimateTime(treq *EstimateRequest) (pagesChan chan *TimeEstimatesPage, cancelPaging func(), err error)
func (*Client) ListAllMyHistory ¶
func (c *Client) ListAllMyHistory() (thChan chan *TripThreadPage, cancelFn func(), err error)
func (*Client) ListDeliveries ¶
func (c *Client) ListDeliveries(dReq *DeliveryListRequest) (*DeliveryThread, error)
ListDeliveries requires authorization with OAuth2.0 with the delivery scope set.
func (*Client) ListDriverPayments ¶ added in v0.0.4
func (c *Client) ListDriverPayments(dpq *DriverInfoQuery) (*DriverInfoResponse, error)
DriverPayments returns the payments for the given driver. Payments are available at this endpoint in near real-time. Some entries, such as "device_subscription" will appear on a periodic basis when actually billed to the parnter. If a trip is cancelled (either by rider or driver) and there is no payment made, the corresponding "trip_id" of that cancelled trip will not appear in this endpoint. If the given driver works for a fleet manager, there will be no payments associated and the response will always be an empty array. Drivers working for fleet managers will receive payments from the fleet manager and not from Uber.
func (*Client) ListDriverTrips ¶ added in v0.0.4
func (c *Client) ListDriverTrips(dpq *DriverInfoQuery) (*DriverInfoResponse, error)
func (*Client) ListHistory ¶
func (c *Client) ListHistory(threq *Pager) (thChan chan *TripThreadPage, cancelFn func(), err error)
func (*Client) ListPaymentMethods ¶
func (c *Client) ListPaymentMethods() (*PaymentListing, error)
func (*Client) ListProducts ¶
ListProducts is a method that returns information about the Uber products offered at a given location. Some products such as uberEATS, are not returned by this endpoint, at least as of: Fri 23 Jun 2017 18:01:04 MDT. The results of this method do not reflect real-time availability of the products. Please use the EstimateTime method to determine real-time availability and ETAs of products. In some markets, the list of products returned from this endpoint may vary by the time of day due to time restrictions on when that product may be utilized.
func (*Client) OpenMapForTrip ¶
OpenMapForTrip is a convenience method that opens the map for a trip or returns an error if it encounters an error.
func (*Client) RequestDelivery ¶
func (c *Client) RequestDelivery(req *DeliveryRequest) (*Delivery, error)
func (*Client) RequestRide ¶
func (c *Client) RequestRide(rreq *RideRequest) (*Ride, error)
func (*Client) RetrieveMyProfile ¶
func (*Client) SetBearerToken ¶
func (*Client) SetHTTPRoundTripper ¶
func (c *Client) SetHTTPRoundTripper(rt http.RoundTripper)
func (*Client) SetSandboxMode ¶
Sandboxed if set to true, the client will send requests to the sandboxed API endpoint. See: + https://developer.uber.com/docs/riders/guides/sandbox + https://developer.uber.com/docs/drivers
func (*Client) TripByID ¶ added in v0.0.4
TripByID returns the details of a trip whose ID is known. It is a privileged method that requires FULL ACCESS when used for all Uber riders. See more information about scopes here https://developer.uber.com/docs/riders/guides/scopes.
func (*Client) UpdateEnrollmentByID ¶ added in v0.1.6
func (c *Client) UpdateEnrollmentByID(id string, update *EnrollmentUpdate) (*Enrollment, error)
func (*Client) UpdatePlace ¶
func (c *Client) UpdatePlace(pp *PlaceParams) (*Place, error)
UpdatePlace udpates your place's address.
func (*Client) UpfrontFare ¶
func (c *Client) UpfrontFare(esReq *EstimateRequest) (*UpfrontFare, error)
type Contact ¶
type Contact struct { FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` CompanyName string `json:"company_name,omitempty"` Email string `json:"email,omitempty"` Phone *Phone `json:"phone,omitempty"` // SendEmailNotifications if set requests that // Uber send email delivery notifications. // This field is optional and defaults to true. SendEmailNotifications bool `json:"send_email_notifications,omitempty"` // SendSMSNotifications if set requests that // Uber send SMS delivery notifications. // This field is optional and defaults to true. SendSMSNotifications bool `json:"send_sms_notifications,omitempty"` }
type CurrencyCode ¶
type CurrencyCode string
type Delivery ¶
type Delivery struct { ID string `json:"delivery_id"` Fee float32 `json:"fee"` QuoteID string `json:"quote_id"` Status Status `json:"status"` Courier *Contact `json:"courier,omitempty"` OrderReferenceID string `json:"order_reference_id"` CurrencyCode CurrencyCode `json:"currency_code"` TrackingURL otils.NullableString `json:"tracking_url"` Items []*Item `json:"items"` Pickup *Endpoint `json:"pickup"` Dropoff *Endpoint `json:"dropoff"` CreatedAt uint64 `json:"created_at"` // Batch is an optional object which // indicates whether a delivery should be // batched with other deliveries at pickup. Batch *Batch `json:"batch"` }
type DeliveryListRequest ¶
type DeliveryPage ¶
type DeliveryRequest ¶
type DeliveryRequest struct { // The ID of the quoted price of the // delivery. This field is optional. // If missing, the fee for the delivery will // be determined at the time of the request. QuoteID string `json:"quote_id,omitempty"` // The merchant supplied order reference identifier. // This field is optional and it is limited to 256 characters. OrderReferenceID string `json:"order_reference_id,omitempty"` // The items being delivered. Items []*Item `json:"items"` // The details of the delivery pickup. Pickup *Endpoint `json:"pickup"` Dropoff *Endpoint `json:"dropoff"` }
func (*DeliveryRequest) Validate ¶
func (dr *DeliveryRequest) Validate() error
type DeliveryThread ¶
type DeliveryThread struct { Pages chan *DeliveryPage `json:"-"` Cancel func() }
type DriverInfoPage ¶ added in v0.0.4
type DriverInfoQuery ¶ added in v0.0.4
type DriverInfoQuery struct { Offset int `json:"offset,omitempty"` // LimitPerPage is the number of items to retrieve per page. // Default is 5, maximum is 50. LimitPerPage int `json:"limit,omitempty"` StartDate *time.Time `json:"start_date,omitempty"` EndDate *time.Time `json:"end_date,omitempty"` MaxPageNumber int `json:"max_page_number,omitempty"` Throttle time.Duration `json:"throttle,omitempty"` }
type DriverInfoResponse ¶ added in v0.0.4
type DriverInfoResponse struct { Cancel func() Pages <-chan *DriverInfoPage }
type Endpoint ¶
type Endpoint struct { Location *Location `json:"location,omitempty"` Contact *Contact `json:"contact,omitempty"` // Special instructions for the endpoint. This field // is optional and it is limited to 256 characters. SpecialInstructions otils.NullableString `json:"special_instructions,omitempty"` SignatureRequired bool `json:"signature_required,omitempty"` // Indicates if the delivery includes alcohol. This // feature is only available to whitelisted businesses. IncludesAlcohol bool `json:"includes_alcohol,omitempty"` ETAMinutes int `json:"eta,omitempty"` TimestampUnix int64 `json:"timestamp,omitempty"` }
type Enrollment ¶ added in v0.1.6
type Enrollment struct { ID string `json:"id"` Status EnrollmentStatus `json:"status"` Device string `json:"device,omitempty"` }
type EnrollmentStatus ¶ added in v0.1.6
type EnrollmentStatus string
const ( Offered EnrollmentStatus = "OFFERED" Purchased EnrollmentStatus = "PURCHASED" Enabled EnrollmentStatus = "ENABLED" Deactivated EnrollmentStatus = "DEACTIVATED" Blocked EnrollmentStatus = "BLOCKED" )
type EnrollmentUpdate ¶ added in v0.1.6
type Error ¶
type Error struct { Meta interface{} `json:"meta"` Errors []*statusCodedError `json:"errors"` // contains filtered or unexported fields }
type EstimateRequest ¶
type EstimateRequest struct { StartLatitude float64 `json:"start_latitude"` StartLongitude float64 `json:"start_longitude"` EndLongitude float64 `json:"end_longitude"` EndLatitude float64 `json:"end_latitude"` SeatCount int `json:"seat_count"` // ProductID is the UniqueID of the product // being requested. If unspecified, it will // default to the cheapest product for the // given location. ProductID string `json:"product_id"` StartPlace PlaceName `json:"start_place_id"` EndPlace PlaceName `json:"end_place_id"` Pager }
type Fare ¶
type Fare struct { Value otils.NullableFloat64 `json:"value,omitempty"` ExpiresAt int64 `json:"expires_at,omitempty"` CurrencyCode otils.NullableString `json:"currency_code"` DisplayAmount otils.NullableString `json:"display"` ID otils.NullableString `json:"fare_id"` }
type FareBreakdown ¶
type FareBreakdown struct { Low otils.NullableFloat64 `json:"low_amount,omitempty"` High otils.NullableFloat64 `json:"high_amount,omitempty"` DisplayAmount otils.NullableString `json:"display_amount,omitempty"` DisplayName otils.NullableString `json:"display_name,omitempty"` // Toll is the amount for tolls included in the fare. Toll otils.NullableFloat64 `json:"toll,omitempty"` // ServiceFee is the the fee collected by Uber for this fare. ServiceFee otils.NullableFloat64 `json:"service_fee,omitempty"` // Remainder is the remainder of the fare Remainder otils.NullableFloat64 `json:"other,omitempty"` }
type FareEstimate ¶
type FareEstimate struct { SurgeConfirmationURL string `json:"surge_confirmation_href,omitempty"` SurgeConfirmationID string `json:"surge_confirmation_id"` // Breakdown provides details on how a fare came to be. Breakdown []*FareBreakdown `json:"fare_breakdown,omitempty"` SurgeMultiplier otils.NullableFloat64 `json:"surge_multiplier"` CurrencyCode otils.NullableString `json:"currency_code"` DisplayAmount otils.NullableString `json:"display"` }
type Item ¶
type Item struct { Title string `json:"title"` Fragile bool `json:"is_fragile,omitempty"` Quantity int `json:"quantity"` WidthInches float32 `json:"width,omitempty"` HeightInches float32 `json:"height,omitempty"` LengthInches float32 `json:"length,omitempty"` CurrencyCode CurrencyCode `json:"currency_code,omitempty"` }
type Location ¶
type Location struct { Latitude float64 `json:"latitude,omitempty"` Longitude float64 `json:"longitude,omitempty"` // Bearing is the current bearing of the vehicle in degrees (0-359). Bearing int `json:"bearing,omitempty"` PrimaryAddress string `json:"address,omitempty"` SecondaryAddress string `json:"address_2,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` PostalCode string `json:"postal_code,omitempty"` Country string `json:"country,omitempty"` ETAMinutes float32 `json:"eta,omitempty"` // WaypointType is used to describe Waypoints. // Its values could be: // + pickup // + dropoff WaypointType WaypointType `json:"type,omitempty"` }
type Payment ¶
type Payment struct { // ID is the unique identifier of the payment item. // If the payment is related to a trip, it is the same as TripID. ID string `json:"payment_id,omitempty"` MethodID string `json:"payment_method_id,omitempty"` Category PaymentCategory `json:"category,omitempty"` Description string `json:"description,omitempty"` PaymentMethod PaymentMethod `json:"type,omitempty"` // DriverID is the unique identifier of the // driver who received or made the payment. DriverID string `json:"driver_id,omitempty"` // PartnerID is the unique identifier of the // Fleet Manager for the driver. PartnerID string `json:"partner_id,omitempty"` // TripID is the unique identifier of the trip associated // with the payment. It is only present for // PaymentCategory `Fare` otherwise it is null. TripID otils.NullableString `json:"trip_id,omitempty"` EventTime otils.NullableFloat64 `json:"event_time,omitempty"` // CashCollected is the amount collected in cash by the driver. // It is only set for Uber products that are enabled for cash payments. CashCollected otils.NullableFloat64 `json:"cash_collected,omitempty"` // Amount is the net payout to the driver. It is positive for // payments to the account, negative for charges to the account. Amount otils.NullableFloat64 `json:"amount,omitempty"` // CurrencyCode is the ISO 4217 currency code of the payment. CurrencyCode otils.NullableString `json:"currency_code,omitempty"` // Breakdown is the breakdown of the fare. Breakdown *FareBreakdown `json:"breakdown,omitempty"` // RiderFees details the fees paid to the driver by the rider // These fees are not reflected in the fare. RiderFees *ServiceFee `json:"rider_fees,omitempty"` }
type PaymentCategory ¶ added in v0.0.4
type PaymentCategory string
const ( CategoryFare PaymentCategory = "fare" CategoryDevicePayment PaymentCategory = "device_payment" CategoryVehiclePayment PaymentCategory = "vehicle_payment" CategoryPromotion PaymentCategory = "promotion" CategoryOther PaymentCategory = "other" )
type PaymentListing ¶
type PaymentMethod ¶
type PaymentMethod uint
const ( PaymentUnknown PaymentMethod = iota // Last 2 digits of card e.g "***23" or the // obfuscated email address ("ga***@uber.com") // depending on the account identifier. PaymentAlipay // Last 2 digits of cards e.g "***23". PaymentApplePay PaymentAmericanExpress PaymentDiscover PaymentJCB PaymentLianLian PaymentMaestro PaymentMastercard PaymentPaypal PaymentPaytm PaymentUnionPay PaymentVisa // A descriptive name of the family account e.g "John Doe Family Shared". PaymentUberFamilyAccount // No description for these ones. PaymentAirtel PaymentAndroidPay PaymentCash PaymentUcharge PaymentZaakpay )
func StringToPaymentMethod ¶
func StringToPaymentMethod(str string) PaymentMethod
func (*PaymentMethod) PaymentMethodToString ¶
func (pm *PaymentMethod) PaymentMethodToString() string
func (PaymentMethod) String ¶
func (pm PaymentMethod) String() string
func (*PaymentMethod) UnmarshalJSON ¶
func (pm *PaymentMethod) UnmarshalJSON(b []byte) error
type PlaceParams ¶
func (*PlaceParams) Validate ¶
func (pp *PlaceParams) Validate() error
type PriceDetails ¶
type PriceDetails struct { // The base price of a trip. Base otils.NullableFloat64 `json:"base,omitempty"` // The minimum price of a trip. Minimum otils.NullableFloat64 `json:"minimum,omitempty"` // CostPerMinute is the charge per minute(if applicable for the product type). CostPerMinute otils.NullableFloat64 `json:"cost_per_minute,omitempty"` // CostPerDistanceUnit is the charge per // distance unit(if applicable for the product type). CostPerDistanceUnit otils.NullableFloat64 `json:"cost_per_distance,omitempty"` // DistanceUnit is the unit of distance used // to calculate the fare (either UnitMile or UnitKm) DistanceUnit Unit `json:"distance_unit,omitempty"` // Cancellation fee is what the rider has to pay after // they cancel the trip after the grace period. CancellationFee otils.NullableFloat64 `json:"cancellation_fee,omitempty"` CurrencyCode CurrencyCode `json:"currency_code,omitempty"` ServiceFees []*ServiceFee `json:"service_fees,omitempty"` }
type PriceEstimate ¶
type PriceEstimate struct { // ISO 4217 currency code. CurrencyCode otils.NullableString `json:"currency_code"` // Formatted string of estimate in local currency of the // start location. Estimate could be a range, a single // number(flat rate) or "Metered" for TAXI. Estimate otils.NullableString `json:"estimate"` // Expected activity duration in seconds. DurationSeconds otils.NullableFloat64 `json:"duration"` // Minimum price for product. MinimumPrice otils.NullableFloat64 `json:"minimum"` // Lower bound of the estimated price. LowEstimate otils.NullableFloat64 `json:"low_estimate"` // Upper bound of the estimated price. HighEstimate otils.NullableFloat64 `json:"high_estimate"` // Unique identifier representing a specific // product for a given longitude and latitude. // For example, uberX in San Francisco will have // a different ProductID than uberX in Los Angelese. ProductID string `json:"product_id"` // Display name of product. Name string `json:"display_name"` // Localized display name of product. LocalizedName string `json:"localized_display_name"` // Expected surge multiplier. Surge is active if // SurgeMultiplier is greater than 1. Price estimate // already factors in the surge multiplier. SurgeMultiplier otils.NullableFloat64 `json:"surge_multiplier"` LimitPerPage int64 `json:"limit"` }
type PriceEstimatesPage ¶
type PriceEstimatesPage struct { Estimates []*PriceEstimate `json:"prices"` Count int64 `json:"count,omitempty"` Err error PageNumber uint64 }
type Product ¶
type Product struct { UpfrontFareEnabled bool `json:"upfront_fare_enabled,omitempty"` // Capacity is the number of people that can be // accomodated by the product for example, 4 people. Capacity int `json:"capacity,omitempty"` // The unique identifier representing a specific // product for a given latitude and longitude. // For example, uberX in San Francisco will have // a different ID than uberX in Los Angeles. ID string `json:"product_id"` // PriceDetails details the basic price // (not including any surge pricing adjustments). // This field is nil for products with metered // fares(taxi) or upfront fares(uberPOOL). PriceDetails *PriceDetails `json:"price_details"` ImageURL string `json:"image,omitempty"` CashEnabled bool `json:"cash_enabled,omitempty"` // An abbreviated description of the product. // It is localized according to `Accept-Language` header. ShortDescription string `json:"short_description"` DisplayName string `json:"display_name"` Description string `json:"description"` }
type ProductGroup ¶
type ProductGroup string
const ( ProductUberX ProductGroup = "uberx" ProductUberXL ProductGroup = "uberxl" ProductUberBlack ProductGroup = "uberblack" ProductSUV ProductGroup = "suv" ProductTaxi ProductGroup = "taxi" )
type Profile ¶
type Profile struct { // First name of the Uber user. FirstName string `json:"first_name,omitempty"` // Last name of the Uber user. LastName string `json:"last_name,omitempty"` // Email address of the Uber user. Email string `json:"email,omitempty"` // Image URL of the Uber user. PictureURL string `json:"picture,omitempty"` // Whether the user has confirmed their mobile number. MobileVerified bool `json:"mobile_verified"` // The promotion code for the user. // Can be used for rewards when referring // other users to Uber. PromoCode string `json:"promo_code,omitempty"` ID string `json:"uuid,omitempty"` Rating otils.NullableFloat64 `json:"rating,omitempty"` ActivationStatus ActivationStatus `json:"activation_status,omitempty"` DriverID otils.NullableString `json:"driver_id,omitempty"` RiderID otils.NullableString `json:"rider_id,omitempty"` // Me if set, signifies that this Profile // is of current authenticated user. Me bool `json:"me,omitempty"` }
type PromoCodeRequest ¶
type PromoCodeRequest struct {
CodeToApply string `json:"applied_promotion_codes"`
}
type Receipt ¶
type Receipt struct { // Unique identifier representing Request. RequestID string `json:"request_id"` // Subtotal = TotalFare - ChargeAdjustments Subtotal otils.NullableString `json:"subtotal"` // The fare after credits and refunds have been applied. TotalFare otils.NullableString `json:"total_fare"` // The total amount charged to the user's payment method. // This is the subtotal (split if applicable) with taxes included. TotalCharged otils.NullableString `json:"total_charged"` // The total amount still owed after attempting to charge the // user. May be null if amount was paid in full. TotalOwed otils.NullableFloat64 `json:"total_owed"` // The ISO 4217 currency code of the amounts. CurrencyCode otils.NullableString `json:"currency_code"` // Duration is the ISO 8601 HH:MM:SS // format of the time duration of the trip. Duration otils.NullableString `json:"currency_code"` // Distance of the trip charged. Distance otils.NullableString `json:"distance"` // UnitOfDistance is the localized unit of distance. UnitOfDistance otils.NullableString `json:"distance_label"` }
type Ride ¶
type Ride struct { RequestID string `json:"request_id,omitempty"` ProductID string `json:"product_id,omitempty"` // Status indicates the state of the ride request. Status Status `json:"status,omitempty"` Vehicle *Vehicle `json:"vehicle,omitempty"` Driver *Driver `json:"driver,omitempty"` Location *Location `json:"location,omitempty"` Pickup *Location `json:"pickup,omitempty"` Destination *Location `json:"destination,omitempty"` // ETAMinutes is the expected time of arrival in minutes. ETAMinutes int `json:"eta,omitempty"` // The surge pricing multiplier used to calculate the increased price of a request. // A surge multiplier of 1.0 means surge pricing is not in effect. SurgeMultiplier float32 `json:"surge_multiplier,omitempty"` }
func (*Ride) SurgeInEffect ¶
type RideRequest ¶
type RideRequest struct { // FareID is the ID of the upfront fare. If FareID is blank // and you would like an inspection of current estimates, // set PromptOnFare to review the upfront fare. FareID string `json:"fare_id,omitempty"` // PromptOnFare is an optional callback function that is // used when FareID is blank. It is invoked to inspect and // accept the upfront fare estimate or any surges in effect. PromptOnFare func(*UpfrontFare) error `json:"-"` // StartPlace can be used in place of (StartLatitude, StartLongitude) StartPlace PlaceName `json:"start_place_id,omitempty"` // EndPlace can be used in place of (EndLatitude, EndLongitude) EndPlace PlaceName `json:"end_place_id,omitempty"` StartLatitude float64 `json:"start_latitude,omitempty"` StartLongitude float64 `json:"start_longitude,omitempty"` EndLatitude float64 `json:"end_latitude,omitempty"` EndLongitude float64 `json:"end_longitude,omitempty"` // Optional fields // Product is the ID of the product being requested. If none is provided, // it will default to the cheapest product for the given location. ProductID string `json:"product_id,omitempty"` // SurgeConfirmationID is the unique identifier of the surge session for a user. // Required when returned from a 409 Conflict repsonse on a previous POST attempt. SurgeConfirmationID string `json:"surge_confirmation_id,omitempty"` // PaymentMethodID is the unique identifier of the payment method selected by a user. // If set, the trip will be requested using this payment method. If not set, the trip // will be requested using the user's last used payment method. PaymentMethodID string `json:"payment_method_id,omitempty"` // uberPOOL data // SeatCount is the number of seats required for uberPOOL. // The default and maximum value is 2. SeatCount int `json:"seat_count,omitempty"` // Uber for Business data // ExpenseCode is an alphanumeric identifier for expense reporting policies. // This value will appear in the trip receipt and any configured expense-reporting // integrations like: // * Uber For Business: https://www.uber.com/business // * Business Profiles: https://www.uber.com/business/profiles ExpenseCode string `json:"expense_code,omitempty"` // ExpenseMemo is a free text field to describe the purpose of the trip for // expense reporting. This value will appear in the trip receipt and any // configured expense-reporting integrations like: // * Uber For Business: https://www.uber.com/business // * Business Profiles: https://www.uber.com/business/profiles ExpenseMemo string `json:"expense_memo,omitempty"` }
func (*RideRequest) Validate ¶
func (rr *RideRequest) Validate() error
type ServiceFee ¶
type ServiceFee struct { Name string `json:"name,omitempty"` Fee otils.NullableFloat64 `json:"fee,omitempty"` SplitFare otils.NullableFloat64 `json:"split_fare,omitempty"` }
type Status ¶
type Status string
const ( // The request is matching to // the most efficient available driver. StatusProcessing Status = "processing" // The request was unfulfilled because // no drivers were available. StatusNoDriversAvailable Status = "no_drivers_available" // The request has been accepted by a driver and // is "en route" to the start location // (i.e. start_latitude and start_longitude). // This state can occur multiple times in case of // a driver re-assignment. StatusAccepted Status = "accepted" // The driver has arrived or will be shortly. StatusArriving Status = "arriving" // The request is "en route" from the // start location to the end location. StatusInProgress Status = "in_progress" // The request has been canceled by the driver. StatusDriverCanceled Status = "driver_canceled" // The request has been canceled by the rider. StatusRiderCanceled Status = "rider_canceled" // The request has been completed by the driver. StatusCompleted Status = "completed" // The receipt for the trip is ready. StatusReceiptReady Status = "ready" )
type StatusChange ¶ added in v0.0.4
type TimeEstimate ¶
type TimeEstimate struct { // Expected Time of Arrival for the product (in seconds). ETASeconds otils.NullableFloat64 `json:"estimate"` // Unique identifier representing a specific // product for a given longitude and latitude. // For example, uberX in San Francisco will have // a different ProductID than uberX in Los Angelese. ProductID string `json:"product_id"` // Display name of product. Name string `json:"display_name"` // Localized display name of product. LocalizedName string `json:"localized_display_name"` LimitPerPage int64 `json:"limit"` }
type TimeEstimatesPage ¶
type TimeEstimatesPage struct { Estimates []*TimeEstimate `json:"times"` Count int64 `json:"count,omitempty"` Err error PageNumber uint64 }
type Trip ¶
type Trip struct { // Status of the activity. As per API v1.2, // it only return "completed" for now. Status Status `json:"status,omitempty"` // Length of activity in miles. DistanceMiles float64 `json:"distance,omitempty"` // UnixTimestamp of activity start time. StartTimeUnix int64 `json:"start_time,omitempty"` // UnixTimestamp of activity end time. EndTimeUnix int64 `json:"end_time,omitempty"` // The city in which this trip was initiated. StartCity *Place `json:"start_city,omitempty"` ProductID string `json:"product_id,omitempty"` RequestID string `json:"request_id,omitempty"` TripID string `json:"trip_id,omitempty"` DriverID string `json:"driver_id,omitempty"` Unit string `json:"distance_unit,omitempty"` Duration otils.NullableFloat64 `json:"duration,omitempty"` DurationEstimate otils.NullableFloat64 `json:"duration_estimate,omitempty"` Distance otils.NullableFloat64 `json:"distance,omitempty"` DistanceEstimate otils.NullableFloat64 `json:"distance_estimate,omitempty"` VehicleID otils.NullableString `json:"vehicle_id,omitempty"` SurgeMultiplier otils.NullableFloat64 `json:"surge_multiplier,omitempty"` Fare otils.NullableFloat64 `json:"fare,omitempty"` Dropoff *Endpoint `json:"dropoff,omitempty"` Pickup *Endpoint `json:"pickup,omitempty"` StatusChanges []*StatusChange `json:"status_changes,omitempty"` CurrencyCode CurrencyCode `json:"currency_code,omitempty"` // when requested for the current trip or by tripID. Shared bool `json:"shared,omitempty"` // Vehicle will only be non-nil during an ongoing trip. Vehicle *Vehicle `json:"vehicle,omitempty"` // Driver will only be non-nil during an ongoing trip. Driver *Driver `json:"driver,omitempty"` // Location contains the location information // about the driver in the vehicle. Location *Location `json:"location,omitempty"` Destination *Location `json:"destination,omitempty"` Riders []*Profile `json:"riders,omitempty"` // Waypoints is the list of waypoints containing: // + lat/lng of different waypoints // + the rider involved // + type of waypoint // It is only returned for shared rides like UberPOOL. Waypoints []*Location `json:"waypoints,omitempty"` }
type TripThread ¶
type TripThreadPage ¶
type TripThreadPage struct { TripThread Err error PageNumber uint64 }
type Unit ¶
type Unit otils.NullableString
type UpfrontFare ¶
type UpfrontFare struct { Trip *Trip `json:"trip,omitempty"` Fare *Fare `json:"fare,omitempty"` // PickupEstimateMinutes is the estimated time of vehicle arrival // in minutes. It is unset if there are no cars available. PickupEstimateMinutes otils.NullableFloat64 `json:"pickup_estimate,omitempty"` Estimate *FareEstimate `json:"estimate,omitempty"` }
func (*UpfrontFare) NoCarsAvailable ¶
func (upf *UpfrontFare) NoCarsAvailable() bool
func (*UpfrontFare) SurgeInEffect ¶
func (upf *UpfrontFare) SurgeInEffect() bool
type WaypointType ¶ added in v0.0.4
type WaypointType string
const ( PickupWaypoint WaypointType = "pickup" Dropoffpoint WaypointType = "dropoff" )