pub struct TripService { /* private fields */ }Expand description
Implements a client for the Local Rides and Deliveries API.
§Example
async fn sample(
provider_id: &str,
trip_id: &str,
) -> anyhow::Result<()> {
let client = TripService::builder().build().await?;
let response = client.get_trip()
.set_name(format!("providers/{provider_id}/trips/{trip_id}"))
.send().await?;
println!("response {:?}", response);
Ok(())
}§Service Description
Trip management service.
§Configuration
To configure TripService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://fleetengine.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured with Private Google Access with VPC Service Controls) may want to override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
TripService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap TripService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl TripService
impl TripService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for TripService.
let client = TripService::builder().build().await?;Sourcepub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: TripService + 'static,
pub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: TripService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn create_trip(&self) -> CreateTrip
pub fn create_trip(&self) -> CreateTrip
Creates a trip in the Fleet Engine and returns the new trip.
§Example
use google_maps_fleetengine_v1::model::Trip;
use google_maps_fleetengine_v1::Result;
async fn sample(
client: &TripService, provider_id: &str, trip_id: &str
) -> Result<()> {
let response = client.create_trip()
.set_parent(format!("providers/{provider_id}/trips/{trip_id}"))
.set_trip_id("trip_id_value")
.set_trip(
Trip::new()/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn get_trip(&self) -> GetTrip
pub fn get_trip(&self) -> GetTrip
Get information about a single trip.
§Example
use google_maps_fleetengine_v1::Result;
async fn sample(
client: &TripService, provider_id: &str, trip_id: &str
) -> Result<()> {
let response = client.get_trip()
.set_name(format!("providers/{provider_id}/trips/{trip_id}"))
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_trip(&self) -> DeleteTrip
pub fn delete_trip(&self) -> DeleteTrip
Deletes a single Trip.
Returns FAILED_PRECONDITION if the Trip is active and assigned to a vehicle.
§Example
use google_maps_fleetengine_v1::Result;
async fn sample(
client: &TripService, provider_id: &str, trip_id: &str
) -> Result<()> {
client.delete_trip()
.set_name(format!("providers/{provider_id}/trips/{trip_id}"))
.send().await?;
Ok(())
}Sourcepub fn report_billable_trip(&self) -> ReportBillableTrip
pub fn report_billable_trip(&self) -> ReportBillableTrip
Report billable trip usage.
§Example
use google_maps_fleetengine_v1::Result;
async fn sample(
client: &TripService
) -> Result<()> {
client.report_billable_trip()
/* set fields */
.send().await?;
Ok(())
}Sourcepub fn search_trips(&self) -> SearchTrips
pub fn search_trips(&self) -> SearchTrips
Get all the trips for a specific vehicle.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_maps_fleetengine_v1::Result;
async fn sample(
client: &TripService
) -> Result<()> {
let mut list = client.search_trips()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn update_trip(&self) -> UpdateTrip
pub fn update_trip(&self) -> UpdateTrip
Updates trip data.
§Example
use google_cloud_wkt::FieldMask;
use google_maps_fleetengine_v1::model::Trip;
use google_maps_fleetengine_v1::Result;
async fn sample(
client: &TripService, provider_id: &str, trip_id: &str
) -> Result<()> {
let response = client.update_trip()
.set_trip(
Trip::new().set_name(format!("providers/{provider_id}/trips/{trip_id}"))/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.send().await?;
println!("response {:?}", response);
Ok(())
}Trait Implementations§
Source§impl Clone for TripService
impl Clone for TripService
Source§fn clone(&self) -> TripService
fn clone(&self) -> TripService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more