package delivery

import "cloud.google.com/go/maps/fleetengine/delivery/apiv1"

Package delivery is an auto-generated package for the Last Mile Fleet Solution Delivery API.

Enables Fleet Engine for access to the On Demand Rides and Deliveries and Last Mile Fleet Solution APIs. Customer’s use of Google Maps Content in the Cloud Logging Services is subject to the Google Maps Platform Terms of Service located at https://cloud.google.com/maps-platform/terms (at https://cloud.google.com/maps-platform/terms).

General documentation

For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:

Example usage

To get started with this package, create a client.

// go get cloud.google.com/go/maps/fleetengine/delivery/apiv1@latest
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := delivery.NewClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client, mentioned above.

req := &deliverypb.BatchCreateTasksRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#BatchCreateTasksRequest.
}
resp, err := c.BatchCreateTasks(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

Index

Examples

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type CallOptions

type CallOptions struct {
	CreateDeliveryVehicle []gax.CallOption
	GetDeliveryVehicle    []gax.CallOption
	UpdateDeliveryVehicle []gax.CallOption
	BatchCreateTasks      []gax.CallOption
	CreateTask            []gax.CallOption
	GetTask               []gax.CallOption
	UpdateTask            []gax.CallOption
	ListTasks             []gax.CallOption
	GetTaskTrackingInfo   []gax.CallOption
	ListDeliveryVehicles  []gax.CallOption
}

CallOptions contains the retry settings for each method of Client.

type Client

type Client struct {

	// The call options for this service.
	CallOptions *CallOptions
	// contains filtered or unexported fields
}

Client is a client for interacting with Last Mile Fleet Solution Delivery API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

The Last Mile Delivery service.

func NewClient

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

NewClient creates a new delivery service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

The Last Mile Delivery service.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewRESTClient

func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

NewRESTClient creates a new delivery service rest client.

The Last Mile Delivery service.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*Client) BatchCreateTasks

BatchCreateTasks creates and returns a batch of new Task objects.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.BatchCreateTasksRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#BatchCreateTasksRequest.
	}
	resp, err := c.BatchCreateTasks(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) Connection

func (c *Client) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*Client) CreateDeliveryVehicle

CreateDeliveryVehicle creates and returns a new DeliveryVehicle.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.CreateDeliveryVehicleRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#CreateDeliveryVehicleRequest.
	}
	resp, err := c.CreateDeliveryVehicle(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, req *deliverypb.CreateTaskRequest, opts ...gax.CallOption) (*deliverypb.Task, error)

CreateTask creates and returns a new Task object.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.CreateTaskRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#CreateTaskRequest.
	}
	resp, err := c.CreateTask(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetDeliveryVehicle

GetDeliveryVehicle returns the specified DeliveryVehicle instance.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.GetDeliveryVehicleRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#GetDeliveryVehicleRequest.
	}
	resp, err := c.GetDeliveryVehicle(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, req *deliverypb.GetTaskRequest, opts ...gax.CallOption) (*deliverypb.Task, error)

GetTask gets information about a Task.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.GetTaskRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#GetTaskRequest.
	}
	resp, err := c.GetTask(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetTaskTrackingInfo

GetTaskTrackingInfo returns the specified TaskTrackingInfo instance.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.GetTaskTrackingInfoRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#GetTaskTrackingInfoRequest.
	}
	resp, err := c.GetTaskTrackingInfo(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) ListDeliveryVehicles

ListDeliveryVehicles gets all DeliveryVehicles that meet the specified filtering criteria.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.ListDeliveryVehiclesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#ListDeliveryVehiclesRequest.
	}
	it := c.ListDeliveryVehicles(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*deliverypb.ListDeliveryVehiclesResponse)
	}
}
Example (All)

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.ListDeliveryVehiclesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#ListDeliveryVehiclesRequest.
	}
	for resp, err := range c.ListDeliveryVehicles(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*Client) ListTasks

func (c *Client) ListTasks(ctx context.Context, req *deliverypb.ListTasksRequest, opts ...gax.CallOption) *TaskIterator

ListTasks gets all Tasks that meet the specified filtering criteria.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.ListTasksRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#ListTasksRequest.
	}
	it := c.ListTasks(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*deliverypb.ListTasksResponse)
	}
}
Example (All)

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.ListTasksRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#ListTasksRequest.
	}
	for resp, err := range c.ListTasks(ctx, req).All() {
		if err != nil {
			// TODO: Handle error and break/return/continue. Iteration will stop after any error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*Client) UpdateDeliveryVehicle

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 VehicleJourneySegments to be persisted on the DeliveryVehicle. The task_ids are retrieved from remaining_vehicle_journey_segments, and their corresponding Tasks are assigned to the DeliveryVehicle if they have not yet been assigned.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.UpdateDeliveryVehicleRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#UpdateDeliveryVehicleRequest.
	}
	resp, err := c.UpdateDeliveryVehicle(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) UpdateTask

func (c *Client) UpdateTask(ctx context.Context, req *deliverypb.UpdateTaskRequest, opts ...gax.CallOption) (*deliverypb.Task, error)

UpdateTask updates Task data.

Example

Code:play 

package main

import (
	"context"

	delivery "cloud.google.com/go/maps/fleetengine/delivery/apiv1"
	deliverypb "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := delivery.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &deliverypb.UpdateTaskRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb#UpdateTaskRequest.
	}
	resp, err := c.UpdateTask(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

type DeliveryVehicleIterator

type DeliveryVehicleIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*deliverypb.DeliveryVehicle, nextPageToken string, err error)
	// contains filtered or unexported fields
}

DeliveryVehicleIterator manages a stream of *deliverypb.DeliveryVehicle.

func (*DeliveryVehicleIterator) All

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*DeliveryVehicleIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*DeliveryVehicleIterator) PageInfo

func (it *DeliveryVehicleIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type TaskIterator

type TaskIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*deliverypb.Task, nextPageToken string, err error)
	// contains filtered or unexported fields
}

TaskIterator manages a stream of *deliverypb.Task.

func (*TaskIterator) All

func (it *TaskIterator) All() iter.Seq2[*deliverypb.Task, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*TaskIterator) Next

func (it *TaskIterator) Next() (*deliverypb.Task, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*TaskIterator) PageInfo

func (it *TaskIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Source Files

auxiliary.go auxiliary_go123.go delivery_client.go doc.go helpers.go version.go

Directories

PathSynopsis
fleetengine/delivery/apiv1/deliverypb
Version
v1.18.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
28 packages
Last checked
6 days ago

Tools for package owners.