This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String parent = "parent-995424086"; + * DeliveryVehicle deliveryVehicle = DeliveryVehicle.newBuilder().build(); + * String deliveryVehicleId = "deliveryVehicleId-861424685"; + * DeliveryVehicle response = + * deliveryServiceClient.createDeliveryVehicle(parent, deliveryVehicle, deliveryVehicleId); + * } + * }+ * + *
Note: close() needs to be called on the DeliveryServiceClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of DeliveryServiceSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * DeliveryServiceSettings deliveryServiceSettings = + * DeliveryServiceSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * DeliveryServiceClient deliveryServiceClient = + * DeliveryServiceClient.create(deliveryServiceSettings); + * }+ * + *
To customize the endpoint: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * DeliveryServiceSettings deliveryServiceSettings = + * DeliveryServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + * DeliveryServiceClient deliveryServiceClient = + * DeliveryServiceClient.create(deliveryServiceSettings); + * }+ * + *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * DeliveryServiceSettings deliveryServiceSettings = + * DeliveryServiceSettings.newHttpJsonBuilder().build(); + * DeliveryServiceClient deliveryServiceClient = + * DeliveryServiceClient.create(deliveryServiceSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class DeliveryServiceClient implements BackgroundResource { + private final DeliveryServiceSettings settings; + private final DeliveryServiceStub stub; + + /** Constructs an instance of DeliveryServiceClient with default settings. */ + public static final DeliveryServiceClient create() throws IOException { + return create(DeliveryServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of DeliveryServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final DeliveryServiceClient create(DeliveryServiceSettings settings) + throws IOException { + return new DeliveryServiceClient(settings); + } + + /** + * Constructs an instance of DeliveryServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(DeliveryServiceSettings). + */ + public static final DeliveryServiceClient create(DeliveryServiceStub stub) { + return new DeliveryServiceClient(stub); + } + + /** + * Constructs an instance of DeliveryServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected DeliveryServiceClient(DeliveryServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((DeliveryServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected DeliveryServiceClient(DeliveryServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final DeliveryServiceSettings getSettings() { + return settings; + } + + public DeliveryServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and returns a new `DeliveryVehicle`. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String parent = "parent-995424086"; + * DeliveryVehicle deliveryVehicle = DeliveryVehicle.newBuilder().build(); + * String deliveryVehicleId = "deliveryVehicleId-861424685"; + * DeliveryVehicle response = + * deliveryServiceClient.createDeliveryVehicle(parent, deliveryVehicle, deliveryVehicleId); + * } + * }+ * + * @param parent Required. Must be in the format `providers/{provider}`. The provider must be the + * Google Cloud Project ID. For example, `sample-cloud-project`. + * @param deliveryVehicle Required. The `DeliveryVehicle` entity to create. When creating a new + * delivery vehicle, you may set the following optional fields: + *
Note: The DeliveryVehicle's `name` field is ignored. All other DeliveryVehicle fields + * must not be set; otherwise, an error is returned. + * @param deliveryVehicleId Required. The Delivery Vehicle ID must be unique and subject to the + * following restrictions: + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * CreateDeliveryVehicleRequest request = + * CreateDeliveryVehicleRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent("parent-995424086") + * .setDeliveryVehicleId("deliveryVehicleId-861424685") + * .setDeliveryVehicle(DeliveryVehicle.newBuilder().build()) + * .build(); + * DeliveryVehicle response = deliveryServiceClient.createDeliveryVehicle(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DeliveryVehicle createDeliveryVehicle(CreateDeliveryVehicleRequest request) { + return createDeliveryVehicleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and returns a new `DeliveryVehicle`. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * CreateDeliveryVehicleRequest request = + * CreateDeliveryVehicleRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent("parent-995424086") + * .setDeliveryVehicleId("deliveryVehicleId-861424685") + * .setDeliveryVehicle(DeliveryVehicle.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * deliveryServiceClient.createDeliveryVehicleCallable().futureCall(request); + * // Do something. + * DeliveryVehicle response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * DeliveryVehicleName name = DeliveryVehicleName.of("[PROVIDER]", "[VEHICLE]"); + * DeliveryVehicle response = deliveryServiceClient.getDeliveryVehicle(name); + * } + * }+ * + * @param name Required. Must be in the format + * `providers/{provider}/deliveryVehicles/{delivery_vehicle}`. The `provider` must be the + * Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DeliveryVehicle getDeliveryVehicle(DeliveryVehicleName name) { + GetDeliveryVehicleRequest request = + GetDeliveryVehicleRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getDeliveryVehicle(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the specified `DeliveryVehicle` instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String name = DeliveryVehicleName.of("[PROVIDER]", "[VEHICLE]").toString(); + * DeliveryVehicle response = deliveryServiceClient.getDeliveryVehicle(name); + * } + * }+ * + * @param name Required. Must be in the format + * `providers/{provider}/deliveryVehicles/{delivery_vehicle}`. The `provider` must be the + * Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DeliveryVehicle getDeliveryVehicle(String name) { + GetDeliveryVehicleRequest request = + GetDeliveryVehicleRequest.newBuilder().setName(name).build(); + return getDeliveryVehicle(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the specified `DeliveryVehicle` instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * GetDeliveryVehicleRequest request = + * GetDeliveryVehicleRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setName(DeliveryVehicleName.of("[PROVIDER]", "[VEHICLE]").toString()) + * .build(); + * DeliveryVehicle response = deliveryServiceClient.getDeliveryVehicle(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DeliveryVehicle getDeliveryVehicle(GetDeliveryVehicleRequest request) { + return getDeliveryVehicleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the specified `DeliveryVehicle` instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * GetDeliveryVehicleRequest request = + * GetDeliveryVehicleRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setName(DeliveryVehicleName.of("[PROVIDER]", "[VEHICLE]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * deliveryServiceClient.getDeliveryVehicleCallable().futureCall(request); + * // Do something. + * DeliveryVehicle response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * DeliveryVehicle deliveryVehicle = DeliveryVehicle.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * DeliveryVehicle response = + * deliveryServiceClient.updateDeliveryVehicle(deliveryVehicle, updateMask); + * } + * }+ * + * @param deliveryVehicle Required. The `DeliveryVehicle` entity update to apply. Note: You cannot + * update the name of the `DeliveryVehicle`. + * @param updateMask Required. A field mask that indicates which `DeliveryVehicle` fields to + * update. Note that the update_mask must contain at least one field. + *
This is a comma-separated list of fully qualified names of fields. Example: + * `"remaining_vehicle_journey_segments"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DeliveryVehicle updateDeliveryVehicle( + DeliveryVehicle deliveryVehicle, FieldMask updateMask) { + UpdateDeliveryVehicleRequest request = + UpdateDeliveryVehicleRequest.newBuilder() + .setDeliveryVehicle(deliveryVehicle) + .setUpdateMask(updateMask) + .build(); + return updateDeliveryVehicle(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns `Tasks` to the + * `DeliveryVehicle`. You cannot update the name of the `DeliveryVehicle`. You *can* + * update `remaining_vehicle_journey_segments` though, but it must contain all of the + * `VehicleJourneySegment`s currently on the `DeliveryVehicle`. The `task_id`s are retrieved from + * `remaining_vehicle_journey_segments`, and their corresponding `Tasks` are assigned to the + * `DeliveryVehicle` if they have not yet been assigned. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * UpdateDeliveryVehicleRequest request = + * UpdateDeliveryVehicleRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setDeliveryVehicle(DeliveryVehicle.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * DeliveryVehicle response = deliveryServiceClient.updateDeliveryVehicle(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DeliveryVehicle updateDeliveryVehicle(UpdateDeliveryVehicleRequest request) { + return updateDeliveryVehicleCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns `Tasks` to the + * `DeliveryVehicle`. You cannot update the name of the `DeliveryVehicle`. You *can* + * update `remaining_vehicle_journey_segments` though, but it must contain all of the + * `VehicleJourneySegment`s currently on the `DeliveryVehicle`. The `task_id`s are retrieved from + * `remaining_vehicle_journey_segments`, and their corresponding `Tasks` are assigned to the + * `DeliveryVehicle` if they have not yet been assigned. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * UpdateDeliveryVehicleRequest request = + * UpdateDeliveryVehicleRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setDeliveryVehicle(DeliveryVehicle.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * deliveryServiceClient.updateDeliveryVehicleCallable().futureCall(request); + * // Do something. + * DeliveryVehicle response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * BatchCreateTasksRequest request = + * BatchCreateTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .addAllRequests(new ArrayList+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BatchCreateTasksResponse batchCreateTasks(BatchCreateTasksRequest request) { + return batchCreateTasksCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and returns a batch of new `Task` objects. + * + *()) + * .build(); + * BatchCreateTasksResponse response = deliveryServiceClient.batchCreateTasks(request); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * BatchCreateTasksRequest request = + * BatchCreateTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .addAllRequests(new ArrayList+ */ + public final UnaryCallable()) + * .build(); + * ApiFuture future = + * deliveryServiceClient.batchCreateTasksCallable().futureCall(request); + * // Do something. + * BatchCreateTasksResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String parent = "parent-995424086"; + * Task task = Task.newBuilder().build(); + * String taskId = "taskId-880873088"; + * Task response = deliveryServiceClient.createTask(parent, task, taskId); + * } + * }+ * + * @param parent Required. Must be in the format `providers/{provider}`. The `provider` must be + * the Google Cloud Project ID. For example, `sample-cloud-project`. + * @param task Required. The Task entity to create. When creating a Task, the following fields are + * required: + *
Note: The Task's `name` field is ignored. All other Task fields must not be set; + * otherwise, an error is returned. + * @param taskId Required. The Task ID must be unique, but it should be not a shipment tracking + * ID. To store a shipment tracking ID, use the `tracking_id` field. Note that multiple tasks + * can have the same `tracking_id`. Task IDs are subject to the following restrictions: + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * CreateTaskRequest request = + * CreateTaskRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent("parent-995424086") + * .setTaskId("taskId-880873088") + * .setTask(Task.newBuilder().build()) + * .build(); + * Task response = deliveryServiceClient.createTask(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task createTask(CreateTaskRequest request) { + return createTaskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and returns a new `Task` object. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * CreateTaskRequest request = + * CreateTaskRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent("parent-995424086") + * .setTaskId("taskId-880873088") + * .setTask(Task.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = deliveryServiceClient.createTaskCallable().futureCall(request); + * // Do something. + * Task response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * TaskName name = TaskName.of("[PROVIDER]", "[TASK]"); + * Task response = deliveryServiceClient.getTask(name); + * } + * }+ * + * @param name Required. Must be in the format `providers/{provider}/tasks/{task}`. The `provider` + * must be the Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task getTask(TaskName name) { + GetTaskRequest request = + GetTaskRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getTask(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a `Task`. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String name = TaskName.of("[PROVIDER]", "[TASK]").toString(); + * Task response = deliveryServiceClient.getTask(name); + * } + * }+ * + * @param name Required. Must be in the format `providers/{provider}/tasks/{task}`. The `provider` + * must be the Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task getTask(String name) { + GetTaskRequest request = GetTaskRequest.newBuilder().setName(name).build(); + return getTask(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a `Task`. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * GetTaskRequest request = + * GetTaskRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setName(TaskName.of("[PROVIDER]", "[TASK]").toString()) + * .build(); + * Task response = deliveryServiceClient.getTask(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task getTask(GetTaskRequest request) { + return getTaskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a `Task`. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * GetTaskRequest request = + * GetTaskRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setName(TaskName.of("[PROVIDER]", "[TASK]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = deliveryServiceClient.getTaskCallable().futureCall(request); + * // Do something. + * Task response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String parent = "parent-995424086"; + * for (Task element : deliveryServiceClient.searchTasks(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Must be in the format `providers/{provider}`. The provider must be the + * Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated This method is deprecated and will be removed in the next major version update. + */ + @Deprecated + public final SearchTasksPagedResponse searchTasks(String parent) { + SearchTasksRequest request = SearchTasksRequest.newBuilder().setParent(parent).build(); + return searchTasks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deprecated: Use `GetTaskTrackingInfo` instead. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * SearchTasksRequest request = + * SearchTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent("parent-995424086") + * .setTrackingId("trackingId1168987698") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Task element : deliveryServiceClient.searchTasks(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated This method is deprecated and will be removed in the next major version update. + */ + @Deprecated + public final SearchTasksPagedResponse searchTasks(SearchTasksRequest request) { + return searchTasksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deprecated: Use `GetTaskTrackingInfo` instead. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * SearchTasksRequest request = + * SearchTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent("parent-995424086") + * .setTrackingId("trackingId1168987698") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ * + * @deprecated This method is deprecated and will be removed in the next major version update. + */ + @Deprecated + public final UnaryCallablefuture = deliveryServiceClient.searchTasksPagedCallable().futureCall(request); + * // Do something. + * for (Task element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * SearchTasksRequest request = + * SearchTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent("parent-995424086") + * .setTrackingId("trackingId1168987698") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * SearchTasksResponse response = deliveryServiceClient.searchTasksCallable().call(request); + * for (Task element : response.getTasksList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ * + * @deprecated This method is deprecated and will be removed in the next major version update. + */ + @Deprecated + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * Task task = Task.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Task response = deliveryServiceClient.updateTask(task, updateMask); + * } + * }+ * + * @param task Required. The Task associated with the update. The following fields are maintained + * by Fleet Engine. Do not update them using `Task.update`. + *
* `last_location`. * `last_location_snappable`. * `name`. * + * `remaining_vehicle_journey_segments`. * `task_outcome_location_source`. + *
Note: You cannot change the value of `task_outcome` once you set it. + *
If the Task has been assigned to a delivery vehicle, then don't set the Task state to + * CLOSED using `Task.update`. Instead, remove the `VehicleStop` that contains the Task from + * the delivery vehicle, which automatically sets the Task state to CLOSED. + * @param updateMask Required. The field mask that indicates which Task fields to update. Note: + * The `update_mask` must contain at least one field. + *
This is a comma-separated list of fully qualified names of fields. Example: + * `"task_outcome,task_outcome_time,task_outcome_location"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task updateTask(Task task, FieldMask updateMask) { + UpdateTaskRequest request = + UpdateTaskRequest.newBuilder().setTask(task).setUpdateMask(updateMask).build(); + return updateTask(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates `Task` data. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * UpdateTaskRequest request = + * UpdateTaskRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setTask(Task.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Task response = deliveryServiceClient.updateTask(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task updateTask(UpdateTaskRequest request) { + return updateTaskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates `Task` data. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * UpdateTaskRequest request = + * UpdateTaskRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setTask(Task.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = deliveryServiceClient.updateTaskCallable().futureCall(request); + * // Do something. + * Task response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ProviderName parent = ProviderName.of("[PROVIDER]"); + * for (Task element : deliveryServiceClient.listTasks(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Must be in the format `providers/{provider}`. The `provider` must be + * the Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTasksPagedResponse listTasks(ProviderName parent) { + ListTasksRequest request = + ListTasksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listTasks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all `Task`s that meet the specified filtering criteria. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String parent = ProviderName.of("[PROVIDER]").toString(); + * for (Task element : deliveryServiceClient.listTasks(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Must be in the format `providers/{provider}`. The `provider` must be + * the Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTasksPagedResponse listTasks(String parent) { + ListTasksRequest request = ListTasksRequest.newBuilder().setParent(parent).build(); + return listTasks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all `Task`s that meet the specified filtering criteria. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ListTasksRequest request = + * ListTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .build(); + * for (Task element : deliveryServiceClient.listTasks(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTasksPagedResponse listTasks(ListTasksRequest request) { + return listTasksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all `Task`s that meet the specified filtering criteria. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ListTasksRequest request = + * ListTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = deliveryServiceClient.listTasksPagedCallable().futureCall(request); + * // Do something. + * for (Task element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ListTasksRequest request = + * ListTasksRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .build(); + * while (true) { + * ListTasksResponse response = deliveryServiceClient.listTasksCallable().call(request); + * for (Task element : response.getTasksList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * TaskTrackingInfoName name = TaskTrackingInfoName.of("[PROVIDER]", "[TRACKING]"); + * TaskTrackingInfo response = deliveryServiceClient.getTaskTrackingInfo(name); + * } + * }+ * + * @param name Required. Must be in the format + * `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider` must be the Google + * Cloud Project ID, and the `tracking_id` must be the tracking ID associated with the task. + * An example name can be + * `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TaskTrackingInfo getTaskTrackingInfo(TaskTrackingInfoName name) { + GetTaskTrackingInfoRequest request = + GetTaskTrackingInfoRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getTaskTrackingInfo(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the specified `TaskTrackingInfo` instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String name = TaskTrackingInfoName.of("[PROVIDER]", "[TRACKING]").toString(); + * TaskTrackingInfo response = deliveryServiceClient.getTaskTrackingInfo(name); + * } + * }+ * + * @param name Required. Must be in the format + * `providers/{provider}/taskTrackingInfo/{tracking_id}`. The `provider` must be the Google + * Cloud Project ID, and the `tracking_id` must be the tracking ID associated with the task. + * An example name can be + * `providers/sample-cloud-project/taskTrackingInfo/sample-tracking-id`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TaskTrackingInfo getTaskTrackingInfo(String name) { + GetTaskTrackingInfoRequest request = + GetTaskTrackingInfoRequest.newBuilder().setName(name).build(); + return getTaskTrackingInfo(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the specified `TaskTrackingInfo` instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * GetTaskTrackingInfoRequest request = + * GetTaskTrackingInfoRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setName(TaskTrackingInfoName.of("[PROVIDER]", "[TRACKING]").toString()) + * .build(); + * TaskTrackingInfo response = deliveryServiceClient.getTaskTrackingInfo(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TaskTrackingInfo getTaskTrackingInfo(GetTaskTrackingInfoRequest request) { + return getTaskTrackingInfoCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the specified `TaskTrackingInfo` instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * GetTaskTrackingInfoRequest request = + * GetTaskTrackingInfoRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setName(TaskTrackingInfoName.of("[PROVIDER]", "[TRACKING]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * deliveryServiceClient.getTaskTrackingInfoCallable().futureCall(request); + * // Do something. + * TaskTrackingInfo response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ProviderName parent = ProviderName.of("[PROVIDER]"); + * for (DeliveryVehicle element : + * deliveryServiceClient.listDeliveryVehicles(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Must be in the format `providers/{provider}`. The `provider` must be + * the Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListDeliveryVehiclesPagedResponse listDeliveryVehicles(ProviderName parent) { + ListDeliveryVehiclesRequest request = + ListDeliveryVehiclesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listDeliveryVehicles(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all `DeliveryVehicle`s that meet the specified filtering criteria. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * String parent = ProviderName.of("[PROVIDER]").toString(); + * for (DeliveryVehicle element : + * deliveryServiceClient.listDeliveryVehicles(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Must be in the format `providers/{provider}`. The `provider` must be + * the Google Cloud Project ID. For example, `sample-cloud-project`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListDeliveryVehiclesPagedResponse listDeliveryVehicles(String parent) { + ListDeliveryVehiclesRequest request = + ListDeliveryVehiclesRequest.newBuilder().setParent(parent).build(); + return listDeliveryVehicles(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all `DeliveryVehicle`s that meet the specified filtering criteria. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ListDeliveryVehiclesRequest request = + * ListDeliveryVehiclesRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setViewport(Viewport.newBuilder().build()) + * .build(); + * for (DeliveryVehicle element : + * deliveryServiceClient.listDeliveryVehicles(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListDeliveryVehiclesPagedResponse listDeliveryVehicles( + ListDeliveryVehiclesRequest request) { + return listDeliveryVehiclesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all `DeliveryVehicle`s that meet the specified filtering criteria. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ListDeliveryVehiclesRequest request = + * ListDeliveryVehiclesRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setViewport(Viewport.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * deliveryServiceClient.listDeliveryVehiclesPagedCallable().futureCall(request); + * // Do something. + * for (DeliveryVehicle element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) { + * ListDeliveryVehiclesRequest request = + * ListDeliveryVehiclesRequest.newBuilder() + * .setHeader(DeliveryRequestHeader.newBuilder().build()) + * .setParent(ProviderName.of("[PROVIDER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setViewport(Viewport.newBuilder().build()) + * .build(); + * while (true) { + * ListDeliveryVehiclesResponse response = + * deliveryServiceClient.listDeliveryVehiclesCallable().call(request); + * for (DeliveryVehicle element : response.getDeliveryVehiclesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of createDeliveryVehicle to 30 seconds: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * DeliveryServiceSettings.Builder deliveryServiceSettingsBuilder = + * DeliveryServiceSettings.newBuilder(); + * deliveryServiceSettingsBuilder + * .createDeliveryVehicleSettings() + * .setRetrySettings( + * deliveryServiceSettingsBuilder + * .createDeliveryVehicleSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * DeliveryServiceSettings deliveryServiceSettings = deliveryServiceSettingsBuilder.build(); + * }+ */ +@Generated("by gapic-generator-java") +public class DeliveryServiceSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= DeliveryServiceClient =======================
+ *
+ * Service Description: The Last Mile Delivery service.
+ *
+ * Sample for DeliveryServiceClient:
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class DeliveryServiceStub implements BackgroundResource {
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of createDeliveryVehicle to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcDeliveryServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcDeliveryServiceStub extends DeliveryServiceStub {
+ private static final MethodDescriptor{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DeliveryServiceClient deliveryServiceClient = DeliveryServiceClient.create()) {
+ * String parent = "parent-995424086";
+ * DeliveryVehicle deliveryVehicle = DeliveryVehicle.newBuilder().build();
+ * String deliveryVehicleId = "deliveryVehicleId-861424685";
+ * DeliveryVehicle response =
+ * deliveryServiceClient.createDeliveryVehicle(parent, deliveryVehicle, deliveryVehicleId);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package google.maps.fleetengine.delivery.v1;
+
+import javax.annotation.Generated;
diff --git a/java-maps-fleetengine-delivery/google-maps-fleetengine-delivery/src/main/java/com/google/maps/fleetengine/delivery/v1/stub/DeliveryServiceStub.java b/java-maps-fleetengine-delivery/google-maps-fleetengine-delivery/src/main/java/com/google/maps/fleetengine/delivery/v1/stub/DeliveryServiceStub.java
new file mode 100644
index 000000000000..013f4028130b
--- /dev/null
+++ b/java-maps-fleetengine-delivery/google-maps-fleetengine-delivery/src/main/java/com/google/maps/fleetengine/delivery/v1/stub/DeliveryServiceStub.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package google.maps.fleetengine.delivery.v1.stub;
+
+import static google.maps.fleetengine.delivery.v1.DeliveryServiceClient.ListDeliveryVehiclesPagedResponse;
+import static google.maps.fleetengine.delivery.v1.DeliveryServiceClient.ListTasksPagedResponse;
+import static google.maps.fleetengine.delivery.v1.DeliveryServiceClient.SearchTasksPagedResponse;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.UnaryCallable;
+import google.maps.fleetengine.delivery.v1.BatchCreateTasksRequest;
+import google.maps.fleetengine.delivery.v1.BatchCreateTasksResponse;
+import google.maps.fleetengine.delivery.v1.CreateDeliveryVehicleRequest;
+import google.maps.fleetengine.delivery.v1.CreateTaskRequest;
+import google.maps.fleetengine.delivery.v1.DeliveryVehicle;
+import google.maps.fleetengine.delivery.v1.GetDeliveryVehicleRequest;
+import google.maps.fleetengine.delivery.v1.GetTaskRequest;
+import google.maps.fleetengine.delivery.v1.GetTaskTrackingInfoRequest;
+import google.maps.fleetengine.delivery.v1.ListDeliveryVehiclesRequest;
+import google.maps.fleetengine.delivery.v1.ListDeliveryVehiclesResponse;
+import google.maps.fleetengine.delivery.v1.ListTasksRequest;
+import google.maps.fleetengine.delivery.v1.ListTasksResponse;
+import google.maps.fleetengine.delivery.v1.SearchTasksRequest;
+import google.maps.fleetengine.delivery.v1.SearchTasksResponse;
+import google.maps.fleetengine.delivery.v1.Task;
+import google.maps.fleetengine.delivery.v1.TaskTrackingInfo;
+import google.maps.fleetengine.delivery.v1.UpdateDeliveryVehicleRequest;
+import google.maps.fleetengine.delivery.v1.UpdateTaskRequest;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the DeliveryService service API.
+ *
+ *
+ *
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * DeliveryServiceStubSettings.Builder deliveryServiceSettingsBuilder =
+ * DeliveryServiceStubSettings.newBuilder();
+ * deliveryServiceSettingsBuilder
+ * .createDeliveryVehicleSettings()
+ * .setRetrySettings(
+ * deliveryServiceSettingsBuilder
+ * .createDeliveryVehicleSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * DeliveryServiceStubSettings deliveryServiceSettings = deliveryServiceSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class DeliveryServiceStubSettings extends StubSettings