Vehicle management service. v1
Package
@googlemaps/fleetengineConstructors
(constructor)(opts, gaxInstance)
constructor
(
opts
?:
ClientOptions
,
gaxInstance
?:
typeof
gax
|
typeof
gax
.
fallback
);
Construct an instance of VehicleServiceClient.
opts
ClientOptions
gaxInstance
typeof gax
| typeof fallback
: loaded instance of google-gax
. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new VehicleServiceClient({fallback: true}, gax); ```
Properties
apiEndpoint
get
apiEndpoint
()
:
string
;
The DNS address for this API service.
apiEndpoint
static
get
apiEndpoint
()
:
string
;
The DNS address for this API service - same as servicePath.
auth
auth
:
gax
.
GoogleAuth
;
descriptors
descriptors
:
Descriptors
;
innerApiCalls
innerApiCalls
:
{
[
name
:
string
]
:
Function
;
};
pathTemplates
pathTemplates
:
{
[
name
:
string
]
:
gax
.
PathTemplate
;
};
port
static
get
port
()
:
number
;
The port for this API service.
scopes
static
get
scopes
()
:
string
[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static
get
servicePath
()
:
string
;
The DNS address for this API service.
universeDomain
get
universeDomain
()
:
string
;
vehicleServiceStub
vehicleServiceStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
warn
warn
:
(
code
:
string
,
message
:
string
,
warnType
?:
string
)
=
>
void
;
Methods
close()
close
()
:
Promise<void>
;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Promise
<void>
{Promise} A promise that resolves when the client is closed.
createVehicle(request, options)
createVehicle
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
ICreateVehicleRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
ICreateVehicleRequest
|
undefined
,
{}
|
undefined
]>;
Instantiates a new vehicle associated with an on-demand rideshare or deliveries provider. Each Vehicle
must have a unique vehicle ID.
The following Vehicle
fields are required when creating a Vehicle
:
* vehicleState
* supportedTripTypes
* maximumCapacity
* vehicleType
The following Vehicle
fields are ignored when creating a Vehicle
:
* name
* currentTrips
* availableCapacity
* current_route_segment
* current_route_segment_end_point
* current_route_segment_version
* current_route_segment_traffic
* route
* waypoints
* waypoints_version
* remaining_distance_meters
* remaining_time_seconds
* eta_to_next_waypoint
* navigation_status
All other fields are optional and used if provided.
request
options
Promise
<[ protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.ICreateVehicleRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The standard Fleet Engine request header.
*/
// const header = {}
/**
* Required. Must be in the format `providers/{provider}`.
* The provider must be the Project ID (for example, `sample-cloud-project`)
* of the Google Cloud Project of which the service account making
* this call is a member.
*/
// const parent = 'abc123'
/**
* Required. Unique Vehicle ID.
* 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 '#'.
*/
// const vehicleId = 'abc123'
/**
* Required. The Vehicle entity to create. When creating a Vehicle, the
* following fields are required:
* * `vehicleState`
* * `supportedTripTypes`
* * `maximumCapacity`
* * `vehicleType`
* When creating a Vehicle, the following fields are ignored:
* * `name`
* * `currentTrips`
* * `availableCapacity`
* * `current_route_segment`
* * `current_route_segment_end_point`
* * `current_route_segment_version`
* * `current_route_segment_traffic`
* * `route`
* * `waypoints`
* * `waypoints_version`
* * `remaining_distance_meters`
* * `remaining_time_seconds`
* * `eta_to_next_waypoint`
* * `navigation_status`
* All other fields are optional and used if provided.
*/
// const vehicle = {}
// Imports the Fleetengine library
const
{
VehicleServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
VehicleServiceClient
();
async
function
callCreateVehicle
()
{
// Construct request
const
request
=
{
parent
,
vehicleId
,
vehicle
,
};
// Run request
const
response
=
await
fleetengineClient
.
createVehicle
(
request
);
console
.
log
(
response
);
}
callCreateVehicle
();
createVehicle(request, options, callback)
createVehicle
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ICreateVehicleRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
ICreateVehicleRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.ICreateVehicleRequest
| null | undefined, {} | null | undefined>
void
createVehicle(request, callback)
createVehicle
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ICreateVehicleRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
ICreateVehicleRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.ICreateVehicleRequest
| null | undefined, {} | null | undefined>
void
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, undefined>
void
getVehicle(request, options)
getVehicle
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IGetVehicleRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
IGetVehicleRequest
|
undefined
,
{}
|
undefined
]>;
Returns a vehicle from the Fleet Engine.
request
options
Promise
<[ protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.IGetVehicleRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The standard Fleet Engine request header.
*/
// const header = {}
/**
* Required. Must be in the format
* `providers/{provider}/vehicles/{vehicle}`.
* The provider must be the Project ID (for example, `sample-cloud-project`)
* of the Google Cloud Project of which the service account making
* this call is a member.
*/
// const name = 'abc123'
/**
* Indicates the minimum timestamp (exclusive) for which
* `Vehicle.current_route_segment` is retrieved.
* If the route is unchanged since this timestamp, the `current_route_segment`
* field is not set in the response. If a minimum is unspecified, the
* `current_route_segment` is always retrieved.
*/
// const currentRouteSegmentVersion = {}
/**
* Indicates the minimum timestamp (exclusive) for which `Vehicle.waypoints`
* data is retrieved. If the waypoints are unchanged since this timestamp, the
* `vehicle.waypoints` data is not set in the response. If this field is
* unspecified, `vehicle.waypoints` is always retrieved.
*/
// const waypointsVersion = {}
// Imports the Fleetengine library
const
{
VehicleServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
VehicleServiceClient
();
async
function
callGetVehicle
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
fleetengineClient
.
getVehicle
(
request
);
console
.
log
(
response
);
}
callGetVehicle
();
getVehicle(request, options, callback)
getVehicle
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IGetVehicleRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
IGetVehicleRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.IGetVehicleRequest
| null | undefined, {} | null | undefined>
void
getVehicle(request, callback)
getVehicle
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IGetVehicleRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
IGetVehicleRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.IGetVehicleRequest
| null | undefined, {} | null | undefined>
void
initialize()
initialize
()
:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Promise
<{
[name: string]: Function
;
}>
{Promise} A promise that resolves to an authenticated service stub.
listVehicles(request, options)
listVehicles
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
IVehicle
[],
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
|
null
,
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesResponse
]>;
Returns a paginated list of vehicles associated with a provider that match the request options.
request
options
Promise
<[ protos.maps.fleetengine.v1.IVehicle
[], protos.maps.fleetengine.v1.IListVehiclesRequest
| null, protos.maps.fleetengine.v1.IListVehiclesResponse
]>
{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listVehiclesAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
listVehicles(request, options, callback)
listVehicles
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
,
options
:
CallOptions
,
callback
:
PaginationCallback<protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
,
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesResponse
|
null
|
undefined
,
protos
.
maps
.
fleetengine
.
v1
.
IVehicle
> )
:
void
;
request
options
CallOptions
callback
PaginationCallback
< protos.maps.fleetengine.v1.IListVehiclesRequest
, protos.maps.fleetengine.v1.IListVehiclesResponse
| null | undefined, protos.maps.fleetengine.v1.IVehicle
>
void
listVehicles(request, callback)
listVehicles
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
,
callback
:
PaginationCallback<protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
,
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesResponse
|
null
|
undefined
,
protos
.
maps
.
fleetengine
.
v1
.
IVehicle
> )
:
void
;
request
callback
PaginationCallback
< protos.maps.fleetengine.v1.IListVehiclesRequest
, protos.maps.fleetengine.v1.IListVehiclesResponse
| null | undefined, protos.maps.fleetengine.v1.IVehicle
>
void
listVehiclesAsync(request, options)
listVehiclesAsync
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
,
options
?:
CallOptions
)
:
AsyncIterable<protos
.
maps
.
fleetengine
.
v1
.
IVehicle
> ;
Equivalent to listVehicles
, but returns an iterable object.
for
- await
- of
syntax is used with the iterable to get response elements on-demand.
request
options
AsyncIterable
< protos.maps.fleetengine.v1.IVehicle
>
{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.
/** * 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. * TODO(developer): Uncomment these variables before running the sample. */ /** * The standard Fleet Engine request header. */ // const header = {} /** * Required. Must be in the format `providers/{provider}`. * The provider must be the Project ID (for example, `sample-cloud-project`) * of the Google Cloud Project of which the service account making * this call is a member. */ // const parent = 'abc123' /** * The maximum number of vehicles to return. * Default value: 100. */ // const pageSize = 1234 /** * The value of the `next_page_token` provided by a previous call to * `ListVehicles` so that you can paginate through groups of vehicles. The * value is undefined if the filter criteria of the request is not the same as * the filter criteria for the previous call to `ListVehicles`. */ // const pageToken = 'abc123' /** * Specifies the required minimum capacity of the vehicle. All vehicles * returned will have a `maximum_capacity` greater than or equal to this * value. If set, must be greater or equal to 0. */ // const minimumCapacity = {} /** * Restricts the response to vehicles that support at least one of the * specified trip types. */ // const tripTypes = [1,2,3,4] /** * Restricts the response to vehicles that have sent location updates to Fleet * Engine within the specified duration. Stationary vehicles still * transmitting their locations are not considered stale. If present, must be * a valid positive duration. */ // const maximumStaleness = {} /** * Required. Restricts the response to vehicles with one of the specified type * categories. `UNKNOWN` is not allowed. */ // const vehicleTypeCategories = [1,2,3,4] /** * Callers can form complex logical operations using any combination of the * `required_attributes` , `required_one_of_attributes` , and * `required_one_of_attribute_sets` fields . * `required_attributes` is a list ; `required_one_of_attributes` uses a * message which allows a list of lists . In combination , the two fields allow * the composition of this expression : *
* ( required_attributes0 AND required_attributes1 AND ...) * AND * ( required_one_of_attributes0 0 OR required_one_of_attributes0 1 OR * ...) * AND * ( required_one_of_attributes1 0 OR required_one_of_attributes1 1 OR * ...) *
- Restricts the response to vehicles with the specified attributes. This
- field is a conjunction/AND operation. A max of 50 required_attributes is
- allowed. This matches the maximum number of attributes allowed on a
- vehicle. Each repeated string should be of the format "key:value". / // const requiredAttributes = ['abc','def'] / *
- Restricts the response to vehicles with at least one of the specified
- attributes in each
VehicleAttributeList
. Within each list, a vehicle must - match at least one of the attributes. This field is an inclusive
- disjunction/OR operation in each
VehicleAttributeList
and a - conjunction/AND operation across the collection of
VehicleAttributeList
. - Each repeated string should be of the format
- "key1:value1|key2:value2|key3:value3". / // const requiredOneOfAttributes = ['abc','def'] / *
-
required_one_of_attribute_sets
provides additional functionality. - Similar to
required_one_of_attributes
,required_one_of_attribute_sets
- uses a message which allows a list of lists, allowing expressions such as
- this one:
-
- (required_attributes0 AND required_attributes1 AND ...)
- AND
- (
- (required_one_of_attribute_sets0 0 AND
- required_one_of_attribute_sets0 1 AND
- ...)
- OR
- (required_one_of_attribute_sets1 0 AND
- required_one_of_attribute_sets1 1 AND
- ...)
- )
- Restricts the response to vehicles that match all the attributes in a
-
VehicleAttributeList
. Within each list, a vehicle must match all of the - attributes. This field is a conjunction/AND operation in each
-
VehicleAttributeList
and inclusive disjunction/OR operation across the - collection of
VehicleAttributeList
. Each repeated string should be of the - format "key1:value1|key2:value2|key3:value3". / // const requiredOneOfAttributeSets = ['abc','def'] / *
- Restricts the response to vehicles that have this vehicle state. / // const vehicleState = {} / *
- Only return the vehicles with current trip(s). / // const onTripOnly = true / *
- Optional. A filter query to apply when listing vehicles. See
- http://aip.dev/160 for examples of the filter syntax.
- This field is designed to replace the
required_attributes
, -
required_one_of_attributes
, andrequired_one_of_attributes_sets
fields. - If a non-empty value is specified here, the following fields must be empty:
-
required_attributes
,required_one_of_attributes
, and -
required_one_of_attributes_sets
. - This filter functions as an AND clause with other constraints,
- such as
vehicle_state
oron_trip_only
. - Note that the only queries supported are on vehicle attributes (for
- example,
attributes.<key> = <value>
or `attributes. - attributes.
- in a filter query is 50.
- Also, all attributes are stored as strings, so the only supported
- comparisons against attributes are string comparisons. In order to compare
- against number or boolean values, the values must be explicitly quoted to
- be treated as strings (for example,
attributes.<key> = "10"
or -
attributes.<key> = "true"
). / // const filter = 'abc123' / * - Optional. A filter that limits the vehicles returned to those whose last
-
known location was in the rectangular area defined by the viewport. */ // const viewport = {}
// Imports the Fleetengine library const {VehicleServiceClient} = require('@googlemaps/fleetengine').v1;
// Instantiates a client const fleetengineClient = new VehicleServiceClient();
async function callListVehicles() { // Construct request const request = { parent, vehicleTypeCategories, };
// Run request const iterable = fleetengineClient.listVehiclesAsync(request); for await (const response of iterable) { console.log(response); } }
callListVehicles();
listVehiclesStream(request, options)
listVehiclesStream
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IListVehiclesRequest
,
options
?:
CallOptions
)
:
Transform
;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
request
options
Transform
{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listVehiclesAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
matchProviderFromTripName(tripName)
matchProviderFromTripName
(
tripName
:
string
)
:
string
|
number
;
Parse the provider from Trip resource.
tripName
string
A fully-qualified path representing Trip resource.
string | number
{string} A string representing the provider.
matchProviderFromVehicleName(vehicleName)
matchProviderFromVehicleName
(
vehicleName
:
string
)
:
string
|
number
;
Parse the provider from Vehicle resource.
vehicleName
string
A fully-qualified path representing Vehicle resource.
string | number
{string} A string representing the provider.
matchTripFromTripName(tripName)
matchTripFromTripName
(
tripName
:
string
)
:
string
|
number
;
Parse the trip from Trip resource.
tripName
string
A fully-qualified path representing Trip resource.
string | number
{string} A string representing the trip.
matchVehicleFromVehicleName(vehicleName)
matchVehicleFromVehicleName
(
vehicleName
:
string
)
:
string
|
number
;
Parse the vehicle from Vehicle resource.
vehicleName
string
A fully-qualified path representing Vehicle resource.
string | number
{string} A string representing the vehicle.
searchVehicles(request, options)
searchVehicles
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesResponse
,
protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesRequest
|
undefined
,
{}
|
undefined
]>;
Returns a list of vehicles that match the request options.
request
options
Promise
<[ protos.maps.fleetengine.v1.ISearchVehiclesResponse
, protos.maps.fleetengine.v1.ISearchVehiclesRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing SearchVehiclesResponse . Please see the documentation for more details and examples.
/** * 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. * TODO(developer): Uncomment these variables before running the sample. */ /** * The standard Fleet Engine request header. */ // const header = {} /** * Required. Must be in the format `providers/{provider}`. * The provider must be the Project ID (for example, `sample-cloud-project`) * of the Google Cloud Project of which the service account making * this call is a member. */ // const parent = 'abc123' /** * Required. The pickup point to search near. */ // const pickupPoint = {} /** * The customer's intended dropoff location. The field is required if * `trip_types` contains `TripType.SHARED`. */ // const dropoffPoint = {} /** * Required. Defines the vehicle search radius around the pickup point. Only * vehicles within the search radius will be returned. Value must be between * 400 and 10000 meters (inclusive). */ // const pickupRadiusMeters = 1234 /** * Required. Specifies the maximum number of vehicles to return. The value * must be between 1 and 50 (inclusive). */ // const count = 1234 /** * Required. Specifies the number of passengers being considered for a trip. * The value must be greater than or equal to one. The driver is not * considered in the capacity value. */ // const minimumCapacity = 1234 /** * Required. Represents the type of proposed trip. Must include exactly one * type. `UNKNOWN_TRIP_TYPE` is not allowed. Restricts the search to only * those vehicles that can support that trip type. */ // const tripTypes = [1,2,3,4] /** * Restricts the search to only those vehicles that have sent location updates * to Fleet Engine within the specified duration. Stationary vehicles still * transmitting their locations are not considered stale. If this field is not * set, the server uses five minutes as the default value. */ // const maximumStaleness = {} /** * Required. Restricts the search to vehicles with one of the specified types. * At least one vehicle type must be specified. VehicleTypes with a category * of `UNKNOWN` are not allowed. */ // const vehicleTypes = [1,2,3,4] /** * Callers can form complex logical operations using any combination of the * `required_attributes` , `required_one_of_attributes` , and * `required_one_of_attribute_sets` fields . * `required_attributes` is a list ; `required_one_of_attributes` uses a * message which allows a list of lists . In combination , the two fields allow * the composition of this expression : *
* ( required_attributes0 AND required_attributes1 AND ...) * AND * ( required_one_of_attributes0 0 OR required_one_of_attributes0 1 OR * ...) * AND * ( required_one_of_attributes1 0 OR required_one_of_attributes1 1 OR * ...) *
- Restricts the search to only those vehicles with the specified attributes.
- This field is a conjunction/AND operation. A max of 50 required_attributes
- is allowed. This matches the maximum number of attributes allowed on a
- vehicle. / // const requiredAttributes = [1,2,3,4] / *
- Restricts the search to only those vehicles with at least one of
- the specified attributes in each
VehicleAttributeList
. Within each - list, a vehicle must match at least one of the attributes. This field is an
- inclusive disjunction/OR operation in each
VehicleAttributeList
and a - conjunction/AND operation across the collection of
VehicleAttributeList
. / // const requiredOneOfAttributes = [1,2,3,4] / * -
required_one_of_attribute_sets
provides additional functionality. - Similar to
required_one_of_attributes
,required_one_of_attribute_sets
- uses a message which allows a list of lists, allowing expressions such as
- this one:
-
- (required_attributes0 AND required_attributes1 AND ...)
- AND
- (
- (required_one_of_attribute_sets0 0 AND
- required_one_of_attribute_sets0 1 AND
- ...)
- OR
- (required_one_of_attribute_sets1 0 AND
- required_one_of_attribute_sets1 1 AND
- ...)
- )
- Restricts the search to only those vehicles with all the attributes in a
-
VehicleAttributeList
. Within each list, a - vehicle must match all of the attributes. This field is a conjunction/AND
- operation in each
VehicleAttributeList
and inclusive disjunction/OR - operation across the collection of
VehicleAttributeList
. / // const requiredOneOfAttributeSets = [1,2,3,4] / * - Required. Specifies the desired ordering criterion for results. / // const orderBy = {} / *
- This indicates if vehicles with a single active trip are eligible for this
- search. This field is only used when
current_trips_present
is - unspecified. When
current_trips_present
is unspecified and this field - is
false
, vehicles with assigned trips are excluded from the search - results. When
current_trips_present
is unspecified and this field is -
true
, search results can include vehicles with one active trip that has a - status of
ENROUTE_TO_DROPOFF
. Whencurrent_trips_present
is specified, - this field cannot be set to true.
- The default value is
false
. / // const includeBackToBack = true / * - Indicates the trip associated with this
SearchVehicleRequest
. / // const tripId = 'abc123' / * - This indicates if vehicles with active trips are eligible for this search.
- This must be set to something other than
-
CURRENT_TRIPS_PRESENT_UNSPECIFIED
iftrip_type
includesSHARED
. / // const currentTripsPresent = {} / * - Optional. A filter query to apply when searching vehicles. See
- http://aip.dev/160 for examples of the filter syntax.
- This field is designed to replace the
required_attributes
, -
required_one_of_attributes
, andrequired_one_of_attributes_sets
fields. - If a non-empty value is specified here, the following fields must be empty:
-
required_attributes
,required_one_of_attributes
, and -
required_one_of_attributes_sets
. - This filter functions as an AND clause with other constraints,
- such as
minimum_capacity
orvehicle_types
. - Note that the only queries supported are on vehicle attributes (for
- example,
attributes.<key> = <value>
or `attributes. - attributes.
- in a filter query is 50.
- Also, all attributes are stored as strings, so the only supported
- comparisons against attributes are string comparisons. In order to compare
- against number or boolean values, the values must be explicitly quoted to
- be treated as strings (for example,
attributes.<key> = "10"
or -
attributes.<key> = "true"
). */ // const filter = 'abc123'// Imports the Fleetengine library const {VehicleServiceClient} = require('@googlemaps/fleetengine').v1;
// Instantiates a client const fleetengineClient = new VehicleServiceClient();
async function callSearchVehicles() { // Construct request const request = { parent, pickupPoint, pickupRadiusMeters, count, minimumCapacity, tripTypes, vehicleTypes, orderBy, };
// Run request const response = await fleetengineClient.searchVehicles(request); console.log(response); }
callSearchVehicles();
searchVehicles(request, options, callback)
searchVehicles
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesResponse
,
protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.ISearchVehiclesResponse
, protos.maps.fleetengine.v1.ISearchVehiclesRequest
| null | undefined, {} | null | undefined>
void
searchVehicles(request, callback)
searchVehicles
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesResponse
,
protos
.
maps
.
fleetengine
.
v1
.
ISearchVehiclesRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.ISearchVehiclesResponse
, protos.maps.fleetengine.v1.ISearchVehiclesRequest
| null | undefined, {} | null | undefined>
void
tripPath(provider, trip)
tripPath
(
provider
:
string
,
trip
:
string
)
:
string
;
Return a fully-qualified trip resource name string.
provider
string
trip
string
string
{string} Resource name string.
updateVehicle(request, options)
updateVehicle
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleRequest
|
undefined
,
{}
|
undefined
]>;
Writes updated vehicle data to the Fleet Engine.
When updating a Vehicle
, the following fields cannot be updated since they are managed by the server:
* currentTrips
* availableCapacity
* current_route_segment_version
* waypoints_version
The vehicle name
also cannot be updated.
If the attributes
field is updated, **all** the vehicle's attributes are replaced with the attributes provided in the request. If you want to update only some attributes, see the UpdateVehicleAttributes
method. Likewise, the waypoints
field can be updated, but must contain all the waypoints currently on the vehicle, and no other waypoints.
request
options
Promise
<[ protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.IUpdateVehicleRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The standard Fleet Engine request header.
*/
// const header = {}
/**
* Required. Must be in the format
* `providers/{provider}/vehicles/{vehicle}`.
* The {provider} must be the Project ID (for example, `sample-cloud-project`)
* of the Google Cloud Project of which the service account making
* this call is a member.
*/
// const name = 'abc123'
/**
* Required. The `Vehicle` entity values to apply. When updating a `Vehicle`,
* the following fields may not be updated as they are managed by the
* server.
* * `available_capacity`
* * `current_route_segment_version`
* * `current_trips`
* * `name`
* * `waypoints_version`
* If the `attributes` field is updated, **all** the vehicle's attributes are
* replaced with the attributes provided in the request. If you want to update
* only some attributes, see the `UpdateVehicleAttributes` method.
* Likewise, the `waypoints` field can be updated, but must contain all the
* waypoints currently on the vehicle, and no other waypoints.
*/
// const vehicle = {}
/**
* Required. A field mask indicating which fields of the `Vehicle` to update.
* At least one field name must be provided.
*/
// const updateMask = {}
// Imports the Fleetengine library
const
{
VehicleServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
VehicleServiceClient
();
async
function
callUpdateVehicle
()
{
// Construct request
const
request
=
{
name
,
vehicle
,
updateMask
,
};
// Run request
const
response
=
await
fleetengineClient
.
updateVehicle
(
request
);
console
.
log
(
response
);
}
callUpdateVehicle
();
updateVehicle(request, options, callback)
updateVehicle
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.IUpdateVehicleRequest
| null | undefined, {} | null | undefined>
void
updateVehicle(request, callback)
updateVehicle
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IVehicle
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.IVehicle
, protos.maps.fleetengine.v1.IUpdateVehicleRequest
| null | undefined, {} | null | undefined>
void
updateVehicleAttributes(request, options)
updateVehicleAttributes
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesResponse
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesRequest
|
undefined
,
{}
|
undefined
]>;
Partially updates a vehicle's attributes. Only the attributes mentioned in the request will be updated, other attributes will NOT be altered. Note: this is different in UpdateVehicle
, where the whole attributes
field will be replaced by the one in UpdateVehicleRequest
, attributes not in the request would be removed.
request
options
Promise
<[ protos.maps.fleetengine.v1.IUpdateVehicleAttributesResponse
, protos.maps.fleetengine.v1.IUpdateVehicleAttributesRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing UpdateVehicleAttributesResponse . Please see the documentation for more details and examples.
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The standard Fleet Engine request header.
*/
// const header = {}
/**
* Required. Must be in the format `providers/{provider}/vehicles/{vehicle}`.
* The provider must be the Project ID (for example, `sample-cloud-project`)
* of the Google Cloud Project of which the service account making
* this call is a member.
*/
// const name = 'abc123'
/**
* Required. The vehicle attributes to update. Unmentioned attributes are not
* altered or removed.
*/
// const attributes = [1,2,3,4]
// Imports the Fleetengine library
const
{
VehicleServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
VehicleServiceClient
();
async
function
callUpdateVehicleAttributes
()
{
// Construct request
const
request
=
{
name
,
attributes
,
};
// Run request
const
response
=
await
fleetengineClient
.
updateVehicleAttributes
(
request
);
console
.
log
(
response
);
}
callUpdateVehicleAttributes
();
updateVehicleAttributes(request, options, callback)
updateVehicleAttributes
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesResponse
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.IUpdateVehicleAttributesResponse
, protos.maps.fleetengine.v1.IUpdateVehicleAttributesRequest
| null | undefined, {} | null | undefined>
void
updateVehicleAttributes(request, callback)
updateVehicleAttributes
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesResponse
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateVehicleAttributesRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.IUpdateVehicleAttributesResponse
, protos.maps.fleetengine.v1.IUpdateVehicleAttributesRequest
| null | undefined, {} | null | undefined>
void
vehiclePath(provider, vehicle)
vehiclePath
(
provider
:
string
,
vehicle
:
string
)
:
string
;
Return a fully-qualified vehicle resource name string.
provider
string
vehicle
string
string
{string} Resource name string.