Trip management service. v1
Package
@googlemaps/fleetengineConstructors
(constructor)(opts, gaxInstance)
constructor
(
opts
?:
ClientOptions
,
gaxInstance
?:
typeof
gax
|
typeof
gax
.
fallback
);
Construct an instance of TripServiceClient.
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 TripServiceClient({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.
tripServiceStub
tripServiceStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
universeDomain
get
universeDomain
()
:
string
;
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.
createTrip(request, options)
createTrip
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
ICreateTripRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
ICreateTripRequest
|
undefined
,
{}
|
undefined
]>;
Creates a trip in the Fleet Engine and returns the new trip.
request
options
Promise
<[ protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.ICreateTripRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Trip . 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 Trip 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 tripId = 'abc123'
/**
* Required. Trip entity to create.
* When creating a Trip, the following fields are required:
* * `trip_type`
* * `pickup_point`
* The following fields are used if you provide them:
* * `number_of_passengers`
* * `vehicle_id`
* * `dropoff_point`
* * `intermediate_destinations`
* * `vehicle_waypoints`
* All other Trip fields are ignored. For example, all trips start with a
* `trip_status` of `NEW` even if you pass in a `trip_status` of `CANCELED` in
* the creation request.
* Only `EXCLUSIVE` trips support `intermediate_destinations`.
* When `vehicle_id` is set for a shared trip, you must supply
* the list of `Trip.vehicle_waypoints` to specify the order of the remaining
* waypoints for the vehicle, otherwise the waypoint order will be
* undetermined.
* When you specify `Trip.vehicle_waypoints`, the list must contain all
* the remaining waypoints of the vehicle's trips, with no extra waypoints.
* You must order these waypoints such that for a given trip, the pickup
* point is before intermediate destinations, and all intermediate
* destinations come before the drop-off point. An `EXCLUSIVE` trip's
* waypoints must not interleave with any other trips.
* The `trip_id`, `waypoint_type` and `location` fields are used, and all
* other TripWaypoint fields in `vehicle_waypoints` are ignored.
*/
// const trip = {}
// Imports the Fleetengine library
const
{
TripServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
TripServiceClient
();
async
function
callCreateTrip
()
{
// Construct request
const
request
=
{
parent
,
tripId
,
trip
,
};
// Run request
const
response
=
await
fleetengineClient
.
createTrip
(
request
);
console
.
log
(
response
);
}
callCreateTrip
();
createTrip(request, options, callback)
createTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ICreateTripRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
ICreateTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.ICreateTripRequest
| null | undefined, {} | null | undefined>
void
createTrip(request, callback)
createTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ICreateTripRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
ICreateTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.ICreateTripRequest
| null | undefined, {} | null | undefined>
void
deleteTrip(request, options)
deleteTrip
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IDeleteTripRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
protobuf
.
IEmpty
,
protos
.
maps
.
fleetengine
.
v1
.
IDeleteTripRequest
|
undefined
,
{}
|
undefined
]>;
Deletes a single Trip.
Returns FAILED_PRECONDITION if the Trip is active and assigned to a vehicle.
request
options
Promise
<[ protos.google.protobuf.IEmpty
, protos.maps.fleetengine.v1.IDeleteTripRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty . 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.
*/
/**
* Optional. The standard Fleet Engine request header.
*/
// const header = {}
/**
* Required. Must be in the format `providers/{provider}/trips/{trip}`.
* 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'
// Imports the Fleetengine library
const
{
TripServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
TripServiceClient
();
async
function
callDeleteTrip
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
fleetengineClient
.
deleteTrip
(
request
);
console
.
log
(
response
);
}
callDeleteTrip
();
deleteTrip(request, options, callback)
deleteTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IDeleteTripRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
maps
.
fleetengine
.
v1
.
IDeleteTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.protobuf.IEmpty
, protos.maps.fleetengine.v1.IDeleteTripRequest
| null | undefined, {} | null | undefined>
void
deleteTrip(request, callback)
deleteTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IDeleteTripRequest
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
maps
.
fleetengine
.
v1
.
IDeleteTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.protobuf.IEmpty
, protos.maps.fleetengine.v1.IDeleteTripRequest
| 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
getTrip(request, options)
getTrip
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IGetTripRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
IGetTripRequest
|
undefined
,
{}
|
undefined
]>;
Get information about a single trip.
request
options
Promise
<[ protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.IGetTripRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Trip . 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}/trips/{trip}`.
* 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'
/**
* The subset of Trip fields that should be returned and their interpretation.
*/
// const view = {}
/**
* Indicates the minimum timestamp (exclusive) for which `Trip.route` or
* `Trip.current_route_segment` data are retrieved. If route data are
* unchanged since this timestamp, the route field is not set in the response.
* If a minimum is unspecified, the route data are always retrieved.
*/
// const currentRouteSegmentVersion = {}
/**
* Indicates the minimum timestamp (exclusive) for which
* `Trip.remaining_waypoints` are retrieved. If they are unchanged since this
* timestamp, the `remaining_waypoints` are not set in the response. If this
* field is unspecified, `remaining_waypoints` is always retrieved.
*/
// const remainingWaypointsVersion = {}
/**
* The returned current route format, `LAT_LNG_LIST_TYPE` (in `Trip.route`),
* or `ENCODED_POLYLINE_TYPE` (in `Trip.current_route_segment`). The default
* is `LAT_LNG_LIST_TYPE`.
*/
// const routeFormatType = {}
/**
* Indicates the minimum timestamp (exclusive) for which
* `Trip.current_route_segment_traffic` is retrieved. If traffic data are
* unchanged since this timestamp, the `current_route_segment_traffic` field
* is not set in the response. If a minimum is unspecified, the traffic data
* are always retrieved. Note that traffic is only available for On-Demand
* Rides and Deliveries Solution customers.
*/
// const currentRouteSegmentTrafficVersion = {}
/**
* Indicates the minimum timestamp (exclusive) for which
* `Trip.remaining_waypoints.traffic_to_waypoint` and
* `Trip.remaining_waypoints.path_to_waypoint` data are retrieved. If data are
* unchanged since this timestamp, the fields above are
* not set in the response. If `remaining_waypoints_route_version` is
* unspecified, traffic and path are always retrieved.
*/
// const remainingWaypointsRouteVersion = {}
// Imports the Fleetengine library
const
{
TripServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
TripServiceClient
();
async
function
callGetTrip
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
fleetengineClient
.
getTrip
(
request
);
console
.
log
(
response
);
}
callGetTrip
();
getTrip(request, options, callback)
getTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IGetTripRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
IGetTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.IGetTripRequest
| null | undefined, {} | null | undefined>
void
getTrip(request, callback)
getTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IGetTripRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
IGetTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.IGetTripRequest
| 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.
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.
reportBillableTrip(request, options)
reportBillableTrip
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IReportBillableTripRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
protobuf
.
IEmpty
,
protos
.
maps
.
fleetengine
.
v1
.
IReportBillableTripRequest
|
undefined
,
{}
|
undefined
]>;
Report billable trip usage.
request
options
Promise
<[ protos.google.protobuf.IEmpty
, protos.maps.fleetengine.v1.IReportBillableTripRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty . 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.
*/
/**
* Required. Must be in the format
* `providers/{provider}/billableTrips/{billable_trip}`. 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. Two letter country code of the country where the trip takes
* place. Price is defined according to country code.
*/
// const countryCode = 'abc123'
/**
* The platform upon which the request was issued.
*/
// const platform = {}
/**
* The identifiers that are directly related to the trip being reported. These
* are usually IDs (for example, session IDs) of pre-booking operations done
* before the trip ID is available. The number of `related_ids` is
* limited to 50.
*/
// const relatedIds = ['abc','def']
/**
* The type of GMP product solution (for example,
* `ON_DEMAND_RIDESHARING_AND_DELIVERIES`) used for the reported trip.
*/
// const solutionType = {}
// Imports the Fleetengine library
const
{
TripServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
TripServiceClient
();
async
function
callReportBillableTrip
()
{
// Construct request
const
request
=
{
name
,
countryCode
,
};
// Run request
const
response
=
await
fleetengineClient
.
reportBillableTrip
(
request
);
console
.
log
(
response
);
}
callReportBillableTrip
();
reportBillableTrip(request, options, callback)
reportBillableTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IReportBillableTripRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
maps
.
fleetengine
.
v1
.
IReportBillableTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.protobuf.IEmpty
, protos.maps.fleetengine.v1.IReportBillableTripRequest
| null | undefined, {} | null | undefined>
void
reportBillableTrip(request, callback)
reportBillableTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IReportBillableTripRequest
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
maps
.
fleetengine
.
v1
.
IReportBillableTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.protobuf.IEmpty
, protos.maps.fleetengine.v1.IReportBillableTripRequest
| null | undefined, {} | null | undefined>
void
searchTrips(request, options)
searchTrips
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
ITrip
[],
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
|
null
,
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsResponse
]>;
Get all the trips for a specific vehicle.
request
options
Promise
<[ protos.maps.fleetengine.v1.ITrip
[], protos.maps.fleetengine.v1.ISearchTripsRequest
| null, protos.maps.fleetengine.v1.ISearchTripsResponse
]>
{Promise} - The promise which resolves to an array. The first element of the array is Array of Trip
. 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 searchTripsAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
searchTrips(request, options, callback)
searchTrips
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
,
options
:
CallOptions
,
callback
:
PaginationCallback<protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
,
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsResponse
|
null
|
undefined
,
protos
.
maps
.
fleetengine
.
v1
.
ITrip
> )
:
void
;
request
options
CallOptions
callback
PaginationCallback
< protos.maps.fleetengine.v1.ISearchTripsRequest
, protos.maps.fleetengine.v1.ISearchTripsResponse
| null | undefined, protos.maps.fleetengine.v1.ITrip
>
void
searchTrips(request, callback)
searchTrips
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
,
callback
:
PaginationCallback<protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
,
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsResponse
|
null
|
undefined
,
protos
.
maps
.
fleetengine
.
v1
.
ITrip
> )
:
void
;
request
callback
PaginationCallback
< protos.maps.fleetengine.v1.ISearchTripsRequest
, protos.maps.fleetengine.v1.ISearchTripsResponse
| null | undefined, protos.maps.fleetengine.v1.ITrip
>
void
searchTripsAsync(request, options)
searchTripsAsync
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
,
options
?:
CallOptions
)
:
AsyncIterable<protos
.
maps
.
fleetengine
.
v1
.
ITrip
> ;
Equivalent to searchTrips
, 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.ITrip
>
{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing Trip . 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 vehicle associated with the trips in the request. If unspecified, the
* returned trips do not contain:
* * `current_route_segment`
* * `remaining_waypoints`
* * `remaining_distance_meters`
* * `eta_to_first_waypoint`
*/
// const vehicleId = 'abc123'
/**
* If set to true, the response includes Trips that influence a driver's
* route.
*/
// const activeTripsOnly = true
/**
* If not set, the server decides the number of results to return.
*/
// const pageSize = 1234
/**
* Set this to a value previously returned in the `SearchTripsResponse` to
* continue from previous results.
*/
// const pageToken = 'abc123'
/**
* If specified, returns the trips that have not been updated after the time
* `(current - minimum_staleness)`.
*/
// const minimumStaleness = {}
// Imports the Fleetengine library
const
{
TripServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
TripServiceClient
();
async
function
callSearchTrips
()
{
// Construct request
const
request
=
{
parent
,
};
// Run request
const
iterable
=
fleetengineClient
.
searchTripsAsync
(
request
);
for
await
(
const
response
of
iterable
)
{
console
.
log
(
response
);
}
}
callSearchTrips
();
searchTripsStream(request, options)
searchTripsStream
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
ISearchTripsRequest
,
options
?:
CallOptions
)
:
Transform
;
Equivalent to searchTrips
, but returns a NodeJS Stream object.
request
options
Transform
{Stream} An object stream which emits an object representing Trip
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 searchTripsAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
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.
updateTrip(request, options)
updateTrip
(
request
?:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateTripRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateTripRequest
|
undefined
,
{}
|
undefined
]>;
Updates trip data.
request
options
Promise
<[ protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.IUpdateTripRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Trip . 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}/trips/{trip}`. The provider must
* be the Project ID (for example, `sample-consumer-project`) of the Google
* Cloud Project of which the service account making this call is a member.
*/
// const name = 'abc123'
/**
* Required. The Trip associated with the update.
* The following fields are maintained by the Fleet Engine. Do not update
* them using Trip.update.
* * `current_route_segment`
* * `current_route_segment_end_point`
* * `current_route_segment_traffic`
* * `current_route_segment_traffic_version`
* * `current_route_segment_version`
* * `dropoff_time`
* * `eta_to_next_waypoint`
* * `intermediate_destinations_version`
* * `last_location`
* * `name`
* * `number_of_passengers`
* * `pickup_time`
* * `remaining_distance_meters`
* * `remaining_time_to_first_waypoint`
* * `remaining_waypoints`
* * `remaining_waypoints_version`
* * `route`
* When you update the `Trip.vehicle_id` for a shared trip, you must supply
* the list of `Trip.vehicle_waypoints` to specify the order of the remaining
* waypoints, otherwise the order will be undetermined.
* When you specify `Trip.vehicle_waypoints`, the list must contain all
* the remaining waypoints of the vehicle's trips, with no extra waypoints.
* You must order these waypoints such that for a given trip, the pickup
* point is before intermediate destinations, and all intermediate
* destinations come before the drop-off point. An `EXCLUSIVE` trip's
* waypoints must not interleave with any other trips.
* The `trip_id`, `waypoint_type` and `location` fields are used, and all
* other TripWaypoint fields in `vehicle_waypoints` are ignored.
* To avoid a race condition for trips with multiple destinations, you
* should provide `Trip.intermediate_destinations_version` when updating
* the trip status to `ENROUTE_TO_INTERMEDIATE_DESTINATION`. The
* `Trip.intermediate_destinations_version` passed must be consistent with
* Fleet Engine's version. If it isn't, the request fails.
*/
// const trip = {}
/**
* Required. The field mask indicating which fields in Trip to update.
* The `update_mask` must contain at least one field.
*/
// const updateMask = {}
// Imports the Fleetengine library
const
{
TripServiceClient
}
=
require
(
' @googlemaps/fleetengine
'
).
v1
;
// Instantiates a client
const
fleetengineClient
=
new
TripServiceClient
();
async
function
callUpdateTrip
()
{
// Construct request
const
request
=
{
name
,
trip
,
updateMask
,
};
// Run request
const
response
=
await
fleetengineClient
.
updateTrip
(
request
);
console
.
log
(
response
);
}
callUpdateTrip
();
updateTrip(request, options, callback)
updateTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateTripRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.IUpdateTripRequest
| null | undefined, {} | null | undefined>
void
updateTrip(request, callback)
updateTrip
(
request
:
protos
.
maps
.
fleetengine
.
v1
.
IUpdateTripRequest
,
callback
:
Callback<protos
.
maps
.
fleetengine
.
v1
.
ITrip
,
protos
.
maps
.
fleetengine
.
v1
.
IUpdateTripRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.maps.fleetengine.v1.ITrip
, protos.maps.fleetengine.v1.IUpdateTripRequest
| 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.