Reference documentation and code samples for the Google Maps FleetEngine Delivery V1 Client class DeliveryServiceClient.
Service Description: The Last Mile Delivery service.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
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 parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Namespace
Google \ Maps \ FleetEngine \ Delivery \ V1 \ ClientMethods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
batchCreateTasks
Creates and returns a batch of new Task
objects.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::batchCreateTasksAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\BatchCreateTasksRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\BatchCreateTasksResponse |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\BatchCreateTasksRequest;
use Google\Maps\FleetEngine\Delivery\V1\BatchCreateTasksResponse;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\CreateTaskRequest;
use Google\Maps\FleetEngine\Delivery\V1\Task;
use Google\Maps\FleetEngine\Delivery\V1\Task\State;
use Google\Maps\FleetEngine\Delivery\V1\Task\Type;
use Google\Protobuf\Duration;
/**
* @param string $formattedParent The parent resource shared by all tasks. This value must be in
* the format `providers/{provider}`. The `provider` must be the Google Cloud
* Project ID. For example, `sample-cloud-project`. The parent field in the
* `CreateTaskRequest` messages must either be empty, or it must match this
* field. Please see
* {@see DeliveryServiceClient::providerName()} for help formatting this field.
* @param string $requestsParent Must be in the format `providers/{provider}`. The `provider` must
* be the Google Cloud Project ID. For example, `sample-cloud-project`.
* @param string $requestsTaskId 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:
*
* * Must be a valid Unicode string.
* * Limited to a maximum length of 64 characters.
* * Normalized according to [Unicode Normalization Form C]
* (http://www.unicode.org/reports/tr15/).
* * May not contain any of the following ASCII characters: '/', ':', '?',
* ',', or '#'.
* @param int $requestsTaskType Immutable. Defines the type of the Task. For example, a break or
* shipment.
* @param int $requestsTaskState The current execution state of the Task.
*/
function batch_create_tasks_sample(
string $formattedParent,
string $requestsParent,
string $requestsTaskId,
int $requestsTaskType,
int $requestsTaskState
): void {
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$requestsTaskTaskDuration = new Duration();
$requestsTask = (new Task())
->setType($requestsTaskType)
->setState($requestsTaskState)
->setTaskDuration($requestsTaskTaskDuration);
$createTaskRequest = (new CreateTaskRequest())
->setParent($requestsParent)
->setTaskId($requestsTaskId)
->setTask($requestsTask);
$requests = [$createTaskRequest,];
$request = (new BatchCreateTasksRequest())
->setParent($formattedParent)
->setRequests($requests);
// Call the API and handle any network failures.
try {
/** @var BatchCreateTasksResponse $response */
$response = $deliveryServiceClient->batchCreateTasks($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DeliveryServiceClient::providerName('[PROVIDER]');
$requestsParent = '[PARENT]';
$requestsTaskId = '[TASK_ID]';
$requestsTaskType = Type::TYPE_UNSPECIFIED;
$requestsTaskState = State::STATE_UNSPECIFIED;
batch_create_tasks_sample(
$formattedParent,
$requestsParent,
$requestsTaskId,
$requestsTaskType,
$requestsTaskState
);
}
createDeliveryVehicle
Creates and returns a new DeliveryVehicle
.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::createDeliveryVehicleAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\CreateDeliveryVehicleRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\DeliveryVehicle |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\CreateDeliveryVehicleRequest;
use Google\Maps\FleetEngine\Delivery\V1\DeliveryVehicle;
/**
* @param string $parent Must be in the format `providers/{provider}`. The provider must
* be the Google Cloud Project ID. For example, `sample-cloud-project`.
* @param string $deliveryVehicleId The Delivery Vehicle ID must be unique and subject to the
* following restrictions:
*
* * Must be a valid Unicode string.
* * Limited to a maximum length of 64 characters.
* * Normalized according to [Unicode Normalization Form C]
* (http://www.unicode.org/reports/tr15/).
* * May not contain any of the following ASCII characters: '/', ':', '?',
* ',', or '#'.
*/
function create_delivery_vehicle_sample(string $parent, string $deliveryVehicleId): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$deliveryVehicle = new DeliveryVehicle();
$request = (new CreateDeliveryVehicleRequest())
->setParent($parent)
->setDeliveryVehicleId($deliveryVehicleId)
->setDeliveryVehicle($deliveryVehicle);
// Call the API and handle any network failures.
try {
/** @var DeliveryVehicle $response */
$response = $deliveryServiceClient->createDeliveryVehicle($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$parent = '[PARENT]';
$deliveryVehicleId = '[DELIVERY_VEHICLE_ID]';
create_delivery_vehicle_sample($parent, $deliveryVehicleId);
}
createTask
Creates and returns a new Task
object.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::createTaskAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\CreateTaskRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\Task |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\CreateTaskRequest;
use Google\Maps\FleetEngine\Delivery\V1\Task;
use Google\Maps\FleetEngine\Delivery\V1\Task\State;
use Google\Maps\FleetEngine\Delivery\V1\Task\Type;
use Google\Protobuf\Duration;
/**
* @param string $parent Must be in the format `providers/{provider}`. The `provider` must
* be the Google Cloud Project ID. For example, `sample-cloud-project`.
* @param string $taskId 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:
*
* * Must be a valid Unicode string.
* * Limited to a maximum length of 64 characters.
* * Normalized according to [Unicode Normalization Form C]
* (http://www.unicode.org/reports/tr15/).
* * May not contain any of the following ASCII characters: '/', ':', '?',
* ',', or '#'.
* @param int $taskType Immutable. Defines the type of the Task. For example, a break or
* shipment.
* @param int $taskState The current execution state of the Task.
*/
function create_task_sample(string $parent, string $taskId, int $taskType, int $taskState): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$taskTaskDuration = new Duration();
$task = (new Task())
->setType($taskType)
->setState($taskState)
->setTaskDuration($taskTaskDuration);
$request = (new CreateTaskRequest())
->setParent($parent)
->setTaskId($taskId)
->setTask($task);
// Call the API and handle any network failures.
try {
/** @var Task $response */
$response = $deliveryServiceClient->createTask($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$parent = '[PARENT]';
$taskId = '[TASK_ID]';
$taskType = Type::TYPE_UNSPECIFIED;
$taskState = State::STATE_UNSPECIFIED;
create_task_sample($parent, $taskId, $taskType, $taskState);
}
getDeliveryVehicle
Returns the specified DeliveryVehicle
instance.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::getDeliveryVehicleAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\GetDeliveryVehicleRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\DeliveryVehicle |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\DeliveryVehicle;
use Google\Maps\FleetEngine\Delivery\V1\GetDeliveryVehicleRequest;
/**
* @param string $formattedName Must be in the format
* `providers/{provider}/deliveryVehicles/{delivery_vehicle}`.
* The `provider` must be the Google Cloud Project ID. For example,
* `sample-cloud-project`. Please see
* {@see DeliveryServiceClient::deliveryVehicleName()} for help formatting this field.
*/
function get_delivery_vehicle_sample(string $formattedName): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$request = (new GetDeliveryVehicleRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var DeliveryVehicle $response */
$response = $deliveryServiceClient->getDeliveryVehicle($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DeliveryServiceClient::deliveryVehicleName('[PROVIDER]', '[VEHICLE]');
get_delivery_vehicle_sample($formattedName);
}
getTask
Gets information about a Task
.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::getTaskAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\GetTaskRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\Task |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\GetTaskRequest;
use Google\Maps\FleetEngine\Delivery\V1\Task;
/**
* @param string $formattedName Must be in the format `providers/{provider}/tasks/{task}`. The
* `provider` must be the Google Cloud Project ID. For example,
* `sample-cloud-project`. Please see
* {@see DeliveryServiceClient::taskName()} for help formatting this field.
*/
function get_task_sample(string $formattedName): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$request = (new GetTaskRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Task $response */
$response = $deliveryServiceClient->getTask($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DeliveryServiceClient::taskName('[PROVIDER]', '[TASK]');
get_task_sample($formattedName);
}
getTaskTrackingInfo
Returns the specified TaskTrackingInfo
instance.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::getTaskTrackingInfoAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\GetTaskTrackingInfoRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\TaskTrackingInfo |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\GetTaskTrackingInfoRequest;
use Google\Maps\FleetEngine\Delivery\V1\TaskTrackingInfo;
/**
* @param string $formattedName 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`. Please see
* {@see DeliveryServiceClient::taskTrackingInfoName()} for help formatting this field.
*/
function get_task_tracking_info_sample(string $formattedName): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$request = (new GetTaskTrackingInfoRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var TaskTrackingInfo $response */
$response = $deliveryServiceClient->getTaskTrackingInfo($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = DeliveryServiceClient::taskTrackingInfoName('[PROVIDER]', '[TRACKING]');
get_task_tracking_info_sample($formattedName);
}
listDeliveryVehicles
Gets all DeliveryVehicle
s that meet the specified filtering criteria.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::listDeliveryVehiclesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\ListDeliveryVehiclesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\DeliveryVehicle;
use Google\Maps\FleetEngine\Delivery\V1\ListDeliveryVehiclesRequest;
/**
* @param string $formattedParent Must be in the format `providers/{provider}`.
* The `provider` must be the Google Cloud Project ID.
* For example, `sample-cloud-project`. Please see
* {@see DeliveryServiceClient::providerName()} for help formatting this field.
*/
function list_delivery_vehicles_sample(string $formattedParent): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$request = (new ListDeliveryVehiclesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $deliveryServiceClient->listDeliveryVehicles($request);
/** @var DeliveryVehicle $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DeliveryServiceClient::providerName('[PROVIDER]');
list_delivery_vehicles_sample($formattedParent);
}
listTasks
Gets all Task
s that meet the specified filtering criteria.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::listTasksAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\ListTasksRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\ListTasksRequest;
use Google\Maps\FleetEngine\Delivery\V1\Task;
/**
* @param string $formattedParent Must be in the format `providers/{provider}`.
* The `provider` must be the Google Cloud Project ID. For example,
* `sample-cloud-project`. Please see
* {@see DeliveryServiceClient::providerName()} for help formatting this field.
*/
function list_tasks_sample(string $formattedParent): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$request = (new ListTasksRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $deliveryServiceClient->listTasks($request);
/** @var Task $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = DeliveryServiceClient::providerName('[PROVIDER]');
list_tasks_sample($formattedParent);
}
updateDeliveryVehicle
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
,
but it must contain all of the VehicleJourneySegment
s to be persisted 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.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::updateDeliveryVehicleAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\UpdateDeliveryVehicleRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\DeliveryVehicle |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\DeliveryVehicle;
use Google\Maps\FleetEngine\Delivery\V1\UpdateDeliveryVehicleRequest;
use Google\Protobuf\FieldMask;
/**
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function update_delivery_vehicle_sample(): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$deliveryVehicle = new DeliveryVehicle();
$updateMask = new FieldMask();
$request = (new UpdateDeliveryVehicleRequest())
->setDeliveryVehicle($deliveryVehicle)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var DeliveryVehicle $response */
$response = $deliveryServiceClient->updateDeliveryVehicle($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateTask
Updates Task
data.
The async variant is Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient::updateTaskAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\UpdateTaskRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Maps\FleetEngine\Delivery\V1\Task |
use Google\ApiCore\ApiException;
use Google\Maps\FleetEngine\Delivery\V1\Client\DeliveryServiceClient;
use Google\Maps\FleetEngine\Delivery\V1\Task;
use Google\Maps\FleetEngine\Delivery\V1\Task\State;
use Google\Maps\FleetEngine\Delivery\V1\Task\Type;
use Google\Maps\FleetEngine\Delivery\V1\UpdateTaskRequest;
use Google\Protobuf\Duration;
use Google\Protobuf\FieldMask;
/**
* @param int $taskType Immutable. Defines the type of the Task. For example, a break or
* shipment.
* @param int $taskState The current execution state of the Task.
*/
function update_task_sample(int $taskType, int $taskState): void
{
// Create a client.
$deliveryServiceClient = new DeliveryServiceClient();
// Prepare the request message.
$taskTaskDuration = new Duration();
$task = (new Task())
->setType($taskType)
->setState($taskState)
->setTaskDuration($taskTaskDuration);
$updateMask = new FieldMask();
$request = (new UpdateTaskRequest())
->setTask($task)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Task $response */
$response = $deliveryServiceClient->updateTask($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$taskType = Type::TYPE_UNSPECIFIED;
$taskState = State::STATE_UNSPECIFIED;
update_task_sample($taskType, $taskState);
}
batchCreateTasksAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\BatchCreateTasksRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createDeliveryVehicleAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\CreateDeliveryVehicleRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createTaskAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\CreateTaskRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getDeliveryVehicleAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\GetDeliveryVehicleRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getTaskAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\GetTaskRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getTaskTrackingInfoAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\GetTaskTrackingInfoRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listDeliveryVehiclesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\ListDeliveryVehiclesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listTasksAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\ListTasksRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateDeliveryVehicleAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\UpdateDeliveryVehicleRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateTaskAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Maps\FleetEngine\Delivery\V1\UpdateTaskRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
static::deliveryVehicleName
Formats a string containing the fully-qualified path to represent a delivery_vehicle resource.
Parameters | |
---|---|
Name | Description |
provider |
string
|
vehicle |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted delivery_vehicle resource. |
static::providerName
Formats a string containing the fully-qualified path to represent a provider resource.
Parameter | |
---|---|
Name | Description |
provider |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted provider resource. |
static::taskName
Formats a string containing the fully-qualified path to represent a task resource.
Parameters | |
---|---|
Name | Description |
provider |
string
|
task |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted task resource. |
static::taskTrackingInfoName
Formats a string containing the fully-qualified path to represent a task_tracking_info resource.
Parameters | |
---|---|
Name | Description |
provider |
string
|
tracking |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted task_tracking_info resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- deliveryVehicle: providers/{provider}/deliveryVehicles/{vehicle}
- provider: providers/{provider}
- task: providers/{provider}/tasks/{task}
- taskTrackingInfo: providers/{provider}/taskTrackingInfo/{tracking}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array |
An associative array from name component IDs to component values. |