GetParkingAvailability method

This endpoint provide the availability for a user in a specific zone.

Request

GetParkingAvailabilityRequest

Return value

GetParkingAvailabilityResponse

Related Specifications

Price
VehicleInformation

// Request to fetch availability info (i.e. available duration and associated
// price), given a parking zone and other info.
message GetParkingAvailabilityRequest {
  // Opaque identifier of the parking zone, must be globally unique for
  // the partner.
  // Required.
  string zone_id = 1;

  // Vehicle information, required when the associated zone requires license
  // plate info (as defined by the ParkingZone.ZoneType) and when no
  // existing_session_id is provided.
  VehicleInformation vehicle_information = 2;

  // Space code, required when the associated zone requires space code (as
  // defined by the ParkingZone.ZoneType) and when no existing_session_id is
  // provided.
  string space_code = 3;

  // The existing session id, must be supplied when extending an existing
  // session.
  // When supplied, both vehicle information and the space code will be ignored.
  // Optional.
  string existing_session_id = 4;

  // Requested start time, in seconds since the unix epoch. All availability
  // messages in the response must begin at this time.
  // Required.
  int64 start_time_sec = 5;

  // If provided, only return availability less than or equal to the provided
  // duration.
  // Optional.
  int64 max_duration_sec = 6;
}

message GetParkingAvailabilityResponse {
  // Opaque identifier of the parking zone, must match the zone_id provided in
  // the request.
  // Required.
  string zone_id = 1;

  // Vehicle information.
  // Required if provided in the request.
  VehicleInformation vehicle_information = 2;

  // Space code within the parking zone.
  // Required if provided in the request.
  string space_code = 3;

  // The existing session id.
  // Required if provided in the request.
  string existing_session_id = 4;

  // A list of durations (from the requested start_time_sec) the user can park
  // here for and their corresponding prices.
  // An empty list means parking payment is not accepted here.
  //
  // When fetching availability for extensions, this list
  // should reflect the duration and price for the extension part, not the total
  // session.
  repeated ParkingAvailability availability = 5;

  // Whether there are additional slots longer than the requested
  // max_duration_sec.
  bool has_longer_duration_slots = 6;

  // If there is no availability, this field should reflect the business logic
  // error on why (e.g. parking is not allowed).
  ParkingAvailabilityFailure failure = 7;
}
// Describes the time range and associated price of a parking availability slot
// that a user could purchase for a given zone, space and/or vehicle.
message ParkingAvailability {
  // Start time of the availability in seconds since Unix epoch, this should
  // be the same as the requested start_time_sec.
  int64 start_time_sec = 1;

  // Duration in seconds of the availability.
  int64 duration_sec = 2;

  // Base amount associated with this slot, exclusive of any taxes and fees.
  // The total amount user will be charged is amount + taxes + fees.
  // Required.
  Price base_amount = 3;

  // Additional taxes associated with this slot, should be in the same currency
  // code as the `base_amount` field.
  // Optional, if Additional tax applies.
  Price taxes = 4;

  // Additional fees associated with this slot, should be in the same currency
  // code as the `base_amount` field.
  // Optional, if Additional fee applies.
  Price fees = 5;
}
// Parking availability failure cases.
message ParkingAvailabilityFailure {
  enum Cause {
    CAUSE_UNKNOWN = 0;
    // Parking is currently not allowed at this zone (for anyone).
    PARKING_NOT_ALLOWED = 1;
    // Parking is free, no payment is accepted.
    PARKING_FREE = 2;
    // User has reached the max parking limit with the existing session and
    // cannot extend further, i.e., user has an existing session of 2hrs and
    // the zone has a max parking of 2hrs.
    MAX_PARKING_REACHED_WITH_EXISTING_SESSION = 3;
    // Parking is currently not allowed at this zone for this particular user.
    // User could have reached the parking limit over multiple sessions.
    PARKING_NOT_ALLOWED_FOR_USER = 4;
    // The supplied space code is invalid.
    INVALID_SPACE_CODE = 5;
    // The supplied existing session_id is invalid. Should only be used when an
    // existing session_id is provided in the request.
    INVALID_SESSION_ID = 6;
    // The requested start time is invalid (e.g. too old).
    REQUESTED_START_TIME_INVALID = 7;
    // The license plate info contains invalid characters.
    INVALID_LICENSE_PLATE_CHARACTER = 8;
    // The supplied zone ID was not found.
    ZONE_ID_NOT_FOUND = 9;
  }

  Cause cause = 1;

  // A human readable description of the failure to aid in debugging.
  string description = 2;
}