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