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.delivery.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/geo/type/viewport.proto"; 25import "google/maps/fleetengine/delivery/v1/delivery_vehicles.proto"; 26import "google/maps/fleetengine/delivery/v1/header.proto"; 27import "google/maps/fleetengine/delivery/v1/task_tracking_info.proto"; 28import "google/maps/fleetengine/delivery/v1/tasks.proto"; 29import "google/protobuf/field_mask.proto"; 30 31option csharp_namespace = "Google.Maps.FleetEngine.Delivery.V1"; 32option go_package = "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb;deliverypb"; 33option java_multiple_files = true; 34option java_outer_classname = "DeliveryApi"; 35option java_package = "google.maps.fleetengine.delivery.v1"; 36option objc_class_prefix = "CFED"; 37option (google.api.resource_definition) = { 38 type: "fleetengine.googleapis.com/Provider" 39 pattern: "providers/{provider}" 40}; 41 42// The Last Mile Delivery service. 43service DeliveryService { 44 option (google.api.default_host) = "fleetengine.googleapis.com"; 45 option (google.api.oauth_scopes) = 46 "https://www.googleapis.com/auth/cloud-platform"; 47 48 // Creates and returns a new `DeliveryVehicle`. 49 rpc CreateDeliveryVehicle(CreateDeliveryVehicleRequest) 50 returns (DeliveryVehicle) { 51 option (google.api.http) = { 52 post: "/v1/{parent=providers/*}/deliveryVehicles" 53 body: "delivery_vehicle" 54 }; 55 option (google.api.routing) = { 56 routing_parameters { 57 field: "parent" 58 path_template: "{provider_id=providers/*}" 59 } 60 }; 61 option (google.api.method_signature) = 62 "parent,delivery_vehicle,delivery_vehicle_id"; 63 } 64 65 // Returns the specified `DeliveryVehicle` instance. 66 rpc GetDeliveryVehicle(GetDeliveryVehicleRequest) returns (DeliveryVehicle) { 67 option (google.api.http) = { 68 get: "/v1/{name=providers/*/deliveryVehicles/*}" 69 }; 70 option (google.api.routing) = { 71 routing_parameters { 72 field: "name" 73 path_template: "{provider_id=providers/*}" 74 } 75 }; 76 option (google.api.method_signature) = "name"; 77 } 78 79 // Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns 80 // `Tasks` to the `DeliveryVehicle`. You cannot update the name of the 81 // `DeliveryVehicle`. You *can* update `remaining_vehicle_journey_segments` 82 // though, but it must contain all of the `VehicleJourneySegment`s currently 83 // on the `DeliveryVehicle`. The `task_id`s are retrieved from 84 // `remaining_vehicle_journey_segments`, and their corresponding `Tasks` are 85 // assigned to the `DeliveryVehicle` if they have not yet been assigned. 86 rpc UpdateDeliveryVehicle(UpdateDeliveryVehicleRequest) 87 returns (DeliveryVehicle) { 88 option (google.api.http) = { 89 patch: "/v1/{delivery_vehicle.name=providers/*/deliveryVehicles/*}" 90 body: "delivery_vehicle" 91 }; 92 option (google.api.routing) = { 93 routing_parameters { 94 field: "delivery_vehicle.name" 95 path_template: "{provider_id=providers/*}" 96 } 97 }; 98 option (google.api.method_signature) = "delivery_vehicle,update_mask"; 99 } 100 101 // Creates and returns a batch of new `Task` objects. 102 rpc BatchCreateTasks(BatchCreateTasksRequest) 103 returns (BatchCreateTasksResponse) { 104 option (google.api.http) = { 105 post: "/v1/{parent=providers/*}/tasks:batchCreate" 106 body: "*" 107 }; 108 option (google.api.routing) = { 109 routing_parameters { 110 field: "parent" 111 path_template: "{provider_id=providers/*}" 112 } 113 }; 114 } 115 116 // Creates and returns a new `Task` object. 117 rpc CreateTask(CreateTaskRequest) returns (Task) { 118 option (google.api.http) = { 119 post: "/v1/{parent=providers/*}/tasks" 120 body: "task" 121 }; 122 option (google.api.routing) = { 123 routing_parameters { 124 field: "parent" 125 path_template: "{provider_id=providers/*}" 126 } 127 }; 128 option (google.api.method_signature) = "parent,task,task_id"; 129 } 130 131 // Gets information about a `Task`. 132 rpc GetTask(GetTaskRequest) returns (Task) { 133 option (google.api.http) = { 134 get: "/v1/{name=providers/*/tasks/*}" 135 }; 136 option (google.api.routing) = { 137 routing_parameters { 138 field: "name" 139 path_template: "{provider_id=providers/*}" 140 } 141 }; 142 option (google.api.method_signature) = "name"; 143 } 144 145 // Deprecated: Use `GetTaskTrackingInfo` instead. 146 rpc SearchTasks(SearchTasksRequest) returns (SearchTasksResponse) { 147 option deprecated = true; 148 option (google.api.http) = { 149 get: "/v1/{parent=providers/*}/tasks:search" 150 }; 151 option (google.api.routing) = { 152 routing_parameters { 153 field: "parent" 154 path_template: "{provider_id=providers/*}" 155 } 156 }; 157 option (google.api.method_signature) = "parent"; 158 } 159 160 // Updates `Task` data. 161 rpc UpdateTask(UpdateTaskRequest) returns (Task) { 162 option (google.api.http) = { 163 patch: "/v1/{task.name=providers/*/tasks/*}" 164 body: "task" 165 }; 166 option (google.api.routing) = { 167 routing_parameters { 168 field: "task.name" 169 path_template: "{provider_id=providers/*}" 170 } 171 }; 172 option (google.api.method_signature) = "task,update_mask"; 173 } 174 175 // Gets all `Task`s that meet the specified filtering criteria. 176 rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) { 177 option (google.api.http) = { 178 get: "/v1/{parent=providers/*}/tasks" 179 }; 180 option (google.api.routing) = { 181 routing_parameters { 182 field: "parent" 183 path_template: "{provider_id=providers/*}" 184 } 185 }; 186 option (google.api.method_signature) = "parent"; 187 } 188 189 // Returns the specified `TaskTrackingInfo` instance. 190 rpc GetTaskTrackingInfo(GetTaskTrackingInfoRequest) 191 returns (TaskTrackingInfo) { 192 option (google.api.http) = { 193 get: "/v1/{name=providers/*/taskTrackingInfo/*}" 194 }; 195 option (google.api.routing) = { 196 routing_parameters { 197 field: "name" 198 path_template: "{provider_id=providers/*}" 199 } 200 }; 201 option (google.api.method_signature) = "name"; 202 } 203 204 // Gets all `DeliveryVehicle`s that meet the specified filtering criteria. 205 rpc ListDeliveryVehicles(ListDeliveryVehiclesRequest) 206 returns (ListDeliveryVehiclesResponse) { 207 option (google.api.http) = { 208 get: "/v1/{parent=providers/*}/deliveryVehicles" 209 }; 210 option (google.api.routing) = { 211 routing_parameters { 212 field: "parent" 213 path_template: "{provider_id=providers/*}" 214 } 215 }; 216 option (google.api.method_signature) = "parent"; 217 } 218} 219 220// The `CreateDeliveryVehicle` request message. 221message CreateDeliveryVehicleRequest { 222 // Optional. The standard Delivery API request header. 223 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 224 225 // Required. Must be in the format `providers/{provider}`. The provider must 226 // be the Google Cloud Project ID. For example, `sample-cloud-project`. 227 string parent = 3 [(google.api.field_behavior) = REQUIRED]; 228 229 // Required. The Delivery Vehicle ID must be unique and subject to the 230 // following restrictions: 231 // 232 // * Must be a valid Unicode string. 233 // * Limited to a maximum length of 64 characters. 234 // * Normalized according to [Unicode Normalization Form C] 235 // (http://www.unicode.org/reports/tr15/). 236 // * May not contain any of the following ASCII characters: '/', ':', '?', 237 // ',', or '#'. 238 string delivery_vehicle_id = 4 [(google.api.field_behavior) = REQUIRED]; 239 240 // Required. The `DeliveryVehicle` entity to create. When creating a new 241 // delivery vehicle, you may set the following optional fields: 242 // 243 // * last_location 244 // * attributes 245 // 246 // Note: The DeliveryVehicle's `name` field is ignored. All other 247 // DeliveryVehicle fields must not be set; otherwise, an error is returned. 248 DeliveryVehicle delivery_vehicle = 5 [(google.api.field_behavior) = REQUIRED]; 249} 250 251// The `GetDeliveryVehicle` request message. 252message GetDeliveryVehicleRequest { 253 // Optional. The standard Delivery API request header. 254 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 255 256 // Required. Must be in the format 257 // `providers/{provider}/deliveryVehicles/{delivery_vehicle}`. 258 // The `provider` must be the Google Cloud Project ID. For example, 259 // `sample-cloud-project`. 260 string name = 3 [ 261 (google.api.field_behavior) = REQUIRED, 262 (google.api.resource_reference) = { 263 type: "fleetengine.googleapis.com/DeliveryVehicle" 264 } 265 ]; 266} 267 268// The `ListDeliveryVehicles` request message. 269message ListDeliveryVehiclesRequest { 270 // Optional. The standard Delivery API request header. 271 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 272 273 // Required. Must be in the format `providers/{provider}`. 274 // The `provider` must be the Google Cloud Project ID. 275 // For example, `sample-cloud-project`. 276 string parent = 3 [ 277 (google.api.field_behavior) = REQUIRED, 278 (google.api.resource_reference) = { 279 child_type: "fleetengine.googleapis.com/DeliveryVehicle" 280 } 281 ]; 282 283 // Optional. The maximum number of vehicles to return. The service may return 284 // fewer than this number. If you don't specify this number, then the server 285 // determines the number of results to return. 286 int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; 287 288 // Optional. A page token, received from a previous `ListDeliveryVehicles` 289 // call. You must provide this in order to retrieve the subsequent page. 290 // 291 // When paginating, all other parameters provided to `ListDeliveryVehicles` 292 // must match the call that provided the page token. 293 string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; 294 295 // Optional. A filter query to apply when listing delivery vehicles. See 296 // http://aip.dev/160 for examples of the filter syntax. If you don't specify 297 // a value, or if you specify an empty string for the filter, then all 298 // delivery vehicles are returned. 299 // 300 // Note that the only queries supported for `ListDeliveryVehicles` are 301 // on vehicle attributes (for example, `attributes.<key> = <value>` or 302 // `attributes.<key1> = <value1> AND attributes.<key2> = <value2>`). Also, all 303 // attributes are stored as strings, so the only supported comparisons against 304 // attributes are string comparisons. In order to compare against number or 305 // boolean values, the values must be explicitly quoted to be treated as 306 // strings (for example, `attributes.<key> = "10"` or 307 // `attributes.<key> = "true"`). 308 // 309 // The maximum number of restrictions allowed in a filter query is 50. A 310 // restriction is a part of the query of the form 311 // `attribute.<KEY> <COMPARATOR> <VALUE>`, for example `attributes.foo = bar` 312 // is 1 restriction. 313 string filter = 6 [(google.api.field_behavior) = OPTIONAL]; 314 315 // Optional. A filter that limits the vehicles returned to those whose last 316 // known location was in the rectangular area defined by the viewport. 317 google.geo.type.Viewport viewport = 7 318 [(google.api.field_behavior) = OPTIONAL]; 319} 320 321// The `ListDeliveryVehicles` response message. 322message ListDeliveryVehiclesResponse { 323 // The set of delivery vehicles that meet the requested filtering criteria. 324 // When no filter is specified, the request returns all delivery vehicles. A 325 // successful response can also be empty. An empty response indicates that no 326 // delivery vehicles were found meeting the requested filter criteria. 327 repeated DeliveryVehicle delivery_vehicles = 1; 328 329 // You can pass this token in the `ListDeliveryVehiclesRequest` to continue to 330 // list results. When all of the results are returned, this field won't be in 331 // the response, or it will be an empty string. 332 string next_page_token = 2; 333 334 // The total number of delivery vehicles that match the request criteria, 335 // across all pages. 336 int64 total_size = 3; 337} 338 339// The `UpdateDeliveryVehicle` request message. 340message UpdateDeliveryVehicleRequest { 341 // Optional. The standard Delivery API request header. 342 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 343 344 // Required. The `DeliveryVehicle` entity update to apply. 345 // Note: You cannot update the name of the `DeliveryVehicle`. 346 DeliveryVehicle delivery_vehicle = 3 [(google.api.field_behavior) = REQUIRED]; 347 348 // Required. A field mask that indicates which `DeliveryVehicle` fields to 349 // update. Note that the update_mask must contain at least one field. 350 // 351 // This is a comma-separated list of fully qualified names of fields. Example: 352 // `"remaining_vehicle_journey_segments"`. 353 google.protobuf.FieldMask update_mask = 4 354 [(google.api.field_behavior) = REQUIRED]; 355} 356 357// The `BatchCreateTask` request message. 358message BatchCreateTasksRequest { 359 // Optional. The standard Delivery API request header. 360 // Note: If you set this field, then the header field in the 361 // `CreateTaskRequest` messages must either be empty, or it must match this 362 // field. 363 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 364 365 // Required. The parent resource shared by all tasks. This value must be in 366 // the format `providers/{provider}`. The `provider` must be the Google Cloud 367 // Project ID. For example, `sample-cloud-project`. The parent field in the 368 // `CreateTaskRequest` messages must either be empty, or it must match this 369 // field. 370 string parent = 3 [ 371 (google.api.field_behavior) = REQUIRED, 372 (google.api.resource_reference) = { 373 child_type: "fleetengine.googleapis.com/Task" 374 } 375 ]; 376 377 // Required. The request message that specifies the resources to create. 378 // Note: You can create a maximum of 500 tasks in a batch. 379 repeated CreateTaskRequest requests = 4 380 [(google.api.field_behavior) = REQUIRED]; 381} 382 383// The `BatchCreateTask` response message. 384message BatchCreateTasksResponse { 385 // The created Tasks. 386 repeated Task tasks = 1; 387} 388 389// The `CreateTask` request message. 390message CreateTaskRequest { 391 // Optional. The standard Delivery API request header. 392 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 393 394 // Required. Must be in the format `providers/{provider}`. The `provider` must 395 // be the Google Cloud Project ID. For example, `sample-cloud-project`. 396 string parent = 3 [(google.api.field_behavior) = REQUIRED]; 397 398 // Required. The Task ID must be unique, but it should be not a shipment 399 // tracking ID. To store a shipment tracking ID, use the `tracking_id` field. 400 // Note that multiple tasks can have the same `tracking_id`. Task IDs are 401 // subject to the following restrictions: 402 // 403 // * Must be a valid Unicode string. 404 // * Limited to a maximum length of 64 characters. 405 // * Normalized according to [Unicode Normalization Form C] 406 // (http://www.unicode.org/reports/tr15/). 407 // * May not contain any of the following ASCII characters: '/', ':', '?', 408 // ',', or '#'. 409 string task_id = 5 [(google.api.field_behavior) = REQUIRED]; 410 411 // Required. The Task entity to create. 412 // When creating a Task, the following fields are required: 413 // 414 // * `type` 415 // * `state` (must be set to `OPEN`) 416 // * `tracking_id` (must not be set for `UNAVAILABLE` or `SCHEDULED_STOP` 417 // tasks, but required for all other task types) 418 // * `planned_location` (optional for `UNAVAILABLE` tasks) 419 // * `task_duration` 420 // 421 // Note: The Task's `name` field is ignored. All other Task fields must not be 422 // set; otherwise, an error is returned. 423 Task task = 4 [(google.api.field_behavior) = REQUIRED]; 424} 425 426// The `GetTask` request message. 427message GetTaskRequest { 428 // Optional. The standard Delivery API request header. 429 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 430 431 // Required. Must be in the format `providers/{provider}/tasks/{task}`. The 432 // `provider` must be the Google Cloud Project ID. For example, 433 // `sample-cloud-project`. 434 string name = 3 [ 435 (google.api.field_behavior) = REQUIRED, 436 (google.api.resource_reference) = { 437 type: "fleetengine.googleapis.com/Task" 438 } 439 ]; 440} 441 442// Deprecated: Issue `GetTaskTrackingInfoRequest`s to `GetTaskTrackingInfo` 443// instead. 444message SearchTasksRequest { 445 option deprecated = true; 446 447 // Optional. The standard Delivery API request header. 448 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 449 450 // Required. Must be in the format `providers/{provider}`. 451 // The provider must be the Google Cloud Project ID. For example, 452 // `sample-cloud-project`. 453 string parent = 3 [(google.api.field_behavior) = REQUIRED]; 454 455 // Required. The identifier of the set of related Tasks being requested. 456 // Tracking IDs are subject to the following restrictions: 457 // 458 // * Must be a valid Unicode string. 459 // * Limited to a maximum length of 64 characters. 460 // * Normalized according to [Unicode Normalization Form C] 461 // (http://www.unicode.org/reports/tr15/). 462 // * May not contain any of the following ASCII characters: '/', ':', '?', 463 // ',', or '#'. 464 string tracking_id = 4 [(google.api.field_behavior) = REQUIRED]; 465 466 // Optional. The maximum number of Tasks to return. The service may return 467 // fewer than this value. If you don't specify this value, then the server 468 // determines the number of results to return. 469 int32 page_size = 5 [(google.api.field_behavior) = OPTIONAL]; 470 471 // Optional. A page token, received from a previous `SearchTasks` call. You 472 // must provide this value to retrieve the subsequent page. 473 // 474 // When paginating, all other parameters provided to `SearchTasks` must match 475 // the call that provided the page token. 476 string page_token = 6 [(google.api.field_behavior) = OPTIONAL]; 477} 478 479// The `SearchTasks` response. It contains the set of Tasks that meet the search 480// criteria in the `SearchTasksRequest`. 481message SearchTasksResponse { 482 option deprecated = true; 483 484 // The set of Tasks for the requested `tracking_id`. A successful response can 485 // also be empty. An empty response indicates that no Tasks are associated 486 // with the supplied `tracking_id`. 487 repeated Task tasks = 1; 488 489 // Pass this token in the `SearchTasksRequest` to continue to 490 // list results. If all results have been returned, then this field is either 491 // an empty string, or it doesn't appear in the response. 492 string next_page_token = 2; 493} 494 495// The `UpdateTask` request message. 496message UpdateTaskRequest { 497 // Optional. The standard Delivery API request header. 498 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 499 500 // Required. The Task associated with the update. 501 // The following fields are maintained by Fleet Engine. Do not update 502 // them using `Task.update`. 503 // 504 // * `last_location`. 505 // * `last_location_snappable`. 506 // * `name`. 507 // * `remaining_vehicle_journey_segments`. 508 // * `task_outcome_location_source`. 509 // 510 // Note: You cannot change the value of `task_outcome` once you set it. 511 // 512 // If the Task has been assigned to a delivery vehicle, then don't set the 513 // Task state to CLOSED using `Task.update`. Instead, remove the `VehicleStop` 514 // that contains the Task from the delivery vehicle, which automatically sets 515 // the Task state to CLOSED. 516 Task task = 3 [(google.api.field_behavior) = REQUIRED]; 517 518 // Required. The field mask that indicates which Task fields to update. 519 // Note: The `update_mask` must contain at least one field. 520 // 521 // This is a comma-separated list of fully qualified names of fields. Example: 522 // `"task_outcome,task_outcome_time,task_outcome_location"`. 523 google.protobuf.FieldMask update_mask = 4 524 [(google.api.field_behavior) = REQUIRED]; 525} 526 527// The `ListTasks` request message. 528message ListTasksRequest { 529 // Optional. The standard Delivery API request header. 530 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 531 532 // Required. Must be in the format `providers/{provider}`. 533 // The `provider` must be the Google Cloud Project ID. For example, 534 // `sample-cloud-project`. 535 string parent = 3 [ 536 (google.api.field_behavior) = REQUIRED, 537 (google.api.resource_reference) = { 538 child_type: "fleetengine.googleapis.com/Task" 539 } 540 ]; 541 542 // Optional. The maximum number of Tasks to return. The service may return 543 // fewer than this value. If you don't specify this value, then the server 544 // determines the number of results to return. 545 int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; 546 547 // Optional. A page token received from a previous `ListTasks` call. 548 // You can provide this to retrieve the subsequent page. 549 // 550 // When paginating, all other parameters provided to `ListTasks` must match 551 // the call that provided the page token. 552 string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; 553 554 // Optional. A filter query to apply when listing Tasks. See 555 // http://aip.dev/160 for examples of filter syntax. If you don't specify a 556 // value, or if you filter on an empty string, then all Tasks are returned. 557 // For information about the Task properties that you can filter on, see [Task 558 // list](/maps/documentation/transportation-logistics/last-mile-fleet-solution/fleet-performance/fleet-engine/deliveries_api#list_tasks). 559 string filter = 6 [(google.api.field_behavior) = OPTIONAL]; 560} 561 562// The `ListTasks` response that contains the set of Tasks that meet the filter 563// criteria in the `ListTasksRequest`. 564message ListTasksResponse { 565 // The set of Tasks that meet the requested filtering criteria. When no filter 566 // is specified, the request returns all tasks. A successful response can also 567 // be empty. An empty response indicates that no Tasks were found meeting the 568 // requested filter criteria. 569 repeated Task tasks = 1; 570 571 // Pass this token in the `ListTasksRequest` to continue to list results. 572 // If all results have been returned, then this field is either an empty 573 // string, or it doesn't appear in the response. 574 string next_page_token = 2; 575 576 // The total number of Tasks that match the request criteria, across all 577 // pages. 578 int64 total_size = 3; 579} 580 581// The `GetTaskTrackingInfoRequest` request message. 582message GetTaskTrackingInfoRequest { 583 // Optional. The standard Delivery API request header. 584 DeliveryRequestHeader header = 1 [(google.api.field_behavior) = OPTIONAL]; 585 586 // Required. Must be in the format 587 // `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider` 588 // must be the Google Cloud Project ID, and the `tracking_id` must be the 589 // tracking ID associated with the task. An example name can be 590 // `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`. 591 string name = 3 [ 592 (google.api.field_behavior) = REQUIRED, 593 (google.api.resource_reference) = { 594 type: "fleetengine.googleapis.com/TaskTrackingInfo" 595 } 596 ]; 597} 598