trip_api.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. // Copyright 2022 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/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/api/routing.proto";
  21. import "google/maps/fleetengine/v1/fleetengine.proto";
  22. import "google/maps/fleetengine/v1/header.proto";
  23. import "google/maps/fleetengine/v1/trips.proto";
  24. import "google/protobuf/duration.proto";
  25. import "google/protobuf/empty.proto";
  26. import "google/protobuf/field_mask.proto";
  27. import "google/protobuf/timestamp.proto";
  28. option go_package = "google.golang.org/genproto/googleapis/maps/fleetengine/v1;fleetengine";
  29. option java_multiple_files = true;
  30. option java_outer_classname = "TripApi";
  31. option java_package = "google.maps.fleetengine.v1";
  32. option objc_class_prefix = "CFE";
  33. // Trip management service.
  34. service TripService {
  35. option (google.api.default_host) = "fleetengine.googleapis.com";
  36. // Creates a trip in the Fleet Engine and returns the new trip.
  37. rpc CreateTrip(CreateTripRequest) returns (Trip) {
  38. option (google.api.http) = {
  39. post: "/v1/{parent=providers/*}/trips"
  40. body: "trip"
  41. };
  42. option (google.api.routing) = {
  43. routing_parameters {
  44. field: "parent"
  45. path_template: "{provider_id=providers/*}"
  46. }
  47. };
  48. }
  49. // Get information about a single trip.
  50. rpc GetTrip(GetTripRequest) returns (Trip) {
  51. option (google.api.http) = {
  52. get: "/v1/{name=providers/*/trips/*}"
  53. };
  54. option (google.api.routing) = {
  55. routing_parameters {
  56. field: "name"
  57. path_template: "{provider_id=providers/*}"
  58. }
  59. };
  60. }
  61. // Report billable trip usage.
  62. rpc ReportBillableTrip(ReportBillableTripRequest) returns (google.protobuf.Empty) {
  63. option (google.api.http) = {
  64. post: "/v1/{name=providers/*/billableTrips/*}:report"
  65. body: "*"
  66. };
  67. option (google.api.routing) = {
  68. routing_parameters {
  69. field: "name"
  70. path_template: "{provider_id=providers/*}"
  71. }
  72. };
  73. }
  74. // Get all the trips for a specific vehicle.
  75. rpc SearchTrips(SearchTripsRequest) returns (SearchTripsResponse) {
  76. option (google.api.http) = {
  77. post: "/v1/{parent=providers/*}/trips:search"
  78. body: "*"
  79. };
  80. option (google.api.routing) = {
  81. routing_parameters {
  82. field: "parent"
  83. path_template: "{provider_id=providers/*}"
  84. }
  85. };
  86. }
  87. // Updates trip data.
  88. rpc UpdateTrip(UpdateTripRequest) returns (Trip) {
  89. option (google.api.http) = {
  90. put: "/v1/{name=providers/*/trips/*}"
  91. body: "trip"
  92. };
  93. option (google.api.routing) = {
  94. routing_parameters {
  95. field: "name"
  96. path_template: "{provider_id=providers/*}"
  97. }
  98. };
  99. }
  100. }
  101. // CreateTrip request message.
  102. message CreateTripRequest {
  103. // The standard Fleet Engine request header.
  104. RequestHeader header = 1;
  105. // Required. Must be in the format `providers/{provider}`.
  106. // The provider must be the Project ID (for example, `sample-cloud-project`)
  107. // of the Google Cloud Project of which the service account making
  108. // this call is a member.
  109. string parent = 3 [
  110. (google.api.field_behavior) = REQUIRED,
  111. (google.api.resource_reference) = {
  112. type: "fleetengine.googleapis.com/Trip"
  113. }
  114. ];
  115. // Required. Unique Trip ID.
  116. // Subject to the following restrictions:
  117. //
  118. // * Must be a valid Unicode string.
  119. // * Limited to a maximum length of 64 characters.
  120. // * Normalized according to [Unicode Normalization Form C]
  121. // (http://www.unicode.org/reports/tr15/).
  122. // * May not contain any of the following ASCII characters: '/', ':', '?',
  123. // ',', or '#'.
  124. string trip_id = 5 [(google.api.field_behavior) = REQUIRED];
  125. // Required. Trip entity to create.
  126. //
  127. // When creating a Trip, the following fields are required:
  128. //
  129. // * `trip_type`
  130. // * `pickup_point`
  131. //
  132. // The following fields are used if you provide them:
  133. //
  134. // * `number_of_passengers`
  135. // * `vehicle_id`
  136. // * `dropoff_point`
  137. // * `intermediate_destinations`
  138. //
  139. // Only `EXCLUSIVE` trips support multiple destinations.
  140. //
  141. // When `vehicle_id` is set for a shared trip, you must supply
  142. // the list of `Trip.vehicle_waypoints` to specify the order of the remaining
  143. // waypoints for the vehicle, otherwise the waypoint order will be
  144. // undetermined.
  145. //
  146. // When you specify `Trip.vehicle_waypoints`, the list must contain all
  147. // the remaining waypoints of the vehicle's trips, with no extra waypoints.
  148. // You must order these waypoints such that for a given trip, the pickup
  149. // point is before intermediate destinations, and all intermediate
  150. // destinations come before the drop-off point. An `EXCLUSIVE` trip's
  151. // waypoints must not interleave with any other trips.
  152. //
  153. // The `trip_id`, `waypoint_type` and `location` fields are used, and all
  154. // other TripWaypoint fields in `vehicle_waypoints` are ignored.
  155. //
  156. // All other Trip fields are ignored.
  157. Trip trip = 4 [(google.api.field_behavior) = REQUIRED];
  158. }
  159. // GetTrip request message.
  160. message GetTripRequest {
  161. // The standard Fleet Engine request header.
  162. RequestHeader header = 1;
  163. // Required. Must be in the format `providers/{provider}/trips/{trip}`.
  164. // The provider must be the Project ID (for example, `sample-cloud-project`)
  165. // of the Google Cloud Project of which the service account making
  166. // this call is a member.
  167. string name = 3 [
  168. (google.api.field_behavior) = REQUIRED,
  169. (google.api.resource_reference) = {
  170. type: "fleetengine.googleapis.com/Trip"
  171. }
  172. ];
  173. // The subset of Trip fields that should be returned and their interpretation.
  174. TripView view = 11;
  175. // Indicates the minimum timestamp (exclusive) for which `Trip.route` or
  176. // `Trip.current_route_segment` data are retrieved. If route data are
  177. // unchanged since this timestamp, the route field is not set in the response.
  178. // If a minimum is unspecified, the route data are always retrieved.
  179. google.protobuf.Timestamp current_route_segment_version = 6;
  180. // Indicates the minimum timestamp (exclusive) for which
  181. // `Trip.remaining_waypoints` are retrieved. If they are unchanged since this
  182. // timestamp, the `remaining_waypoints` are not set in the response. If this
  183. // field is unspecified, `remaining_waypoints` is always retrieved.
  184. google.protobuf.Timestamp remaining_waypoints_version = 7;
  185. // The returned current route format, `LAT_LNG_LIST_TYPE` (in `Trip.route`),
  186. // or `ENCODED_POLYLINE_TYPE` (in `Trip.current_route_segment`). The default
  187. // is `LAT_LNG_LIST_TYPE`.
  188. PolylineFormatType route_format_type = 8;
  189. // Indicates the minimum timestamp (exclusive) for which
  190. // `Trip.current_route_segment_traffic` is retrieved. If traffic data are
  191. // unchanged since this timestamp, the `current_route_segment_traffic` field
  192. // is not set in the response. If a minimum is unspecified, the traffic data
  193. // are always retrieved. Note that traffic is only available for On-Demand
  194. // Rides and Deliveries Solution customers.
  195. google.protobuf.Timestamp current_route_segment_traffic_version = 9;
  196. // Indicates the minimum timestamp (exclusive) for which
  197. // `Trip.remaining_waypoints.traffic_to_waypoint` and
  198. // `Trip.remaining_waypoints.path_to_waypoint` data are retrieved. If data are
  199. // unchanged since this timestamp, the fields above are
  200. // not set in the response. If `remaining_waypoints_route_version` is
  201. // unspecified, traffic and path are always retrieved.
  202. google.protobuf.Timestamp remaining_waypoints_route_version = 10;
  203. }
  204. // ReportBillableTrip request message.
  205. message ReportBillableTripRequest {
  206. // Selector for different solution types of a reported trip.
  207. enum SolutionType {
  208. // The default value. For backwards-compatibility, the API will use
  209. // `ON_DEMAND_RIDESHARING_AND_DELIVERIES` by default which is the first
  210. // supported solution type.
  211. SOLUTION_TYPE_UNSPECIFIED = 0;
  212. // The solution is an on-demand ridesharing and deliveries trip.
  213. ON_DEMAND_RIDESHARING_AND_DELIVERIES = 1;
  214. }
  215. // Required. Must be in the format
  216. // `providers/{provider}/billableTrips/{billable_trip}`. The
  217. // provider must be the Project ID (for example, `sample-cloud-project`) of
  218. // the Google Cloud Project of which the service account making this call is a
  219. // member.
  220. string name = 2 [(google.api.field_behavior) = REQUIRED];
  221. // Required. Two letter country code of the country where the trip takes place. Price is
  222. // defined according to country code.
  223. string country_code = 3 [(google.api.field_behavior) = REQUIRED];
  224. // The platform upon which the request was issued.
  225. BillingPlatformIdentifier platform = 5;
  226. // The identifiers that are directly related to the trip being reported. These
  227. // are usually IDs (for example, session IDs) of pre-booking operations done
  228. // before the trip ID is available. The number of `related_ids` is
  229. // limited to 50.
  230. repeated string related_ids = 6;
  231. // The type of GMP product solution (for example,
  232. // `ON_DEMAND_RIDESHARING_AND_DELIVERIES`) used for the reported trip.
  233. SolutionType solution_type = 7;
  234. }
  235. // UpdateTrip request message.
  236. message UpdateTripRequest {
  237. // The standard Fleet Engine request header.
  238. RequestHeader header = 1;
  239. // Required. Must be in the format
  240. // `providers/{provider}/trips/{trip}`. The provider must
  241. // be the Project ID (for example, `sample-consumer-project`) of the Google
  242. // Cloud Project of which the service account making this call is a member.
  243. string name = 3 [(google.api.field_behavior) = REQUIRED];
  244. // Required. The Trip associated with the update.
  245. //
  246. // The following fields are maintained by the Fleet Engine. Do not update
  247. // them using Trip.update.
  248. //
  249. // * `current_route_segment`
  250. // * `current_route_segment_end_point`
  251. // * `current_route_segment_traffic`
  252. // * `current_route_segment_traffic_version`
  253. // * `current_route_segment_version`
  254. // * `dropoff_time`
  255. // * `eta_to_next_waypoint`
  256. // * `intermediate_destinations_version`
  257. // * `last_location`
  258. // * `name`
  259. // * `number_of_passengers`
  260. // * `pickup_time`
  261. // * `remaining_distance_meters`
  262. // * `remaining_time_to_first_waypoint`
  263. // * `remaining_waypoints`
  264. // * `remaining_waypoints_version`
  265. // * `route`
  266. //
  267. // When you update the `Trip.vehicle_id` for a shared trip, you must supply
  268. // the list of `Trip.vehicle_waypoints` to specify the order of the remaining
  269. // waypoints, otherwise the order will be undetermined.
  270. //
  271. // When you specify `Trip.vehicle_waypoints`, the list must contain all
  272. // the remaining waypoints of the vehicle's trips, with no extra waypoints.
  273. // You must order these waypoints such that for a given trip, the pickup
  274. // point is before intermediate destinations, and all intermediate
  275. // destinations come before the drop-off point. An `EXCLUSIVE` trip's
  276. // waypoints must not interleave with any other trips.
  277. // The `trip_id`, `waypoint_type` and `location` fields are used, and all
  278. // other TripWaypoint fields in `vehicle_waypoints` are ignored.
  279. //
  280. // To avoid a race condition for trips with multiple destinations, you
  281. // should provide `Trip.intermediate_destinations_version` when updating
  282. // the trip status to `ENROUTE_TO_INTERMEDIATE_DESTINATION`. The
  283. // `Trip.intermediate_destinations_version` passed must be consistent with
  284. // Fleet Engine's version. If it isn't, the request fails.
  285. Trip trip = 4 [(google.api.field_behavior) = REQUIRED];
  286. // Required. The field mask indicating which fields in Trip to update.
  287. // The `update_mask` must contain at least one field.
  288. google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = REQUIRED];
  289. }
  290. // SearchTrips request message.
  291. message SearchTripsRequest {
  292. // The standard Fleet Engine request header.
  293. RequestHeader header = 1;
  294. // Required. Must be in the format `providers/{provider}`.
  295. // The provider must be the Project ID (for example, `sample-cloud-project`)
  296. // of the Google Cloud Project of which the service account making
  297. // this call is a member.
  298. string parent = 3 [(google.api.field_behavior) = REQUIRED];
  299. // The vehicle associated with the trips in the request. If unspecified, the
  300. // returned trips do not contain:
  301. //
  302. // * `current_route_segment`
  303. // * `remaining_waypoints`
  304. // * `remaining_distance_meters`
  305. // * `eta_to_first_waypoint`
  306. string vehicle_id = 4;
  307. // If set to true, the response includes Trips that influence a driver's
  308. // route.
  309. bool active_trips_only = 5;
  310. // If not set, the server decides the number of results to return.
  311. int32 page_size = 6;
  312. // Set this to a value previously returned in the `SearchTripsResponse` to
  313. // continue from previous results.
  314. string page_token = 7;
  315. // If specified, returns the trips that have not been updated after the time
  316. // `(current - minimum_staleness)`.
  317. google.protobuf.Duration minimum_staleness = 8;
  318. }
  319. // SearchTrips response message.
  320. message SearchTripsResponse {
  321. // The list of trips for the requested vehicle.
  322. repeated Trip trips = 1;
  323. // Pass this token in the SearchTripsRequest to continue to
  324. // list results. If all results have been returned, this field is an empty
  325. // string or not present in the response.
  326. string next_page_token = 2;
  327. }