trip_api.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package maps.fleetengine.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/field_behavior.proto";
  18. import "google/api/resource.proto";
  19. import "google/maps/fleetengine/v1/fleetengine.proto";
  20. import "google/maps/fleetengine/v1/header.proto";
  21. import "google/maps/fleetengine/v1/trips.proto";
  22. import "google/protobuf/duration.proto";
  23. import "google/protobuf/empty.proto";
  24. import "google/protobuf/field_mask.proto";
  25. import "google/protobuf/timestamp.proto";
  26. import "google/api/client.proto";
  27. option go_package = "google.golang.org/genproto/googleapis/maps/fleetengine/v1;fleetengine";
  28. option java_multiple_files = true;
  29. option java_outer_classname = "TripApi";
  30. option java_package = "google.maps.fleetengine.v1";
  31. option objc_class_prefix = "CFE";
  32. // Trip management service.
  33. service TripService {
  34. option (google.api.default_host) = "fleetengine.googleapis.com";
  35. // Creates a trip in the Fleet Engine and returns the new trip.
  36. rpc CreateTrip(CreateTripRequest) returns (Trip) {
  37. option (google.api.http) = {
  38. post: "/v1/{parent=providers/*}/trips"
  39. body: "trip"
  40. };
  41. }
  42. // Get information about a single trip.
  43. rpc GetTrip(GetTripRequest) returns (Trip) {
  44. option (google.api.http) = {
  45. get: "/v1/{name=providers/*/trips/*}"
  46. };
  47. }
  48. // Report billable trip usage.
  49. rpc ReportBillableTrip(ReportBillableTripRequest) returns (google.protobuf.Empty) {
  50. option (google.api.http) = {
  51. post: "/v1/{name=providers/*/billableTrips/*}:report"
  52. body: "*"
  53. };
  54. }
  55. // Get all the trips for a specific vehicle.
  56. rpc SearchTrips(SearchTripsRequest) returns (SearchTripsResponse) {
  57. option (google.api.http) = {
  58. post: "/v1/{parent=providers/*}/trips:search"
  59. body: "*"
  60. };
  61. }
  62. // Updates trip data.
  63. rpc UpdateTrip(UpdateTripRequest) returns (Trip) {
  64. option (google.api.http) = {
  65. put: "/v1/{name=providers/*/trips/*}"
  66. body: "trip"
  67. };
  68. }
  69. }
  70. // CreateTrip request message.
  71. message CreateTripRequest {
  72. // The standard Fleet Engine request header.
  73. RequestHeader header = 1;
  74. // Required. Must be in the format "providers/{provider}".
  75. // The provider must be the Project ID (for example, sample-cloud-project)
  76. // of the Google Cloud Project of which the service account making
  77. // this call is a member.
  78. string parent = 3 [
  79. (google.api.field_behavior) = REQUIRED,
  80. (google.api.resource_reference) = {
  81. type: "fleetengine.googleapis.com/Trip"
  82. }
  83. ];
  84. // Required. Unique Trip ID; must be unique per provider. The actual
  85. // format and value is opaque to the Fleet Engine and is determined
  86. // by the provider.
  87. string trip_id = 5 [(google.api.field_behavior) = REQUIRED];
  88. // Required. Trip entity to create.
  89. //
  90. // When creating a Trip, the following fields are required:
  91. //
  92. // * trip_type
  93. // * pickup_point
  94. //
  95. // The following fields are used if you provide them:
  96. //
  97. // * number_of_passengers
  98. // * vehicle_id
  99. // * dropoff_point
  100. // * intermediate_destinations
  101. //
  102. // Only EXCLUSIVE trips support multiple destinations.
  103. //
  104. // When vehicle_id is set for a shared trip, you must supply
  105. // the list of `Trip.vehicle_waypoints` to specify the order of the remaining
  106. // waypoints for the vehicle, otherwise the waypoint order will be
  107. // undetermined.
  108. //
  109. // When you specify `Trip.vehicle_waypoints`, the list must contain all
  110. // the remaining waypoints of the vehicle's trips, with no extra waypoints.
  111. // You must order these waypoints such that for a given trip, the pickup
  112. // point is before intermediate destinations, and all intermediate
  113. // destinations come before the drop-off point. An `EXCLUSIVE` trip's
  114. // waypoints must not interleave with any other trips.
  115. //
  116. // The `trip_id`, `waypoint_type` and `location` fields are used, and all
  117. // other TripWaypoint fields in vehicle_waypoints are ignored.
  118. //
  119. // All other Trip fields are ignored.
  120. Trip trip = 4 [(google.api.field_behavior) = REQUIRED];
  121. }
  122. // GetTrip request message.
  123. message GetTripRequest {
  124. // The standard Fleet Engine request header.
  125. RequestHeader header = 1;
  126. // Required. Must be in the format "providers/{provider}/trips/{trip}".
  127. // The provider must be the Project ID (for example, sample-cloud-project)
  128. // of the Google Cloud Project of which the service account making
  129. // this call is a member.
  130. string name = 3 [
  131. (google.api.field_behavior) = REQUIRED,
  132. (google.api.resource_reference) = {
  133. type: "fleetengine.googleapis.com/Trip"
  134. }
  135. ];
  136. // The subset of Trip fields that should be returned and their interpretation.
  137. TripView view = 11;
  138. // Indicates the minimum timestamp (exclusive) for which Trip.route or
  139. // Trip.current_route_segment data is retrieved. If route data is unchanged
  140. // since this timestamp, the route field is not set in the response. If a
  141. // minimum is unspecified, the route data is always retrieved.
  142. google.protobuf.Timestamp current_route_segment_version = 6;
  143. // Indicates the minimum timestamp (exclusive) for which
  144. // Trip.remaining_waypoints are retrieved. If they are unchanged since this
  145. // timestamp, the remaining_waypoints are not set in the response. If this
  146. // field is unspecified, remaining_waypoints is always retrieved.
  147. google.protobuf.Timestamp remaining_waypoints_version = 7;
  148. // The returned current route format, LAT_LNG_LIST_TYPE (in Trip.route), or
  149. // ENCODED_POLYLINE_TYPE (in Trip.current_route_segment).
  150. // The default is LAT_LNG_LIST_TYPE.
  151. PolylineFormatType route_format_type = 8;
  152. }
  153. // ReportBillableTrip request message.
  154. message ReportBillableTripRequest {
  155. // Selector for different solution types of a reported trip.
  156. enum SolutionType {
  157. // The default value. For backwards-compatibility, the API will use
  158. // ON_DEMAND_RIDESHARING_AND_DELIVERIES by default which is the first
  159. // supported solution type.
  160. SOLUTION_TYPE_UNSPECIFIED = 0;
  161. // The solution is an on-demand ridesharing and deliveries trip.
  162. ON_DEMAND_RIDESHARING_AND_DELIVERIES = 1;
  163. }
  164. // Required. Must be in the format
  165. // "providers/{provider}/billableTrips/{billable_trip}". The
  166. // provider must be the Project ID (for example, sample-cloud-project) of the
  167. // Google Cloud Project of which the service account making this call is a
  168. // member.
  169. string name = 2 [(google.api.field_behavior) = REQUIRED];
  170. // Required. Two letter country code of the country where the trip takes place. Price is
  171. // defined according to country code.
  172. string country_code = 3 [(google.api.field_behavior) = REQUIRED];
  173. // The platform upon which the request was issued.
  174. BillingPlatformIdentifier platform = 5;
  175. // The identifiers that are directly related to the trip being reported. These
  176. // are usually IDs (for example, session IDs) of pre-booking operations done
  177. // before the trip ID is available. The number of related_ids is
  178. // limited to 50.
  179. repeated string related_ids = 6;
  180. // The type of GMP product solution (for example,
  181. // ON_DEMAND_RIDESHARING_AND_DELIVERIES) used for the reported trip.
  182. SolutionType solution_type = 7;
  183. }
  184. // UpdateTrip request message.
  185. message UpdateTripRequest {
  186. // The standard Fleet Engine request header.
  187. RequestHeader header = 1;
  188. // Required. Must be in the format
  189. // `providers/{provider}/trips/{trip}`. The provider must
  190. // be the Project ID (for example, sample-consumer-project) of the Google
  191. // Cloud Project of which the service account making this call is a member.
  192. string name = 3 [(google.api.field_behavior) = REQUIRED];
  193. // Required. The Trip associated with the update.
  194. //
  195. // The following fields are maintained by the Fleet Engine. Do not update
  196. // them using Trip.update.
  197. //
  198. // * current_route_segment
  199. // * current_route_segment_version
  200. // * eta_to_next_waypoint
  201. // * intermediate_destinations_version
  202. // * last_location
  203. // * name
  204. // * number_of_passengers
  205. // * remaining_distance_meters
  206. // * remaining_time_to_first_waypoint
  207. // * remaining_waypoints
  208. // * remaining_waypoints_version
  209. //
  210. // When you update the `Trip.vehicle_id` for a shared trip, you must supply
  211. // the list of `Trip.vehicle_waypoints` to specify the order of the remaining
  212. // waypoints, otherwise the order will be undetermined.
  213. //
  214. // When you specify `Trip.vehicle_waypoints`, the list must contain all
  215. // the remaining waypoints of the vehicle's trips, with no extra waypoints.
  216. // You must order these waypoints such that for a given trip, the pickup
  217. // point is before intermediate destinations, and all intermediate
  218. // destinations come before the drop-off point. An `EXCLUSIVE` trip's
  219. // waypoints must not interleave with any other trips.
  220. // The `trip_id`, `waypoint_type` and `location` fields are used, and all
  221. // other TripWaypoint fields in vehicle_waypoints are ignored.
  222. //
  223. // To avoid a race condition for trips with multiple destinations, you
  224. // should provide `Trip.intermediate_destinations_version` when updating
  225. // the trip status to `ENROUTE_TO_INTERMEDIATE_DESTINATION`. The
  226. // `Trip.intermediate_destinations_version` passed must be consistent with
  227. // Fleet Engine's version. If it isn't, the request fails.
  228. Trip trip = 4 [(google.api.field_behavior) = REQUIRED];
  229. // Required. The field mask indicating which fields in Trip to update.
  230. // The update_mask must contain at least one field.
  231. google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = REQUIRED];
  232. }
  233. // SearchTrips request message.
  234. message SearchTripsRequest {
  235. // The standard Fleet Engine request header.
  236. RequestHeader header = 1;
  237. // Required. Must be in the format "providers/*"
  238. // The provider must be the Project ID (for example, sample-cloud-project)
  239. // of the Google Cloud Project of which the service account making
  240. // this call is a member.
  241. string parent = 3 [(google.api.field_behavior) = REQUIRED];
  242. // The vehicle associated with the trips in the request. If unspecified, the
  243. // returned trips do not contain:
  244. //
  245. // * current_route_segment
  246. // * remaining_waypoints
  247. // * remaining_distance_meters
  248. // * eta_to_first_waypoint
  249. string vehicle_id = 4;
  250. // If set to true, only Trips that influence the drivers route
  251. // are included in the response.
  252. bool active_trips_only = 5;
  253. // If not set, the server will decide the number of
  254. // results to return.
  255. int32 page_size = 6;
  256. // Set this to a value previously returned in the
  257. // SearchTripsResponse to continue from previous results.
  258. string page_token = 7;
  259. // If specified, returns the trips that have not been updated after
  260. // the time (current - minimum_staleness).
  261. google.protobuf.Duration minimum_staleness = 8;
  262. }
  263. // SearchTrips response message.
  264. message SearchTripsResponse {
  265. // The list of trips for the requested vehicle.
  266. repeated Trip trips = 1;
  267. // Pass this token in the SearchTripsRequest to continue to
  268. // list results. If all results have been returned, this field is an empty
  269. // string or not present in the response.
  270. string next_page_token = 2;
  271. }