# Google Maps FleetEngine Delivery V1 Client - Class Task (0.5.3)

0.5.3 (latest) 0.5.2 0.4.1 0.3.1 0.2.0 0.1.8 Reference documentation and code samples for the Google Maps FleetEngine Delivery V1 Client class Task.

A Task in the Delivery API represents a single action to track. In general,
there is a distinction between shipment-related Tasks and break Tasks. A
shipment can have multiple Tasks associated with it. For example, there could
be one Task for the pickup, and one for the drop-off or transfer. Also,
different Tasks for a given shipment can be handled by different vehicles.

For example, one vehicle could handle the pickup, driving the shipment to the
hub, while another vehicle drives the same shipment from the hub to the
drop-off location.
Note: gRPC and REST APIs use different field naming conventions. For example,
the `Task.journey_sharing_info` field in the gRPC API and the
`Task.journeySharingInfo` field in the REST API refer to the same
field.

Generated from protobuf message `maps.fleetengine.delivery.v1.Task`

## Namespace

Google \\ Maps \\ FleetEngine \\ Delivery \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Must be in the format `providers/{provider}/tasks/{task}`. |
| `↳ type` | `int` Required. Immutable. Defines the type of the Task. For example, a break or shipment. |
| `↳ state` | `int` Required. The current execution state of the Task. |
| `↳ task_outcome` | `int` The outcome of the Task. |
| `↳ task_outcome_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The timestamp that indicates when the `Task`'s outcome was set by the provider. |
| `↳ task_outcome_location` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.LocationInfo` The location where the `Task`'s outcome was set. This value is updated as part of `UpdateTask`. If this value isn't explicitly updated by the provider, then Fleet Engine populates it by default with the last known vehicle location (the *raw* location). |
| `↳ task_outcome_location_source` | `int` Indicates where the value of the `task_outcome_location` came from. |
| `↳ tracking_id` | `string` Immutable. This field facilitates the storing of an ID so you can avoid using a complicated mapping. You cannot set `tracking_id` for Tasks of type `UNAVAILABLE` and `SCHEDULED_STOP`. These 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 '#'. |
| `↳ delivery_vehicle_id` | `string` Output only. The ID of the vehicle that is executing this Task. Delivery Vehicle 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 '#'. |
| `↳ planned_location` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.LocationInfo` Immutable. The location where the Task will be completed. Optional for `UNAVAILABLE` Tasks, but required for all other Tasks. |
| `↳ task_duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` Required. Immutable. The time needed to execute a Task at this location. |
| `↳ target_time_window` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TimeWindow` The time window during which the task should be completed. |
| `↳ journey_sharing_info` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.Task.JourneySharingInfo` Output only. Journey sharing-specific fields. Not populated when state is `CLOSED`. |
| `↳ task_tracking_view_config` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TaskTrackingViewConfig` The configuration for task tracking that specifies which data elements are visible to the end users under what circumstances. |
| `↳ attributes` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TaskAttribute>` A list of custom Task attributes. Each attribute must have a unique key. |

### getName

Must be in the format `providers/{provider}/tasks/{task}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Must be in the format `providers/{provider}/tasks/{task}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getType

Required. Immutable. Defines the type of the Task. For example, a break or
shipment.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setType

Required. Immutable. Defines the type of the Task. For example, a break or
shipment.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getState

Required. The current execution state of the Task.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setState

Required. The current execution state of the Task.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTaskOutcome

The outcome of the Task.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setTaskOutcome

The outcome of the Task.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTaskOutcomeTime

The timestamp that indicates when the `Task`'s outcome was set by the
provider.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasTaskOutcomeTime

### clearTaskOutcomeTime

### setTaskOutcomeTime

The timestamp that indicates when the `Task`'s outcome was set by the
provider.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTaskOutcomeLocation

The location where the `Task`'s outcome was set. This value is updated as
part of `UpdateTask`. If this value isn't explicitly updated by the
provider, then Fleet Engine populates it by default with the last known
vehicle location (the *raw* location).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.LocationInfo|null` |   |

### hasTaskOutcomeLocation

### clearTaskOutcomeLocation

### setTaskOutcomeLocation

The location where the `Task`'s outcome was set. This value is updated as
part of `UpdateTask`. If this value isn't explicitly updated by the
provider, then Fleet Engine populates it by default with the last known
vehicle location (the *raw* location).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.LocationInfo` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTaskOutcomeLocationSource

Indicates where the value of the `task_outcome_location` came from.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setTaskOutcomeLocationSource

Indicates where the value of the `task_outcome_location` came from.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTrackingId

Immutable. This field facilitates the storing of an ID so you can avoid
using a complicated mapping. You cannot set `tracking_id` for Tasks of type
`UNAVAILABLE` and `SCHEDULED_STOP`. These 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 '#'.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setTrackingId

Immutable. This field facilitates the storing of an ID so you can avoid
using a complicated mapping. You cannot set `tracking_id` for Tasks of type
`UNAVAILABLE` and `SCHEDULED_STOP`. These 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 '#'.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDeliveryVehicleId

Output only. The ID of the vehicle that is executing this Task. Delivery
Vehicle 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 '#'.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDeliveryVehicleId

Output only. The ID of the vehicle that is executing this Task. Delivery
Vehicle 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 '#'.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPlannedLocation

Immutable. The location where the Task will be completed.

Optional for `UNAVAILABLE` Tasks, but required for all other Tasks.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.LocationInfo|null` |   |

### hasPlannedLocation

### clearPlannedLocation

### setPlannedLocation

Immutable. The location where the Task will be completed.

Optional for `UNAVAILABLE` Tasks, but required for all other Tasks.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.LocationInfo` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTaskDuration

Required. Immutable. The time needed to execute a Task at this location.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasTaskDuration

### clearTaskDuration

### setTaskDuration

Required. Immutable. The time needed to execute a Task at this location.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTargetTimeWindow

The time window during which the task should be completed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TimeWindow|null` |   |

### hasTargetTimeWindow

### clearTargetTimeWindow

### setTargetTimeWindow

The time window during which the task should be completed.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TimeWindow` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getJourneySharingInfo

Output only. Journey sharing-specific fields. Not populated when state is
`CLOSED`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.Task.JourneySharingInfo|null` |   |

### hasJourneySharingInfo

### clearJourneySharingInfo

### setJourneySharingInfo

Output only. Journey sharing-specific fields. Not populated when state is
`CLOSED`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.Task.JourneySharingInfo` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTaskTrackingViewConfig

The configuration for task tracking that specifies which data elements are
visible to the end users under what circumstances.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TaskTrackingViewConfig|null` |   |

### hasTaskTrackingViewConfig

### clearTaskTrackingViewConfig

### setTaskTrackingViewConfig

The configuration for task tracking that specifies which data elements are
visible to the end users under what circumstances.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TaskTrackingViewConfig` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAttributes

A list of custom Task attributes. Each attribute must have a unique key.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TaskAttribute>` |   |

### setAttributes

A list of custom Task attributes. Each attribute must have a unique key.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.TaskAttribute>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |